performLowPassFilter.py

This is a useful script that can be used to smooth high frequency noise out of any time series history. For example, if you have an absorbed current history, an output power history, etc. with large fluctuations on a short timescale, this low-pass filter will attenuate high frequency noise and smooth the signal.

The low-pass filter performs the operation

\[s^{n+1} = \left( 1 - \frac{\delta t}{\tau} \right)s^n + \frac{\delta t}{\tau} h^{n+1}\]

where \(s\) is the smoothed signal, \(h\) is the original time series history, \(\delta t\) is the timestep, and \(\tau\) is a time period related to the cutoff frequency (i.e. \(\tau = \frac{1}{f_{co}}\) ). In continuous, integral form this looks like

\[s(t) = \frac{1}{\tau}\int_{-\infty}^t h(t') e^{(t' - t)/ \tau} dt'.\]

Essentially the operation is analogous to doing a Fourier transform, attenuating the high frequency components to the signal, and transforming back.

When supplying a cutoff frequency for the analysis, try to estimate the frequency of the noise and pick a lower value. The user is encouraged to experiment with different frequency values to achieve the desired smoothing. Lower values for the cutoff frequency will correspond to more extreme smoothing, which will weight older/earlier values from the time series more heavily, possibly causing important transient affects to be smoothed over.

The output is a new time series as amplitude vs. time for the filtered signal.

-s <simname>, --simulationName=<simname>

(string, required)

<simname> is the name of the simulation to be analyzed. The file extension should NOT be included in this text field.

-f, --frequency

(float, required)

The frequency at which history will be analyzed.

-H, --historyName

(string, required)

The history to analyze.

-O <outname>, --outputFileName=<outname>

(string, optional, default = SIMULATIONNAME_lowPassFilterFREQ)

Replace <outname> with the name of the file into which the transformed time series will be written.

-c <comp>, --component=<comp>

(int, optional, default = 0)

<comp> is the component to select within a multi-component dataset.

-w, --overwrite

(flag)

Whether a dataset or group should be overwritten if it already exists

Output

This script prints out formatted text in two columns representing the transformed time series after the low-pass filter has been applied. The first column is the time axis in seconds, and the second column is the amplitude of the time series. n It also creates a VizSchema compliant HDF5 file that contains the transformed time series that can be visualized in Composer. The name of the new dataset is simulationName_lowPassFilterFREQ.vsh5, where FREQ is the low-pass filter frequency with periods replaced by underscores.

The data will be visualize-able through the 1-D fields option from the Data View drop-down menu.

If you are running this analyzer from the UI, and the output dataset file already exists, then it will be overwritten each time the analyzer is run, unless you uncheck the Overwrite Existing Files box near the bottom of the Analysis Results pane.

If you are running the analyzer from the command line, the dataset will not be overwritten unless the -w, or --overwrite flag is specified on the command line.

The results of your analyzer may not be written into the output file if you have not specified the overwrite option to be True.