rfwtools.extractor.windowing.window_extractor_faulted_cavity
- rfwtools.extractor.windowing.window_extractor_faulted_cavity(example, windows, n_samples, waveforms, standardize=True, downsample=False, ds_kwargs={'axis': 0, 'num': 256}, query=None)[source]
Extract labeled time windows of a Example’s event_df for the labeled cavity. None if cavity_label is ‘0’
Will produce one feature row for each key in windows. Windows are left inclusive, right exclusive.
One use of this is to extract two windows of data. One relating to ‘stable’ running, another to fault ‘impending’.
Please note the order of operations. First query is applied to the Example’s event_df. Then each signal is standardized. Then the standardized signal is down sampled using scipy.signal.resample.
- Parameters:
example (
Example) – The example on which to operatewindows (
Dict[str,float]) – A dictionary keyed on window labels (e.g., ‘stable’, ‘impending fault’, etc.) with values that are the start of the window.n_samples (
int) – The number of samples to include from start.waveforms (
List[str]) – An explicit list of the waveforms to be down sampled (e.g., “GMES”). If None, then [GMES, CRFP, DETA2, GASK] will be used for the cavity labeled as faulting.standardize (
bool) – If True, each signal is z-score standardized ( (x-u)/s) ). No change if False. Each window is standardized independently.downsample (
bool) – Should the signals be down sampled.ds_kwargs (
dict) – Keyword arguments that will be passed to the scipy.signal.resample routine, if downsample is Truequery (
Optional[str]) – Argument passed to the ex.event_df to filter data prior to feature extraction, e.g. “Time <= 0”.
- Return type:
Optional[DataFrame]- Returns:
A DataFrame with a row each requested window. Has a window_label column and a ‘Sample_#_<waveform>’ column for each Time sample, where # is the number of samples from the start of the window (after down sampling, if requested). None if cavity_label is ‘0’.