nixio.util package
Submodules
nixio.util.find module
nixio.util.names module
- nixio.util.names.check(name)
Checks a string whether is needs to be sanitized.
- Parameters:
name – The name.
- Returns:
True if the name is valid, false otherwise.
- Return type:
nixio.util.units module
- nixio.util.units.invert_power(unit)
- nixio.util.units.is_atomic(unit)
Checked whether a unit string represents an atomic si unit, i.e. not a combination.
- Parameters:
unit – The unit to be checked.
- Returns:
True if unit is atomic, False otherwise.
- Return type:
- nixio.util.units.is_compound(unit)
Checks whether a unit string represents a combination of SI units.
- Parameters:
unit – The unit string.
- Returns:
True if the unit string represents a combination of SI units, False otherwise.
- Return type:
- nixio.util.units.is_si(unit)
Determines whether a unit is a recognized SI unit.
- Parameters:
unit – The unit that needs to be checked.
- Returns:
True if the unit is an SI unit, false otherwise.
- Return type:
- nixio.util.units.sanitizer(unit)
Sanitizes a unit string. That is, it is de-blanked, and mu and µ symbols are changed to u for micro.
- Parameters:
unit – The unit that needs to be sanitized.
- Returns:
the sanitized unit.
- Return type:
- nixio.util.units.scalable(units_a, units_b)
Checks whether units are scalable versions of the same SI unit. Method works on two lists and compares the corresponding units in both lists.
- Parameters:
unit_a – List of unit strings.
unit_b – List of unit strings.
- Returns:
True if all corresponding units are scalable.
- Return type:
- nixio.util.units.scaling(origin, destination)
Returns the scaling factor to convert from one unit to another.
- Parameters:
origin – The original unit string.
destination – The destination unit string.
- Returns:
The scaling factor.
- Return type:
double
- nixio.util.units.split(combined_unit)
Splits a unit string into magnitude prefix, the base unit, and the power.
- Parameters:
combined_unit – The unit string.
- Returns:
A tuple of prefix, base unit, and power.
- Return type:
nixio.util.util module
- nixio.util.util.apply_polynomial(coefficients, origin, data)
- nixio.util.util.check_attr_type(value, type_)
Checks if a value is of a given type and raises an exception if the check fails. The check does not fail if value is None. Specifying str for type checks against all string types (str, bytes, basestring).
- Parameters:
value – the value to check
type – the type to check against
- nixio.util.util.check_empty_str(string, field_name)
- nixio.util.util.check_entity_id(id_)
- nixio.util.util.check_entity_input(entity, raise_exception=True)
- nixio.util.util.check_entity_name(name)
- nixio.util.util.check_entity_name_and_type(name, type_)
- nixio.util.util.check_entity_type(type_)
- nixio.util.util.check_name_or_id(name_or_id)
- nixio.util.util.create_id()
Creates an ID as used for nix entities.
- Returns:
The ID.
- Return type:
- nixio.util.util.is_uuid(id_str)
- nixio.util.util.now_int()
Returns the current POSIX time as an integer.
- Returns:
integer POSIX time
- nixio.util.util.str_to_time(time_str)
Returns the POSIX time represented by the given string as an integer.
Module contents
- nixio.util.apply_polynomial(coefficients, origin, data)
- nixio.util.check_attr_type(value, type_)
Checks if a value is of a given type and raises an exception if the check fails. The check does not fail if value is None. Specifying str for type checks against all string types (str, bytes, basestring).
- Parameters:
value – the value to check
type – the type to check against
- nixio.util.check_empty_str(string, field_name)
- nixio.util.check_entity_id(id_)
- nixio.util.check_entity_input(entity, raise_exception=True)
- nixio.util.check_entity_name(name)
- nixio.util.check_entity_name_and_type(name, type_)
- nixio.util.check_entity_type(type_)
- nixio.util.check_name_or_id(name_or_id)
- nixio.util.is_uuid(id_str)
- nixio.util.now_int()
Returns the current POSIX time as an integer.
- Returns:
integer POSIX time
- nixio.util.str_to_time(time_str)
Returns the POSIX time represented by the given string as an integer.