Reference on kuibit.simdir¶
This module provides easy access to Cactus data files.
A simulation directory is represented by an instance of the SimDir
class, which provides access to all supported data types.
This is the main entry point into kuibit
. When a SimDir
is
initialized, the simulation directory is scanned and all the data is organized.
SimDir
objects have attributes that are interfaces to the data:
each attribute is a dictionary-like object that indexes the relevant data in
some way. For example, timeseries()
contains all the time series in
the output, indexed by the type of reduction that produced them (for example,
norm2
, max
, …).
In case of uncertainty, it is always possible to print SimDir
,
or any of its attributes, to obtain a message with the available content of
such attribute.
The function load_SimDir()
can be used to load a SimDir
saved with the method save()
.
- class kuibit.simdir.SimDir(path, max_depth=8, ignored_dirs=None, ignore_symlinks=True, pickle_file=None)[source]¶
This class represents a Cactus simulation directory.
SimDir
can be used as a context manager. For instance:By itself, this is not very useful. It becomes more useful in conjunction with using pickles. Pickles are used to save the work done and resume it later. Since
kuibit
does a lot of lazy-loading, it can be useful to save the operations performed to disk and restart from them. For example, when initializing aSimDir
, the files have to be scanned and organized. It is pointless to this all the times if the simulation has not changed. For this, we use pickles.What happens here is that if
pickle_file
exists, it will be loaded. If it does not exist, it will be created. Using context managers here is useful because it automatically saves all the progress done. Alternatively, one has to call thesave()
method manually.Warning
When using pickles, it is important to make sure that the underlying data does not change, as the new/changed data will be not considered. To refresh
SimDir
, you can always use therescan()
method. Pickles have to be regenerated from scratch if the version ofkuibit
changes.Data is searched recursively in all subfolders. No particular folder structure (e.g.
simfactory
style) is assumed. The following attributes allow access to the supported data types:- Variables:
path – Top level path of simulation directory.
dirs – All directories in which data is searched.
logfiles – The locations of all log files (.out).
errfiles – The location of all error log files (.err).
ts – Scalar data of various type, see
ScalarsDir
gf – Access to grid function data, see
GridFunctionsDir
.gws – GW signal from the Weyl scalar multipole decomposition, see
GravitationalWavesDir
.emws – EM signal from the Weyl scalar multipole decomposition, see
ElectromagneticWavesDir
.horizons – Apparent horizon information, see
HorizonsDir
.timers – Timer information, see
TimersDir
.twopunctures – Metadata information from TwoPunctures.
TwoPuncturesDir
.multipoles – Multipole components, see
CactusMultipoleDir
.
Constructor.
- Parameters:
path (str) – Path to output of the simulation.
max_depth (int) – Maximum recursion depth for subfolders.
ignored_dirs (set) – Names of folders to ignore (e.g. SIMFACTORY).
ignore_symlink (bool) – If True, do not consider symlinks.
pickle_file (bool) – If
pickle_file
is not None, do not scan the folders and load the pickle file. All the other parameters are ignored.
Parfiles (
*.par
) will be searched in all data directories and the top-level SIMFACTORY/par folder, if it exists. The parfile in the latter folder, if available, or else the oldest parfile in any of the data directories, will be used to extract the simulation parameters. Logfiles (*.out
) and errorfiles (*.err
) will be searched for in all data directories.- property electromagneticwaves¶
Return all the available
Phi2
data.- Returns:
Interface to all the
Phi2
data in the directory.- Return type:
- property emws¶
Return all the available
Phi2
data.- Returns:
Interface to all the
Phi2
data in the directory.- Return type:
- property gf¶
Return all the available grid data.
- Returns:
Interface to all the grid data in the directory.
- Return type:
- property gravitationalwaves¶
Return all the available
Psi4
data.- Returns:
Interface to all the
Psi4
data in the directory.- Return type:
- property gridfunctions¶
Return all the available grid data.
- Returns:
Interface to all the grid data in the directory.
- Return type:
- property gws¶
Return all the available
Psi4
data.- Returns:
Interface to all the
Psi4
data in the directory.- Return type:
- property horizons¶
Return all the available horizon data.
- Returns:
Interface to all the horizon data in the directory.
- Return type:
- property multipoles¶
Return all the available multipole data.
- Returns:
Interface to all the multipole data in the directory.
- Return type:
- save(path)[source]¶
Save this object as a pickle.
The object can be loaded with the function
load_SimDir()
.- Parameters:
path (str) – Path where to save the file.
- property timers: TimersDir¶
Return all the available timertree data.
- Returns:
Interface to all the timertree data in the directory.
- Return type:
TimertreeDir
- property timeseries¶
Return all the available timeseries in the data.
- Returns:
Interface to all the timeseries in the directory.
- Return type:
- property ts¶
Return all the available timeseries in the data.
- Returns:
Interface to all the timeseries in the directory.
- Return type:
- property twopunctures¶
Return the metadata for TwoPunctures.
- Returns:
Interface to the metadata in TwoPunctures.
- Return type: