Differences

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

Link to this comparison view

Next revision
Previous revision
background_straight_line_segments [2011/08/25 18:43]
alancoelho created
background_straight_line_segments [2011/08/25 19:11] (current)
alancoelho
Line 5: Line 5:
 <code topas>​macro Bkg_Straight_Line_xy(n,​ x, y) <code topas>​macro Bkg_Straight_Line_xy(n,​ x, y)
 { {
- prm !bkg_x_##n = x; +   prm !bkg_x_##n = x; 
- prm !bkg_y_##n = y;+   ​prm !bkg_y_##n = y;
 } }
 macro Bkg_Straight_Line_First(n,​ x, y) macro Bkg_Straight_Line_First(n,​ x, y)
 { {
- Bkg_Straight_Line_xy(n,​ x, y)+   Bkg_Straight_Line_xy(n,​ x, y)
 } }
 macro Bkg_Straight_Line(n1,​ n2, x2, y2) macro Bkg_Straight_Line(n1,​ n2, x2, y2)
 { {
- fit_obj = (X - bkg_x_##n1) ((y2)-bkg_y_##​n1)/​((x2)-bkg_x_##​n1) + bkg_y_##​n1;​ +   fit_obj = (X - bkg_x_##n1) ((y2)-bkg_y_##​n1)/​((x2)-bkg_x_##​n1) + bkg_y_##​n1;​ 
- min_X >= bkg_x_##n1 + 1.0e-9; +      min_X >= bkg_x_##n1 + 1.0e-9; 
- #m_ifarg x2 "​X2"​  +      #m_ifarg x2 "​X2"​  
- max_X >= x2 + 1.0e-10; +         ​max_X >= x2 + 1.0e-10; 
- #m_else +      #m_else 
- max_X <= x2 + 1.0e-10; +         ​max_X <= x2 + 1.0e-10; 
- #m_endif +      #m_endif 
- Bkg_Straight_Line_xy(n2,​ x2, y2)+   ​Bkg_Straight_Line_xy(n2,​ x2, y2)
 }</​code>​ }</​code>​
  
-Then use the macros ​as follows:+Then graphically gather (x,y) points and form the straight line segments ​as follows:
  
 <code topas>​DAT(y2o3a) <code topas>​DAT(y2o3a)
Line 41: Line 41:
  Bkg_Straight_Line(10,​ 11, X2,    280.0)</​code>​  Bkg_Straight_Line(10,​ 11, X2,    280.0)</​code>​
  
 +This describes a background for the Y2O3a.INP file which can be found in the test_examples directory.
  
 +Note, in doing the above macros a bug in the interpretation of the >= and <= signs for min_X/max_X have been uncovered. The macros as defined above will work in version 4. Version 5 will have a different combination of the >=,<= signs and the macros would be inside of TOPAS.INC.
 +
 +--- //​[[alan.coelho@bigpond.com|Alan Coelho]] 2011/08/25 19:09//

Personal Tools