Get Scalar Data

The cactus_scalars module provides functions to load timeseries in Cactus formats and a class ScalarsDir for easy access to all timeseries in a Cactus simulation directory. This module is normally not used directly, but from the simdir module. The data loaded by this module is represented as TimeSeries objects.

class postcactus.cactus_scalars.IntegralsReader(src_norm, src_scalar)

Helper class to convert norms to integrals using grid volume saved by volomnia thorn. Not intended for direct use.

get(key, default=None)

Get variable if available, else return a default value.

class postcactus.cactus_scalars.NormInfOmniReader(src_inf, src_min, src_max)

Helper class to transparently get inf norm either from saved inf norm if available or else from min and max norms, if available. Not intended for direct use.

get(key, default=None)

Get variable if available, else return a default value.

class postcactus.cactus_scalars.ScalarReader(sd, kind)

Helper class to read various types of scalar data. Not intended for direct use.

get(key, default=None)

Get variable if available, else return a default value.

class postcactus.cactus_scalars.ScalarsDir(sd)

This class provides acces to various types of scalar data in a given simulation directory. Typically used from simdir instance. The different scalars are available as attributes:

Variables
  • scalar – access to grid scalars.

  • min – access to minimum reduction.

  • max – access to maximum reduction.

  • norm1 – access to norm1 reduction.

  • norm2 – access to norm2 reduction.

  • average – access to average reduction.

  • infnorm – access to inf-norm reduction.

  • integral – access to integral over coordinate volume.

  • absint – access to integral of modulus.

Each of those works as a dictionary mapping variable names to TimeSeries instances.

Note

infnorm is reconstructed from min and max if infnorm itself is not available.

Note

integral and absint require the grid volume saved by the ‘volomnia’ thorn.

The constructor is not intended for direct use.

Parameters

sd (SimDir instance.) – Simulation directory.

postcactus.cactus_scalars.load_cactus_0d(fname)

DEPRECATED. Load 0D CACTUS ASCII timeseries, e.g. rho..asc. If the file contains overlapping time intervals (as happens when restarting in the same directory), the latest of the overlapping segments is kept and the others removed.

Parameters

fname (string) – Path to the data file.

Returns

The time series.

Return type

TimeSeries

postcactus.cactus_scalars.load_cactus_scalar(fname)

DEPRECATED. Load scalar CACTUS timeseries in 3 column ASCII format, e.g. rho.maximum.asc. If the file contains overlapping time intervals (as happens when restarting in the same directory), the latest of the overlapping segments is kept and the others removed.

Parameters

fname (string) – Path to the data file.

Returns

The time series.

Return type

TimeSeries