Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NIFTy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ift
NIFTy
Commits
edca48d9
There was a problem fetching the pipeline summary.
Commit
edca48d9
authored
7 years ago
by
Martin Reinecke
Browse files
Options
Downloads
Patches
Plain Diff
allow multiple simultaneous plots for 1D spaces
parent
a1e8d8d1
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Pipeline
#
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
nifty/plotting/plot.py
+27
-9
27 additions, 9 deletions
nifty/plotting/plot.py
with
27 additions
and
9 deletions
nifty/plotting/plot.py
+
27
−
9
View file @
edca48d9
...
@@ -153,12 +153,25 @@ def _get_kw(kwname, kwdefault=None, **kwargs):
...
@@ -153,12 +153,25 @@ def _get_kw(kwname, kwdefault=None, **kwargs):
def
plot
(
f
,
**
kwargs
):
def
plot
(
f
,
**
kwargs
):
import
matplotlib.pyplot
as
plt
import
matplotlib.pyplot
as
plt
_register_cmaps
()
_register_cmaps
()
if
not
isinstance
(
f
,
Field
):
if
isinstance
(
f
,
Field
):
f
=
[
f
]
if
not
isinstance
(
f
,
list
):
raise
TypeError
(
"
incorrect data type
"
)
raise
TypeError
(
"
incorrect data type
"
)
if
len
(
f
.
domain
)
!=
1
:
for
i
,
fld
in
enumerate
(
f
):
raise
ValueError
(
"
input field must have exactly one domain
"
)
if
not
isinstance
(
fld
,
Field
):
raise
TypeError
(
"
incorrect data type
"
)
if
i
==
0
:
dom
=
fld
.
domain
if
len
(
dom
)
!=
1
:
raise
ValueError
(
"
input field must have exactly one domain
"
)
else
:
if
fld
.
domain
!=
dom
:
raise
ValueError
(
"
domain mismatch
"
)
if
not
(
isinstance
(
dom
[
0
],
PowerSpace
)
or
(
isinstance
(
dom
[
0
],
RGSpace
)
and
len
(
dom
[
0
].
shape
)
==
1
)):
raise
ValueError
(
"
PowerSpace or 1D RGSpace required
"
)
dom
=
f
.
dom
ain
[
0
]
dom
=
dom
[
0
]
fig
=
plt
.
figure
()
fig
=
plt
.
figure
()
ax
=
fig
.
add_subplot
(
1
,
1
,
1
)
ax
=
fig
.
add_subplot
(
1
,
1
,
1
)
...
@@ -174,12 +187,14 @@ def plot(f, **kwargs):
...
@@ -174,12 +187,14 @@ def plot(f, **kwargs):
npoints
=
dom
.
shape
[
0
]
npoints
=
dom
.
shape
[
0
]
dist
=
dom
.
distances
[
0
]
dist
=
dom
.
distances
[
0
]
xcoord
=
np
.
arange
(
npoints
,
dtype
=
np
.
float64
)
*
dist
xcoord
=
np
.
arange
(
npoints
,
dtype
=
np
.
float64
)
*
dist
ycoord
=
dobj
.
to_global_data
(
f
.
val
)
for
fld
in
f
:
plt
.
plot
(
xcoord
,
ycoord
)
ycoord
=
dobj
.
to_global_data
(
fld
.
val
)
plt
.
plot
(
xcoord
,
ycoord
)
_limit_xy
(
**
kwargs
)
_limit_xy
(
**
kwargs
)
_makeplot
(
kwargs
.
get
(
"
name
"
))
_makeplot
(
kwargs
.
get
(
"
name
"
))
return
return
elif
len
(
dom
.
shape
)
==
2
:
elif
len
(
dom
.
shape
)
==
2
:
f
=
f
[
0
]
nx
=
dom
.
shape
[
0
]
nx
=
dom
.
shape
[
0
]
ny
=
dom
.
shape
[
1
]
ny
=
dom
.
shape
[
1
]
dx
=
dom
.
distances
[
0
]
dx
=
dom
.
distances
[
0
]
...
@@ -199,16 +214,18 @@ def plot(f, **kwargs):
...
@@ -199,16 +214,18 @@ def plot(f, **kwargs):
_makeplot
(
kwargs
.
get
(
"
name
"
))
_makeplot
(
kwargs
.
get
(
"
name
"
))
return
return
elif
isinstance
(
dom
,
PowerSpace
):
elif
isinstance
(
dom
,
PowerSpace
):
xcoord
=
dom
.
k_lengths
ycoord
=
dobj
.
to_global_data
(
f
.
val
)
plt
.
xscale
(
'
log
'
)
plt
.
xscale
(
'
log
'
)
plt
.
yscale
(
'
log
'
)
plt
.
yscale
(
'
log
'
)
plt
.
title
(
'
power
'
)
plt
.
title
(
'
power
'
)
plt
.
plot
(
xcoord
,
ycoord
)
xcoord
=
dom
.
k_lengths
for
fld
in
f
:
ycoord
=
dobj
.
to_global_data
(
fld
.
val
)
plt
.
plot
(
xcoord
,
ycoord
)
_limit_xy
(
**
kwargs
)
_limit_xy
(
**
kwargs
)
_makeplot
(
kwargs
.
get
(
"
name
"
))
_makeplot
(
kwargs
.
get
(
"
name
"
))
return
return
elif
isinstance
(
dom
,
HPSpace
):
elif
isinstance
(
dom
,
HPSpace
):
f
=
f
[
0
]
import
pyHealpix
import
pyHealpix
xsize
=
800
xsize
=
800
res
,
mask
,
theta
,
phi
=
_mollweide_helper
(
xsize
)
res
,
mask
,
theta
,
phi
=
_mollweide_helper
(
xsize
)
...
@@ -225,6 +242,7 @@ def plot(f, **kwargs):
...
@@ -225,6 +242,7 @@ def plot(f, **kwargs):
_makeplot
(
kwargs
.
get
(
"
name
"
))
_makeplot
(
kwargs
.
get
(
"
name
"
))
return
return
elif
isinstance
(
dom
,
GLSpace
):
elif
isinstance
(
dom
,
GLSpace
):
f
=
f
[
0
]
import
pyHealpix
import
pyHealpix
xsize
=
800
xsize
=
800
res
,
mask
,
theta
,
phi
=
_mollweide_helper
(
xsize
)
res
,
mask
,
theta
,
phi
=
_mollweide_helper
(
xsize
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment