swiftest.Simulation.set_unit_system#
- Simulation.set_unit_system(MU=None, DU=None, TU=None, MU2KG=None, DU2M=None, TU2S=None, MU_name=None, DU_name=None, TU_name=None, recompute_unit_values=True, **kwargs)[source]#
Setter for setting the unit conversion between one of the standard sets.
The units can be set one of two ways
The user can supply string values to the arguments MU, DU, and TU to select between common systems
The user can supply float values to the arguments MU2KG, DU2M, and TU2S to manually set the conversion factor between the desired unit and the SI unit (kg-m-s).
The two sets of arguments are mutually exclusive. Any values passed to MU2KG, DU2M, or TU2S will override any specified in MU, DU, or TU, respectively. The default system is Msun-AU-YR. MU, DU, and TU are case-insenstive
- Parameters:
MU (str, optional) – The mass unit system to use. Case-insensitive valid options are
“Msun” - Solar mass
“Mearth” - Earth mass
“kg” - kilograms
“g”,”gm” - grams
DU (str, optional) – The distance unit system to use. Case-insensitive valid options are
“AU” - Astronomical Unit
“Rearth” - Earth radius
“km” - kilometer
“m” - meter
“cm” - centimeter
TU (str, optional) – The time unit system to use. Case-insensitive valid options are
“y”,”YR”,”year”,”years” - Year
“d”,”day”,”days” - Julian day
“s”,”sec”,”seconds”,”second” - second
MU2KG (float, optional) – The conversion factor to multiply by the mass unit that would convert it to kilogram. Setting this overrides MU
DU2M (float, optional) – The conversion factor to multiply by the distance unit that would convert it to meter. Setting this overrides DU
TU2S (float, optional) – The conversion factor to multiply by the time unit that would convert it to seconds. Setting this overrides TU
MU_name (str, optional) – The name of the mass unit. When setting one of the standard units via MU a name will be automatically set for the unit, so this argument will override the automatic name.
DU_name (str, optional) – The name of the distance unit. When setting one of the standard units via DU a name will be automatically set for the unit, so this argument will override the automatic name.
TU_name (str, optional) – The name of the time unit. When setting one of the standard units via TU a name will be automatically set for the unit, so this argument will override the automatic name.
recompute_unit_values (bool, default True) – Recompute all values into the new unit system. This is a destructive operation, however if not executed then the values contained in the parameter file and input/output data files computed previously may not be consistent with the new unit conversion factors.
**kwargs (Any) – A dictionary of additional keyword argument. This allows this method to be called by the more general set_parameter method, which takes all possible Simulation parameters as arguments, so these are ignored.
- Returns:
unit_dict (dict) – A dictionary containing the requested unit conversion parameters