dispel.io.raw module#
Common functionality to read files.
- dispel.io.raw.convert_types(sensor_data, value_definition)[source]#
Convert sensor data types.
The conversion happens only if specified in
dispel.data.raw.RawDataSetDefinition
.- Parameters:
sensor_data (DataFrame) – Copy of the data frame output of
read_sensor_log_as_data_frame()
value_definition (ValueDefinition) – The definition of a value.
- Returns:
The updated data frame with formatted types.
- Return type:
- dispel.io.raw.extract_raw_data_set(sensor_or_definition, data, data_set_definitions_dict)[source]#
Extract raw data set based on sensor type from data frame.
- Parameters:
sensor_or_definition (str | RawDataSetDefinition) – The sensor to be extracted or the definition of the data set
data (DataFrame) – The data frame obtained with
read_sensor_log_as_data_frame()
data_set_definitions_dict (Dict[str | SensorType, RawDataSetDefinition]) – A dictionary mapping sensor type to raw data set definitions
- Returns:
The raw data set for the specified sensor.
- Return type:
- Raises:
ValueError – If the
data
is not a filled pandas data frame.ValueError – If the
sensor_or_definition
’s definition is not found.
- dispel.io.raw.generate_raw_data_set(data_set_id, columns)[source]#
Generate a random raw data set.
- Parameters:
- Return type:
- dispel.io.raw.generate_raw_data_set_definition(data_set_id, columns)[source]#
Create a basic RawDataSetDefinition for data.
- dispel.io.raw.generate_raw_data_value_definition(column, unit=None)[source]#
Create a basic RawDataValueDefinition for data (unit is optional).
- dispel.io.raw.get_unit_from_datatype(data_type)[source]#
Parse data_type string to extract the unit.
- dispel.io.raw.raw_data_set_definition_to_columns(definition)[source]#
Get column names for data set definition.
- Parameters:
definition (RawDataSetDefinition) – The raw data set definition.
- Returns:
The column names of the value definitions of the data set.
- Return type:
List[str]
- dispel.io.raw.raw_data_set_definition_to_index(definition)[source]#
Get index names for data set definition.
- Parameters:
definition (RawDataSetDefinition) – The raw data set definition
- Returns:
The list of indices, if any value definition is part of the index
- Return type:
List[str]