User Tools

Site Tools


visual3d:documentation:pipeline:expressions:least_squares_fitting_of_data

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:least_squares_fitting_of_data [2024/06/18 13:30] sgrangervisual3d:documentation:pipeline:expressions:least_squares_fitting_of_data [2025/01/24 18:53] (current) – [Best Fit Plane] wikisysop
Line 1: Line 1:
-This page contains a list of all functions that are used to find a line or plane of best fit to your data.+===== Least Squares Fitting of Data =====
  
-===== Best Fit Plane =====+This page contains a list of all of [[visual3d:documentation:pipeline:expressions:expressions_overview|Evaluate_Expression]]'s functions that are used to find a line or plane of best fit to your data.
  
-**Best_Fit_Plane**(signal, start_event_signal, end_event_signal) - Find a plane that fits the path of a point from a start event to an end event.+==== Best Fit Plane ====
  
-[[[https://en.wikipedia.org/wiki/Plane_%28geometry%29#Point-normal_form_and_general_form_of_the_equation_of_a_plane|The resulting plane is defined by 4 components]]] +**Best_Fit_Plane**(signal, start_event_signal, end_event_signal) - Finds a plane that fits the path of a point from a start event to an end event. [[https://en.wikipedia.org/wiki/Plane_%28geometry%29#Point-normal_form_and_general_form_of_the_equation_of_a_plane|The resulting plane is defined by 4 components]]
-Example: Compute a Best_Plane_Fit for one signal across a range of frames + 
-**Evaluate_Expression**+The general form of the equation of a plane in 3D is ax+by+cz+d = 0 where 𝑎, 𝑏, and 𝑐 are the components of the normal vector which is perpendicular to the plane or any vector parallel to the plane. 
 + 
 +If (𝑥0,𝑦0,𝑧0)is a point that lies on the plane, then 𝑑=−(𝑎𝑥0+𝑏𝑦0+𝑐𝑧0) and as 𝑎𝑥+𝑏𝑦+𝑐𝑧−(𝑎𝑥0+𝑏𝑦0+𝑐𝑧0)=0. 
 + 
 +The result of the Best_Fit_Plane function is a signal with the fource components (a,b,c,d) 
 + 
 +<code> 
 +Example: Compute a Best_Plane_Fit for one signal across a range of frames 
 +Evaluate_Expression
 /EXPRESSION=Best_Fit_Plane(CURRENT_SIGNAL,EVENT_LABEL::ORIGINAL::START,EVENT_LABEL::ORIGINAL::END) /EXPRESSION=Best_Fit_Plane(CURRENT_SIGNAL,EVENT_LABEL::ORIGINAL::START,EVENT_LABEL::ORIGINAL::END)
 /SIGNAL_TYPES=TARGET /SIGNAL_TYPES=TARGET
Line 16: Line 24:
 /RESULT_NAME=LSK1_PLANE /RESULT_NAME=LSK1_PLANE
 /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=TRUE /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=TRUE
-**;** +
-Example: Compute a Best_Plane_Fit for multiple signals at each frame of data +</code> 
-**Evaluate_Expression**+ 
 +<code> 
 +Example: Compute a Best_Plane_Fit for multiple signals at each frame of data 
 +Evaluate_Expression
 /EXPRESSION=Best_Fit_Plane(CURRENT_SIGNAL) /EXPRESSION=Best_Fit_Plane(CURRENT_SIGNAL)
 /SIGNAL_TYPES=TARGET /SIGNAL_TYPES=TARGET
Line 27: Line 38:
 /RESULT_NAME=LSK_PLANE /RESULT_NAME=LSK_PLANE
 /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=TRUE /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=TRUE
-**;** +
-===== Best Fit Circle =====+</code>
  
-**Best_Fit_Circle**(signal, start_event_signal, end_event_signal)+==== Best Fit Circle ====
  
-Fit a 2D circle to the path of a signal. +**Best_Fit_Circle**(signal, start_event_signal, end_event_signal) - Fits a 2D circle to the path of a signal.
-The algorithm computes a best fit plane to the data, rotates this plane into a principal plane, computes the center and radius, the rotates these values back into the original plane. +
-The result is 4 components; the X,Y,Z location of the origin and the radius. +
-\\+
  
 +The algorithm computes a best fit plane to the data, rotates this plane into a principal plane, computes the center and radius, the rotates these values back into the original plane. The result is 4 components:
 +  - the origin's X-coordinate;
 +  - the origin's Y-coordinate;
 +  - the origin's Z-coordinate; and
 +  - the radius.
  
-===== Best Fit Sphere =====+==== Best Fit Sphere ====
  
-**Best_Fit_Sphere**(signal,start_event_signal,end_event_signal)+**Best_Fit_Sphere**(signal,start_event_signal,end_event_signal) - Fits a 3D sphere to the path of a signal.
  
-Example : Fit a sphere to 6 points on a DIAMOND +<code> 
-Create 6 TARGETS representing the Vertices+Example : Fit a sphere to 6 points on a DIAMOND
  
-[[Visual3D:Documentation:Pipeline:Signal_Commands:Create_Target|Create_Target]]+! Create 6 TARGETS representing the Vertices 
 +Create_Target
 /SIGNAL_NAMES=V1 /SIGNAL_NAMES=V1
 ! /SIGNAL_DESCRIPTION= ! /SIGNAL_DESCRIPTION=
 /EXPRESSION=VECTOR((0.5+0*FRAME_NUMBERS::ORIGINAL::FRAMES),0,0) /EXPRESSION=VECTOR((0.5+0*FRAME_NUMBERS::ORIGINAL::FRAMES),0,0)
 ! /INCLUDE_CALFILE=FALSE ! /INCLUDE_CALFILE=FALSE
-**;** +
-[[Visual3D:Documentation:Pipeline:Signal_Commands:Create_Target|Create_Target]]+ 
 +Create_Target
 /SIGNAL_NAMES=V2 /SIGNAL_NAMES=V2
 ! /SIGNAL_DESCRIPTION= ! /SIGNAL_DESCRIPTION=
 /EXPRESSION=VECTOR((-0.5+0*FRAME_NUMBERS::ORIGINAL::FRAMES),0,0) /EXPRESSION=VECTOR((-0.5+0*FRAME_NUMBERS::ORIGINAL::FRAMES),0,0)
 ! /INCLUDE_CALFILE=FALSE ! /INCLUDE_CALFILE=FALSE
-**;** +
-[[Visual3D:Documentation:Pipeline:Signal_Commands:Create_Target|Create_Target]]+ 
 +Create_Target
 /SIGNAL_NAMES=V3 /SIGNAL_NAMES=V3
 ! /SIGNAL_DESCRIPTION= ! /SIGNAL_DESCRIPTION=
 /EXPRESSION=VECTOR((0,0.5+0*FRAME_NUMBERS::ORIGINAL::FRAMES),0) /EXPRESSION=VECTOR((0,0.5+0*FRAME_NUMBERS::ORIGINAL::FRAMES),0)
 ! /INCLUDE_CALFILE=FALSE ! /INCLUDE_CALFILE=FALSE
-**;** +
-[[Visual3D:Documentation:Pipeline:Signal_Commands:Create_Target|Create_Target]]+ 
 +Create_Target
 /SIGNAL_NAMES=V4 /SIGNAL_NAMES=V4
 ! /SIGNAL_DESCRIPTION= ! /SIGNAL_DESCRIPTION=
 /EXPRESSION=VECTOR((0,-0.5+0*FRAME_NUMBERS::ORIGINAL::FRAMES),0) /EXPRESSION=VECTOR((0,-0.5+0*FRAME_NUMBERS::ORIGINAL::FRAMES),0)
 ! /INCLUDE_CALFILE=FALSE ! /INCLUDE_CALFILE=FALSE
-**;** +
-[[Visual3D:Documentation:Pipeline:Signal_Commands:Create_Target|Create_Target]]+ 
 +Create_Target
 /SIGNAL_NAMES=V5 /SIGNAL_NAMES=V5
 ! /SIGNAL_DESCRIPTION= ! /SIGNAL_DESCRIPTION=
 /EXPRESSION=VECTOR((0,0,0.5+0*FRAME_NUMBERS::ORIGINAL::FRAMES)) /EXPRESSION=VECTOR((0,0,0.5+0*FRAME_NUMBERS::ORIGINAL::FRAMES))
 ! /INCLUDE_CALFILE=FALSE ! /INCLUDE_CALFILE=FALSE
-**;** +
-[[Visual3D:Documentation:Pipeline:Signal_Commands:Create_Target|Create_Target]]+ 
 +Create_Target
 /SIGNAL_NAMES=V6 /SIGNAL_NAMES=V6
 ! /SIGNAL_DESCRIPTION= ! /SIGNAL_DESCRIPTION=
 /EXPRESSION=VECTOR((0,0,-0.5+0*FRAME_NUMBERS::ORIGINAL::FRAMES)) /EXPRESSION=VECTOR((0,0,-0.5+0*FRAME_NUMBERS::ORIGINAL::FRAMES))
 ! /INCLUDE_CALFILE=FALSE ! /INCLUDE_CALFILE=FALSE
-**;** +
-**Evaluate_Expression**+ 
 +Evaluate_Expression
 /EXPRESSION=Best_Fit_Sphere(CURRENT_SIGNAL) /EXPRESSION=Best_Fit_Sphere(CURRENT_SIGNAL)
 /SIGNAL_TYPES=TARGET /SIGNAL_TYPES=TARGET
Line 90: Line 110:
 /RESULT_NAME=SPHERE /RESULT_NAME=SPHERE
 ! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE ! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
-**;** +
-Note that TARGETS are created and the sphere computed has each TARGET on its surface. {{Sphere1.jpg{{/images/8/84/Sphere1.jpg?508x363}}]]sphere6view.jpg}}+</code>
  
-Example : Create a TARGET where each frame is on a random location on the surface of a sphere of radius 1 +Note that TARGETS are created and the sphere computed has each TARGET on its surface. 
-**Evaluate_Expression**+ 
 +{{:Sphere1.jpg}}{{:sphere6view.jpg}} 
 + 
 +<code> 
 +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) /EXPRESSION=RAND(-PI(),PI(),FRAME_NUMBERS::ORIGINAL::FRAMES)
 /RESULT_TYPES=DERIVED /RESULT_TYPES=DERIVED
