EppicTimescales

class PlasmaCalcs.hookups.eppic.eppic_choose_params.EppicTimescales(ec, *, units='raw', item=True, calc=True, precision=None)

Bases: object

helps with calculating dt based on physical timescales for eppic.

ec: EppicCalculator
used for calculations of values.
units: str, default ‘raw’
units system for output values. Probably ‘raw’ or ‘si’.
item: bool, default True
True –> convert all values to scalars (e.g., python floats).
False –> keep values as xarrays.
calc: bool, default True
whether to calc all values when initializing, via self.calc().
precision: None or int
precision to use when converting to strings.
None –> use type(self).precision (default 1)
self.tt will be a dict like {scalename: {key: value}},
where key will be:
fluid, for timescales associated with a specific fluid;
‘global’, for global timescales;
‘min’, for timescales which are the minimum (e.g., across fluids).

Methods

calc()

calculate all timescales, updating self.tt.

calc_mins()

calculate 'min' for each scalename, updating self.tt.

calc_subcycling()

calculate timescales incorporating subcycling of fluids, updating self.tt.

calc_timescales()

calculate timescales for fluids, updating self.tt.

min()

returns the minimum timescale from within self.

to_pandas()

return pandas DataFrame of timescales.

to_pandas_display()

return self.to_pandas(), but prettier, for display purposes:

values()

returns a list of all timescale from self, in no particular order.

_repr_html_()

display hook for jupyter notebook.

Attributes

precision

_repr_html_()

display hook for jupyter notebook.

calc()

calculate all timescales, updating self.tt. returns self.

calc_mins()

calculate ‘min’ for each scalename, updating self.tt. returns self.

calc_subcycling()

calculate timescales incorporating subcycling of fluids, updating self.tt. returns self.

Equivalent to dividing every fluid timescale by subcycle for that fluid.
scalenames will be old scalename with ‘_subcycle’ appended.
Does not remove old scalenames.
calc_timescales()

calculate timescales for fluids, updating self.tt. returns self.

calculations are in units system defined by self.units (probably ‘raw’ or ‘si’).
(the actual math for timescales is in TimescalesLoader, in timescales.py)
min()

returns the minimum timescale from within self.

to_pandas()

return pandas DataFrame of timescales.

‘min’ and ‘global’ columns will appear before other columns.
to_pandas_display()

return self.to_pandas(), but prettier, for display purposes:

- replaces NaNs with ‘—‘.
- converts numbers to exponential form using self.precision.
- put a helpful caption, including self.units, self.ec.snap, and self.ec.input_deck[‘dt’]
- highlights the minimum value in each row (but not in the ‘min’ column)
- highlights the minimum value in the ‘min’ column (in a different color ^)
- puts a horizontal border above the first row whose name ends with ‘_subcycle’
values()

returns a list of all timescale from self, in no particular order.