rfwtools.extractor.windowing

This module provides the ability to grab time-based windows of signals, and provide labels to them.

Typically, these will be used by DataSet.produce_feature_set(). However there is no reason why these can’t be run externally.

Basic Usage Example:

from rfwtools.data_set import DataSet
from rfwtools.extractor.windowing import window_extractor, window_extractor_metadata

# Setup a DataSet object and get some example data to work with
ds = DataSet()
ds.load_example_set_csv("my_example_set.csv")

# Get a single example to work on
ex = ds.example_set.loc[0, 'example']

# Run on one example with defaults (start at Time == -500, and include the next 100 samples)
window_extractor(ex, windows={'my_window': -500}, n_samples=100)

# Run on one example with only 2 signals being processed
window_extractor(ex, windows={'my_window': -500}, n_samples=100,
                 signals=['1_GMES', '1_PMES'])

# Produce one window for stable running and one window for impending fault
window_extractor(ex, windows={'stable': -1536, 'impending': -105}, n_samples=500)

# Run this on every example in the example set and produce a corresponding feature set for pre-fault signal data.
ds.produce_feature_set(window_extractor, windows={'my_window': -500}, n_samples=100)

# Update the metdata_columns to reflect the additional columns generated by the window_extractor
ds.feature_set.update_metadata_columns(window_extractor_metadata)

Module Attributes

window_extractor_metadata

A list of metadata column names generated by the window_extractor

Functions

window_extractor(example, windows, n_samples)

Extract labeled time windows of a Example's event_df.

window_extractor_faulted_cavity(example, ...)

Extract labeled time windows of a Example's event_df for the labeled cavity.