PlasmaCalcs.quantities.collisions.cross_section_tools.UnitsManagerCrossUnits

class PlasmaCalcs.quantities.collisions.cross_section_tools.UnitsManagerCrossUnits(units='si', *, M=1, l=1, t=1, q=1, K=1, sic_quantities=None)

Bases: UnitsManager

UnitsManager for cross sections, since crossunits are in [cm^-2].
__init__(units='si', *, M=1, l=1, t=1, q=1, K=1, sic_quantities=None)

Methods

CGS_UNITS_DEFAULT()

__init__([units, M, l, t, q, K, sic_quantities])

calc_sic_factor(ustr)

Calculate conversion factor from raw units to SI units.

clear_sic()

from_crossunits(crossunits, **kw)

get_sic_factor(ustr)

Get conversion factor from raw units to SI units.

help()

init_sic()

is_trivial()

populate_physical_constants_raw([quantities])

Calculate all the physical constants in raw units. :param quantities: None or iterable of strings calculate only these physical constants. if None, use self.PHYSICAL_CONSTANTS_SI.keys() :return: self.physical_constants_raw, after creating and filling it.

populate_sic([quantities, reset])

Calculate lots of conversion factors. :param quantities: None or iterable of strings calculate these conversion factors and put them in self.sic. e.g. "p", "momentum", "M u", "kg m s-1". if None, use self.SIC_QUANTITIES. :reset: bool, default False. if True, clear self.sic before calculating. :return: self.sic, after adding all the requested conversion factors.

string_to_si_bases(string_of_units)

Attributes

BASES

CGS_UNITS

K

KNOWN

M

PHYSICAL_CONSTANTS_SI

SIC_QUANTITIES

alts

display_precision

l

pcr

physical_constants_raw

q

t

property CGS_UNITS
UnitsManager for cgs units. Default is UnitsManager(M=1e-3, l=1e2, t=1, q=None, K=1).
q=None is the default because electromagnetic cgs units are ambiguous,
there are multiple options for how to convert to si and the equations differ.
Note that for CGS_UNITS, ‘raw’ means ‘cgs’.
Feel free to set self.CGS_UNITS = a new UnitsManager with a known q,
if you have decided on a specific cgs system to remove relevant ambiguities.
classmethod CGS_UNITS_DEFAULT()
UnitsManager for cgs units. Default is UnitsManager(M=1e-3, l=1e2, t=1, q=None, K=1).
q=None is the default because electromagnetic cgs units are ambiguous,
there are multiple options for how to convert to si and the equations differ.
Note that for the CGS_UNITS result,’raw’ means ‘cgs’.
property K
Temperature_si = K * Temperature_raw
property M
Mass_si = M * Mass_raw
property alts
dict of {key: units} for alternative objects’ unit systems.
e.g. CoordsUnitsHaver might set alts[‘coords’] = ‘si’ to indicate coords always in si.
calc_sic_factor(ustr)

Calculate conversion factor from raw units to SI units. Also save result in self.sic for future use. :param ustr: string of units (e.g. “m-3”) :return: conversion factor from raw units to SI units

clear_sic()
clear self.sic. delete self.sic, then do self.init_sic()
classmethod from_crossunits(crossunits, **kw)
return UnitsManagerCrossUnits with length units conversions based on crossunits.
cross_section [si] = result(‘area’, ‘si’) * cross_section [from file]
equivalent to cls(l=np.sqrt(crossunits) * 1e-2, **kw)
get_sic_factor(ustr)

Get conversion factor from raw units to SI units. If not already calculated, calculate it first. :param ustr: string of units (e.g. “m-3”) :return: conversion factor from raw units to SI units

if None, raise UnitsUnknownError instead.

classmethod help()
prints a helpful message about using cls.
init_sic()
initialize self.sic from self.bases.
is_trivial()
returns whether self has only trivial conversion factors in it (all factors 1 or not provided).
property l
Length_si = l * Length_raw
property pcr
alias to physical_constants_raw
property physical_constants_raw
dict of all the physical constants in raw units.
populate_physical_constants_raw(quantities=None)

Calculate all the physical constants in raw units. :param quantities: None or iterable of strings

calculate only these physical constants. if None, use self.PHYSICAL_CONSTANTS_SI.keys()

Returns:

self.physical_constants_raw, after creating and filling it.

populate_sic(quantities=None, *, reset=False)

Calculate lots of conversion factors. :param quantities: None or iterable of strings

calculate these conversion factors and put them in self.sic. e.g. “p”, “momentum”, “M u”, “kg m s-1”. if None, use self.SIC_QUANTITIES.

Reset:

bool, default False. if True, clear self.sic before calculating.

Returns:

self.sic, after adding all the requested conversion factors.

property q
Charge_si = q * Charge_raw
string_to_si_bases(string_of_units)
convert string of any units to string of SI base units.
property t
Time_si = t * Time_raw