microbenthos.exporters package¶
Submodules¶
microbenthos.exporters.exporter module¶
Base class definition for exporters
-
class
microbenthos.exporters.exporter.
BaseExporter
(name='exp', logger=None, **kwargs)[source]¶ Bases:
object
An abstract base class to define the interface for model state exporters to be used by the classes defined in
runners
.-
is_eager
= False¶
-
started
¶ flag indicating if export has started
-
runner
¶ the runner instance operating this exporter
-
property
sim
¶ The simulation object of the runner, if any
- Returns
None or
Simulation
-
abstract
prepare
(state)[source]¶ Prepare the exporter based on the model state
- Parameters
state (dict) – a model snapshot dict
-
close
()[source]¶ Close the exporter by calling
finish()
to clean up resources. Setsstarted
to False.
-
microbenthos.exporters.graphic module¶
-
class
microbenthos.exporters.graphic.
GraphicExporter
(show=False, write_video=False, video_dpi=100, video_filename='simulation.mp4', track_budget=False, write_frames=False, frames_dpi=100, frames_folder='frames', **kwargs)[source]¶ Bases:
microbenthos.exporters._output_dir_mixin.OutputDirMixin
,microbenthos.exporters.exporter.BaseExporter
An exporter for model snapshot data into a graphical representation.
This can write out videos (with
write_video
= True) and image frames (withwrite_frames
= True). This usesmatplotlib
to render the plots.-
property
video_outpath
¶
-
property
frames_outdir
¶
-
prepare
(state)[source]¶ Prepare the
ModelPlotter
that will generate the plots for graphical export
-
property
microbenthos.exporters.model_data module¶
-
class
microbenthos.exporters.model_data.
ModelDataExporter
(overwrite=False, filename='simulation_data.h5', compression=6, **kwargs)[source]¶ Bases:
microbenthos.exporters._output_dir_mixin.OutputDirMixin
,microbenthos.exporters.exporter.BaseExporter
A ‘stateless’ exporter for model snapshot data into HDF file. The exporter only keeps the output path, and reopens the file for each snapshot. This ensures that each snapshot is committed to disk, reducing risk of data corruption. It uses
save_snapshot()
internally.-
property
outpath
¶
-
prepare
(state)[source]¶ Check that the output path can be created. Create the HDF file and add some metadata from the exporter.
If newly created, then the state is stored into the disk.
Warning
If the output file already exists on disk, then it is just appended to. So, care must be taken by the caller that old files are removed, if so desired.
-
property
microbenthos.exporters.progress module¶
-
class
microbenthos.exporters.progress.
ProgressExporter
(desc='evolution', position=None, **kwargs)[source]¶ Bases:
microbenthos.exporters.exporter.BaseExporter
An exporter that displays a progress bar of a running simulation.
-
is_eager
= True¶
-