BifrostVarPathsManager

class PlasmaCalcs.hookups.bifrost.bifrost_io_tools.BifrostVarPathsManager(snap, calc)

Bases: BifrostlikeVarPathsManager

manages filepaths (as abspaths) and readable vars for a BifrostSnap.

This tells which part of which file corresponds to which var,
as implied by the snapname_NNN.idl file params.
Intended to be immutable; do not edit after creating.
snap: BifrostSnap
calc: BifrostCalculator
STORAGE DICTS:
self.kind2path = {kind: path}
self.kind2vars = {kind: (tuple of readable vars)}
self.var2kind = {var: kind}
self.var2path = {var: path}
self.path2kind = {path: kind}
self.path2vars = {path: (tuple of readable vars)}
self.var2index = {var: index of var in its path’s list of vars}
CONVENIENCE TUPLES:
self.kinds = tuple of kinds with any vars in self.
self.vars = tuple of all vars in self.
self.paths = tuple of all paths with any vars in self.
self.KINDS tells all available kinds, as dict (with values docstrings for each kind).
self.KIND2FILEBASE tells file paths (with placeholders, and relative to snapdir).
NOTE: aux vars containing ‘xy’, ‘yz’, ‘xz’ are NOT included in same aux file.
Presently they are not readable through PlasmaCalcs;
this feature might be added in the future.
List of all such vars will be stored in self.aux_todo.

Methods

help()

print docstring of self...

init_aux_kind()

vars stored in snapname_NNN.aux file.

init_convenience()

initialize convenience tuples.

init_helium_kind()

vars stored in snapname.helium_NNN.snap file.

init_hion_kind()

vars stored in snapname.hion_NNN.snap file.

init_kinds()

initialize all kinds in self, filling in all the details for self's storage dicts.

init_ooe_kind()

out of equilibrium vars.

init_snap_kind()

vars stored in snapname_NNN.snap file.

init_storage()

initialize storage dicts.

kind2filebase(kind)

returns file basename for this kind.

snappath(filename)

returns os.path.join(self.snapdir, filename)

_init_kind_vars_path(kind, vars, path)

updates self with corresponding kind, vars, and path.

_repr_contents()

contents for repr(self), as list of strings

Attributes

KIND2FILEBASE

KINDS

NNN

(str) the NNN part of the snapname_NNN.idl filename.

aux_todo

list of all vars in 'aux' not yet handled by this VarPathsManager instance.

calc

gets self._calc(), or just self._calc if not self._calc_is_weakref.

params

alias to self.snap.params

snap

gets self._snap(), or just self._snap if not self._snap_is_weakref.

snapdir

alias to self.calc.snapdir

snapname

alias to self.params['snapname']

property NNN

(str) the NNN part of the snapname_NNN.idl filename.

_init_kind_vars_path(kind, vars, path)

updates self with corresponding kind, vars, and path.

_repr_contents()

contents for repr(self), as list of strings

property aux_todo

list of all vars in ‘aux’ not yet handled by this VarPathsManager instance.

Presently, this means the list of all vars containing ‘xy’, ‘yz’, or ‘xz’.
property calc

gets self._calc(), or just self._calc if not self._calc_is_weakref.

help()

print docstring of self…

init_aux_kind()

vars stored in snapname_NNN.aux file.

init_convenience()

initialize convenience tuples.

init_helium_kind()

vars stored in snapname.helium_NNN.snap file.

init_hion_kind()

vars stored in snapname.hion_NNN.snap file.

init_kinds()

initialize all kinds in self, filling in all the details for self’s storage dicts.

init_ooe_kind()

out of equilibrium vars.

init_snap_kind()

vars stored in snapname_NNN.snap file.

init_storage()

initialize storage dicts.

kind2filebase(kind)

returns file basename for this kind.

Equivalent: self.KIND2FILEBASE[kind].format(snapname=self.snapname, NNN=self.NNN)
property params

alias to self.snap.params

property snap

gets self._snap(), or just self._snap if not self._snap_is_weakref.

property snapdir

alias to self.calc.snapdir

property snapname

alias to self.params[‘snapname’]

snappath(filename)

returns os.path.join(self.snapdir, filename)