====== Expression Numbers ======
There is current a single "numbers"-related expression function.
===== Random =====
rand(lo_value,hi_value,signal) - random number in the range (lo_value,hi_value)
==== Example: Generate a random number in the range 0 to 1 ====
Set_Pipeline_Parameter_From_Expression
/PARAMETER_NAME=TEST1
/EXPRESSION=RAND()
/AS_INTEGER=FALSE
;
TEST1 = 0.220525
The default range for the random number is from 0 to 1.
==== Example: Generate a random number within a range ====
Set_Pipeline_Parameter_From_Expression
/PARAMETER_NAME=TEST2
/EXPRESSION=RAND(2,3)
/AS_INTEGER=FALSE
;
TEST2 = 2.232995
The output value occurs in the range from lo_value to hi_value.
==== Example: Generate a random number in a range to match a signal ====
Set_Pipeline_Parameter_From_Expression
/PARAMETER_NAME=TEST3
/EXPRESSION=RAND(2,3,FRAME_NUMBERS::ORIGINAL::FRAMES)
/AS_INTEGER=FALSE
;
::TEST3 = 2.808424+2.582592+2.346721+2.697052+2.662510+2.861250+2.843808+...(to number of frames)
Using all three arguments will produce a random number in the range from lo_value to hi_value with the same number of components and frames as the argument signal.
==== Example: Generate a specific number of random values ====
Set_Pipeline_Parameter_From_Expression
/PARAMETER_NAME=TEST4
/EXPRESSION=RAND(2,3,3)
/AS_INTEGER=FALSE
;
::TEST4 = 2.446495 + 2.718410 + 2.201863
If the signal argument is a number, then that number of random values from the range lo_value to hi_value are returned.
==== Example: Create a TARGET with random values between 0 and 1 ====
Create_Target
/SIGNAL_NAMES=TEST5
! /SIGNAL_DESCRIPTION=
/EXPRESSION=RAND(0,1,TARGET::ORIGINAL::LFT1)
! /INCLUDE_CALFILE=FALSE
;
View the resulting signal in the 3D viewer by turning on the target trail:
{{:random_target.jpg}}
==== Example: create a TARGET with random values between 0 and 1 ====
Create_Target
/SIGNAL_NAMES=TEST6
! /SIGNAL_DESCRIPTION=
/EXPRESSION=VECTOR(RAND(0,1,FRAME_NUMBERS::ORIGINAL::FRAMES),RAND(0,1,FRAME_NUMBERS::ORIGINAL::FRAMES),RAND(0,1,FRAME_NUMBERS::ORIGINAL::FRAMES))
! /INCLUDE_CALFILE=FALSE
;
Note that all components contain different values
{{:Random7.jpg}} {{:random7view.jpg}}
==== Example: Create a TARGET where each frame is on a random location on the surface of a sphere of radius 1 ====
Evaluate_Expression
/EXPRESSION=RAND(-PI(),PI(),FRAME_NUMBERS::ORIGINAL::FRAMES)
/RESULT_TYPES=DERIVED
/RESULT_FOLDERS=RADIUS
/RESULT_NAME=VERTICAL
! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
;
Evaluate_Expression
/EXPRESSION=RAND(0,2*PI(),FRAME_NUMBERS::ORIGINAL::FRAMES)
/RESULT_TYPES=DERIVED
/RESULT_FOLDERS=RADIUS
/RESULT_NAME=HORIZONTAL
! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
;
Create_Target
/SIGNAL_NAMES=SPHERE
! /SIGNAL_DESCRIPTION=
/EXPRESSION=VECTOR(
COS(DERIVED::RADIUS::VERTICAL)*COS(DERIVED::RADIUS::HORIZONTAL),
-COS(DERIVED::RADIUS::VERTICAL)*SIN(DERIVED::RADIUS::HORIZONTAL),
SIN(DERIVED::RADIUS::VERTICAL))
! /INCLUDE_CALFILE=FALSE
;
{{:random8view.jpg}}