Line 100: Line 125:
 /RESULT_NAME=VERTICAL /RESULT_NAME=VERTICAL
 ! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE ! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
-**;** +
-**Evaluate_Expression**+ 
 +Evaluate_Expression
 /EXPRESSION=RAND(0,2*PI(),FRAME_NUMBERS::ORIGINAL::FRAMES) /EXPRESSION=RAND(0,2*PI(),FRAME_NUMBERS::ORIGINAL::FRAMES)
 /RESULT_TYPES=DERIVED /RESULT_TYPES=DERIVED
Line 107: Line 133:
 /RESULT_NAME=HORIZONTAL /RESULT_NAME=HORIZONTAL
 ! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE ! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
-**;** +
-[[Visual3D:Documentation:Pipeline:Signal_Commands:Create_Target|Create_Target]]+ 
 +Create_Target
 /SIGNAL_NAMES=SPHERE /SIGNAL_NAMES=SPHERE
 ! /SIGNAL_DESCRIPTION= ! /SIGNAL_DESCRIPTION=
Line 116: Line 143:
 SIN(DERIVED::RADIUS::VERTICAL)) SIN(DERIVED::RADIUS::VERTICAL))
 ! /INCLUDE_CALFILE=FALSE ! /INCLUDE_CALFILE=FALSE
-**;** +
-**Evaluate_Expression**+ 
 +Evaluate_Expression
 /EXPRESSION=Best_Fit_Sphere(CURRENT_SIGNAL) /EXPRESSION=Best_Fit_Sphere(CURRENT_SIGNAL)
 /SIGNAL_TYPES=TARGET /SIGNAL_TYPES=TARGET
