User Tools

Site Tools


visual3d:documentation:pipeline:expressions:examples

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
visual3d:documentation:pipeline:expressions:examples [2024/06/17 18:18] – created sgrangervisual3d:documentation:pipeline:expressions:examples [2024/11/25 20:02] (current) – [Compute the magnitude of a vector] wikisysop
Line 1: Line 1:
 +====== Examples ======
  
- +==== Create signal using another signal component ==== 
- +
- +
-===== Examples ===== +
- +
-==== Example: Create signal using another signal component ====+
  
 Extract the z-component of a target. Extract the z-component of a target.
 +<code>
 Evaluate_Expression Evaluate_Expression
 /Expression= TARGET::ORIGINAL::RFT1::Z /Expression= TARGET::ORIGINAL::RFT1::Z
Line 14: Line 10:
 /Result_Type=DERIVED /Result_Type=DERIVED
 /Result_Folder=PROCESSED /Result_Folder=PROCESSED
-**;** +
-==== Example: Add two ANALOG signals ====+</code>
  
 +==== Add two ANALOG signals ==== 
 +
 +<code>
 Evaluate_Expression Evaluate_Expression
 /Expression= ANALOG::ORIGINAL::EMG1 + ANALOG::ORIGINAL::EMG2 /Expression= ANALOG::ORIGINAL::EMG1 + ANALOG::ORIGINAL::EMG2
Line 22: Line 21:
 ! /Result_Type=DERIVED ! /Result_Type=DERIVED
 ! /Result_Folder=PROCESSED ! /Result_Folder=PROCESSED
-**;** +
-==== Example: Divide the components of a signal ====+</code>
  
 +==== Divide the components of a signal ==== 
 +
 +<code>
 Evaluate_Expression Evaluate_Expression
 /Expression= FORCE::ORIGINAL::FP1::Y/FORCE::ORIGINAL::FP1::X /Expression= FORCE::ORIGINAL::FP1::Y/FORCE::ORIGINAL::FP1::X
Line 30: Line 32:
 ! /Result_Type=DERIVED ! /Result_Type=DERIVED
 ! /Result_Folder=PROCESSED ! /Result_Folder=PROCESSED
-**;** +
-==== Example: Create a vector between two locations ====+</code>
  
-A Vector is created by subtracting one location from another.+==== Create a vector between two locations ==== 
  
 +A vector is created by subtracting one location from another.
 +
 +<code>
 Evaluate_Expression Evaluate_Expression
 /Expression= LINK_MODEL_BASED::ORIGINAL::RT_COP-LINK_MODEL_BASED::ORIGINAL::COM /Expression= LINK_MODEL_BASED::ORIGINAL::RT_COP-LINK_MODEL_BASED::ORIGINAL::COM
Line 40: Line 45:
 /Result_Type=DERIVED /Result_Type=DERIVED
 /Result_Folder=PROCESSED /Result_Folder=PROCESSED
-**;** +
-==== Example: Average several TARGET signals ====+</code>
  
 +==== Average several TARGET signals ==== 
 +
 +<code>
 Evaluate_Expression Evaluate_Expression
 /Expression= (TARGET::ORIGINAL::TARG1 + TARGET::ORIGINAL::TARG2 + TARGET::ORIGINAL::TARG3) / 3 /Expression= (TARGET::ORIGINAL::TARG1 + TARGET::ORIGINAL::TARG2 + TARGET::ORIGINAL::TARG3) / 3
Line 48: Line 56:
 ! /Result_Type=DERIVED ! /Result_Type=DERIVED
 ! /Result_Folder=PROCESSED ! /Result_Folder=PROCESSED
-**;** +
-==== Example: Distance between a TARGET and a LANDMARK ====+</code>
  
 +==== Distance between a TARGET and a LANDMARK ==== 
 +
 +<code>
 Evaluate_Expression Evaluate_Expression
 /Expression= distance(LANDMARK::ORIGINAL::RIGHT_HIP , TARGET::ORIGINAL::LHIP) /Expression= distance(LANDMARK::ORIGINAL::RIGHT_HIP , TARGET::ORIGINAL::LHIP)
Line 56: Line 67:
 ! /Result_Type=DERIVED ! /Result_Type=DERIVED
 ! /Result_Folder=PROCESSED ! /Result_Folder=PROCESSED
-**;** +
-==== Example: Perpendicular distance - LANDMARK to VECTOR ====+</code>
  
-Compute the perpendicular distance from the Knee joint center +==== Perpendicular distance LANDMARK to VECTOR ==== 
-LANDMARK::ORIGINAL::RT_KNEE +
-To a vector between the Hip Joint Center and Ankle Joint Center +
-LANDMARK::ORIGINAL::RIGHT_HIP +
-LANDMARK::ORIGINAL::RT_ANKLE +
-\\+
  
 +Compute the perpendicular distance from the Knee Joint Center (LANDMARK::ORIGINAL::RT_KNEE) to a vector between the Hip Joint Center (LANDMARK::ORIGINAL::RIGHT_HIP) and Ankle Joint Center (LANDMARK::ORIGINAL::RT_ANKLE)
  
 +<code>
 ! create a unit_vector from the hip joint landmark (RIGHT_HIP) to the ankle joint landmark (RT_ANKLE) ! create a unit_vector from the hip joint landmark (RIGHT_HIP) to the ankle joint landmark (RT_ANKLE)
 Evaluate_Expression Evaluate_Expression
