Measurement
Raw Data files
Prior to downloading the raw data files content, the user can list and filter the available files on the server. This helps to identify the files that are relevant for the analysis, and reduce the number of files to be downloaded.
The filtering can be done by date, asset id and type of data.
The files found on the server are represented by the RawMeasurementsFound class, the list of found group of files
collected at the same timestamp. Each group is represented by the RawMeasurementFilesOverview class,
which contains the list of files, including their name, id and the download link.
Raw Measurement Data
Raw data is a collection of signals collected from the SmartSensor or Machine Guardian sensors.. Each signal is a vector of measurement values, each with a known sampling rate and scaling factor. The signals are usually stored in CSV files, with a header that contains metadata about the signal and the device that collected it.
Since it comes as a collection of data signals ( from vibration sensor, magnetic sensor and microphone) along with metadata describing this collection (timestamp, sensor parameters, snapshot of other values at the sensor) it is useful to represent that structure in the code.
It is called RawDataMeasurement, and it contains collection of signals, and a context describing the state
at which those signals were captured, along with methods for filtering the signals and calculating values
that requires an input from several signals at once (like speed and line frequency algorithm).
For filtering the signals, we have introduced a RawDataSignalFilter class, which allows chaining
several filters together. The filters are applied to the signals in the order they are added to the filter chain.
Finally, the RawDataMeasurement class has a method for exporting the signals to a CSV files,
which can be used for further analysis or visualization.
API
smartreport.v3.models.measurement.files.RawMeasurementsFound
Bases: ReportDataModel
filter_by_sensor_codes(sensor_codes)
Filter the raw measurements by sensor codes. If sensor codes are not provided, return all measurements.
Known sensor codes are following: - "msr4m" - MACHsense-R - "ss4m" - SmartSensor Gen1 - "sssp" - SmartSensor Standard Performance - "sshp" - SmartSensor High Perfomance - "sshh" - SmartSensor Handheld
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
sensor_codes
|
Optional[List[str]]
|
List of sensor codes to filter the measurements by. |
required |
Returns:
| Type | Description |
|---|---|
RawMeasurementsFound
|
New instance of RawMeasurementsFound with the filtered raw measurements. |
get_sample(n)
Get a sample of n raw measurements.
We always include the first and last measurement if there are more than 2 measurements.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
n
|
int
|
Number of raw measurements to return |
required |
Returns:
| Type | Description |
|---|---|
List[RawMeasurementFilesOverview]
|
List of raw measurements with length |
select_measurements(mode, **kwargs)
Select raw measurements based on the mode and the number of measurements to return.
Mode can be a timestamp, "first", "latest", "sample" or "all".
If mode is a timestamp, the measurements with timestamp within a tolerance are returned.
Tolerance can be set with the tolerance keyword argument.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mode
|
MeasurementModes
|
Mode to select the raw measurements. Can be a timestamp, "first", "latest", "sample" or "all". |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
tolerance |
timedelta
|
Tolerance for the timestamp mode. Default is 60 seconds. |
n |
int
|
Number of samples to return for |
Returns:
| Type | Description |
|---|---|
RawMeasurementsFound
|
New instance of RawMeasurementsFound with the selected raw measurements. |
smartanalytics.raw_data.models.measurement.measurement.RawDataMeasurement
Bases: Collection
bearing_frequencies
property
Returns a dictionary of bearing frequencies for both drive end and non-drive end bearings.
from_csv_paths(paths, **kwargs)
classmethod
Create a RawMeasurementData object from a list of CSV file paths.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
paths
|
Sequence[Path]
|
List of CSV file paths. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
header_lines |
int
|
Number of header lines in the CSV files. Default is 9. |
delimiter |
str
|
Delimiter used in the CSV files. Default is ";". |
source |
RawDataSource
|
Source of the raw data. Default is Unknown. |
sensor_firmware |
str
|
Firmware version of the sensor. Default is None |
unit_standard |
UnitStandard
|
Unit standard to be used with signals. Default is Metric. |
kwargs |
dict
|
Additional keyword arguments to be passed to the signal reader. |
Returns:
| Type | Description |
|---|---|
RawDataMeasurement
|
RawMeasurementData object with signals from the CSV files. |
from_downloaded_files(downloaded_files, **kwargs)
classmethod
Create a RawMeasurementData object from a list of files downloaded from Powertrain API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
downloaded_files
|
Sequence[FileWithCsvContent]
|
List of CSV files downloaded from Powertrain API. |
required |
Other Parameters:
| Name | Type | Description |
|---|---|---|
header_lines |
int
|
Number of header lines in the CSV files. Default is 9. |
delimiter |
str
|
Delimiter used in the CSV files. Default is ";". |
source |
RawDataSource
|
Source of the raw data. Default is Unknown. |
sensor_firmware |
str
|
Firmware version of the sensor. Default is None |
unit_standard |
UnitStandard
|
Unit standard to be used with signals. Default is Metric. |
kwargs |
dict
|
Additional keyword arguments to be passed to the signal reader. |
Returns: RawMeasurementData object with signals from the CSV files.
get_line_frequency(nominal_speed=None, nominal_line_frequency=None, use_single_axis_acc=False)
Returns the line frequency at measurement time in [Hz] unit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nominal_speed
|
Optional[float]
|
Nominal speed value in RPM. If not provided, it is read from the measurement context. |
None
|
nominal_line_frequency
|
Optional[float]
|
Nominal line frequency value in Hz. If not provided, it is read from the measurement context. |
None
|
use_single_axis_acc
|
bool
|
If True, then the speed is calculated using single axis acceleration data. |
False
|
:return: Line frequency in given unit as a float or None
get_speed(nominal_speed=None, nominal_line_frequency=None, use_single_axis_acc=False)
Returns the speed at measurement time in [Hz] unit.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
nominal_speed
|
Optional[float]
|
Nominal speed value in RPM. If not provided, it is read from the measurement context. |
None
|
nominal_line_frequency
|
Optional[float]
|
Nominal line frequency value in Hz. If not provided, it is read from the measurement context. |
None
|
use_single_axis_acc
|
bool
|
If True, then the speed is calculated using single axis acceleration data. |
False
|
Returns:
| Type | Description |
|---|---|
Optional[float]
|
Speed in given unit as a float or None if speed is not found. |
update_context(**kwargs)
Updates the measurement context with new values.
Keyword Args kwargs(dict): New values for the measurement context.