emout.article module

Article data recording and replay support.

This module keeps figure scripts reproducible by recording the minimum grid data consumed by Data.plot() and Data.to_numpy(), then replaying those same slices without requiring the original EMSES output files.

class emout.article.ArticleConfig(mode, records_path, article_name, source_name, archive_format)[source]

Bases: object

Resolved article mode configuration.

archive_format: str | None
article_name: str
mode: str
records_path: Path | None
source_name: str | None
class emout.article.ArticleMeanSelection(replay, field, selectors, source_shape)[source]

Bases: object

Replay selection for a recorded time-mean field.

property boundaries
property boundary
property inp
materialize()[source]

Load the recorded mean data object for this selection.

plot(**kwargs)[source]
plot_surfaces(surfaces, *, ax=None, use_si=True, vmin=None, vmax=None, **kwargs)[source]

Plot recorded bounded mean surface data using the local path.

to_numpy()[source]
Return type:

ndarray

property unit
class emout.article.ArticleRecorder(source_path, config)[source]

Bases: object

Persist article data records for one emout.Emout source.

copy_input_path(input_path)[source]

Copy the original input file when it exists.

Return type:

None

copy_source_files(input_directory, output_directory)[source]

Copy small source-side files useful for article replay.

Return type:

None

record_data(data, *, kind, kwargs=None)[source]

Append a consumed data slice to the article bundle.

Return type:

None

records: list[dict[str, Any]]
write_input(inp)[source]

Save the input file required for unit reconstruction.

Return type:

None

class emout.article.ArticleReplayEmout(source_path, config)[source]

Bases: object

Replay proxy returned by Emout(..., article_mode='replay').

available_fields()[source]

Return recorded scalar field names.

Return type:

list[str]

property backtrace

Backtrace is not part of article replay bundles.

property boundaries

Return boundary meshes reconstructed from the recorded input file.

property directory: Path

Return the article replay directory.

property icur: DataFrame

Return the recorded icur diagnostic file as a DataFrame.

property inp: InpFile | None

Return recorded input parameters.

When a recorded plasma.toml exists, this is the TOML-backed InpFile compatibility view. Otherwise it is loaded from the recorded plasma.inp.

is_valid()[source]

Return whether the replay bundle has the files required by its manifest.

Return type:

bool

property ocur: DataFrame

Return the recorded ocur diagnostic file as a DataFrame.

particle(*args, **kwargs)[source]

Particle files are not part of article replay bundles.

property pbody: DataFrame

Return the recorded pbody diagnostic file as a DataFrame.

remote(*args, **kwargs)[source]

Remote execution is not available for article replay bundles.

property toml

Return the recorded TOML configuration when available.

property trace

Trace workflows are not part of article replay bundles.

property unit: Units | None

Return units reconstructed from the recorded input file.

class emout.article.ArticleSelection(replay, field, selectors, source_shape)[source]

Bases: object

Replay selection for a recorded field.

materialize()[source]

Load the recorded data object for this selection.

mean(axis=None, dtype=None, out=None, keepdims=False)[source]

Return a recorded time-mean selection.

plot(**kwargs)[source]

Plot the recorded data using the normal Data plotting path.

plot_surfaces(surfaces, *, ax=None, use_si=True, vmin=None, vmax=None, **kwargs)[source]

Plot recorded bounded surface data using the normal local path.

to_numpy()[source]

Return the recorded NumPy array.

Return type:

ndarray

class emout.article.ArticleSeries(replay, field)[source]

Bases: object

Lazy selector for one recorded field.

emout.article.attach_recorder(obj, recorder, source_shape=None)[source]

Attach recorder recursively to grid data objects.

Return type:

Any

emout.article.record_data_access(data, kind, kwargs=None)[source]

Record a data object when an article recorder is attached.

Return type:

None

emout.article.resolve_config(*, article_mode=None, article_records_path=None, records_path=None, article_name=None, article_source_name=None, article_archive=None)[source]

Resolve article settings from explicit arguments and environment.

Return type:

ArticleConfig

emout.article.resolve_existing_record_dir(source_path, config)[source]

Resolve a replay directory, falling back to a single matching article.

Return type:

Path

emout.article.resolve_record_dir(source_path, config)[source]

Return the directory for one source dataset and article name.

Return type:

Path

emout.article.source_id(source_path, source_name=None)[source]

Return a stable record directory name for a source path.

Return type:

str