[S0023] Performs a Fourier transform on the specified dataset

 

The Graph Manager manages calculation results as point sequence data, allowing to perform processing such as Fourier transforms.
Time series result tables for torque, electromagnetic force, etc. can be evaluated by frequency components without recalculating or outputting special data.
This script performs a Fourier transform on the circuit current and creates a frequency series dataset and graph.

Preconditions

  • One or more study has been calculated.
    This script runs on the active magnetic field transient analysis study in the project tree.

Script Function

  • Obtain the circuit current results table for the magnetic field transient response analysis as a DataSet object.
  • Perform a Fourier transform on the obtained data set.
    Set the output type to amplitude, and the X-range to time, with a minimum value of 0.01 and a maximum value of 0.015.
    Set other parameters as follows: line selection: All Lines, periodicity: 1/2, frequency scale: 0.5.
  • If execution is successful, a frequency series data set and graph of the Fourier transform results will be created.
# Copyright (c) 2026 JSOL CORPORATION
#
# This script is released under the MIT License.
# See the full license text at:
# https://www.jmag-international.com/scriptlibrary/jmag_script_library_mit/

app = designer.GetApplication()

def fourierTransform(targetDataSet, type, axisType):
    """Perform a Fourier transform on the dataset passed as an argument"""
    fftParam = app.CreateFFTParameter(u"Fourier transform")
    fftParam.AddDataSet(targetDataSet)
    # Line
    # 0:Specify dataset
    # 1:Specify all datasets
    fftParam.SetLineType(1)
    fftParam.SetType(type)
    fftParam.SetMin(u"0.01")
    fftParam.SetMax(u"0.015")
    # Periodicity
    # 0:None
    # 1:1/2
    fftParam.SetPeriodicity(1)
    fftParam.SetFrequencyMultiplier(u"0.5")
    fftParam.SetAxisType(axisType)
    return fftParam

study = app.GetCurrentStudy()
dataSet = study.GetDataSet(u"Circuit Current", 1)
type = u"Amplitude"
axisType = u"Time"
parameter = fourierTransform(dataSet, type, axisType)

dm = app.GetDataManager()
dm.CreateFFTWithParameter(parameter)

Download Python source code

How to use script file

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

Search Filter

  • All Categories

An engineer's diary
JMAG-Express Online