nilspodlib.header.Header#
- class nilspodlib.header.Header(**kwargs)[source]#
Additional Infos of recording.
Usually their is no need to use this class on its own, but it is just used as a convenient wrapper to access all information via a dataset instance.
Warning
UTC timestamps and datetime, might not be in UTC. We just provide the values recorded by the sensor without any local conversions. Depending on the recording device, a localized timestamp might have been set for the internal sensor clock
- Attributes:
sensor_id
Get the unique sensor identifier.
- enabled_sensors
Tuple of sensors that were enabled during the recording. Uses typical shorthands.
- motion_interrupt_enabled
If the motion interrupt of the sensor was enable.
- dock_mode_enabled
If the sensor was used in dock/home monitoring mode (charging starts/stops sessions)
- sensor_position
If a sensor position was specified. Can be a position from a list or custom bytes.
has_position_info
If any information about the sensor position is provided.
- session_termination
The reason, why the session was stopped. Can be used to diagnose potential issues.
- sample_size
The size of a single sample in bytes. This depends on the enabled sensors.
- sampling_rate_hz
Sampling rate of the recording.
- acc_range_g
Range of the accelerometer in g.
- gyro_range_dps
Range of the gyroscope in deg per s.
- sync_role
Can be “master”, “slave” or disabled.
is_synchronised
If a recording was synchronised or not.
- sync_distance_ms
How far apart the sync packages were set to be. This is only a lower limit and does not represent the actual timing.
- sync_address
Shared address used by all sensors of the sync group.
- sync_channel
Shared radio channel used by all sensors of the sync group.
- sync_index_start
Index (position in counter) were the first sync package was received (0 if sync_role==”master”)
- sync_index_stop
Index (position in counter) were the last sync package was received (0 if sync_role==”master”)
- utc_start
Unix time stamp of the start of the recording.
Note
No timezone is assumed and client software is instructed to set the internal sensor clock to utc time. However, this can not be guaranteed.
utc_datetime_start
Start time as utc datetime.
utc_datetime_stop
Stop time as utc datetime.
- utc_stop
Unix time stamp of the end of the recording.
Note
No timezone is assumed and client software is instructed to set the internal sensor clock to utc time. However, this can not be guaranteed.
utc_datetime_start_day_midnight
UTC timestamp marking midnight of the recording date.
- timezone
A str defining the timezone of the recording. This information is not taken from the sensor, but provided by the user.
local_datetime_start
Start time in specified timezone.
local_datetime_stop
Stop time in specified timezone.
- duration
Length of the measurement in seconds.
- version_firmware
Version number of the firmware
strict_version_firmware
Get the firmware as a Version object.
- version_hardware
Hardware revision of the sensor. Another revision usually indicates, that data should be handled differently.
- mac_address
BLE Mac address of the sensor.
- custom_meta_data
Custom meta data (3 bytes) which was saved on the sensor.
- n_samples
Number of samples recorded during the measurement
Note
The number of samples might not be equal to the actual number of samples in the file, because the sensor only transmits full flash pages. This means a couple of samples (max. 2048/sample_size) at the end might be cut. This issue should be resolved in firmware versions 0.14.0 or higher.
Methods
from_bin_array
(bin_array[, tz])Create a new Header instance from an array of bytes.
from_json
(json_string)Create a new Header from a json export of the header.
parse_header_package
(bin_array)Extract all values from a binary header package.
to_json
()Export a header as json.
- __init__(**kwargs)[source]#
Initialize a header object.
This will just put all values provided in kwargs as attributes onto the class instance. If one value has an unexpected name, a warning is raised, and the key is ignored.
- classmethod from_bin_array(bin_array: ndarray, tz: Optional[str] = None) Header [source]#
Create a new Header instance from an array of bytes.
- classmethod from_json(json_string: str) Header [source]#
Create a new Header from a json export of the header.
This is only tested with the direct output of the
to_json
method and should only be used to reimport a Header exported with this method.