Line 73: Line 81:
 /RESULT_TYPE=DERIVED /RESULT_TYPE=DERIVED
 /RESULT_FOLDER=MIKULICZ /RESULT_FOLDER=MIKULICZ
-**;**+; 
 ! create a vector from the hip joint landmark (RIGHT_HIP) to the knee joint landmark (RT_KNEE) ! create a vector from the hip joint landmark (RIGHT_HIP) to the knee joint landmark (RT_KNEE)
 Evaluate_Expression Evaluate_Expression
Line 80: Line 89:
 /RESULT_TYPE=DERIVED /RESULT_TYPE=DERIVED
 /RESULT_FOLDER=MIKULICZ /RESULT_FOLDER=MIKULICZ
-**;**+; 
 ! compute the perpendicular distance from the RT_KNEE to the vector from the HIP to the ANKLE ! compute the perpendicular distance from the RT_KNEE to the vector from the HIP to the ANKLE
 Evaluate_Expression Evaluate_Expression
Line 87: Line 97:
 /RESULT_TYPE=DERIVED /RESULT_TYPE=DERIVED
 /RESULT_FOLDER=MIKULICZ /RESULT_FOLDER=MIKULICZ
-**;** +; 
-==== Example: Get the actual start time of the C3D file ====+</code> 
 + 
 +==== Get the actual start time of the C3D file ==== 
  
 Visual3D always treats the first frame of data in the C3D file as Frame 1. If the original c3d file was truncated, so that the first frame is not 1, Visual3D retains that information and stores it in the Visual3D Parameter Group. If a user wants to compute the actual start time for the file, the following command can be used. Visual3D always treats the first frame of data in the C3D file as Frame 1. If the original c3d file was truncated, so that the first frame is not 1, Visual3D retains that information and stores it in the Visual3D Parameter Group. If a user wants to compute the actual start time for the file, the following command can be used.
  
-**Evaluate_Expression**+<code> 
 +Evaluate_Expression
 /EXPRESSION=(PARAMETER::VISUAL3D::ORIGINAL_FIRST_FRAME-1)/PARAMETER::POINT::RATE /EXPRESSION=(PARAMETER::VISUAL3D::ORIGINAL_FIRST_FRAME-1)/PARAMETER::POINT::RATE
 /RESULT_NAME=START_TIME /RESULT_NAME=START_TIME
 /RESULT_TYPE=METRIC /RESULT_TYPE=METRIC
 /RESULT_FOLDER=PROCESSED /RESULT_FOLDER=PROCESSED
-**;** +
-==== Example: Copying a signal ====+</code>
  
-**Evaluate_Expression**+==== Copying a signal ====  
 + 
 +<code> 
 +Evaluate_Expression
 /Expression= ANALOG::ORIGINAL::EMG1 /Expression= ANALOG::ORIGINAL::EMG1
 /Result_Name=EMG1_COPY /Result_Name=EMG1_COPY
 /Result_Type=ANALOG /Result_Type=ANALOG
 /Result_Folder=PROCESSED /Result_Folder=PROCESSED
-**;** +; 
-Note that the Result_Folder cannot be ORIGINAL because we frown on artificially labelling a signal as ORIGINAL. If ORIGINAL is specified, the data is automatically stored in the PROCESSED folder+</code> 
 + 
 +**Note:** The Result_Folder cannot be ORIGINAL because we frown on artificially labelling a signal as ORIGINAL. If ORIGINAL is specified, the data is automatically stored in the PROCESSED folder
  
-==== Example: Copy a signal to the Global Workspace ====+==== Copy a signal to the Global Workspace ==== 
  
 In order to pass data between files, it is necessary to use the [[Visual3D:Documentation:Definitions:Global_Workspace|Global Workspace]] which is common to all files in the Workspace. In order to pass data between files, it is necessary to use the [[Visual3D:Documentation:Definitions:Global_Workspace|Global Workspace]] which is common to all files in the Workspace.
  
-**Evaluate_Expression**+<code> 
 +Evaluate_Expression
 /EXPRESSION=METRIC::ORIGINAL::RTH1_MEAN /EXPRESSION=METRIC::ORIGINAL::RTH1_MEAN
 /RESULT_NAME=GLOBAL::RTH1_MEAN /RESULT_NAME=GLOBAL::RTH1_MEAN
 /RESULT_TYPE=METRIC /RESULT_TYPE=METRIC
 /RESULT_FOLDER=PROCESSED /RESULT_FOLDER=PROCESSED
-**;** +
-==== Example: Copy a signal to a different signal type ====+</code>
  
-**Evaluate_Expression**+==== Copy a signal to a different signal type ====  
 + 
 +<code> 
 +Evaluate_Expression
 /Expression= ANALOG::ORIGINAL::EMG1 /Expression= ANALOG::ORIGINAL::EMG1
 /Result_Name=EMG1_COPY /Result_Name=EMG1_COPY
 /Result_Type=DERIVED /Result_Type=DERIVED
 /Result_Folder=PROCESSED /Result_Folder=PROCESSED
-**;** +
-Note: the PROCESSED signal is at the sampling rate of the Analog signal.+</code>
  
-==== ExampleSubtracting Two Metrics ====+**Note:** The PROCESSED signal is at the sampling rate of the Analog signal.
  
