Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
a2118d85
Commit
a2118d85
authored
May 12, 2017
by
Theo Steininger
Browse files
Merge branch 'plotting' into 'master'
Plotting See merge request
!104
parents
3860e6da
4e71a7b5
Pipeline
#12360
passed with stage
in 7 minutes and 22 seconds
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
nifty/plotting/plotter/plotter.py
View file @
a2118d85
...
...
@@ -5,31 +5,35 @@ import os
import
numpy
as
np
import
plotly
import
plotly.offline
as
plotly_offline
import
d2o
from
keepers
import
Loggable
from
nifty.config
import
dependency_injector
as
gdi
from
nifty.spaces.space
import
Space
from
nifty.field
import
Field
import
nifty.nifty_utilities
as
utilities
from
nifty.plotting.figures
import
Figure
2D
,
\
Figure3D
,
\
MultiFigure
from
nifty.plotting.figures
import
Multi
Figure
plotly
=
gdi
.
get
(
'plotly'
)
plotly
.
offline
.
init_notebook_mode
()
try
:
plotly
.
offline
.
init_notebook_mode
()
except
AttributeError
:
pass
from
mpi4py
import
MPI
comm
=
MPI
.
COMM_WORLD
rank
=
comm
.
rank
rank
=
d2o
.
config
.
dependency_injector
[
d2o
.
configuration
[
'mpi_module'
]].
COMM_WORLD
.
rank
class
Plotter
(
Loggable
,
object
):
__metaclass__
=
abc
.
ABCMeta
def
__init__
(
self
,
interactive
=
False
,
path
=
'.'
,
title
=
""
):
if
'plotly'
not
in
gdi
:
raise
ImportError
(
"The module plotly is needed but not available."
)
self
.
interactive
=
interactive
self
.
path
=
path
self
.
title
=
str
(
title
)
...
...
@@ -120,5 +124,5 @@ class Plotter(Loggable, object):
else
:
final_figure
=
figures
[
0
]
plotly
_
offline
.
plot
(
final_figure
.
to_plotly
(),
plotly
.
offline
.
plot
(
final_figure
.
to_plotly
(),
filename
=
os
.
path
.
join
(
self
.
path
,
self
.
title
))
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