nixio.util package¶
Submodules¶
nixio.util.find module¶
-
class
nixio.util.find.
Cont
(elem, level)¶ Bases:
object
Simple container for an element an a level
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
bool
-
nixio.util.names.
sanitizer
(name)¶ Sanitizes a string supposed to be an entity name. That is, invalid characters like slashes are substituted with underscores.
- Parameters
name – A string representing the name.
- Returns
The sanitized name.
- Return type
str
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
bool
-
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
bool
-
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
bool
-
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
str
-
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
bool
-
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
tuple
-
nixio.util.units.
split_compound
(compound_unit)¶ Splits a compound unit (like mV/Hz) into the atomic units.
- Parameters
compound_unit – The unit string.
- Returns
A tuple containing the atomic units.
- Return type
tuple
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
str
-
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.
- Parameters
time_str (str) – string in the form “YYYYMMDDTHHMMSS”, where T is the date-time separator
- Returns
integer POSIX time
- Return type
int
-
nixio.util.util.
time_to_str
(time)¶ Returns the time represented by the parameter in the format of Boost’s posix time to_iso_string function.
- Parameters
time (int) – integer POSIX time
- Returns
string in the form “YYYYMMDDTHHMMSS”, where T is the date-time separator
- Return type
str
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.
create_id
()¶ Creates an ID as used for nix entities.
- Returns
The ID.
- Return type
str
-
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.
- Parameters
time_str (str) – string in the form “YYYYMMDDTHHMMSS”, where T is the date-time separator
- Returns
integer POSIX time
- Return type
int
-
nixio.util.
time_to_str
(time)¶ Returns the time represented by the parameter in the format of Boost’s posix time to_iso_string function.
- Parameters
time (int) – integer POSIX time
- Returns
string in the form “YYYYMMDDTHHMMSS”, where T is the date-time separator
- Return type
str