truncateHistory.py
This analyzer truncates a scalar history, removing records from start and end. This might be used, for example, to only use data after a model is at a quasi-steady state (eg the frequency of a magnetron, excluding the moding at startup).
- -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 to truncate.
- -o <newhistname>, --newHistoryName=<newhistname>
(string, required)
<newhistname> is the name of the new truncated history you are creating.
- -m <M>, --multiplier=<M>
(float, required, default = 1.0)
<M> is the factor, variable of integration, eg dt, that you can multiply your history by, if you choose.
- -b <time>, --beginTime=<time>
(float, optional)
<time> is the time at which to start truncating.
- -e <time>, --endTime=<time>
(float, optional)
<time> is the time at which to end truncating.
- -w, --overwrite
(flag)
Whether a dataset or group should be overwritten if it already exists.
Output
An additional “history” vizschema file is output, containing a portion of the data from another history. At present this will be visible under 1D fields, where the ordinate is time and the abcissa is whatever was used for the original history.
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.
Example of Usage
Run the 2D magnetron example (XSimVE -> Radiation generation). Select “all annotations” in the annotation level setting in bottom left corner of data overview pane. You will see it takes ~100k steps for the spokes to start to form, corresponding with 300ns into the simulation. Observe that around dump 240ns there appear to be four spokes, instead of the desired five. A measure of frequency there will give an incorrect result, and adversely affect the accuracy of the FFT calculated.
(show FFT of cavity1Voltage history)
Truncate using beginTime = 240e-9.
(show FFT of cavity1Voltage history)
See also computeSpectrogram.py.