Line 126: Line 154:
 /RESULT_NAME=SPHERE /RESULT_NAME=SPHERE
 ! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE ! /APPLY_AS_SUFFIX_TO_SIGNAL_NAME=FALSE
-**;** +; 
-{{random8view.jpg}} +</code> 
-{{sphereRandom.jpg}} + 
-===== Simple Linear Regression =====+{{:random8view.jpg}} 
 +{{:sphereRandom.jpg}} 
 + 
 +==== Simple Linear Regression ====
  
-**Simple_Linear_Regression**(signal1, signal2, start_event, end_event); - Fit a signal to a lineY = mX + b.+**Simple_Linear_Regression**(signal1, signal2, start_event, end_event); - Fits a signal to a line given by the equation Y = mX + b where
  
-Signal2 = m Signal1 + b +<code> 
-An explanation of the calculation can be found [[Visual3D:Documentation:Statistics:Compute_Linear_Regression|here]] or [[[https://en.wikipedia.org/wiki/Simple_linear_regression|here]]] +Signal = m Signal1 + b 
-Signal1 and Signal2 are one component signals +</code>
-Resulting METRIC signal contains 6 components +
-Slope = m -> Component 1 +
-Intercept = b -> Component 2 +
-Siga = uncertainty in m -> Component 3 +
-Sigb = uncertainty in b -> Component 4 +
-Chi2 = chi square -> Component 5 +
-Q = The R^2 statistic -Component 6+
  
 +An explanation of the calculation can be found [[Visual3D:Documentation:Statistics:Compute_Linear_Regression|here]] or [[https://en.wikipedia.org/wiki/Simple_linear_regression|here]].
  
 +Signal1 and Signal2 are both one-component signals and the resulting METRIC contains 6 components:
 +  - Slope = m -> Component 1
 +  - Intercept = b -> Component 2
 +  - Siga = uncertainty in m -> Component 3
 +  - Sigb = uncertainty in b -> Component 4
 +  - Chi2 = chi square -> Component 5
 +  - Q = The R^2 statistic -> Component 6
visual3d/documentation/pipeline/expressions/least_squares_fitting_of_data.1718717424.txt.gz · Last modified: 2024/06/18 13:30 by sgranger