Table of Contents
Metric Compute Power From DFT Coefficients
The power in a signal can be computed from the DFT coefficients.
The form of the DFT is as follows:
p(t)= p0 + p1 sin(w t) + p2 cos(w t) + p3 sin(2w t) + p4 cos(2 w t) + ….
where w = 2 * PI * Base_Frequency
the power at a given frequency is given as the sum of the squares of the coefficients.
For example, the power at the Base_Frequency is given by (p1^2 + p2^2) the power at 2 * Base_Frequency is given by (p3^2 + p3^2)
This can be useful when looking at muscle related signals like EMGs.
Pipeline Command
The command below is as seen on the Visual3D application, it can be found in the Pipeline Workshop within the Metric folder.
Metric_Compute_Power_From_DFT_Coefficients /SIGNAL_TYPES= ! /SIGNAL_FOLDER=DFT ! /SIGNAL_NAMES= ! /RESULT_FOLDER=DFT ! /RESULT_SUFFIX=_POWER ;
Additionally (starting in Visual3D Version 5) the Mean and Median Frequency are computed.
These two metrics are commonly used to describe changes related to muscle fatigue.
Command Parameters
- Table with parameters and descriptions (include link to parameter wiki pages if they are available)
The following table shows the command parameters and descriptions:
SIGNAL_TYPES | Specify Signal Types |
SIGNAL_FOLDER | Specify folder containing signals |
SIGNAL_NAMES | Specify names of signals to be processed |
RESULT_FOLDER | Specify destination folder for results |
RESULT_SUFFIX | Specify suffix attached to resulting signals |
Notes
Signal Components
The resulting Metric signal has two components.
The first component is the frequency. The second component is the power at the associated frequency.
Median Frequency
The Median Frequency is the Frequency at which the Integral of the Power Spectrum to that Frequency equals half the Integral of the Total Power Spectrum (e.g. divides the power spectrum in two)
Mean Frequency
The Mean Frequency is the Ratio of the Integral of the Frequency*Power over the Integral of the Power.
_STATS
An additional result signal appended with _STATS is also created.
This signal contains the median frequency (component 1) and mean frequency (component 2)
Examples
Simple example
Here we will look at a basic example of computing power from DFT coefficients calculated for EMG signals during the right stance phase. For more information on computing DFT coefficients go to Metric Compute DFT Coefficients.
First we must create a group of EMG signals from the analog folder. This can be done using the Set Pipeline Parameter to List of Signal Names command, like so:
Set_Pipeline_Parameter_To_List_Of_Signal_Names /PARAMETER_NAME=EMG_Signals /SIGNAL_TYPES=ANALOG /SIGNAL_FOLDER=ORIGINAL /SIGNAL_MASK=EMG* ;
Now that our EMGs have been grouped we can compute the DFT coefficients for each signal.
Metric_Compute_DFT_Coefficients /SIGNAL_TYPES=ANALOG /SIGNAL_FOLDER=ORIGINAL /SIGNAL_NAMES=&::EMG_Signals ! /SIGNAL_COMPONENTS=ALL_COMPONENTS ! /RESULT_FOLDER=DFT ! /RESULT_SUFFIX=_DFT /EVENT_SEQUENCE=RON+ROFF ! /EXCLUDE_EVENTS= ! /START_FRAME= ! /END_FRAME= ! /BASE_FREQUENCY= ! /NUM_FREQUENCIES=4 ;
Now, use the Metric Compute Power From DFT Coefficients command to find the power from the DFT coefficients that were just created. We'll create a new folder within the METRIC folder called DFT_Power for this data.
Metric_Compute_Power_From_DFT_Coefficients /SIGNAL_TYPES=METRIC /SIGNAL_FOLDER=DFT ! /SIGNAL_NAMES= /RESULT_FOLDER=DFT_Power ! /RESULT_SUFFIX=_POWER ;
Once the pipeline has been executed two new folders should be located within the METRIC folder, one called DFT and one called DFT_Power containing the DFT coefficients and the power associated with them.
Complex example
In real world applications it is often necessary to apply filters to data before analysis can be conducted. Here, similar to above, we will compute the DFT coefficients and power for EMG signals, but only after applying a filter to the raw EMG data.
First we will assemble the same list of EMG signals as above using Set Pipeline Parameter to List of Signal Names.
Set_Pipeline_Parameter_To_List_Of_Signal_Names /PARAMETER_NAME=EMG_Signals /SIGNAL_TYPES=ANALOG /SIGNAL_FOLDER=ORIGINAL /SIGNAL_MASK=EMG* ;
Next, before computing DFT coefficients we will apply a bandpass filter to the EMG signals using a combination of a highpass and lowpass filter. The pipeline commands for each filter are below.
Highpass_Filter /SIGNAL_TYPES=ANALOG /SIGNAL_FOLDER=ORIGINAL /SIGNAL_NAMES=&::EMG_Signals /RESULT_FOLDER=PROCESSED_EMG ! /RESULT_SUFFIX= ! /FILTER_CLASS=BUTTERWORTH ! /FREQUENCY_CUTOFF=6.0 ! /NUM_REFLECTED=6 ! /NUM_EXTRAPOLATED=0 ! /TOTAL_BUFFER_SIZE=6 ! /NUM_BIDIRECTIONAL_PASSES=1 ;
Lowpass_Filter /SIGNAL_TYPES=ANALOG /SIGNAL_FOLDER=ORIGINAL /SIGNAL_NAMES=&::EMG_Signals /RESULT_FOLDER=PROCESSED_EMG ! /RESULT_SUFFIX= ! /FILTER_CLASS=BUTTERWORTH ! /FREQUENCY_CUTOFF=6.0 ! /NUM_REFLECTED=6 ! /NUM_EXTRAPOLATED=0 ! /TOTAL_BUFFER_SIZE=6 ! /NUM_BIDIRECTIONAL_PASSES=1 ;
Now that our EMG signals have been appropriately filtered we can compute DFT coefficients and find the associated signal power, using the same commands as the previous example.
Metric Compute DFT Coefficients
Metric_Compute_DFT_Coefficients /SIGNAL_TYPES=ANALOG /SIGNAL_FOLDER=PROCESSED_EMG /SIGNAL_NAMES= ! /SIGNAL_COMPONENTS=ALL_COMPONENTS ! /RESULT_FOLDER=DFT ! /RESULT_SUFFIX=_DFT /EVENT_SEQUENCE=RON+ROFF ! /EXCLUDE_EVENTS= ! /START_FRAME= ! /END_FRAME= ! /BASE_FREQUENCY= ! /NUM_FREQUENCIES=4 ;
Metric Compute Power from DFT Coefficients
Metric_Compute_Power_From_DFT_Coefficients /SIGNAL_TYPES=METRIC /SIGNAL_FOLDER=DFT ! /SIGNAL_NAMES= /RESULT_FOLDER=DFT_Power ! /RESULT_SUFFIX=_POWER ;
You should now see two new folders in the METRIC folder, one for the DFT coefficients and another for the signal power.
Using these results we can create a report showing the power spectrum of an EMG signal. Navigate to the Reports tab and create a new page. Add a 2d graph and table using the contents shown below.
You should now see a graph and table showing you the filtered EMG signal data similar to below.