====== Normalize EMG to Generic Global Variable ======
\\
**Normalizing EMG signal to generic GLOBAL Value**\\
Typically the Scaling factors for EMG signals are the result of other data trials (such as MVIC trials). Individual files in Visual3D cannot access the data from other files, so the only way signals can be shared is through the Global Workspace.\\
\\
**This tutorial assumes that a global metric has already been created and that metric is used to normalize the EMG signals.**\\
===== Sample Files =====
[[https://www.has-motion.com/download/examples/EMG/Generic_Global_Metric.zip|You can download the sample files here.]]
The download contains:
* EMG_Norm_Global_Variable_Example.cmz with -
* 3 MVC trial
* 2 Dynamic Trials
* EMG_Norm_Global_Variable.v3s (Example Pipeline Script)
* EMG_Norm_Global_Variable.v3m (Example Meta-Command)
* Call_EMG_Norm_Global_Variable_Meta.v3s (Example Pipeline Script calling Meta-Command)
Typically EMG signals are normalized after they have been processed (ex. linear envelope). In this example, the original signal is normalized. In reality, you should reference the folder which contains your processed EMG signal (ex. if you calculated a linear envelope, and the resulting EMG signal is stored in a folder called LOWPASS, change ORIGINAL in the script to LOWPASS).
==== Example Pipeline Script ====
\\
Assumes there is a previously created GLOBAL metric called METRIC::MVC_MAX::EMG_A_MAX.
! -------------------------------------------------------------
! Normalize
! -------------------------------------------------------------
! Select All Files as Active
Select_Active_File
/File_Name=ALL_FILES
;
! For each EMG signal, divide by it's maximum value
For_Each
/Iteration_Parameter_Name=CURRENT_SIGNAL
/Items=EMG_A+EMG_B+EMG_C
;
! Divide the EMG signal by it's maximum value, which was stored in the GLOBAL workspace
Evaluate_Expression
/EXPRESSION= ANALOG::ORIGINAL::&::CURRENT_SIGNAL& / GLOBAL::METRIC::MVC_MAX::&::CURRENT_SIGNAL&_MAX
! /SIGNAL_TYPES=
! /SIGNAL_FOLDER=ORIGINAL
! /SIGNAL_NAMES=
/RESULT_TYPES=ANALOG
/RESULT_FOLDERS=NORMALIZED
/RESULT_NAME=::CURRENT_SIGNAL
! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
;
End_For_Each
/Iteration_Parameter_Name= CURRENT_SIGNAL
;
==== Calling Example Meta-Command ====
Once the example Meta-Command from the download is placed in your [[Visual3D:Documentation:Pipeline:Meta_Commands:Meta_Commands_Overview|Meta-Command folder]], you can call the command using the following syntax:
EMG_Norm_Global_Variable
/EMG_INPUT_FOLDER=ORIGINAL
/EMG_OUTPUT_FOLDER=NORMALIZED
/EMG_SIGNAL_LIST=EMG_A+EMG_B+EMG_C
/GLOBAL_METRIC_FOLDER=MVC_MAX
/GLOBAL_METRIC_SUFFIX=_MAX
;
* **EMG_INPUT_FOLDER** should be the EMG signals you want to normalized
* **EMG_OUTPUT_FOLDER** should be the resulting EMG folder for the normalized signals
* **EMG_SIGNAL_LIST** the list of EMG signals to normalize
* **GLOBAL_METRIC_FOLDER** should be the name of the folder with the value to normalize to
* **GLOBAL_METRIC_SUFFIX** should be the suffix for the name of the normalized value (ex. EMG_A_Max, _Max is the suffix). This can also be left blank.