Changeset 128 for sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/Cylinder_PolyLength.ipf
- Timestamp:
- Jul 25, 2007 3:07:20 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/Cylinder_PolyLength.ipf
r127 r128 28 28 make/o/t parameters_cypl = {"scale","radius (A)","length (A)","polydispersity of Length","SLD diff (A^-2)","incoh. bkg (cm^-1)"} 29 29 Edit parameters_cypl,coef_cypl 30 ywave_cypl := Cyl_PolyLength(coef_cypl,xwave_cypl) 30 31 Variable/G root:g_cypl 32 g_cypl := Cyl_PolyLength(coef_cypl,ywave_cypl,xwave_cypl) 31 33 Display ywave_cypl vs xwave_cypl 32 34 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 36 38 End 37 39 38 // plot the smeared version - quite slow - use only for final fit39 Proc PlotSmearedCyl_PolyLength( )40 //no input parameters necessary, it MUST use the experimental q-values41 // from the experimental data read in from an AVE/QSIG data file42 43 // if no gQvals wave, data must not have been loaded=> abort44 if(ResolutionWavesMissing ())40 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 41 Proc PlotSmearedCyl_PolyLength(str) 42 String str 43 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 44 45 // if any of the resolution waves are missing => abort 46 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 45 47 Abort 46 48 endif 49 50 SetDataFolder $("root:"+str) 47 51 48 52 // Setup parameter table for model function … … 53 57 // output smeared intensity wave, dimensions are identical to experimental QSIG values 54 58 // make extra copy of experimental q-values for easy plotting 55 Duplicate/O $ gQvalssmeared_cypl,smeared_qvals59 Duplicate/O $(str+"_q") smeared_cypl,smeared_qvals 56 60 SetScale d,0,0,"1/cm",smeared_cypl 57 58 smeared_cypl := SmearedCyl_PolyLength(smear_coef_cypl,$gQvals) 61 62 Variable/G gs_cypl=0 63 gs_cypl := fSmearedCyl_PolyLength(smear_coef_cypl,smeared_cypl,smeared_qvals) //this wrapper fills the STRUCT 64 59 65 Display smeared_cypl vs smeared_qvals 60 66 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 62 68 Label left "Intensity (cm\\S-1\\M)" 63 69 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 70 71 SetDataFolder root: 72 End 73 74 75 76 //AAO version, uses XOP if available 77 // simply calls the original single point calculation with 78 // a wave assignment (this will behave nicely if given point ranges) 79 Function Cyl_PolyLength(cw,yw,xw) : FitFunc 80 Wave cw,yw,xw 81 82 #if exists("Cyl_PolyLengthX") 83 yw = Cyl_PolyLengthX(cw,xw) 84 #else 85 yw = fCyl_PolyLength(cw,xw) 86 #endif 87 return(0) 64 88 End 65 89 … … 67 91 // both integrals are done using quadrature, although both may benefit from an 68 92 // adaptive integration 69 Function Cyl_PolyLength(w,x) : FitFunc93 Function fCyl_PolyLength(w,x) : FitFunc 70 94 Wave w 71 95 Variable x … … 182 206 kp[4] = 0 //bkg fixed at 0 183 207 184 Pq = CylinderForm(kp,qw) 185 //Pq = CylinderFit(kp,qw) //from the XOP 208 #if exists("CylinderFormX") 209 Pq = CylinderFormX(kp,qw) 210 #else 211 Pq = fCylinderForm(kp,qw) 212 #endif 186 213 187 214 // undo the normalization that CylinderForm does … … 208 235 End 209 236 237 //wrapper to calculate the smeared model as an AAO-Struct 238 // fills the struct and calls the ususal function with the STRUCT parameter 239 // 240 // used only for the dependency, not for fitting 241 // 242 Function fSmearedCyl_PolyLength(coefW,yW,xW) 243 Wave coefW,yW,xW 244 245 String str = getWavesDataFolder(yW,0) 246 String DF="root:"+str+":" 247 248 WAVE resW = $(DF+str+"_res") 249 250 STRUCT ResSmearAAOStruct fs 251 WAVE fs.coefW = coefW 252 WAVE fs.yW = yW 253 WAVE fs.xW = xW 254 WAVE fs.resW = resW 255 256 Variable err 257 err = SmearedCyl_PolyLength(fs) 258 259 return (0) 260 End 261 210 262 // this is all there is to the smeared calculation! 211 Function SmearedCyl_PolyLength(w,x) :FitFunc 212 Wave w 213 Variable x 214 215 Variable ans 216 SVAR sq = gSig_Q 217 SVAR qb = gQ_bar 218 SVAR sh = gShadow 219 SVAR gQ = gQVals 220 221 //the name of your unsmeared model is the first argument 222 ans = Smear_Model_20(Cyl_PolyLength,$sq,$qb,$sh,$gQ,w,x) 223 224 return(ans) 225 End 263 Function SmearedCyl_PolyLength(s) :FitFunc 264 Struct ResSmearAAOStruct &s 265 266 // the name of your unsmeared model (AAO) is the first argument 267 s.yW = Smear_Model_20(Cyl_PolyLength,s.coefW,s.xW,s.resW) 268 269 return(0) 270 End 271
Note: See TracChangeset
for help on using the changeset viewer.