slki.data.sensor_data_item ¶
Classes:
| Name | Description |
|---|---|
SensorDataItem | Represents a single data item from a sensor, containing its 1D time series data and associated metadata. |
Classes¶
SensorDataItem ¶
Represents a single data item from a sensor, containing its 1D time series data and associated metadata.
This class provides an interface to access and manipulate the data and metadata of a single data point.
Methods:
| Name | Description |
|---|---|
__init__ | Initializes a SensorDataItem instance. |
__iter__ | Returns an iterator over this SensorDataItem instance. |
create | Creates a new SensorDataItem instance from the given data and metadata. |
get_signal | Get the signal data with the correct sample length and its sample length. |
Attributes:
| Name | Type | Description |
|---|---|---|
data | The sensor data as 1D time series. | |
meta | The meta data. | |
sample_length | int | The sample length of the time series data. |
Source code in slki/data/sensor_data_item.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 | |
Attributes¶
sample_length property writable ¶
sample_length: int
The sample length of the time series data.
Returns:
| Name | Type | Description |
|---|---|---|
int | int | The sample length. |
Functions¶
__init__ ¶
Initializes a SensorDataItem instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ndarray | The sensor 1D time series data. | required |
| Dict[str, Any] | Meta data about the sensor data including at least | required |
Source code in slki/data/sensor_data_item.py
__iter__ ¶
Returns an iterator over this SensorDataItem instance.
Yields:
| Type | Description |
|---|---|
| The data array and metadata dictionary, in that order. |
Source code in slki/data/sensor_data_item.py
create classmethod ¶
create(
data: ndarray,
start_time: str | datetime | None = None,
end_time: str | datetime | None = None,
*,
sample_length: int | None = None,
**meta_kwargs
) -> SensorDataItem
Creates a new SensorDataItem instance from the given data and metadata.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| ndarray | The sensor data (time series data). | required |
| str | datetime | None | The start time of the data as a string or datetime object, or | None |
| str | datetime | None | The end time of the data as a string or datetime object, or | None |
| int | None | The number of samples in the data array. If not provided, it will be inferred from the data length. Defaults to None. | None |
| Additional metadata key-value pairs. | {} |
Returns:
| Name | Type | Description |
|---|---|---|
SensorDataItem | SensorDataItem | A new SensorDataItem instance with the given data and metadata. |
Source code in slki/data/sensor_data_item.py
get_signal ¶
Get the signal data with the correct sample length and its sample length.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
| bool | Wether the signal is already resampled of not. If True, returns the entire data array. Otherwise, returns a slice of the data up to its sample length. | required |
Returns:
| Type | Description |
|---|---|
tuple[ndarray, int] | Tuple[np.ndarray, int]: A tuple containing the signal data and its length. |