[S8333] Script to FFT and output csv

 

I want to automate the process of performing FFT on the results and outputting them as a CSV file.

An example in a Python script is as follows.
# -*- coding: utf-8 -*-

app = designer.GetApplication()

#Get the number of datasets before FFT execution

numsets = app.GetDataManager().NumSets()

#Specify the data set to be used for FFT execution

ref1 = app.GetDataManager().GetDataSet(u"VoltageDifference")

#Execute FFT

app.GetDataManager().CreateFFT(ref1, 0, u"AmplitudeAndPhase", 20, 0, 8.68056e-05)

#Output the amplitude of the FFT execution result to csv

app.GetDataManager().GetDataSet(numsets).WriteTable(u"D:/numsets.csv")

#Output csv of phase of FFT execution result

app.GetDataManager().GetDataSet(numsets+1).WriteTable(u"D:/numsets+1.csv")
*Note
IDs are from 0 to the number of data sets, and the number of data sets and IDs are shifted by one.
Maximum value of ID = number of data sets - 1 (e.g., if there are 10 data sets, the maximum value of ID is 9)
From this, the data set IDs to be added are numsets and numsets+1,
each of which is an amplitude and a phase.

How to use script file

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