Ignore:
Timestamp:
Nov 8, 2007 11:15:58 AM (15 years ago)
Author:
srkline
Message:

Changes to PlotUtils2D here undo the previous changeset, now correctly setting upt the Qx and Qy waves in the call to FucFit?. 2D fit functions do need to have the parameters in the order specified in the function (cw,zw,xw,yw)

Cylinder2D has been REPLACED with a version that uses a MODIFIED version of the DANSE XOPs that is currently only on my computer... We will need to decide in the near future how we are going to include Mathieu's code into our XOPs.

GizmoCylinder? is a crude display of the cylinder angles as a function of theta and phi. Not automatically included, and needs to be tweaked (a lot) before prime time, but it's at least something.

Location:
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/Models_2D
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/Models_2D/Cylinder_2D.ipf

    r196 r197  
    1212// in the same way the 2D SANS data matrix is handled. 
    1313// 
    14 // Nothing is threaded at this point, although I think it needs to be since upon 
    15 // reading of the WM documentation, it looks like only "basic" fit functions (meaning 
    16 // NOT AAO or Struct functions) are automatically threaded during curve fitting. 
    17 // 
    18 // 
    1914 
    20 //Cylinder_2D_Dist() 
    2115 
    22 // this is what Cylinder_2D_Dist() from our XOP is expecting 
    23 //double dist_cylinder_2D(double pars[], double q, double phi) { 
    24 //      SmearCylinderParameters danse_pars; 
    25 //      danse_pars.scale        = pars[0]; 
    26 //      danse_pars.radius       = pars[1]; 
    27 //      danse_pars.length       = pars[2]; 
    28 //      danse_pars.contrast     = pars[3]; 
    29 //      danse_pars.background   = pars[4]; 
    30 //      danse_pars.cyl_theta    = pars[5]; 
    31 //      danse_pars.cyl_phi      = pars[6]; 
    32 //      danse_pars.sigma_theta  = pars[7]; 
    33 //      danse_pars.sigma_phi    = pars[8]; 
    34 //      danse_pars.sigma_radius = pars[9]; 
    35 // 
    36 //      return smeared_cylinder_analytical_2D(&danse_pars, q, phi);      
    37 //       
    38 //}; 
     16///  REQUIRES DANSE XOP for 2D FUNCTIONS 
    3917 
    4018// 
     
    5331        SetDataFolder $("root:"+str) 
    5432         
     33         
     34        // NOTE THAT THE COEFFICIENTS [N] ARE IN A DIFFERENT ORDER !!! 
    5535        // Setup parameter table for model function 
    56         make/O/T/N=10 parameters_Cyl2D 
    57         Make/O/D/N=10 coef_Cyl2D 
     36        make/O/T/N=11 parameters_Cyl2D 
     37        Make/O/D/N=11 coef_Cyl2D 
    5838        coef_Cyl2D[0] = 1.0 
    5939        coef_Cyl2D[1] = 20.0 
     
    6646        coef_Cyl2D[8] = 0.0 
    6747        coef_Cyl2D[9] = 0.0 
    68         //NOT THE SAME ORDER AS MATHIEU'S CODE - POLYDISPERSITY OF RADIUS IS IN A DIFFERENT LOCATION FROM 
    69         // MATHIEU'S CylinderModel 
     48        coef_Cyl2D[10] = 25 
     49        // 
    7050        parameters_Cyl2D[0] = "Scale" 
    7151        parameters_Cyl2D[1] = "Radius" 
     
    7555        parameters_Cyl2D[5] = "Axis Theta" 
    7656        parameters_Cyl2D[6] = "Axis Phi" 
    77         parameters_Cyl2D[7] = "Sigma of polydisp in Theta [rad]" 
    78         parameters_Cyl2D[8] = "Sigma of polydisp in Phi [rad]" 
    79         parameters_Cyl2D[9] = "Sigma of polydisp in Radius [A]" 
     57         
     58        parameters_Cyl2D[8] = "Sigma of polydisp in Theta [rad]"                //***** 
     59        parameters_Cyl2D[9] = "Sigma of polydisp in Phi [rad]"                  //***** 
     60        parameters_Cyl2D[7] = "Sigma of polydisp in Radius [A]"         //***** 
     61         
     62        parameters_Cyl2D[10] = "number of integration points" 
    8063 
    8164        Edit parameters_Cyl2D,coef_Cyl2D                                         
     
    8669                 
    8770        Variable/G gs_Cyl2D=0 
    88         gs_Cyl2D := Cylinder2D(coef_Cyl2D,zwave_Cyl2D,ywave_Cyl2D,xwave_Cyl2D)  //AAO 2D calculation 
     71        gs_Cyl2D := Cylinder2D(coef_Cyl2D,zwave_Cyl2D,xwave_Cyl2D,ywave_Cyl2D)  //AAO 2D calculation 
    8972         
    9073        Display ywave_Cyl2D vs xwave_Cyl2D 
     
    11194End 
    11295 
    113  
    11496//AAO version, uses XOP if available 
    11597// simply calls the original single point calculation with 
     
    118100// NON-THREADED IMPLEMENTATION 
    119101// 
    120 //Function Cylinder2D(cw,zw,yw,xw) : FitFunc 
    121 //      Wave cw,zw,yw,xw 
     102//Function Cylinder2D(cw,zw,xw,yw) : FitFunc 
     103//      Wave cw,zw,xw,yw 
    122104//       
    123 //#if exists("Cylinder_2D_Dist") 
    124 //      zw = Cylinder_2D_Dist(cw,xw,yw) 
     105//#if exists("CylinderModel_D") 
     106//      zw = CylinderModel_D(cw,xw,yw) 
    125107//#else 
    126108//      Abort "You do not have the SANS Analysis XOP installed" 
     
    131113 
    132114//threaded version of the function 
    133 ThreadSafe Function Cylinder2D_T(cw,zw,yw,xw,p1,p2) 
    134         WAVE cw,zw,yw,xw 
     115ThreadSafe Function Cylinder2D_T(cw,zw,xw,yw,p1,p2) 
     116        WAVE cw,zw,xw,yw 
    135117        Variable p1,p2 
    136118         
    137 #if exists("Cylinder_2D_Dist")                  //to hide the function if XOP not installed 
    138         zw[p1,p2]= Cylinder_2D_Dist(cw,xw,yw) 
     119#if exists("CylinderModel_D")                   //to hide the function if XOP not installed 
     120        zw[p1,p2]= CylinderModel_D(cw,xw,yw) 
    139121#endif 
    140122 
     
    145127//function that is actually a wrapper to dispatch the calculation to N threads 
    146128// 
    147 Function Cylinder2D(cw,zw,yw,xw) : FitFunc 
    148         Wave cw,zw,yw,xw 
     129Function Cylinder2D(cw,zw,xw,yw) : FitFunc 
     130        Wave cw,zw,xw,yw 
    149131         
    150132        Variable npt=numpnts(yw) 
     
    154136        for(i=0;i<nthreads;i+=1) 
    155137//              Print (i*npt/nthreads),((i+1)*npt/nthreads-1) 
    156                 ThreadStart mt,i,Cylinder2D_T(cw,zw,yw,xw,(i*npt/nthreads),((i+1)*npt/nthreads-1)) 
     138                ThreadStart mt,i,Cylinder2D_T(cw,zw,xw,yw,(i*npt/nthreads),((i+1)*npt/nthreads-1)) 
    157139        endfor 
    158140 
Note: See TracChangeset for help on using the changeset viewer.