EbysusVarPathsManager

class PlasmaCalcs.hookups.ebysus.ebysus_io_tools.EbysusVarPathsManager(snap, calc)

Bases: BifrostlikeVarPathsManager

manages filepaths (as abspaths) and readable vars for an EbysusSnap.

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: EbysusSnap
calc: EbysusCalculator
STORAGE DICTS:
self.kind2paths = {kind: (tuple of paths)}
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.
EXTRA CONVENIENCE (ESPECIALLY FOR WRITING FILES):
self.snap_vars = tuple of all vars in self with kind.startswith(‘snap_’)
self.snap_paths = tuple of all paths with any vars in self with kind.startswith(‘snap_’).
self.snap_path2vars = {path: (tuple of vars at path)} for paths with kind.startswith(‘snap_’).
self.KINDS tells all available kinds, as dict (with values docstrings for each kind).
kinds’ docs’ vars include {x} if they depend on vector component,
{SL} if they depend on fluid, and {jSL} if they depend on two fluids.
‘{SL}’ will be filled like ‘{SS}_{LL}’, and ‘{jSL}’ will be filled like ‘{jSS}_{jLL}’,
where SS, LL = (species, level) of fluid, and jSS, jLL = (species, level) of jfluid.
E.g., p{x}_{SL} for corresponding vector component of momentum density of fluid SL,
_var_for_loadfromfile passes var like: “px_1_2”.
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

compute_snap_paths()

sets self.snap_vars, snap_paths, and snap_paths_vars appropriately.

help()

print docstring of self...

init_convenience()

initialize convenience tuples.

init_kind__snap_mf_common()

init snap_mf_common kind.

init_kind__snap_mf_e()

init snap_mf_e kind.

init_kind__snap_mfe()

init snap_mfe kind.

init_kind__snap_mfp()

init snap_mfp kind.

init_kind__snap_mfr()

init snap_mfr kind.

init_kinds()

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

init_kinds__aux()

init all aux kinds.

init_storage()

initialize storage dicts

kind2filebase(kind[, SL])

returns file basename for this kind, and this SL (if provided).

snappath(filename)

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

_add_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

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.

fluids

alias to self.calc.fluids

jfluids

alias to self.calc.jfluids

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']

_add_kind_vars_path(kind, vars, path)

updates self with corresponding kind, vars, and path. Internally converts vars to tuple.

This must be ALL the vars at path.
Meanwhile, it might be only some of the vars for this kind.
_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.

compute_snap_paths()

sets self.snap_vars, snap_paths, and snap_paths_vars appropriately.

(see help(type(self)) for details.)
property fluids

alias to self.calc.fluids

help()

print docstring of self…

init_convenience()

initialize convenience tuples.

init_kind__snap_mf_common()

init snap_mf_common kind.

init_kind__snap_mf_e()

init snap_mf_e kind.

init_kind__snap_mfe()

init snap_mfe kind.

init_kind__snap_mfp()

init snap_mfp kind.

init_kind__snap_mfr()

init snap_mfr kind.

init_kinds()

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

init_kinds__aux()

init all aux kinds.

init_storage()

initialize storage dicts

property jfluids

alias to self.calc.jfluids

kind2filebase(kind, SL=None)

returns file basename for this kind, and this SL (if provided).

like self.KIND2FILEBASE[kind], but formats with snapname=self.snapname, _NNN=self._NNN,
and (if SL provided) SS=str(SL[0]).zfill(2), LL=str(SL[1]).zfill(2).
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)