Changeset 197 for sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/Models_2D
- Timestamp:
- Nov 8, 2007 11:15:58 AM (15 years ago)
- 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 12 12 // in the same way the 2D SANS data matrix is handled. 13 13 // 14 // Nothing is threaded at this point, although I think it needs to be since upon15 // reading of the WM documentation, it looks like only "basic" fit functions (meaning16 // NOT AAO or Struct functions) are automatically threaded during curve fitting.17 //18 //19 14 20 //Cylinder_2D_Dist()21 15 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 39 17 40 18 // … … 53 31 SetDataFolder $("root:"+str) 54 32 33 34 // NOTE THAT THE COEFFICIENTS [N] ARE IN A DIFFERENT ORDER !!! 55 35 // Setup parameter table for model function 56 make/O/T/N=1 0parameters_Cyl2D57 Make/O/D/N=1 0coef_Cyl2D36 make/O/T/N=11 parameters_Cyl2D 37 Make/O/D/N=11 coef_Cyl2D 58 38 coef_Cyl2D[0] = 1.0 59 39 coef_Cyl2D[1] = 20.0 … … 66 46 coef_Cyl2D[8] = 0.0 67 47 coef_Cyl2D[9] = 0.0 68 //NOT THE SAME ORDER AS MATHIEU'S CODE - POLYDISPERSITY OF RADIUS IS IN A DIFFERENT LOCATION FROM69 // MATHIEU'S CylinderModel48 coef_Cyl2D[10] = 25 49 // 70 50 parameters_Cyl2D[0] = "Scale" 71 51 parameters_Cyl2D[1] = "Radius" … … 75 55 parameters_Cyl2D[5] = "Axis Theta" 76 56 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" 80 63 81 64 Edit parameters_Cyl2D,coef_Cyl2D … … 86 69 87 70 Variable/G gs_Cyl2D=0 88 gs_Cyl2D := Cylinder2D(coef_Cyl2D,zwave_Cyl2D, ywave_Cyl2D,xwave_Cyl2D) //AAO 2D calculation71 gs_Cyl2D := Cylinder2D(coef_Cyl2D,zwave_Cyl2D,xwave_Cyl2D,ywave_Cyl2D) //AAO 2D calculation 89 72 90 73 Display ywave_Cyl2D vs xwave_Cyl2D … … 111 94 End 112 95 113 114 96 //AAO version, uses XOP if available 115 97 // simply calls the original single point calculation with … … 118 100 // NON-THREADED IMPLEMENTATION 119 101 // 120 //Function Cylinder2D(cw,zw, yw,xw) : FitFunc121 // Wave cw,zw, yw,xw102 //Function Cylinder2D(cw,zw,xw,yw) : FitFunc 103 // Wave cw,zw,xw,yw 122 104 // 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) 125 107 //#else 126 108 // Abort "You do not have the SANS Analysis XOP installed" … … 131 113 132 114 //threaded version of the function 133 ThreadSafe Function Cylinder2D_T(cw,zw, yw,xw,p1,p2)134 WAVE cw,zw, yw,xw115 ThreadSafe Function Cylinder2D_T(cw,zw,xw,yw,p1,p2) 116 WAVE cw,zw,xw,yw 135 117 Variable p1,p2 136 118 137 #if exists("Cylinder _2D_Dist") //to hide the function if XOP not installed138 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) 139 121 #endif 140 122 … … 145 127 //function that is actually a wrapper to dispatch the calculation to N threads 146 128 // 147 Function Cylinder2D(cw,zw, yw,xw) : FitFunc148 Wave cw,zw, yw,xw129 Function Cylinder2D(cw,zw,xw,yw) : FitFunc 130 Wave cw,zw,xw,yw 149 131 150 132 Variable npt=numpnts(yw) … … 154 136 for(i=0;i<nthreads;i+=1) 155 137 // 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)) 157 139 endfor 158 140
Note: See TracChangeset
for help on using the changeset viewer.