astronomix._snapshotting._snapshot_diagnostics#

Per-snapshot diagnostics for the time integration.

A data-driven registry of the quantities that can be stored at each snapshot: which ones a given configuration collects, how they are sized, and how each is computed from the (unpadded) primitive state. Adding a new diagnostic means appending one SnapshotQuantity entry here and adding the matching field to SnapshotDatabuild_snapshot_store and record_snapshot below are generic and need no changes.

Module Contents#

Classes#

SnapshotQuantity

One diagnostic collected into the snapshot store.

Functions#

spectra_requested

Whether any spectral diagnostic (kinetic / magnetic / helicity) is on.

spectral_wavenumbers

The shared wavenumber bin centers for the spectra, or None.

enabled_snapshot_quantities

The snapshot quantities collected for config, in registry order.

build_snapshot_store

Allocate the snapshot store with zeroed buffers for every enabled quantity.

record_snapshot

Write the time and every enabled diagnostic into store at snapshot_index.

Data#

API#

class astronomix._snapshotting._snapshot_diagnostics.SnapshotQuantity[source]#

Bases: typing.NamedTuple

One diagnostic collected into the snapshot store.

Attributes:

field: The SnapshotData field this quantity writes to. is_enabled: is_enabled(config) -> bool — collected for this config. per_snapshot_shape: per_snapshot_shape(config, state_shape) -> tuple

— the shape of one snapshot’s entry (excluding the snapshot axis).

compute: ``compute(primitive_state, helper_data, params, config,

registered_variables) -> array`` — evaluated on the unpadded primitive state at each snapshot time.

field: str = None#
is_enabled: Callable = None#
per_snapshot_shape: Callable = None#
compute: Callable = None#
astronomix._snapshotting._snapshot_diagnostics.spectra_requested(config) bool[source]#

Whether any spectral diagnostic (kinetic / magnetic / helicity) is on.

astronomix._snapshotting._snapshot_diagnostics.spectral_wavenumbers(config)[source]#

The shared wavenumber bin centers for the spectra, or None.

astronomix._snapshotting._snapshot_diagnostics.SNAPSHOT_QUANTITIES = ()#
astronomix._snapshotting._snapshot_diagnostics.enabled_snapshot_quantities(config)[source]#

The snapshot quantities collected for config, in registry order.

astronomix._snapshotting._snapshot_diagnostics.build_snapshot_store(config, number_of_snapshots, state_shape) astronomix.data_classes.simulation_snapshot_data.SnapshotData[source]#

Allocate the snapshot store with zeroed buffers for every enabled quantity.

astronomix._snapshotting._snapshot_diagnostics.record_snapshot(store, snapshot_index, time, primitive_state, helper_data, params, config, registered_variables) astronomix.data_classes.simulation_snapshot_data.SnapshotData[source]#

Write the time and every enabled diagnostic into store at snapshot_index.