Skip to content

Parsers

actimotus.Sens dataclass

Parses SENS accelerometer data from binary files.

This class handles the extraction of raw accelerometer data from SENS .bin files. It reads the binary structure, validates the file format, and optionally normalizes the raw integer values to gravitational units (g).

Attributes:

Name Type Description
normalize bool

If True, raw values are multiplied by the normalization factor (-4/512) to convert them to g-force. If False, returns the raw integer counts from the sensor ADC. Defaults to True.

placement Literal['front', 'side']

Where the sensor was worn on the right thigh. 'front' is the placement that ActiMotus expects, and the axes are returned as read. 'side' is the lateral aspect of the thigh: the axes are turned 90 degrees about the long axis of the thigh (y = -z, z = y, x unchanged), so the data looks as if the sensor was worn on the front. Defaults to 'front'.

from_bin

from_bin(path: str | Path) -> pd.DataFrame

Reads and decodes a Sens binary file into a DataFrame.

This method validates the file extension and existence before parsing. It handles path conversion automatically.

Parameters:

Name Type Description Default
path str | Path

The file path to the source .bin file. Accepts either a string path or a Path object.

required

Returns:

Type Description
DataFrame

A DataFrame containing the parsed accelerometer data. If normalize

DataFrame

is True, the data is in g; otherwise, it is in raw units.

Examples:

>>> parser = Sens(normalize=True)
>>> df = parser.from_bin("data/sensor_01.bin")