computeSpectrogram.py¶
This analysis script, computeSpectrogram.py, takes a history of field at a coordinate or cell index, and works out the spectrogram, writing it into a 2D dataset containing frequency vs time which may be viewed in VSimComposer.
- -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.
- -H <histname>, --historyName=<histname>¶
(string, required)
<histname> is the name of the history dataset to analyze, for example, E1.
- -f <size>, --fourierTransSize=<size>¶
(integer, required, default = 4096)
Replace <size> with the number of timesteps (or history points) to use for each Fourier transform. Determines lowest measurable frequency in the transform.
- -n <overlap>, --noOverlap=<overlap>¶
(integer, required, default = 2048)
Replace <overlap> with the number of timesteps that will overlap between successive measurements of frequency. Set this to between zero and the size of the Fourier transform.
- -F <max>, --maxFreq=<max>¶
(float, required, default = 0.0)
When preparing the data, discard frequencies above this maximum frequency <max>. FFTs show a maximum frequency corresponding to 2*dt. This is higher than any frequency you are reliably going to be able to calculate.
- -W <windowfunc>, --windowType=<windowfunc>¶
(integer, required, default = 1)
Specify a windowing function for the spectrogram. Default is 1 - Hanning.
Hanning
Hamming
Blackmann
Bartlett
If you are unfamiliar with these functions, please consult numpy documentation.
- -c <comp>, --component=<comp>¶
(integer, optional, default = 0)
<comp> is the component to select if history contains multicomponent data.
- -w, --overwrite¶
(flag)
Whether a dataset or group should be overwritten if it already exists.
Output¶
This analysis script outputs a VizSchema compatible HDF5 file containing a 2D field readable in VSimComposer, time on the ordinate, frequency on the abcissa.
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.