-Subtract two metric signals.+==== Subtracting Two Metrics ==== 
  
-**Evaluate_Expression**+Subtract two metric values. 
 + 
 +<code> 
 +Evaluate_Expression
 /EXPRESSION=METRIC::PROCESSED::EMG1_MAX - METRIC::PROCESSED::EMG1_MIN /EXPRESSION=METRIC::PROCESSED::EMG1_MAX - METRIC::PROCESSED::EMG1_MIN
 /RESULT_NAME=EMG1_RANGE /RESULT_NAME=EMG1_RANGE
 /RESULT_TYPE=METRIC /RESULT_TYPE=METRIC
 /RESULT_FOLDER=PROCESSED /RESULT_FOLDER=PROCESSED
-**;** +
-==== Example: Subtract Global Mean Value from Signal ====+</code>
  
-The evaluate_expression command can be used to subtract a global mean value from a signal. In this example, an offset (mean value of the signal) is found for two analog signals from one trial and the offset value is subtracted from the same two analog signals found in other trials.+=== Subtract Global Mean Value from Signal === 
 + 
 +The Evaluate_Expression command can be used to subtract a global mean value from a signal. In this example, an offset (mean value of the signal) is found for two analog signals from one trial and the offset value is subtracted from the same two analog signals found in other trials.
  
 <code> <code>
Line 146: Line 173:
 ! Select a specific trial and compute mean values ! Select a specific trial and compute mean values
 ! ----------------------------------------------- ! -----------------------------------------------
-</code> 
  
-<code> 
 ! Select OFFSET_TRIAL as active file ! Select OFFSET_TRIAL as active file
 Select_Active_File Select_Active_File
Line 198: Line 223:
 </code> </code>
  
-==== Example: Create a vector ====+==== Create a vector ==== 
  
-**Evaluate_Expression**+<code> 
 +Evaluate_Expression
 /EXPRESSION=vector(0.4, 1.2) /EXPRESSION=vector(0.4, 1.2)
 /RESULT_NAME=VECTOR /RESULT_NAME=VECTOR
 /RESULT_TYPE=DERIVED /RESULT_TYPE=DERIVED
 /RESULT_FOLDER=PROCESSED /RESULT_FOLDER=PROCESSED
-**;** +
-**Evaluate_Expression**+ 
 +Evaluate_Expression
 /EXPRESSION=vector(target::processed::rft1::x, target::processed::lft1::y, target::processed::rpv4::z) /EXPRESSION=vector(target::processed::rft1::x, target::processed::lft1::y, target::processed::rpv4::z)
 /RESULT_NAME=VECTOR /RESULT_NAME=VECTOR
 /RESULT_TYPE=DERIVED /RESULT_TYPE=DERIVED
 /RESULT_FOLDER=PROCESSED /RESULT_FOLDER=PROCESSED
-**;** +
-==== Example: Set 2 components of a vector to zero ====+</code>
  
-set the x and z components of a vector to zero+==== Set 2 components of a vector to zero ==== 
  
-**Evaluate_Expression**+Set the x and z components of a vector to zero 
 + 
 +<code> 
 +Evaluate_Expression
 /EXPRESSION=vector(0*target::processed::rft1::x, target::processed::rft1::y, 0*target::processed::rft1::z) /EXPRESSION=vector(0*target::processed::rft1::x, target::processed::rft1::y, 0*target::processed::rft1::z)
 /RESULT_NAME=Y_VEC /RESULT_NAME=Y_VEC
 /RESULT_TYPE=DERIVED /RESULT_TYPE=DERIVED
 /RESULT_FOLDER=PROCESSED /RESULT_FOLDER=PROCESSED
-**;** +
-==== Example: Compute the magnitude of a vector ====+</code>
  
-**Evaluate_Expression**+==== Compute the magnitude of a vector ====  
 + 
 +<code> 
 +Evaluate_Expression
 /EXPRESSION=length(FORCE::ORIGINAL::FP1) /EXPRESSION=length(FORCE::ORIGINAL::FP1)
 /RESULT_NAME=VECTOR /RESULT_NAME=VECTOR
 /RESULT_TYPE=DERIVED /RESULT_TYPE=DERIVED
 /RESULT_FOLDER=PROCESSED /RESULT_FOLDER=PROCESSED
-**;** +
-==== Example: Create a 2x2 matrix ====+</code>
  
-**Evaluate_Expression**+==== Compute the maximum value of the speed of the COG ==== 
 + 
 +Compute the maximum value of the speed of the Center of Mass of the model between two events 
 + 
 +<code> 
 +Evaluate_Expression 
 +/EXPRESSION=Metric_Maximum(Length(LINK_MODEL_BASED::ORIGINAL::CogVelocity), EVENT_LABEL::ORIGINAL::START,EVENT_LABEL::ORIGINAL::END) 
 +/SIGNAL_TYPES= 
 +! /SIGNAL_FOLDER= 
 +/SIGNAL_NAMES= 
 +/SIGNAL_COMPONENTS=X 
 + /RESULT_TYPES=METRIC 
 + /RESULT_FOLDERS=FROM_SCOTT 
 + /RESULT_NAME=CogVelocityMax 
 +! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE 
 +
 +</code> 
 +==== Create a 2x2 matrix ====  
 + 
 +<code> 
 +Evaluate_Expression
 /EXPRESSION=vector(list(11,21),list(12,22)) /EXPRESSION=vector(list(11,21),list(12,22))
 /RESULT_NAME=2x2 /RESULT_NAME=2x2
 /RESULT_TYPE=DERIVED /RESULT_TYPE=DERIVED
 /RESULT_FOLDER=PROCESSED /RESULT_FOLDER=PROCESSED
-**;**+; 
 +</code> 
 The output of this command will be: The output of this command will be:
  
-<code> +^Frame   ^X           ^      ^ 
-Frame             Y +|1       |11.0000     |12.0000 | 
-1       11.0000     12.0000 +|2       |21.0000     |22.0000 |
-2       21.0000     22.0000 +
-</code>+
  
-==== Example: Create a 1 Hz Sine wave ====+==== Create a 1 Hz Sine wave ==== 
  
 Create the signal at the POINT rate. Create the signal at the POINT rate.
  
-**Evaluate_Expression**+<code> 
 +Evaluate_Expression
 /EXPRESSION=SIN(2*PI()*FRAME_NUMBERS::ORIGINAL::TIME) /EXPRESSION=SIN(2*PI()*FRAME_NUMBERS::ORIGINAL::TIME)
 /RESULT_NAME=SIN_WAVE /RESULT_NAME=SIN_WAVE
 /RESULT_TYPE=DERIVED /RESULT_TYPE=DERIVED
 /RESULT_FOLDER=PROCESSED /RESULT_FOLDER=PROCESSED
-**;**+; 
 +</code> 
 + 
 Create the signal at the ANALOG rate. Create the signal at the ANALOG rate.
  
-**Evaluate_Expression**+<code> 
 +Evaluate_Expression
 /EXPRESSION=SIN(2*PI()*FRAME_NUMBERS::ORIGINAL::ANALOGTIME) /EXPRESSION=SIN(2*PI()*FRAME_NUMBERS::ORIGINAL::ANALOGTIME)
 /RESULT_NAME=SIN_WAVE /RESULT_NAME=SIN_WAVE
 /RESULT_TYPE=DERIVED /RESULT_TYPE=DERIVED
 /RESULT_FOLDER=PROCESSED /RESULT_FOLDER=PROCESSED
-**;** +
-==== Example: Compute the cross product of two vectors ====+</code>
  
-**Evaluate_Expression**+==== Compute the cross product of two vectors ====  
 + 
 +<code> 
 +Evaluate_Expression
 /EXPRESSION=CROSS(TARGET::PROCESSED::VEC1,TARGET::PROCESSED::VEC) /EXPRESSION=CROSS(TARGET::PROCESSED::VEC1,TARGET::PROCESSED::VEC)
 /RESULT_NAME=ANGLE_RAD /RESULT_NAME=ANGLE_RAD
 /RESULT_TYPE=DERIVED /RESULT_TYPE=DERIVED
 /RESULT_FOLDER=PROCESSED /RESULT_FOLDER=PROCESSED
-**;** +
-\\ +</code>
  
-==== Example: Compute the angle between two unit vectors ====+==== Compute the angle between two unit vectors ==== 
  
-**Evaluate_Expression**+<code> 
 +Evaluate_Expression
 /EXPRESSION=ACOS(DOT(TARGET::PROCESSED::UNIT1,TARGET::PROCESSED::UNIT2)) /EXPRESSION=ACOS(DOT(TARGET::PROCESSED::UNIT1,TARGET::PROCESSED::UNIT2))
 /RESULT_NAME=ANGLE_RAD /RESULT_NAME=ANGLE_RAD
 /RESULT_TYPE=DERIVED /RESULT_TYPE=DERIVED
 /RESULT_FOLDER=PROCESSED /RESULT_FOLDER=PROCESSED
-**;** +
-The resulting values will be expressed in Radians.+</code>
  
-The equivalent command that will have the result expressed in Degrees is:+The resulting values will be expressed in radians.
  
-**Evaluate_Expression**+The equivalent command that will have the result expressed in degrees is: 
 + 
 +<code> 
 +Evaluate_Expression
 /EXPRESSION=ACOS(DOT(TARGET::PROCESSED::UNIT1,TARGET::PROCESSED::UNIT2))*180/PI() /EXPRESSION=ACOS(DOT(TARGET::PROCESSED::UNIT1,TARGET::PROCESSED::UNIT2))*180/PI()
 /RESULT_NAME=ANGLE_DEG /RESULT_NAME=ANGLE_DEG
 /RESULT_TYPE=DERIVED /RESULT_TYPE=DERIVED
 /RESULT_FOLDER=PROCESSED /RESULT_FOLDER=PROCESSED
-**;** +
-==== Example Integrate a Signal between Events ====+</code>
  
-Integrate a force signal (FORCE::ORIGINAL::FP1) between event labels (START & END) with an initial value of zero+==== Integrate a signal between events ==== 
  
-**Evaluate_Expression**+Integrate signal FORCE::ORIGINAL::FP1 between event labels START & END with an initial value of zero 
 + 
 +<code> 
 +Evaluate_Expression
 /EXPRESSION= Integrate(FORCE::ORIGINAL::FP1,VECTOR(0,0,0),EVENT_LABEL::ORIGINAL::START,EVENT_LABEL::ORIGINAL::END) /EXPRESSION= Integrate(FORCE::ORIGINAL::FP1,VECTOR(0,0,0),EVENT_LABEL::ORIGINAL::START,EVENT_LABEL::ORIGINAL::END)
 /RESULT_NAME=IMPULSE /RESULT_NAME=IMPULSE
 /RESULT_TYPE=DERIVED /RESULT_TYPE=DERIVED
 /RESULT_FOLDER=PROCESSED /RESULT_FOLDER=PROCESSED
-**;** +
-==== Example: Create a binary signal ====+</code>
  
-Based on threshold signal, make the new signal 1 when the value is greater than a threshold and 0 otherwise.+==== Create binary signal ==== 
  
-**Evaluate_Expression**+Based on a threshold signal, make the newly created signal contain the value 1 when the original signal's value is greater than a threshold and 0 otherwise. 
 + 
 +<code> 
 +Evaluate_Expression
 /EXPRESSION= ANALOG::ORIGINAL::CHANNEL1 > 1 /EXPRESSION= ANALOG::ORIGINAL::CHANNEL1 > 1
 /RESULT_NAME=CHANNEL1_BINARY /RESULT_NAME=CHANNEL1_BINARY
 /RESULT_TYPE=DERIVED /RESULT_TYPE=DERIVED
 /RESULT_FOLDER=PROCESSED /RESULT_FOLDER=PROCESSED
-**;** +
-\\+</code>
  
 +==== Test whether Signal 1 greater than Signal 2 ==== 
  
-==== ExampleSignal 1 greater than Signal 2 ====+Given two signals, TARGET::ORIGINAL::RFT1 and TARGET::ORIGINAL::LFT1. Use the Boolean operator > to identify when the Z component of RFT1 is greater than the Z component of LFT1.
  
-Given two signals +<code
-TARGET::ORIGINAL::RFT1 +Evaluate_Expression
-TARGET::ORIGINAL::LFT1 +
-Use the Boolean operator to identify when the Z component of RFT1 is greater than the Z component of LFT1 +
-**Evaluate_Expression**+
 /EXPRESSION= TARGET::ORIGINAL::RFT1::Z > TARGET::ORIGINAL::LFT1::Z /EXPRESSION= TARGET::ORIGINAL::RFT1::Z > TARGET::ORIGINAL::LFT1::Z
 /RESULT_NAME=RFT1_GREATER /RESULT_NAME=RFT1_GREATER
 /RESULT_TYPE=DERIVED /RESULT_TYPE=DERIVED
 /RESULT_FOLDER=PROCESSED /RESULT_FOLDER=PROCESSED
-**;**+; 
 +</code> 
 The output signal will be 1 when RFT1::Z is greater than LFT1::Z and 0 otherwise The output signal will be 1 when RFT1::Z is greater than LFT1::Z and 0 otherwise
-==== Example: Set negative values to zero ==== 
  
-Set all of the negative values of a signal to 0.0.+==== Set negative values to zero ==== 
  
-**Evaluate_Expression**+Set all of the negative values of a signal to 0.0. This expression uses the Boolean operator > to identify when the Y component of FP1 is greater than 0 
 + 
 +<code> 
 +Evaluate_Expression
 /EXPRESSION=(FORCE::ORIGINAL::FP1::Y>0)*FORCE::ORIGINAL::FP1::Y /EXPRESSION=(FORCE::ORIGINAL::FP1::Y>0)*FORCE::ORIGINAL::FP1::Y
 /RESULT_NAME=SCOTT_POS /RESULT_NAME=SCOTT_POS
 /RESULT_TYPE=DERIVED /RESULT_TYPE=DERIVED
 /RESULT_FOLDER=PROCESSED /RESULT_FOLDER=PROCESSED
-**;** +
-This expression uses the Boolean operator to identify when the Y component of FP1 is greater than 0+</code> 
 + 
 Similarly, you can set the positive values to zero Similarly, you can set the positive values to zero
  
-**Evaluate_Expression**+<code> 
 +Evaluate_Expression
 /EXPRESSION=(FORCE::ORIGINAL::FP1::Y<0)*FORCE::ORIGINAL::FP1::Y /EXPRESSION=(FORCE::ORIGINAL::FP1::Y<0)*FORCE::ORIGINAL::FP1::Y
 /RESULT_NAME=SCOTT_NEG /RESULT_NAME=SCOTT_NEG
 /RESULT_TYPE=DERIVED /RESULT_TYPE=DERIVED
 /RESULT_FOLDER=PROCESSED /RESULT_FOLDER=PROCESSED
-**;** +; 
-==== Example: Set negative values to NO_DATA ====+</code> 
 + 
 +==== Set negative values to NO_DATA ==== 
  
 If the z-component of the LELB signal is below 0 set the frame to NO_DATA If the z-component of the LELB signal is below 0 set the frame to NO_DATA
  
-**Evaluate_Expression**+<code> 
 +Evaluate_Expression
 /EXPRESSION=(TARGET::ORIGINAL::LELB::Z>0)/(TARGET::ORIGINAL::LELB::Z>0)*TARGET::ORIGINAL::LELB /EXPRESSION=(TARGET::ORIGINAL::LELB::Z>0)/(TARGET::ORIGINAL::LELB::Z>0)*TARGET::ORIGINAL::LELB
 /RESULT_NAME=LELB /RESULT_NAME=LELB
 /RESULT_TYPE=TARGET /RESULT_TYPE=TARGET
 /RESULT_FOLDER=PROCESSED /RESULT_FOLDER=PROCESSED
-**;** +; 
-==== Example: If one tracking marker is no_data, make all tracking markers no_data ====+</code> 
 + 
 +==== If one tracking marker is no_data, make all tracking markers no_data ==== 
  
 When tracking markers drop out or go missing through out a trial, there is often an artifact in the segment pose. When tracking markers drop out or go missing through out a trial, there is often an artifact in the segment pose.
  
 This artifact is related to two issues: This artifact is related to two issues:
- 
   - The filtered signal isn't very good at the point of dropout   - The filtered signal isn't very good at the point of dropout
   - The best fit to the tracking marker template changes when the template changes.   - The best fit to the tracking marker template changes when the template changes.
  
-The following are different solutions that could be used:\\ +The following are different solutions that could be used:
- +
   - **Solution One:** Remove all signal processing until the very end. In other words filter the LINK_MODEL_BASED signals, but don't filter the TARGET or ANALOG signals. This option is consistent with Ton van den Bogert's recommendation that all signals be filtered with the same filter characteristics (see attached).   - **Solution One:** Remove all signal processing until the very end. In other words filter the LINK_MODEL_BASED signals, but don't filter the TARGET or ANALOG signals. This option is consistent with Ton van den Bogert's recommendation that all signals be filtered with the same filter characteristics (see attached).
   - **Solution Two:** Filter the data, and apply a median filter to the LINK_MODEL_BASED signals. This removes artifacts but we aren't sure if this is appropriate.   - **Solution Two:** Filter the data, and apply a median filter to the LINK_MODEL_BASED signals. This removes artifacts but we aren't sure if this is appropriate.
Line 397: Line 474:
 </code> </code>
  
-==== Example: Conditional Statement ====+==== Conditional Statement ==== 
  
 Implement a conditional expression like the following: Implement a conditional expression like the following:
  
 +<code>
 for i=1:nframe for i=1:nframe
 if y1(i,3)< y1(i,4) if y1(i,3)< y1(i,4)
Line 408: Line 486:
 end end
 end end
 +</code>
 +
 Assume the signal y1 is a target **TARGET::ORIGINAL::RFT1** and the components of interest are **Y** and **Z**. Assume the signal y1 is a target **TARGET::ORIGINAL::RFT1** and the components of interest are **Y** and **Z**.
  
Line 422: Line 502:
 </code> </code>
  
-==== Example: Rank Order a Set of Metrics ====+==== Rank Order a Set of Metrics ==== 
  
 Given a set of metric signals containing one component. Given a set of metric signals containing one component.
 +  *METRIC::GROUP1::TIME
 +  *METRIC::GROUP2::TIME
 +  *METRIC::GROUP3::TIME
 +  *METRIC::GROUP4::TIME
  
-METRIC::GROUP1::TIME 
-METRIC::GROUP2::TIME 
-METRIC::GROUP3::TIME 
-METRIC::GROUP4::TIME 
 The result of the following command will be the RANK of the metric (**METRIC::GROUP1::TIME**) amongst the cohort. The result of the following command will be the RANK of the metric (**METRIC::GROUP1::TIME**) amongst the cohort.
  
-**Evaluate_Expression**+<code> 
 +Evaluate_Expression
 /EXPRESSION= 1 + (METRIC::GROUP1::TIME > METRIC::GROUP2::TIME) + (METRIC::GROUP1::TIME > METRIC::GROUP3::TIME) + (METRIC::GROUP1::TIME > METRIC::GROUP4::TIME) /EXPRESSION= 1 + (METRIC::GROUP1::TIME > METRIC::GROUP2::TIME) + (METRIC::GROUP1::TIME > METRIC::GROUP3::TIME) + (METRIC::GROUP1::TIME > METRIC::GROUP4::TIME)
 /RESULT_NAME=RANK_GROUP1 /RESULT_NAME=RANK_GROUP1
 /RESULT_TYPE=METRIC /RESULT_TYPE=METRIC
 /RESULT_FOLDER=GROUP1 /RESULT_FOLDER=GROUP1
-**;** +; 
-==== Example: Extracting one "component" of data from signal ====+</code> 
 + 
 +==== Example: Extracting one "component" of data from signal ==== 
  
 The following command will result in the DERIVED signal TEST containing the X component values of the TARGET RFT1. The following command will result in the DERIVED signal TEST containing the X component values of the TARGET RFT1.
  
-**Evaluate_Expression**+<code> 
 +Evaluate_Expression
 /EXPRESSION=TARGET::ORIGINAL::RFT1::X /EXPRESSION=TARGET::ORIGINAL::RFT1::X
 /RESULT_NAME=TEST /RESULT_NAME=TEST
 /RESULT_TYPE=DERIVED /RESULT_TYPE=DERIVED
 ! /RESULT_FOLDER=PROCESSED ! /RESULT_FOLDER=PROCESSED
-**;** +; 
-==== Example: Extracting one frame of data from a signal ====+</code> 
 + 
 +==== Extracting one frame of data from a signal ==== 
  
 The following command will result in the METRIC signal TEST containing the values of the TARGET RFT1 from Frame 3. The following command will result in the METRIC signal TEST containing the values of the TARGET RFT1 from Frame 3.
  
-**Evaluate_Expression**+<code> 
 +Evaluate_Expression
 /EXPRESSION=TARGET::ORIGINAL::RFT1[3] /EXPRESSION=TARGET::ORIGINAL::RFT1[3]
 /RESULT_NAME=TEST /RESULT_NAME=TEST
 /RESULT_TYPE=METRIC /RESULT_TYPE=METRIC
 ! /RESULT_FOLDER=PROCESSED ! /RESULT_FOLDER=PROCESSED
-**;** +
-This can be useful in the following situation.+</code>
  
-signal exists that contains the mean and standard deviation of a signal over a gait cycle+This can be useful in the following situation: a signal exists that contains the mean and standard deviation of a signal over a gait cycle (e.g. created using [[Visual3D:Documentation:Pipeline:Signal_Commands:Signal_Management_Commands#Global_Normalized_Signal_Mean|Global_Normalized_Signal_Mean]]; this creates a P2D signal in the Global Workspace). A mean signal is time normalized (by default to 101 frames). If you want one specific value of this signal, you cannot use an Event Label to specify the frame of data because Event Labels have no meaning for a signal that does not have a time base (e.g. a data rate). However, you can take advantage of the fact that you know exactly how many frames of data are in the signal. If you want the value at 25% of the range, you can simply use the following expression:
  
-(e.g. created using [[Visual3D:Documentation:Pipeline:Signal_Commands:Signal_Management_Commands#Global_Normalized_Signal_Mean|Global_Normalized_Signal_Mean]]; this creates a P2D signal in the Global Workspace) +<code> 
- +Evaluate_Expression
-A mean signal is time normalized (by default to 101 frames). If you want one specific value of this signal, you cannot use an Event Label to specify the frame of data because Event Labels have no meaning for a signal that does not have a time base (e.g. a data rate). However, you can take advantage of the fact that you know exactly how many frames of data are in the signal. If you want the value at 25% of the range, you can simply do the following: +
- +
-**Evaluate_Expression**+
 /EXPRESSION=GLOBAL::P2D::ORIGINAL::TESTX[25] /EXPRESSION=GLOBAL::P2D::ORIGINAL::TESTX[25]
 /RESULT_NAME=TEST /RESULT_NAME=TEST
 /RESULT_TYPE=METRIC /RESULT_TYPE=METRIC
 ! /RESULT_FOLDER=PROCESSED ! /RESULT_FOLDER=PROCESSED
-**;** +; 
-==== Example: Value of signal at an analog frame ====+</code> 
 + 
 +==== Value of signal at an analog frame ==== 
  
 Assume that you have an analog signal and the frame that you are looking for is based on a threshold crossing which usually doesn't occur at a point frame rate but occurs at the analog frame rate. Thus, you cannot use events since they are in reference to the point frame rate and not the analog frame rate. Assume that you have an analog signal and the frame that you are looking for is based on a threshold crossing which usually doesn't occur at a point frame rate but occurs at the analog frame rate. Thus, you cannot use events since they are in reference to the point frame rate and not the analog frame rate.
Line 494: Line 580:
 /METRIC_VALUE=-10 /METRIC_VALUE=-10
 ; ;
-</code> 
  
-<code> 
 ! Step 3 is to create a binary signal FZ2_BIN that is based on the analog signal (in this case FZ2). ! Step 3 is to create a binary signal FZ2_BIN that is based on the analog signal (in this case FZ2).
 ! Any analog frame that is greater than the metric value THRESH is set to 1 all other frames are set to 0 ! Any analog frame that is greater than the metric value THRESH is set to 1 all other frames are set to 0
Line 561: Line 645:
 </code> </code>
  
-==== Example: Create a SINE wave ==== +==== Representing the equation R= (Y - M*X - B)^2 ==== 
- +
-The following command creates a sine wave of frequency 1 Hz +
- +
-**Evaluate_Expression** +
-/EXPRESSION=sin(2*[[Visual3D:Documentation:Pipeline:Expressions:Overview#Functions|PI()]]*1*(FRAME_NUMBERS::ORIGINAL::TIME-1)) +
-/RESULT_NAME=SIN1 +
-/RESULT_TYPE=DERIVED +
-/RESULT_FOLDER=SINEWAVES +
-**;** +
-This command takes advantage of the FRAME_NUMBERS data type, which stores FRAMES and TIME. +
- +
-This data type is hidden in all versions of Visual3D prior to version 4.1 +
- +
-If the frequency was stored as a METRIC signal (e.g. METRIC::PROCESSED::FREQ), you could use the following: +
- +
-**Evaluate_Expression** +
-/EXPRESSION=sin(2*[[Visual3D:Documentation:Pipeline:Expressions:Overview#Functions|PI()]]*METRIC::PROCESSED::FREQ*(FRAME_NUMBERS::ORIGINAL::TIME-1)) +
-/RESULT_NAME=SIN1 +
-/RESULT_TYPE=DERIVED +
-/RESULT_FOLDER=SINEWAVES +
-**;** +
-==== Representing the equation R= (Y - M*X - B)^2 ====+
  
 Consider a DERIVED signal named TEST that is stored in the processed folder and has 2 or more component (X, Y, ....). Consider a DERIVED signal named TEST that is stored in the processed folder and has 2 or more component (X, Y, ....).
 +  *X => DERIVED::PROCESSED::TEST::X
 +  *Y => DERIVED::PROCESSED::TEST::Y
  
-X => DERIVED::PROCESSED::TEST::X 
-Y => DERIVED::PROCESSED::TEST::Y 
-\\ 
 Consider M and B to be two Metric signals with one component Consider M and B to be two Metric signals with one component
 +  *M => METRIC::PROCESSED::M
 +  *B => METRIC::PROCESSED::B
  
-M => METRIC::PROCESSED::M 
-B => METRIC::PROCESSED::B 
-\\ 
 The expression is represented as: The expression is represented as:
  
-**Evaluate_Expression**+<code> 
 +Evaluate_Expression
 /EXPRESSION=(DERIVED::PROCESSED::TEST::Y-METRIC::PROCESSED::M*DERIVED::PROCESSED::TEST::X-METRIC::PROCESSED::B)^2 /EXPRESSION=(DERIVED::PROCESSED::TEST::Y-METRIC::PROCESSED::M*DERIVED::PROCESSED::TEST::X-METRIC::PROCESSED::B)^2
 /RESULT_NAME=RESULT /RESULT_NAME=RESULT
 /RESULT_TYPE=DERIVED /RESULT_TYPE=DERIVED
 /RESULT_FOLDER=PROCESSED /RESULT_FOLDER=PROCESSED
-**;**+; 
 +</code> 
 The resulting signal is named RESULT and stored in the PROCESSED folder The resulting signal is named RESULT and stored in the PROCESSED folder
  
-==== Example: Comparing a model metric with a string ====+==== Comparing a model metric with a string ==== 
  
 Consider a model metric that is defined as a string. Consider a model metric that is defined as a string.
  
-**Set_Model_Metric**+<code> 
 +Set_Model_Metric
 ! /CALIBRATION_FILE= ! /CALIBRATION_FILE=
 /METRIC_NAME=TEST /METRIC_NAME=TEST
 /METRIC_VALUE="TTT" /METRIC_VALUE="TTT"
-**;**+; 
 +</code> 
 Now compare it to the text string "TTT" Now compare it to the text string "TTT"
  
-**Evaluate_Expression**+<code> 
 +Evaluate_Expression
 /EXPRESSION=MODEL::METRIC::TEST="TTT" /EXPRESSION=MODEL::METRIC::TEST="TTT"
 /RESULT_NAME=SCOTT /RESULT_NAME=SCOTT
 /RESULT_TYPE=METRIC /RESULT_TYPE=METRIC
 ! /RESULT_FOLDER=PROCESSED ! /RESULT_FOLDER=PROCESSED
-**;**+; 
 +</code> 
 The text strings should be equal so the resulting signal contains a 1 The text strings should be equal so the resulting signal contains a 1
  
-==== Example: Exporting a model metric ====+==== Exporting a model metric ==== 
  
 Model metrics cannot be exported directly. You can, however, copy the model metric to a regular metric signal that can be exported. It is probably safest to create the new metric signal as a global metric because it isn't associated with any particular movement trial. For example the commands below will export the length of the right thigh segment. Model metrics cannot be exported directly. You can, however, copy the model metric to a regular metric signal that can be exported. It is probably safest to create the new metric signal as a global metric because it isn't associated with any particular movement trial. For example the commands below will export the length of the right thigh segment.
Line 652: Line 721:
 </code> </code>
  
-==== Example Store a Model Metric in the Data Tree ====+==== Store a Model Metric in the Data Tree ==== 
  
 Model metrics are stored with the model, but the data can be moved to each C3D file (stored in the data tree). This example will multiply the model metrics for mass and height to use for normalizing a signal. The resulting metric is called MASS_X_HEIGHT and will be stored in the METRIC::MODEL folder Model metrics are stored with the model, but the data can be moved to each C3D file (stored in the data tree). This example will multiply the model metrics for mass and height to use for normalizing a signal. The resulting metric is called MASS_X_HEIGHT and will be stored in the METRIC::MODEL folder
Line 665: Line 734:
 </code> </code>
  
-==== Example: Quasi Case Statement ====+==== Quasi Case Statement ==== 
  
 Given a group of unilaterally affected subjects. The Left side calculations could be the "affected” side and the right side could be the "normal” side, but for other subjects the opposite would be true. The data should be collected as "affected" or "normal" rather than "left" or "right" export them as a group. Given a group of unilaterally affected subjects. The Left side calculations could be the "affected” side and the right side could be the "normal” side, but for other subjects the opposite would be true. The data should be collected as "affected" or "normal" rather than "left" or "right" export them as a group.
Line 673: Line 742:
 <code> <code>
 ! Define Side Parameters ! Define Side Parameters
-</code> 
  
-<code> 
 Set_Pipeline_Parameter Set_Pipeline_Parameter
 /PARAMETER_NAME=SIDE_LETTER /PARAMETER_NAME=SIDE_LETTER
Line 734: Line 801:
 </code> </code>
  
-==== Example: At Event ====+==== Get Time At Event ==== 
  
 Get the event times for the label **ONSET** and place them in the metric folder Get the event times for the label **ONSET** and place them in the metric folder
Line 746: Line 813:
 ; ;
 </code> </code>
- 
- 
  
  
  
visual3d/documentation/pipeline/expressions/examples.1718648325.txt.gz · Last modified: 2024/06/17 18:18 by sgranger