dispel.providers.apdm.io module#

Functionality to read files from APDM.

class dispel.providers.apdm.io.Apdm[source]#

Bases: object

Encapsulate APDM wearable sensor data.

__init__(file)[source]#

Initialize APDM object.

The class initiation reads the initial hdf file and setups the user class.

Parameters:

file – The file location for ADPM sensor data

static convert_unix_microseconds(unix_time)[source]#

Convert unix timestamp to micro seconds.

create_dataframe(location=None)[source]#

Create a data frame with all sensor information.

get_acceleration(loc)[source]#

Get acceleration of sensor in location loc.

get_gyroscope(loc)[source]#

Get angular velocity of sensor in location loc.

get_magnetometer(loc)[source]#

Get acceleration of sensor in location loc.

get_orientation(loc)[source]#

Get orientation in a quaternion form for the sensor.

get_sampling_rate(loc)[source]#

Get sample rate of sensor in location loc.

get_temperature(loc)[source]#

Get temperature of sensor in location loc.

get_time(loc)[source]#

Get time of sensor in location loc.

get_unix_timestamp(loc)[source]#

Get unix timestamp for the beginning of the file.

set_dictionary()[source]#

Get a dictionary mapping sensor locations to numbers.

dispel.providers.apdm.io.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:
Returns:

The raw data set for the specified sensor.

Return type:

RawDataSet

Raises:
  • ValueError – If the data is not a filled pandas data frame.

  • ValueError – If the sensor_or_definition’s definition is not found.

dispel.providers.apdm.io.get_apdm_reading(data)[source]#

Get the reading representation of an APDM data frame.

Parameters:

data (DataFrame) – The data frame obtained with read_apdm_as_data_frame()

Returns:

The APDMReading representation of the APDM h5 file.

Return type:

APDMReading

dispel.providers.apdm.io.get_device(data)[source]#

Get device information from the APDM reading.

Parameters:

data (DataFrame) – The data frame obtained with read_apdm_as_data_frame()

Returns:

The device information present in the APDM reading

Return type:

Device

dispel.providers.apdm.io.get_effective_time_frame(data)[source]#

Get the effective time frame for the APDM reading.

Parameters:

data (DataFrame) – The data frame obtained with read_sensor_log_as_data_frame()

Returns:

The start and end dates for the time frame spanned by data.

Return type:

Tuple[pd.Timestamp, pd.Timestamp]

dispel.providers.apdm.io.get_evaluation(data)[source]#

Get the evaluation for the APDM reading.

Parameters:

data (DataFrame) – The data frame obtained with read_apdm_as_data_frame()

Returns:

The evaluation information

Return type:

Evaluation

dispel.providers.apdm.io.read_apdm(path)[source]#

Read data from SensorLog JSON file.

Parameters:

path (str) – The path to the JSON file containing the data to be read.

Returns:

The Reading representation of the SensorLog json file.

Return type:

Reading

dispel.providers.apdm.io.read_apdm_as_data_frame(path)[source]#

Read an APDM h5 file into a pandas data frame.

Parameters:

path (str) – The path to the APDM h5 file

Returns:

The data frame representation of the APDM h5 file.

Return type:

pandas.DataFrame