unitty.namespace module¶
Created on Mon May 11 20:58:06 2020
@author: Reuben
The namespace module contains groups of Unit, Units, Systems, and System instances that work together. It allows multiple groups to be loaded concurrently, which is probably not usually needed.
Each set of Units, Quantity, Systems, and System objects are designed to be
instantiated in groups through the setup() function. This is called
if required to set up the default units.
-
unitty.namespace.get_active()¶ Return a string of the currently active group
-
unitty.namespace.get_system(group=None)¶ Get the currently active System instance
Parameters: group (str) – [Optional] The name of the group. If None, returns the currently active System instance from the currently active group. Returns: A Systems instance. Return type: Systems
-
unitty.namespace.get_systems(group=None)¶ Get the Systems instance
Parameters: - group (str) – [Optional] The name of the group. If None, returns the
- instance in the currently active group. (Systems) –
Returns: A Systems instance.
Return type:
-
unitty.namespace.get_units(group=None)¶ Get the Units instance
Parameters: - group (str) – [Optional] The name of the group. If None, returns the
- instance from the currently active group. (Units) –
Returns: A Units instance.
Return type:
-
unitty.namespace.set_system(sys_name, group=None)¶ Make the named unit system active
Parameters: - sys_name (str) – The name of the unit system to activate
- group (str) – [Optional] The name of the group. The unit system is set within the Systems instance of that group. Defaults to the currently active group.
-
unitty.namespace.setup(group='default', units_fname=None, units_raw=None, sys_fname=None, sys_raw=None)¶ Setup a new group of Units, Systems, and System instances
Parameters: - group (str) – The name of the group
- units_fname (str) – [Optional] The filename of the input file to use for the Units class. If omitted, the default is loaded.
- units_raw (dict) – [Optional] A dictionary of unit data to use. If given, units_fname should not be given.
- sys_fname (str) – [Optional] The filename of the input file to use for the Systems class. If omitted, the default is loaded.
- sys_raw (dict) – [Optional] A dictionary of data to use for the unit systems. If given, sys_fname should not be given.