Manager Classes¶
This class handles several important package wide tasks:
- Usage of units across objects storing data
- Basis conversion of all registered objects
- Calls to proper optimized implementations of numerically heavy sections of the calculations
Manager is a singleton class, only one instance exists at all times and all managing objects have the instance of the Manager.
Properies¶
- version : string
- contains the package version number
- allower_utypes : list
- contains a list of unit types which can be controlled by the Manager
- units : dictionary
- dictionary of available units for each units type
- units_repre : dictionary
- dictionary of abreviations used to represent various units
- units_repre_latex : dictionary
- dictionary of latex prepresentations of available units
Units Management¶
Units management is performed for all classes derived from quantarhei.managers.UnitsManaged class.
Basis Conversion Management¶
Units management is performed for all classes derived from quantarhei.managers.BasisManaged class.
Basis management works like this: when an class is defined, and its property needs to be basis managed, one should use a predefined type basis_managed_array_property
-
class
quantarhei.core.managers.
BasisManaged
[source]¶ Base class for objects with managed basis
Methods
get_current_basis protect_basis set_current_basis unprotect_basis
-
class
quantarhei.core.managers.
EnergyUnitsManaged
[source]¶ Methods
convert_2_current_u convert_2_internal_u unit_repr unit_repr_latex
-
class
quantarhei.core.managers.
LengthUnitsManaged
[source]¶ Class providing functions for length units conversion
Methods
convert_2_current_u convert_2_internal_u unit_repr unit_repr_latex
-
class
quantarhei.core.managers.
Manager
[source]¶ Main package Manager
Methods
convert_energy_2_current_u
(val)Converts energy from internal units to currently used units convert_energy_2_internal_u
(val)Convert energy from currently used units to internal units convert_frequency_2_current_u
(val)Converts frequency from internal units to currently used units convert_frequency_2_internal_u
(val)Converts frequency from currently used units to internal units convert_length_2_current_u
(val)Converts frequency from internal units to currently used units convert_length_2_internal_u
(val)Converts length from currently used units to internal units cu_energy
(val[, units])Converst to current energy units get_complex_type
()Returns default numpy complex type get_current_basis
()Returns the current basis id get_real_type
()Returns default numpy float type iu_energy
(val[, units])Converst to internal energy units load_conf
()Loads configuration file set_current_units
(utype, units)Sets current units transform_to_current_basis
(operator)Transforms an operator to the currently used basis unit_repr
([utype, mode])Returns a string representing the currently used units unit_repr_latex
([utype, mode])Returns a string representing the currently used units unset_current_units
(utype)Restores previously saved units of a given type commit_implementation get_DistributedConfiguration get_all_implementations get_all_implementations_of get_current_implementation get_current_units get_implementation_points get_implementation_prefix load_implementations load_units register_implementation register_with_basis remove_current_basis_operator save_implementations save_settings save_units set_current_implementation set_new_basis store_current_basis_operator -
convert_energy_2_current_u
(val)[source]¶ Converts energy from internal units to currently used units
Parameters: val (number, array, list, tuple of numbers) – values to convert
-
convert_energy_2_internal_u
(val)[source]¶ Convert energy from currently used units to internal units
Parameters: val (number, array, list, tuple of numbers) – values to convert
-
convert_frequency_2_current_u
(val)[source]¶ Converts frequency from internal units to currently used units
Parameters: val (number, array, list, tuple of numbers) – values to convert
-
convert_frequency_2_internal_u
(val)[source]¶ Converts frequency from currently used units to internal units
Parameters: val (number, array, list, tuple of numbers) – values to convert
-
convert_length_2_current_u
(val)[source]¶ Converts frequency from internal units to currently used units
Parameters: val (number, array, list, tuple of numbers) – values to convert
-
convert_length_2_internal_u
(val)[source]¶ Converts length from currently used units to internal units
Parameters: val (number, array, list, tuple of numbers) – values to convert
-
transform_to_current_basis
(operator)[source]¶ Transforms an operator to the currently used basis
Parameters: operator (operator) – Any basis managed operator
-
unit_repr
(utype='energy', mode='current')[source]¶ Returns a string representing the currently used units
-
-
class
quantarhei.core.managers.
UnitsManaged
[source]¶ Base class for objects with management of units
Methods
convert_energy_2_current_u convert_energy_2_internal_u convert_length_2_current_u convert_length_2_internal_u unit_repr unit_repr_latex
-
class
quantarhei.core.managers.
basis_context_manager
[source]¶ General context manager to manage basis
-
class
quantarhei.core.managers.
frequency_units
(units)[source]¶ Context manager for units of frequency
It behaves exactly the same as
energy_units
context manager.