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
ift
NIFTy
Commits
e6576692
Commit
e6576692
authored
Jun 23, 2017
by
Theo Steininger
Browse files
Added RG1DPlotter.
parent
fd98d2f4
Pipeline
#13981
passed with stages
in 12 minutes and 21 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty/plotting/plotter/__init__.py
View file @
e6576692
...
...
@@ -2,4 +2,5 @@
from
healpix_plotter
import
HealpixPlotter
from
gl_plotter
import
GLPlotter
from
power_plotter
import
PowerPlotter
from
rg1d_plotter
import
RG1DPlotter
from
rg2d_plotter
import
RG2DPlotter
nifty/plotting/plotter/plotter_base.py
View file @
e6576692
...
...
@@ -87,8 +87,8 @@ class PlotterBase(Loggable, object):
for
slice_list
in
utilities
.
get_slice_list
(
data_list
[
0
].
shape
,
axes
):
plots_list
+=
\
[[
self
.
plot
.
at
(
self
.
_parse_data
(
current_data
,
field
,
spaces
))
field
,
spaces
))
for
(
current_data
,
field
)
in
zip
(
data_list
,
fields
)]]
figures
=
[
self
.
figure
.
at
(
plots
)
for
plots
in
plots_list
]
...
...
nifty/plotting/plotter/rg1d_plotter.py
0 → 100644
View file @
e6576692
# -*- coding: utf-8 -*-
import
numpy
as
np
from
nifty.spaces
import
RGSpace
from
nifty.plotting.descriptors
import
Axis
from
nifty.plotting.figures
import
Figure2D
from
nifty.plotting.plots
import
Cartesian2D
from
.plotter_base
import
PlotterBase
class
RG1DPlotter
(
PlotterBase
):
def
__init__
(
self
,
interactive
=
False
,
path
=
'.'
,
title
=
""
,
line
=
None
,
marker
=
None
):
super
(
RG1DPlotter
,
self
).
__init__
(
interactive
,
path
,
title
)
self
.
line
=
line
self
.
marker
=
marker
@
property
def
domain_classes
(
self
):
return
(
RGSpace
,
)
def
_initialize_plot
(
self
):
return
Cartesian2D
(
data
=
None
)
def
_initialize_figure
(
self
):
xaxis
=
Axis
()
yaxis
=
Axis
()
return
Figure2D
(
plots
=
None
,
xaxis
=
xaxis
,
yaxis
=
yaxis
)
def
_parse_data
(
self
,
data
,
field
,
spaces
):
y_data
=
data
rgspace
=
field
.
domain
[
spaces
[
0
]]
xy_data
=
np
.
empty
((
2
,
y_data
.
shape
[
0
]))
xy_data
[
1
]
=
y_data
num
=
rgspace
.
shape
[
0
]
length
=
rgspace
.
distances
[
0
]
*
num
xy_data
[
0
]
=
np
.
linspace
(
start
=
0
,
stop
=
length
,
num
=
num
,
endpoint
=
False
)
if
rgspace
.
zerocenter
[
0
]:
xy_data
[
0
]
-=
np
.
floor
(
length
/
2
)
return
xy_data
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