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
Daniel Boeckenhoff
tfields
Commits
cbaecdea
Commit
cbaecdea
authored
Aug 07, 2018
by
Priyanjana Sinha
Browse files
nt specifics
parent
80cb06e2
Changes
2
Hide whitespace changes
Inline
Side-by-side
tfields/core.py
View file @
cbaecdea
...
...
@@ -353,8 +353,11 @@ class AbstractNdarray(np.ndarray):
sub_dict
=
list_dict
[
key
]
list_dict
[
key
]
=
[]
for
index
in
sorted
(
sub_dict
.
keys
()):
bulk_type
=
sub_dict
[
index
].
get
(
'bulk_type'
)
bulk_type
=
getattr
(
tfields
,
bulk_type
.
tolist
())
bulk_type
=
sub_dict
[
index
].
get
(
'bulk_type'
).
tolist
()
if
isinstance
(
bulk_type
,
bytes
):
# asthonishingly, this is not necessary under linux. Found under nt. ???
bulk_type
=
bulk_type
.
decode
(
'UTF-8'
)
bulk_type
=
getattr
(
tfields
,
bulk_type
)
list_dict
[
key
].
append
(
bulk_type
.
_from_dict
(
**
sub_dict
[
index
]))
'''
...
...
tfields/plotting/mpl.py
View file @
cbaecdea
...
...
@@ -443,7 +443,7 @@ def to_colors(scalars, cmap=None, vmin=None, vmax=None):
vmax
=
max
(
scalars
)
color_map
=
plt
.
get_cmap
(
cmap
)
norm
=
mpl
.
colors
.
Normalize
(
vmin
=
vmin
,
vmax
=
vmax
)
return
color_map
(
map
(
norm
,
scalars
)
)
return
color_map
(
[
norm
(
s
)
for
s
in
scalars
]
)
def
to_scalars
(
colors
,
cmap
,
vmin
,
vmax
):
...
...
@@ -495,9 +495,9 @@ def color_cycle(cmap=None, n=None):
"""
if
cmap
:
color_rgb
=
to_colors
(
np
.
linspace
(
0
,
1
,
n
),
cmap
=
cmap
,
vmin
=
0
,
vmax
=
1
)
colors
=
map
(
lambda
rgb
:
'#%02x%02x%02x'
%
(
rgb
[
0
]
*
255
,
rgb
[
1
]
*
255
,
rgb
[
2
]
*
255
),
colors
=
map
(
lambda
rgb
:
'#%02x%02x%02x'
%
(
int
(
rgb
[
0
]
*
255
)
,
int
(
rgb
[
1
]
*
255
)
,
int
(
rgb
[
2
]
*
255
)
)
,
tuple
(
color_rgb
[:,
0
:
-
1
]))
else
:
colors
=
list
([
color
[
'color'
]
for
color
in
mpl
.
rcParams
[
'axes.prop_cycle'
]])
...
...
Write
Preview
Markdown
is supported
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