Changeset 128 for sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/BinaryHardSpheres.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/BinaryHardSpheres.ipf
r127 r128 58 58 ModifyTable width(coef_BinaryHS)=90 59 59 60 ywave_BinaryHS := BinaryHS(coef_BinaryHS, xwave_BinaryHS) 60 Variable/G root:g_BinaryHS 61 g_BinaryHS := BinaryHS(coef_BinaryHS, ywave_BinaryHS,xwave_BinaryHS) 61 62 Display ywave_BinaryHS vs xwave_BinaryHS 62 63 ModifyGraph marker=29, msize=2, mode=4 … … 67 68 End 68 69 69 // 70 //this macro sets up all the necessary parameters and waves that are 71 //needed to calculate the smeared model function. 72 // 73 //no input parameters are necessary, it MUST use the experimental q-values 74 // from the experimental data read in from an AVE/QSIG data file 75 //////////////////////////////////////////////////// 76 Proc PlotSmeared_BinaryHS() //BinaryHS 77 78 // if no gQvals wave, data must not have been loaded => abort 79 if(ResolutionWavesMissing()) 70 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 71 Proc PlotSmeared_BinaryHS(str) 72 String str 73 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 74 75 // if any of the resolution waves are missing => abort 76 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 80 77 Abort 81 78 endif 79 80 SetDataFolder $("root:"+str) 82 81 83 82 // Setup parameter table for model function … … 89 88 // output smeared intensity wave, dimensions are identical to experimental QSIG values 90 89 // make extra copy of experimental q-values for easy plotting 91 Duplicate/O $ gQvalssmeared_BinaryHS,smeared_qvals //90 Duplicate/O $(str+"_q") smeared_BinaryHS,smeared_qvals // 92 91 SetScale d,0,0,"1/cm",smeared_BinaryHS // 93 94 smeared_BinaryHS := BinaryHS_Smeared(smear_coef_BinaryHS,$gQvals) // SMEARED function name 92 93 Variable/G gs_BinaryHS=0 94 gs_BinaryHS := fBinaryHS_Smeared(smear_coef_BinaryHS,smeared_BinaryHS,smeared_qvals) //this wrapper fills the STRUCT 95 95 96 Display smeared_BinaryHS vs smeared_qvals // 96 97 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 98 99 Label left "I(q) (cm\\S-1\\M)" 99 100 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 100 End // end macro 101 102 SetDataFolder root: 103 End 104 105 106 107 //AAO version, uses XOP if available 108 // simply calls the original single point calculation with 109 // a wave assignment (this will behave nicely if given point ranges) 110 Function BinaryHS(cw,yw,xw) : FitFunc 111 Wave cw,yw,xw 112 113 #if exists("BinaryHSX") 114 yw = BinaryHSX(cw,xw) 115 #else 116 yw = fBinaryHS(cw,xw) 117 #endif 118 return(0) 119 End 120 101 121 102 122 //CH#1 … … 105 125 // based on the wave (array) of parameters that you send it (w) 106 126 // 107 Function BinaryHS(w,x) : FitFunc127 Function fBinaryHS(w,x) : FitFunc 108 128 Wave w 109 129 Variable x … … 168 188 End 169 189 170 Function BinaryHS_PSF11(w,x) : FitFunc 190 //AAO version, uses XOP if available 191 // simply calls the original single point calculation with 192 // a wave assignment (this will behave nicely if given point ranges) 193 Function BinaryHS_PSF11(cw,yw,xw) : FitFunc 194 Wave cw,yw,xw 195 196 #if exists("BinaryHS_PSF11X") 197 yw = BinaryHS_PSF11X(cw,xw) 198 #else 199 yw = fBinaryHS_PSF11(cw,xw) 200 #endif 201 return(0) 202 End 203 204 Function fBinaryHS_PSF11(w,x) : FitFunc 171 205 Wave w 172 206 Variable x … … 210 244 End 211 245 212 Function BinaryHS_PSF12(w,x) : FitFunc 246 //AAO version, uses XOP if available 247 // simply calls the original single point calculation with 248 // a wave assignment (this will behave nicely if given point ranges) 249 Function BinaryHS_PSF12(cw,yw,xw) : FitFunc 250 Wave cw,yw,xw 251 252 #if exists("BinaryHS_PSF12X") 253 yw = BinaryHS_PSF12X(cw,xw) 254 #else 255 yw = fBinaryHS_PSF12(cw,xw) 256 #endif 257 return(0) 258 End 259 260 Function fBinaryHS_PSF12(w,x) : FitFunc 213 261 Wave w 214 262 Variable x … … 252 300 End 253 301 254 Function BinaryHS_PSF22(w,x) : FitFunc 302 //AAO version, uses XOP if available 303 // simply calls the original single point calculation with 304 // a wave assignment (this will behave nicely if given point ranges) 305 Function BinaryHS_PSF22(cw,yw,xw) : FitFunc 306 Wave cw,yw,xw 307 308 #if exists("BinaryHS_PSF22X") 309 yw = BinaryHS_PSF22X(cw,xw) 310 #else 311 yw = fBinaryHS_PSF22(cw,xw) 312 #endif 313 return(0) 314 End 315 316 Function fBinaryHS_PSF22(w,x) : FitFunc 255 317 Wave w 256 318 Variable x … … 387 449 End 388 450 389 451 452 //wrapper to calculate the smeared model as an AAO-Struct 453 // fills the struct and calls the ususal function with the STRUCT parameter 454 // 455 // used only for the dependency, not for fitting 456 // 457 Function fBinaryHS_Smeared(coefW,yW,xW) 458 Wave coefW,yW,xW 459 460 String str = getWavesDataFolder(yW,0) 461 String DF="root:"+str+":" 462 463 WAVE resW = $(DF+str+"_res") 464 465 STRUCT ResSmearAAOStruct fs 466 WAVE fs.coefW = coefW 467 WAVE fs.yW = yW 468 WAVE fs.xW = xW 469 WAVE fs.resW = resW 470 471 Variable err 472 err = BinaryHS_Smeared(fs) 473 474 return (0) 475 End 476 390 477 // this is all there is to the smeared calculation! 391 Function BinaryHS_Smeared(w,x) :FitFunc 392 Wave w 393 Variable x 394 395 Variable ans 396 SVAR sq = gSig_Q 397 SVAR qb = gQ_bar 398 SVAR sh = gShadow 399 SVAR gQ = gQVals 400 401 //the name of your unsmeared model is the first argument 402 ans = Smear_Model_20(BinaryHS,$sq,$qb,$sh,$gQ,w,x) //CH#4 403 404 return(ans) 405 End 478 Function BinaryHS_Smeared(s) :FitFunc 479 Struct ResSmearAAOStruct &s 480 481 // the name of your unsmeared model (AAO) is the first argument 482 s.yW = Smear_Model_20(BinaryHS,s.coefW,s.xW,s.resW) 483 484 return(0) 485 End 486 406 487 407 488
Note: See TracChangeset
for help on using the changeset viewer.