PlasmaCalcs.mhd.mhd_er_tables.erTableManager
- class PlasmaCalcs.mhd.mhd_er_tables.erTableManager
Bases:
dictmanages er tables. Dict of {quantity (str): erTable}- __init__(*args, **kwargs)
Methods
__init__(*args, **kwargs)clear()copy()from_file(memmap_file, *, epermcoords, ...)fromkeys([value])get(key[, default])interp(var, *, r[, eperm, e, ln, keep_er_coords])items()keys()pop(k[,d])popitem()setdefault(key[, default])update([E, ]**F)values()- clear() None. Remove all items from D.
- copy() a shallow copy of D
- er_table_from_memmap_cls
alias of
erTableFromMemmap
- classmethod from_file(memmap_file, *, epermcoords, rcoords, quantities, ln_quants=[], scale_quants={}, extra_dims=None, data_shape=None, data_dtype=<class 'numpy.float32'>, data_order='F', **kw_init_er_table)
- create erTableManager from numpy memmap file with multiple tables.
- memmap_file: str
- path to memmap file.
- epermcoords, rcoords: 1D array
- coords for eperm (energy per unit mass) and r (mass density).Units should be ‘raw’ units.
- quantities: list of str
- names of quantities in file.each quantitiy in file should be an ND array with dims eperm, r, and any extra_dims.
- ln_quants: list of str
- names of quantities whose values in file are in ln-space.
- scale_quants: dict
- {quantity: scaling factor} for each quantity in file. Default scaling factor is 1.quantity value * scaling factor should always convert to ‘raw’ units.(always corresponds to the not-ln’d quant, even if ln_quant=True).
- extra_dims: extra_dims: None, list of str, or dict
- if provided, will be used as names for additional xarray dims.if dict, will be used as names and coords for additional dims.
- data_shape: None or tuple
- shape of a single array in the memmap file.None –> infer shape = (len(epermcoords), len(rcoords))
- data_dtype: data_dtype: np.dtype or something which implies np.dtype
- dtype of the data in memmap file
- data_order: ‘C’ or ‘F’
- order of the data in memmap file. ‘F’ is Fortran order.
- fromkeys(value=None, /)
- Create a new dictionary with keys from iterable and values set to value.
- get(key, default=None, /)
- Return the value for key if key is in the dictionary, else default.
- interp(var, *, r, eperm=UNSET, e=UNSET, ln=False, keep_er_coords=False, **kw_xarray_interp)
- return values of var at eperm and r.
- var: str
- name of quantity to interpolate.
- r: number or array
- evaluate table at these value(s) of r (mass density).
- eperm: UNSET, number, or array
- evaluate table at these value(s) of eperm (internal energy per unit mass).must provide eperm or e, but not both.
- e: UNSET, number, or array
- evaluate table at these value(s) of e (internal energy density).since table uses eperm and r, internally convert e to eperm via eperm = e / r.must provide eperm or e, but not both.
- ln: bool
- whether to report result in ln-space, e.g. ln(P) instead of P.
- keep_er_coords: bool
- whether to keep eperm and r as coords in result.
- items() a set-like object providing a view on D's items
- keys() a set-like object providing a view on D's keys
- pop(k[, d]) v, remove specified key and return the corresponding value.
- If key is not found, default is returned if given, otherwise KeyError is raised
- popitem()
- Remove and return a (key, value) pair as a 2-tuple.Pairs are returned in LIFO (last-in, first-out) order.Raises KeyError if the dict is empty.
- setdefault(key, default=None, /)
- Insert key with a value of default if key is not in the dictionary.Return the value for key if key is in the dictionary, else default.
- update([E, ]**F) None. Update D from dict/iterable E and F.
- If E is present and has a .keys() method, then does: for k in E: D[k] = E[k]If E is present and lacks a .keys() method, then does: for k, v in E: D[k] = vIn either case, this is followed by: for k in F: D[k] = F[k]
- values() an object providing a view on D's values