User Tools

Site Tools


visual3d:documentation:emg:filtering:resting_background_noise_offset

Resting Background Noise Offset

Introduction

The purpose is to offset trial data to accommodate for any DC shift. Quantifying the EMG background noise based on a “Resting Trial” using the following algorithm:

Find overall mean of trial:

if positive, subtract mean from all values to offset overall average to zero if negative, add mean to all values to offset overall average to zero. Rectify trial around the zero baselines

Calculate threshold values for each channel of EMG (level of digitized baseline noise).

Determine noise threshold (i.e., the value determined from the resting EMG values fall below; calculated by passing a ceiling through data at successively higher levels until all data values for the 5 second duration fall below the ceiling.

EMG_Resting_Background

Set_Pipeline_Parameter
/PARAMETER_NAME=SIGNAL_NAMES
/PARAMETER_VALUE=LGAS+LGLU+LMED+LTIB+LVAS+RGAS+RGLU+RMED+RTIB+RVAS
! /PARAMETER_VALUE_SEARCH_FOR=
! /PARAMETER_VALUE_REPLACE_WITH=
! /PARAMETER_VALUE_PREFIX=
! /PARAMETER_VALUE_APPEND=
;
 
! ---------------------------------------------------------------
! Offset trial data to accommodate for any DC shift
! (find overall mean of trial&ldots;if positive,
! subtract mean from all values to offset overall average to zero&ldots;
! if negative, add mean to all values to offset overall average to zero).
! Rectify trial around the zero baselines
! (all values set to absolute values).
! ---------------------------------------------------------------

Set_Pipeline_Parameter
/PARAMETER_NAME=FOLDER
/PARAMETER_VALUE=EMG_FILTERED
! /PARAMETER_VALUE_SEARCH_FOR=
! /PARAMETER_VALUE_REPLACE_WITH=
! /PARAMETER_VALUE_PREFIX=
! /PARAMETER_VALUE_APPEND=
;

Set_Pipeline_Parameter
/PARAMETER_NAME=RESULT
/PARAMETER_VALUE=EMG_BACKGROUND
! /PARAMETER_VALUE_SEARCH_FOR=
! /PARAMETER_VALUE_REPLACE_WITH=
! /PARAMETER_VALUE_PREFIX=
! /PARAMETER_VALUE_APPEND=
;

Select_Active_File
/FILE_NAME=REST
!/QUERY=
;

For_Each
/ITERATION_PARAMETER_NAME=INDEX
/ITEMS=::SIGNAL_NAMES
;

Metric_Mean
/RESULT_METRIC_NAME=_MEAN
/APPLY_AS_SUFFIX_TO_SIGNAL_NAME=TRUE
! /RESULT_METRIC_FOLDER=PROCESSED
/SIGNAL_TYPES=ANALOG
/SIGNAL_NAMES=::INDEX
/SIGNAL_FOLDER=::FOLDER
! /SIGNAL_COMPONENTS=X
/EVENT_SEQUENCE=
/EXCLUDE_EVENTS=
/GENERATE_MEAN_AND_STDDEV=FALSE
! /APPEND_TO_EXISTING_VALUES=FALSE
;

Evaluate_Expression
/EXPRESSION=ABS(ANALOG&:&:&::FOLDER&:&:&::INDEX&-&METRIC::PROCESSED&:&:&::INDEX&_MEAN)
/RESULT_NAME=::INDEX
/RESULT_TYPE=ANALOG
/RESULT_FOLDER=::RESULT
;

End_For_Each
/ITERATION_PARAMETER_NAME=INDEX
;

! ---------------------------------------------------------------
! Remove the EMG background noise
! --------------------------------------------------------------- 

! This loop will remove the resting background from the signals.
For_Each
/ITERATION_PARAMETER_NAME=TAGS
/ITEMS=EMG+GAIT
;

Select_Active_File
/FILE_NAME=::TAGS
!/QUERY=
;
 
Set_Pipeline_Parameter
/PARAMETER_NAME=FOLDER
/PARAMETER_VALUE=EMG_BACKGROUND
! /PARAMETER_VALUE_SEARCH_FOR=
! /PARAMETER_VALUE_REPLACE_WITH=
! /PARAMETER_VALUE_PREFIX=
! /PARAMETER_VALUE_APPEND=
;

Set_Pipeline_Parameter
/PARAMETER_NAME=RESULT
/PARAMETER_VALUE=EMG_PROCESSED
! /PARAMETER_VALUE_SEARCH_FOR=
! /PARAMETER_VALUE_REPLACE_WITH=
! /PARAMETER_VALUE_PREFIX=
! /PARAMETER_VALUE_APPEND=
;

For_Each
/ITERATION_PARAMETER_NAME=INDEX
/ITEMS=::SIGNAL_NAMES
; 

Evaluate_Expression
/EXPRESSION=ABS(ANALOG&:&:&::FOLDER&:&:&::INDEX&& - GLOBAL::METRIC&:&:&::BACKGROUND_FOLDER&:&:&::INDEX&_REST_MAX)
/RESULT_NAME=::INDEX
/RESULT_TYPE=ANALOG
/RESULT_FOLDER=::RESULT
; 

Set_Data_To_New_Values
/SIGNAL_TYPES=ANALOG
/SIGNAL_NAMES=::INDEX
/SIGNAL_FOLDER=::RESULT
! /SIGNAL_COMPONENTS=ALL_COMPONENTS
! /RESULT_SUFFIX=
/RESULT_FOLDER=::RESULT
! /EVENT_SEQUENCE=
! /EXCLUDE_EVENTS=
/START_FRAME=1
/END_FRAME=EOF
! /USE_POINT_RATE=TRUE
/REPLACEMENT_VALUES=0
/THRESHOLD_HIGH=DATA_NOT_FOUND
/THRESHOLD_LOW=GLOBAL::METRIC&:&:&::BACKGROUND_FOLDER&:&:&::INDEX&_REST_MAX
; 

End_For_Each
/ITERATION_PARAMETER_NAME=INDEX
;

End_For_Each
/ITERATION_PARAMETER_NAME=TAGS
;
visual3d/documentation/emg/filtering/resting_background_noise_offset.txt · Last modified: 2024/07/17 11:45 by sgranger