[S0031] Perform a 2D Fourier transform in time and space axes

 

JMAG-Designer provides the function to perform a 2D Fourier transform on a result data defined on the time and spatial axes. It enables a simultaneous analysis of time-frequency and spatial-frequency data.
This script performs a 2D Fourier transform on the calculation of the magnetic flux density for each spatially periodic edge at each time point.

Preconditions

  • One or more magnetic field transient analysis studies have been calculated.
    This script is run on the active study in the project tree.
  • The result calculation that serves as the source data for the 2D Fourier transform must be defined.
    This script runs for on a dataset calculated the magnetic flux density results for each edge with rotational periodicity that title is "Edge".
  • The 2D Fourier transform is available in JMAG-Designer v25.0 and later.

Script Function

  • Obtain the calculation result dataset for case 1 of the edge calculation titled "Edge".
  • Set the necessary parameters for a 2D Fourier transform and perform to the obtained dataset.
# 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 getCalculationDataSetWithSpecifiedStudyCase(calculationTitle, study, caseNo):
    """Get a data set by specifying the data set name, study, case number."""
    calcDef = study.GetCalculationDefinition(calculationTitle)
    dataSet = calcDef.GetCaseDataSet(caseNo)
    return dataSet

def fourierTransform2DTimeSpace(dm, dataSet, graphName, unitType, rangeType):
    """Perform a two-dimensional Fourier transform on physical quantity data defined based on time and space axes."""
    parameter = app.Create2DFourierTransformParameter(graphName)
    
    parameter.SetDataSet(dataSet)
    parameter.SetType(unitType)
    parameter.SetDBRefValueType(u"Specify")
    parameter.SetDBRefValue(u"2e-05")
    parameter.SetDBMultiplier(20)
    parameter.SetAxisType(rangeType)
    parameter.SetMin(u"0.0001")
    parameter.SetMax(u"0.0003")
    parameter.SetTimePeriodicity(0)  # 0:None, 1:1/2
    parameter.SetFrequencyMultiplier(u"1")
    parameter.SetUseTimeOrderLimit(True)
    parameter.SetTimeOrderLimit(u"2")
    parameter.SetFrequencyDomainAxisType(u"Order")
    parameter.SetSpacePeriodicity(0)  # 0:None, 1:1/2
    parameter.SetSpaceOrderMultiplier(u"1")
    parameter.SetUseSpaceOrderLimit(True)
    parameter.SetSpaceOrderLimit(u"3")
    parameter.SetAlgorithmType(u"DFT")
    
    dm.Create2DFourierTransformWithParameter(parameter)


# ------------------------------
graphName = u"Surface_2D_Fourier_Transform"
unitType = u"Decibel"
rangeType = u"Time"
definitionTitle = u"Edge"
caseNo = 1
# ------------------------------
study = app.GetCurrentStudy()
dataSet = getCalculationDataSetWithSpecifiedStudyCase(definitionTitle, study, caseNo)

dm = app.GetDataManager()
fourierTransform2DTimeSpace(dm, dataSet, graphName, unitType, rangeType)

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