| |
- rerun(mauka_message: mauka_pb2.MaukaMessage, logger, mongo_client: mongo.OpqMongoClient = None)
- Rerun the THD plugin over a Makai box event.
:param mauka_message: The event message to rerun THD analysis over.
:param logger: The application logger
:param mongo_client: An optional instance of a mongo client.
:return:
- rolling_window(array: numpy.ndarray, window: int) -> List[numpy.ndarray]
- Given an array and window, restructure the data so that it is in a rolling window of size "window" and step = 1.
:param array: The array to roll a window over
:param window: The window size
:return: A 2D array where each row is a window into the provided data.
- sliding_thd(mongo_client, threshold_percent, sliding_window_ms, event_id: int, box_id: str, box_event_start_timestamp: int, waveform: numpy.ndarray)
- Calculates sliding THD over a waveform.
High THD values are then stored as incidents to the database.
:param event_id: Event that this waveform came form.
:param box_id: Box that this waveform came from.
:param box_event_start_timestamp: Start timestamp of the provided waveform
:param waveform: The waveform to calculate THD over.
- thd(waveform: numpy.ndarray, fundamental: int) -> float
- Calculates the total harmonic distortion (THD) of the provided waveform with the provided fundamental of the
waveform.
:param waveform: The waveform to find the THD of.
:param fundamental: The fundamental frequency (in Hz) of the provided waveform.
:return: The calculated THD of the provided waveform.
|