🎉Community Raffle - Win $25

An exclusive raffle opportunity for active members like you! Complete your profile, answer questions and get your first accepted badge to enter the raffle.
Join and Win

How can I extract the magnitude of a single harmonic in a spectrum and assign it to an I/O parameter using a pyflux commend?

User: "C_Favre"
Altair Employee
Updated by C_Favre

The magnitude in a spectrum 'Name' of harmonic number 'HarmonicNumber' is obtained by the pyflux command:

CurveVariation2D['Name'].spectrumResults[HarmonicNumber].amplitude

Both the magnitude extraction and the I/O parameter update can be done in the same pyflux command line. Here the I/O parameter 'ParameterName' is assigned the magnitude of harmonic 'HarmonicNumber' from the spectrum 'CurveName':

VariationParameter['ParameterName'].formula=str(CurveVariation2D['CurveName'].spectrumResults[HarmonicNumber].amplitude)

Note: 

the I/O parameter should be defined as a formula type. It must be created in Flux before running the pyflux command.

Example:

1. Extracting the magnitude of a harmonic:

Extracts magnitude of harmonic #2 in curve SPECTRUM. The value is given in the Output Window when executed in an interactive session.

2. Extracting the magnitude of a harmonic and assigning it to an I/O parameter:

The command extracts the amplitude of the second harmonic from the SPECTRUM curve and assigns the value to the parameter HARMONICMAGNITUDE.

Find more posts tagged with

Comments

No comments on this post.