[S8441] Script for performing FFT on torque waveforms and extracting the maximum amplitude from each frequency component

 

The following is an example of a script that performs FFT on torque waveforms and extracts the maximum amplitude from each frequency component. 

app = designer.GetApplication()

# Specify the torque of the data set to be executed by FFT.

ref1 = app.GetCurrentStudy().GetDataSet("Torque", 1)

# Get the number of rows

Numrows = ref1.GetRows()

#  Get the time of the last line

ET = ref1.GetValue(Numrows - 1, 0)

# Execute FFT

FFTDataSet = app.GetDataManager().CreateFFT(ref1, 0, "AmplitudeAndPhase", 20, 0, ET, 1)

# Get all amplitude values from the second row onwards in the dataset

amplitude_values = [FFTDataSet.GetValue(i, 1) for i in range(1, FFTDataSet.GetRows())]

# Get the maximum amplitude value

result_value = max(amplitude_values)

print(f"maximum amplitude: {result_value}")

How to use script file

Use the JMAG Script Library after reading and agreeing to the following terms of use.