Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
FSL
fsleyes
fsleyes-props
Commits
4025a4cf
Commit
4025a4cf
authored
Apr 21, 2021
by
Paul McCarthy
🚵
Browse files
Merge branch 'mnt/matplotlib' into 'master'
Mnt/matplotlib See merge request fsl/fsleyes/props!48
parents
a811c494
d70e671d
Changes
6
Hide whitespace changes
Inline
Side-by-side
.ci/build_doc.sh
View file @
4025a4cf
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
set
-e
set
-e
pip
install
-r
requirements.txt
pip
install
-r
requirements-dev.txt
pip
install
-r
requirements-dev.txt
python setup.py doc
python setup.py doc
mkdir
-p
public
mkdir
-p
public
...
...
CHANGELOG.rst
View file @
4025a4cf
...
@@ -2,7 +2,19 @@ This document contains the ``fsleyes-props`` release history in reverse
...
@@ -2,7 +2,19 @@ This document contains the ``fsleyes-props`` release history in reverse
chronological order.
chronological order.
1.7.2 (Saturday March 26th 2021)
1.7.3 (Wednesday April 21st 2021)
---------------------------------
Changed
^^^^^^^
* Fixed deprecated usage of the ``matplotilb.cm.cmap_d`` colour map
dictionary.
1.7.2 (Saturday March 27th 2021)
--------------------------------
--------------------------------
...
...
README.rst
View file @
4025a4cf
...
@@ -69,6 +69,9 @@ Dependencies for running the tests and building documentation are listed in the
...
@@ -69,6 +69,9 @@ Dependencies for running the tests and building documentation are listed in the
Documentation
Documentation
-------------
-------------
The ``fsleyes-props`` API documentation is hosted at
https://open.win.ox.ac.uk/pages/fsl/fsleyes/props/.
``fsleyes-props`` is documented using `sphinx
``fsleyes-props`` is documented using `sphinx
<http://http://sphinx-doc.org/>`_. You can build the API documentation by
<http://http://sphinx-doc.org/>`_. You can build the API documentation by
running::
running::
...
...
doc/conf.py
View file @
4025a4cf
...
@@ -33,6 +33,7 @@ date = datetime.date.today()
...
@@ -33,6 +33,7 @@ date = datetime.date.today()
# ones.
# ones.
extensions
=
[
extensions
=
[
'sphinx.ext.autodoc'
,
'sphinx.ext.autodoc'
,
'sphinx.ext.viewcode'
,
'sphinx.ext.autosummary'
,
'sphinx.ext.autosummary'
,
'sphinx.ext.mathjax'
,
'sphinx.ext.mathjax'
,
# 'sphinxcontrib.restbuilder',
# 'sphinxcontrib.restbuilder',
...
...
fsleyes_props/cli.py
View file @
4025a4cf
...
@@ -193,8 +193,11 @@ import logging
...
@@ -193,8 +193,11 @@ import logging
import
sys
import
sys
import
argparse
import
argparse
from
.
import
properties
as
props
import
matplotlib.pyplot
as
plt
from
.
import
properties_types
as
ptypes
import
matplotlib.cm
as
mplcm
import
fsleyes_props.properties
as
props
import
fsleyes_props.properties_types
as
ptypes
log
=
logging
.
getLogger
(
__name__
)
log
=
logging
.
getLogger
(
__name__
)
...
@@ -205,7 +208,6 @@ class SkipArgument(Exception):
...
@@ -205,7 +208,6 @@ class SkipArgument(Exception):
by :func:`applyArguments` and :func:`generateArguments` to indicate
by :func:`applyArguments` and :func:`generateArguments` to indicate
that the arguemnt should be skipped (i.e. not applied, or not generated).
that the arguemnt should be skipped (i.e. not applied, or not generated).
"""
"""
pass
def
_String
(
parser
,
def
_String
(
parser
,
...
@@ -480,24 +482,21 @@ def _ColourMap(parser,
...
@@ -480,24 +482,21 @@ def _ColourMap(parser,
def
parse
(
cmapName
):
def
parse
(
cmapName
):
try
:
try
:
import
matplotlib.cm
as
mplcm
cmapKeys
=
plt
.
colormaps
()
cmapNames
=
[
mplcm
.
get_cmap
(
cm
).
name
for
cm
in
cmapKeys
]
cmapKeys
=
list
(
mplcm
.
cmap_d
.
keys
())
cmapNames
=
[
mplcm
.
cmap_d
[
k
].
name
for
k
in
cmapKeys
]
lCmapNames
=
[
s
.
lower
()
for
s
in
cmapNames
]
lCmapNames
=
[
s
.
lower
()
for
s
in
cmapNames
]
lCmapKeys
=
[
s
.
lower
()
for
s
in
cmapKeys
]
lCmapKeys
=
[
s
.
lower
()
for
s
in
cmapKeys
]
cmapName
=
cmapName
.
lower
()
cmapName
=
cmapName
.
lower
()
try
:
idx
=
lCmapKeys
.
index
(
cmapName
)
except
ValueError
:
idx
=
lCmapNames
.
index
(
cmapName
)
try
:
idx
=
lCmapKeys
.
index
(
cmapName
)
except
:
idx
=
lCmapNames
.
index
(
cmapName
)
cmapName
=
cmapKeys
[
idx
]
cmapName
=
cmapKeys
[
idx
]
return
mplcm
.
get_cmap
(
cmapName
)
return
mplcm
.
get_cmap
(
cmapName
)
except
:
except
Exception
:
raise
argparse
.
ArgumentTypeError
(
raise
argparse
.
ArgumentTypeError
(
'Unknown colour map: {}'
.
format
(
cmapName
))
'Unknown colour map: {}'
.
format
(
cmapName
))
...
...
fsleyes_props/properties_types.py
View file @
4025a4cf
...
@@ -33,8 +33,8 @@ added as attributes of a :class:`.HasProperties` class definition.
...
@@ -33,8 +33,8 @@ added as attributes of a :class:`.HasProperties` class definition.
import
os.path
as
op
import
os.path
as
op
from
collections
import
abc
import
matplotlib.pyplot
as
plt
import
matplotlib.cm
as
mplcm
import
matplotlib.colors
as
mplcolors
import
matplotlib.colors
as
mplcolors
import
numpy
as
np
import
numpy
as
np
...
@@ -892,7 +892,6 @@ class ColourMap(props.PropertyBase):
...
@@ -892,7 +892,6 @@ class ColourMap(props.PropertyBase):
matplotlib :class:`.Colormap` instance.
matplotlib :class:`.Colormap` instance.
"""
"""
import
matplotlib.colors
as
mplcolors
if
not
isinstance
(
value
,
mplcolors
.
Colormap
):
if
not
isinstance
(
value
,
mplcolors
.
Colormap
):
raise
ValueError
(
'Colour map value is not a '
raise
ValueError
(
'Colour map value is not a '
'matplotlib.colors.Colormap instance'
)
'matplotlib.colors.Colormap instance'
)
...
@@ -909,26 +908,19 @@ class ColourMap(props.PropertyBase):
...
@@ -909,26 +908,19 @@ class ColourMap(props.PropertyBase):
if
isinstance
(
value
,
str
):
if
isinstance
(
value
,
str
):
import
matplotlib.cm
as
mplcm
# Case insensitive match against either
# the registered colourmap key, or the
#
Case insensitive match
#
colourmap name
cmapKeys
=
list
(
mplcm
.
cmap_d
.
key
s
()
)
cmapKeys
=
plt
.
colormap
s
()
cmapNames
=
[
cm
.
name
for
cm
in
mplcm
.
cmap_d
.
values
()
]
cmapNames
=
[
mplcm
.
get_cmap
(
cm
).
name
for
cm
in
cmapKeys
]
lCmapNames
=
[
s
.
lower
()
for
s
in
cmapNames
]
lCmapNames
=
[
s
.
lower
()
for
s
in
cmapNames
]
lCmapKeys
=
[
s
.
lower
()
for
s
in
cmapKeys
]
lCmapKeys
=
[
s
.
lower
()
for
s
in
cmapKeys
]
value
=
value
.
lower
()
idx
=
None
value
=
value
.
lower
()
try
:
idx
=
lCmapKeys
.
index
(
value
)
except
ValueError
:
idx
=
lCmapNames
.
index
(
value
)
try
:
idx
=
lCmapKeys
.
index
(
value
)
except
ValueError
:
idx
=
None
try
:
idx
=
lCmapNames
.
index
(
value
)
except
ValueError
:
idx
=
None
if
idx
is
None
:
if
idx
is
None
:
raise
ValueError
(
'Unknown colour map ({}) - valid choices '
raise
ValueError
(
'Unknown colour map ({}) - valid choices '
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment