Mathematical Operators: Difference between revisions

From Software Product Documentation
Jump to navigation Jump to search
 
(19 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Plus==
NOTE: Pipeline command parameters use + as delimiter
If the user wants to use an expression containing a + in a command parameter that allows multiple signals, Visual3D will likely interpret this plus sign incorrectly.
The workaround is to use a mathematical function add() to express the addition.
:'''add(a,b)''' -- adds two expressions.
==Minus==
==Multiply==
==Divide==
==Power==
==Logical_Or==
: Logical Or
==Logical_And==
: Logical And
==Equals==
:'''= or ==''' - Boolean Operator ''equals''
Example: Comparing a model metric with a string
:Consider a model metric that is defined as a string.
::'''Set_Model_Metric'''
::! /CALIBRATION_FILE=
::/METRIC_NAME=TEST
::/METRIC_VALUE="TTT"
::''';'''
:Now compare it to the text string "TTT"
::'''Evaluate_Expression'''
::/EXPRESSION=MODEL::METRIC::TEST="TTT"
::/RESULT_NAME=SCOTT
::/RESULT_TYPE=METRIC
::! /RESULT_FOLDER=PROCESSED
:''';'''
:The text strings should be equal so the resulting signal contains a 1
==Not_Equals==
:'''<> or ><''' - Boolean Operator "Not Equals"
==Using the Adjective NOT==
==Using the Adjective NOT==


Line 22: Line 69:
This command results in *trial2.c3d and *trial3.c3d being active.
This command results in *trial2.c3d and *trial3.c3d being active.


==equals==
==Less_Than==
'''=''' Boolean Operator ''equals''


Example: Comparing a model metric with a string
'''<''' Boolean Operator ''less than''
 
'''Example'''
:Given two signals
 
::TARGET::ORIGINAL::RFT1
::TARGET::ORIGINAL::LFT1
 
:Use the Boolean operator < to identify when the Z component of RFT1 is less than the Z component of LFT1
 
::'''Evaluate_Expression'''
::/EXPRESSION= TARGET::ORIGINAL::RFT1::Z < TARGET::ORIGINAL::LFT1::Z
::/RESULT_NAME=RFT1_GREATER
::/RESULT_TYPE=DERIVED
::/RESULT_FOLDER=PROCESSED
::''';'''
 
:The output signal will be 1 when RFT1::Z is less than LFT1::Z and 0 otherwise
 
'''Example - Foot Clearance'''
 
:Given the following situation. Heel and Toe clearance are defined by two paths.
:One might consider Foot clearance to be the lower value of the heel and toe clearance values at each frame.
:[[File:heel_toe_clearance.jpg]]
 
:Here is a simplified test of this
 
:Make the Global Workspace Active.
:Create 2 signals as follows
 
:'''Evaluate_Expression'''
:/EXPRESSION=LIST(1,2,3,4,5)
:! /SIGNAL_TYPES=
:! /SIGNAL_FOLDER=ORIGINAL
:! /SIGNAL_NAMES=
:! /SIGNAL_COMPONENTS=
: /RESULT_TYPES=DERIVED
: /RESULT_FOLDERS=PROCESSED
: /RESULT_NAME=SIGNAL1
:! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
:''';'''
 
:'''Evaluate_Expression'''
:/EXPRESSION=LIST(5,4,3,2,1)
:! /SIGNAL_TYPES=
:! /SIGNAL_FOLDER=ORIGINAL
:! /SIGNAL_NAMES=
:! /SIGNAL_COMPONENTS=
: /RESULT_TYPES=DERIVED
: /RESULT_FOLDERS=PROCESSED
: /RESULT_NAME=SIGNAL2
:! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
:''';'''
 
!create a new signal that is the lower value of the two signals
:'''Evaluate_Expression'''
:/EXPRESSION=(DERIVED::PROCESSED::SIGNAL1<=DERIVED::PROCESSED::SIGNAL2)*DERIVED::PROCESSED::SIGNAL1
:::+(DERIVED::PROCESSED::SIGNAL2<DERIVED::PROCESSED::SIGNAL1)*DERIVED::PROCESSED::SIGNAL2
:! /SIGNAL_TYPES=
:! /SIGNAL_FOLDER=ORIGINAL
:! /SIGNAL_NAMES=
:! /SIGNAL_COMPONENTS=
: /RESULT_TYPES=DERIVED
: /RESULT_FOLDERS=PROCESSED
: /RESULT_NAME=SIGNAL_LOWER
:! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
:''';'''
 
:[[File:heel_toe_clearance2.jpg|400px|Caption]]
 
==Less_Than_Or_Equals==
! style="text-align:left;" | &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'''<=''' or '''=<''' Boolean Operator ''less than or equal to''
 
Example:
:Given two signals
 
::TARGET::ORIGINAL::RFT1
::TARGET::ORIGINAL::LFT1


:Consider a model metric that is defined as a string.
:Use the Boolean operator <= or the boolean operative =< to identify when the Z component of RFT1 is less than or equal to the Z component of LFT1


::'''Set_Model_Metric'''
::'''Evaluate_Expression'''
::! /CALIBRATION_FILE=
::/EXPRESSION= TARGET::ORIGINAL::RFT1::Z <= TARGET::ORIGINAL::LFT1::Z
::/METRIC_NAME=TEST
::/RESULT_NAME=RFT1_GREATER
::/METRIC_VALUE="TTT"
::/RESULT_TYPE=DERIVED
::/RESULT_FOLDER=PROCESSED
::''';'''
::''';'''


:Now compare it to the text string "TTT"
:The output signal will be 1 when RFT1::Z is less than or equal toLFT1::Z and 0 otherwise
 
==Greater_Than==
'''>''' Boolean Operator ''greater than''
 
Example:
:Given two signals
 
::TARGET::ORIGINAL::RFT1
::TARGET::ORIGINAL::LFT1
 
:Use the Boolean operator > to identify when the Y component of RFT1 is greater than the Y component of LFT1


::'''Evaluate_Expression'''
::'''Evaluate_Expression'''
::/EXPRESSION=MODEL::METRIC::TEST="TTT"
::/EXPRESSION= TARGET::ORIGINAL::RFT1::Y > TARGET::ORIGINAL::LFT1::Y
::/RESULT_NAME=SCOTT
::/RESULT_NAME=RFT1_GREATER
::/RESULT_TYPE=METRIC
::/RESULT_TYPE=DERIVED
::! /RESULT_FOLDER=PROCESSED
::/RESULT_FOLDER=PROCESSED
:''';'''
::''';'''
 
:The output signal will be 1 when RFT1::Y is greater than LFT1::Y and 0 otherwise


:The text strings should be equal so the resulting signal contains a 1
==Greater_Than_Or_Equals==
'''>=''' Boolean Operator ''greater than or equals''

Latest revision as of 16:04, 5 January 2024

Plus

NOTE: Pipeline command parameters use + as delimiter

If the user wants to use an expression containing a + in a command parameter that allows multiple signals, Visual3D will likely interpret this plus sign incorrectly.

The workaround is to use a mathematical function add() to express the addition.

add(a,b) -- adds two expressions.

Minus

Multiply

Divide

Power

Logical_Or

Logical Or

Logical_And

Logical And

Equals

= or == - Boolean Operator equals

Example: Comparing a model metric with a string

Consider a model metric that is defined as a string.
Set_Model_Metric
! /CALIBRATION_FILE=
/METRIC_NAME=TEST
/METRIC_VALUE="TTT"
;
Now compare it to the text string "TTT"
Evaluate_Expression
/EXPRESSION=MODEL::METRIC::TEST="TTT"
/RESULT_NAME=SCOTT
/RESULT_TYPE=METRIC
! /RESULT_FOLDER=PROCESSED
;
The text strings should be equal so the resulting signal contains a 1

Not_Equals

<> or >< - Boolean Operator "Not Equals"

Using the Adjective NOT

NOT can be used with the logical AND and logical OR

Example: Given a workspace containing 3 trials (*trial1.c3d, *trial2.c3d, and *trial3.c3d)

All trials are assigned a TAG labeled WALK

  • trial1.c3d is also assigned a TAG labeled BAD
Select_Active_File
/FILE_NAME=WALK
/QUERY=BAD
;

This command results in *trial1.c3d being active

Select_Active_File
/FILE_NAME=WALK
/QUERY=NOT(BAD)
;

This command results in *trial2.c3d and *trial3.c3d being active.

Less_Than

< Boolean Operator less than

Example

Given two signals
TARGET::ORIGINAL::RFT1
TARGET::ORIGINAL::LFT1
Use the Boolean operator < to identify when the Z component of RFT1 is less than the Z component of LFT1
Evaluate_Expression
/EXPRESSION= TARGET::ORIGINAL::RFT1::Z < TARGET::ORIGINAL::LFT1::Z
/RESULT_NAME=RFT1_GREATER
/RESULT_TYPE=DERIVED
/RESULT_FOLDER=PROCESSED
;
The output signal will be 1 when RFT1::Z is less than LFT1::Z and 0 otherwise

Example - Foot Clearance

Given the following situation. Heel and Toe clearance are defined by two paths.
One might consider Foot clearance to be the lower value of the heel and toe clearance values at each frame.
Here is a simplified test of this
Make the Global Workspace Active.
Create 2 signals as follows
Evaluate_Expression
/EXPRESSION=LIST(1,2,3,4,5)
! /SIGNAL_TYPES=
! /SIGNAL_FOLDER=ORIGINAL
! /SIGNAL_NAMES=
! /SIGNAL_COMPONENTS=
/RESULT_TYPES=DERIVED
/RESULT_FOLDERS=PROCESSED
/RESULT_NAME=SIGNAL1
! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
;
Evaluate_Expression
/EXPRESSION=LIST(5,4,3,2,1)
! /SIGNAL_TYPES=
! /SIGNAL_FOLDER=ORIGINAL
! /SIGNAL_NAMES=
! /SIGNAL_COMPONENTS=
/RESULT_TYPES=DERIVED
/RESULT_FOLDERS=PROCESSED
/RESULT_NAME=SIGNAL2
! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
;

!create a new signal that is the lower value of the two signals

Evaluate_Expression
/EXPRESSION=(DERIVED::PROCESSED::SIGNAL1<=DERIVED::PROCESSED::SIGNAL2)*DERIVED::PROCESSED::SIGNAL1
+(DERIVED::PROCESSED::SIGNAL2<DERIVED::PROCESSED::SIGNAL1)*DERIVED::PROCESSED::SIGNAL2
! /SIGNAL_TYPES=
! /SIGNAL_FOLDER=ORIGINAL
! /SIGNAL_NAMES=
! /SIGNAL_COMPONENTS=
/RESULT_TYPES=DERIVED
/RESULT_FOLDERS=PROCESSED
/RESULT_NAME=SIGNAL_LOWER
! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
;
Caption

Less_Than_Or_Equals

! style="text-align:left;" |      <= or =< Boolean Operator less than or equal to

Example:

Given two signals
TARGET::ORIGINAL::RFT1
TARGET::ORIGINAL::LFT1
Use the Boolean operator <= or the boolean operative =< to identify when the Z component of RFT1 is less than or equal to the Z component of LFT1
Evaluate_Expression
/EXPRESSION= TARGET::ORIGINAL::RFT1::Z <= TARGET::ORIGINAL::LFT1::Z
/RESULT_NAME=RFT1_GREATER
/RESULT_TYPE=DERIVED
/RESULT_FOLDER=PROCESSED
;
The output signal will be 1 when RFT1::Z is less than or equal toLFT1::Z and 0 otherwise

Greater_Than

> Boolean Operator greater than

Example:

Given two signals
TARGET::ORIGINAL::RFT1
TARGET::ORIGINAL::LFT1
Use the Boolean operator > to identify when the Y component of RFT1 is greater than the Y component of LFT1
Evaluate_Expression
/EXPRESSION= TARGET::ORIGINAL::RFT1::Y > TARGET::ORIGINAL::LFT1::Y
/RESULT_NAME=RFT1_GREATER
/RESULT_TYPE=DERIVED
/RESULT_FOLDER=PROCESSED
;
The output signal will be 1 when RFT1::Y is greater than LFT1::Y and 0 otherwise

Greater_Than_Or_Equals

>= Boolean Operator greater than or equals

Retrieved from ""