Changeset 128 for sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/Beaucage.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/Beaucage.ipf
r127 r128 25 25 make/o/t parameters_b1 = {"scale","G1 (cm-1 sr-1)","Rg1 (A)","B1 (cm-1 sr-1)","Pow1","bkg (cm-1 sr-1)"} 26 26 Edit parameters_b1,coef_b1 27 ywave_b1 := OneLevel(coef_b1,xwave_b1) 27 28 Variable/G root:g_b1 29 g_b1 := OneLevel(coef_b1,ywave_b1,xwave_b1) 28 30 Display ywave_b1 vs xwave_b1 29 31 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 44 46 make/o/t parameters_b2 = {"scale","G1 (cm-1 sr-1)","Rg1 (A)","B1 (cm-1 sr-1)","Pow1","G2 (cm-1 sr-1)","Rg2 (A)","B2 (cm-1 sr-1)","Pow2","bkg (cm-1 sr-1)"} 45 47 Edit parameters_b2,coef_b2 46 ywave_b2 := TwoLevel(coef_b2,xwave_b2) 48 49 Variable/G root:g_b2 50 g_b2 := TwoLevel(coef_b2,ywave_b2,xwave_b2) 47 51 Display ywave_b2 vs xwave_b2 48 52 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 63 67 make/o/t parameters_b3 = {"scale","G1 (cm-1 sr-1)","Rg1 (A)","B1 (cm-1 sr-1)","Pow1","G2 (cm-1 sr-1)","Rg2 (A)","B2 (cm-1 sr-1)","Pow2","G3 (cm-1 sr-1)","Rg3 (A)","B3 (cm-1 sr-1)","Pow3","bkg (cm-1)"} 64 68 Edit parameters_b3,coef_b3 65 ywave_b3 := ThreeLevel(coef_b3,xwave_b3) 69 70 Variable/G root:g_b3 71 g_b3 := ThreeLevel(coef_b3,ywave_b3,xwave_b3) 66 72 Display ywave_b3 vs xwave_b3 67 73 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 82 88 make/o/t parameters_b4 = {"scale","G1 (cm-1 sr-1)","Rg1 (A)","B1 (cm-1 sr-1)","Pow1","G2 (cm-1 sr-1)","Rg2 (A)","B2 (cm-1 sr-1)","Pow2","G3 (cm-1 sr-1)","Rg3 (A)","B3 (cm-1 sr-1)","Pow3","G4 (cm-1 sr-1)","Rg4 (A)","B4 (cm-1 sr-1)","Pow4","bkg (cm-1)"} 83 89 Edit parameters_b4,coef_b4 84 ywave_b4 := FourLevel(coef_b4,xwave_b4) 90 91 Variable/G root:g_b4 92 g_b4 := FourLevel(coef_b4,ywave_b4,xwave_b4) 85 93 Display ywave_b4 vs xwave_b4 86 94 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 92 100 /////////// macros for smeared model calculations 93 101 94 Proc PlotSmearedBeau_OneLevel() 95 //no input parameters necessary, it MUST use the experimental q-values 96 // from the experimental data read in from an AVE/QSIG data file 97 If(ResolutionWavesMissing()) //part of GaussUtils 102 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 103 Proc PlotSmearedBeau_OneLevel(str) 104 String str 105 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 106 107 // if any of the resolution waves are missing => abort 108 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 98 109 Abort 99 110 endif 111 112 SetDataFolder $("root:"+str) 100 113 101 114 // Setup parameter table for model function … … 106 119 // output smeared intensity wave, dimensions are identical to experimental QSIG values 107 120 // make extra copy of experimental q-values for easy plotting 108 Duplicate/O $ gQvalssmeared_b1,smeared_qvals121 Duplicate/O $(str+"_q") smeared_b1,smeared_qvals 109 122 SetScale d,0,0,"1/cm",smeared_b1 110 111 smeared_b1 := SmearedOneLevel(smear_coef_b1,$gQvals) 123 124 Variable/G gs_b1=0 125 gs_b1 := fSmearedOneLevel(smear_coef_b1,smeared_b1,smeared_qvals) //this wrapper fills the STRUCT 126 112 127 Display smeared_b1 vs smeared_qvals 113 128 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 115 130 Label left "Intensity (cm\\S-1\\M)" 116 131 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 117 End 118 119 Proc PlotSmearedBeau_TwoLevel() 120 //no input parameters necessary, it MUST use the experimental q-values 121 // from the experimental data read in from an AVE/QSIG data file 122 If(ResolutionWavesMissing()) //part of GaussUtils 132 133 SetDataFolder root: 134 End 135 136 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 137 Proc PlotSmearedBeau_TwoLevel(str) 138 String str 139 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 140 141 // if any of the resolution waves are missing => abort 142 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 123 143 Abort 124 144 endif 145 146 SetDataFolder $("root:"+str) 125 147 126 148 // Setup parameter table for model function … … 131 153 // output smeared intensity wave, dimensions are identical to experimental QSIG values 132 154 // make extra copy of experimental q-values for easy plotting 133 Duplicate/O $ gQvalssmeared_b2,smeared_qvals155 Duplicate/O $(str+"_q") smeared_b2,smeared_qvals 134 156 SetScale d,0,0,"1/cm",smeared_b2 135 136 smeared_b2 := SmearedTwoLevel(smear_coef_b2,$gQvals) 157 158 Variable/G gs_b2=0 159 gs_b2 := fSmearedTwoLevel(smear_coef_b2,smeared_b2,smeared_qvals) //this wrapper fills the STRUCT 160 137 161 Display smeared_b2 vs smeared_qvals 138 162 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 140 164 Label left "Intensity (cm\\S-1\\M)" 141 165 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 142 End 143 144 Proc PlotSmearedBeau_ThreeLevel() 145 //no input parameters necessary, it MUST use the experimental q-values 146 // from the experimental data read in from an AVE/QSIG data file 147 If(ResolutionWavesMissing()) //part of GaussUtils 166 167 SetDataFolder root: 168 End 169 170 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 171 Proc PlotSmearedBeau_ThreeLevel(str) 172 String str 173 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 174 175 // if any of the resolution waves are missing => abort 176 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 148 177 Abort 149 178 endif 179 180 SetDataFolder $("root:"+str) 150 181 151 182 // Setup parameter table for model function … … 156 187 // output smeared intensity wave, dimensions are identical to experimental QSIG values 157 188 // make extra copy of experimental q-values for easy plotting 158 Duplicate/O $ gQvalssmeared_b3,smeared_qvals189 Duplicate/O $(str+"_q") smeared_b3,smeared_qvals 159 190 SetScale d,0,0,"1/cm",smeared_b3 160 161 smeared_b3 := SmearedThreeLevel(smear_coef_b3,$gQvals) 191 192 Variable/G gs_b3=0 193 gs_b3 := fSmearedThreeLevel(smear_coef_b3,smeared_b3,smeared_qvals) //this wrapper fills the STRUCT 194 162 195 Display smeared_b3 vs smeared_qvals 163 196 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 165 198 Label left "Intensity (cm\\S-1\\M)" 166 199 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 167 End 168 169 Proc PlotSmearedBeau_FourLevel() 170 //no input parameters necessary, it MUST use the experimental q-values 171 // from the experimental data read in from an AVE/QSIG data file 172 If(ResolutionWavesMissing()) //part of GaussUtils 200 201 SetDataFolder root: 202 End 203 204 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 205 Proc PlotSmearedBeau_FourLevel(str) 206 String str 207 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 208 209 // if any of the resolution waves are missing => abort 210 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 173 211 Abort 174 212 endif 213 214 SetDataFolder $("root:"+str) 175 215 176 216 // Setup parameter table for model function … … 181 221 // output smeared intensity wave, dimensions are identical to experimental QSIG values 182 222 // make extra copy of experimental q-values for easy plotting 183 Duplicate/O $ gQvalssmeared_b4,smeared_qvals223 Duplicate/O $(str+"_q") smeared_b4,smeared_qvals 184 224 SetScale d,0,0,"1/cm",smeared_b4 185 186 smeared_b4 := SmearedFourLevel(smear_coef_b4,$gQvals) 225 226 Variable/G gs_b4=0 227 gs_b4 := fSmearedFourLevel(smear_coef_b4,smeared_b4,smeared_qvals) //this wrapper fills the STRUCT 228 187 229 Display smeared_b4 vs smeared_qvals 188 230 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 190 232 Label left "Intensity (cm\\S-1\\M)" 191 233 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 234 235 SetDataFolder root: 236 End 237 238 239 240 241 //AAO version, uses XOP if available 242 // simply calls the original single point calculation with 243 // a wave assignment (this will behave nicely if given point ranges) 244 Function OneLevel(cw,yw,xw) : FitFunc 245 Wave cw,yw,xw 246 247 #if exists("OneLevelX") 248 yw = OneLevelX(cw,xw) 249 #else 250 yw = fOneLevel(cw,xw) 251 #endif 252 return(0) 192 253 End 193 254 194 255 //////////Function definitions 195 256 196 Function OneLevel(w,x) :FitFunc257 Function fOneLevel(w,x) :FitFunc 197 258 Wave w 198 259 Variable x … … 218 279 End 219 280 220 Function TwoLevel(w,x) :FitFunc 281 //AAO version, uses XOP if available 282 // simply calls the original single point calculation with 283 // a wave assignment (this will behave nicely if given point ranges) 284 Function TwoLevel(cw,yw,xw) : FitFunc 285 Wave cw,yw,xw 286 287 #if exists("TwoLevelX") 288 yw = TwoLevelX(cw,xw) 289 #else 290 yw = fTwoLevel(cw,xw) 291 #endif 292 return(0) 293 End 294 295 Function fTwoLevel(w,x) :FitFunc 221 296 Wave w 222 297 Variable x … … 251 326 End 252 327 253 254 Function ThreeLevel(w,x) :FitFunc 328 //AAO version, uses XOP if available 329 // simply calls the original single point calculation with 330 // a wave assignment (this will behave nicely if given point ranges) 331 Function ThreeLevel(cw,yw,xw) : FitFunc 332 Wave cw,yw,xw 333 334 #if exists("ThreeLevelX") 335 yw = ThreeLevelX(cw,xw) 336 #else 337 yw = fThreeLevel(cw,xw) 338 #endif 339 return(0) 340 End 341 342 Function fThreeLevel(w,x) :FitFunc 255 343 Wave w 256 344 Variable x … … 290 378 End 291 379 292 Function FourLevel(w,x) :FitFunc 380 //AAO version, uses XOP if available 381 // simply calls the original single point calculation with 382 // a wave assignment (this will behave nicely if given point ranges) 383 Function FourLevel(cw,yw,xw) : FitFunc 384 Wave cw,yw,xw 385 386 #if exists("FourLevelX") 387 yw = FourLevelX(cw,xw) 388 #else 389 yw = fFourLevel(cw,xw) 390 #endif 391 return(0) 392 End 393 394 Function fFourLevel(w,x) :FitFunc 293 395 Wave w 294 396 Variable x … … 334 436 End 335 437 336 Function SmearedOneLevel(w,x) :FitFunc 337 Wave w 338 Variable x 339 340 // Variable timer=StartMSTimer 341 Variable ans 342 SVAR sq = gSig_Q 343 SVAR qb = gQ_bar 344 SVAR sh = gShadow 345 SVAR gQ = gQVals 346 347 ans = Smear_Model_20(OneLevel,$sq,$qb,$sh,$gQ,w,x) 348 349 // Print "HS elapsed time(s) = ",StopMSTimer(timer)*1e-6 350 return(ans) 351 End 352 353 Function SmearedTwoLevel(w,x) :FitFunc 354 Wave w 355 Variable x 356 357 Variable ans 358 SVAR sq = gSig_Q 359 SVAR qb = gQ_bar 360 SVAR sh = gShadow 361 SVAR gQ = gQVals 362 363 ans = Smear_Model_20(TwoLevel,$sq,$qb,$sh,$gQ,w,x) 364 365 return(ans) 366 End 367 368 Function SmearedThreeLevel(w,x) :FitFunc 369 Wave w 370 Variable x 371 372 Variable ans 373 SVAR sq = gSig_Q 374 SVAR qb = gQ_bar 375 SVAR sh = gShadow 376 SVAR gQ = gQVals 377 378 ans = Smear_Model_20(ThreeLevel,$sq,$qb,$sh,$gQ,w,x) 379 380 return(ans) 381 End 382 383 Function SmearedFourLevel(w,x) :FitFunc 384 Wave w 385 Variable x 386 387 Variable ans 388 SVAR sq = gSig_Q 389 SVAR qb = gQ_bar 390 SVAR sh = gShadow 391 SVAR gQ = gQVals 392 393 ans = Smear_Model_20(FourLevel,$sq,$qb,$sh,$gQ,w,x) 394 395 return(ans) 396 End 438 Function SmearedOneLevel(s) :FitFunc 439 Struct ResSmearAAOStruct &s 440 441 // the name of your unsmeared model (AAO) is the first argument 442 s.yW = Smear_Model_20(OneLevel,s.coefW,s.xW,s.resW) 443 444 return(0) 445 End 446 447 448 Function SmearedTwoLevel(s) :FitFunc 449 Struct ResSmearAAOStruct &s 450 451 // the name of your unsmeared model (AAO) is the first argument 452 s.yW = Smear_Model_20(TwoLevel,s.coefW,s.xW,s.resW) 453 454 return(0) 455 End 456 457 458 Function SmearedThreeLevel(s) :FitFunc 459 Struct ResSmearAAOStruct &s 460 461 // the name of your unsmeared model (AAO) is the first argument 462 s.yW = Smear_Model_20(ThreeLevel,s.coefW,s.xW,s.resW) 463 464 return(0) 465 End 466 467 Function SmearedFourLevel(s) :FitFunc 468 Struct ResSmearAAOStruct &s 469 470 // the name of your unsmeared model (AAO) is the first argument 471 s.yW = Smear_Model_20(FourLevel,s.coefW,s.xW,s.resW) 472 473 return(0) 474 End 475 476 //wrapper to calculate the smeared model as an AAO-Struct 477 // fills the struct and calls the ususal function with the STRUCT parameter 478 // 479 // used only for the dependency, not for fitting 480 // 481 Function fSmearedOneLevel(coefW,yW,xW) 482 Wave coefW,yW,xW 483 484 String str = getWavesDataFolder(yW,0) 485 String DF="root:"+str+":" 486 487 WAVE resW = $(DF+str+"_res") 488 489 STRUCT ResSmearAAOStruct fs 490 WAVE fs.coefW = coefW 491 WAVE fs.yW = yW 492 WAVE fs.xW = xW 493 WAVE fs.resW = resW 494 495 Variable err 496 err = SmearedOneLevel(fs) 497 498 return (0) 499 End 500 501 //wrapper to calculate the smeared model as an AAO-Struct 502 // fills the struct and calls the ususal function with the STRUCT parameter 503 // 504 // used only for the dependency, not for fitting 505 // 506 Function fSmearedTwoLevel(coefW,yW,xW) 507 Wave coefW,yW,xW 508 509 String str = getWavesDataFolder(yW,0) 510 String DF="root:"+str+":" 511 512 WAVE resW = $(DF+str+"_res") 513 514 STRUCT ResSmearAAOStruct fs 515 WAVE fs.coefW = coefW 516 WAVE fs.yW = yW 517 WAVE fs.xW = xW 518 WAVE fs.resW = resW 519 520 Variable err 521 err = SmearedTwoLevel(fs) 522 523 return (0) 524 End 525 526 //wrapper to calculate the smeared model as an AAO-Struct 527 // fills the struct and calls the ususal function with the STRUCT parameter 528 // 529 // used only for the dependency, not for fitting 530 // 531 Function fSmearedThreeLevel(coefW,yW,xW) 532 Wave coefW,yW,xW 533 534 String str = getWavesDataFolder(yW,0) 535 String DF="root:"+str+":" 536 537 WAVE resW = $(DF+str+"_res") 538 539 STRUCT ResSmearAAOStruct fs 540 WAVE fs.coefW = coefW 541 WAVE fs.yW = yW 542 WAVE fs.xW = xW 543 WAVE fs.resW = resW 544 545 Variable err 546 err = SmearedThreeLevel(fs) 547 548 return (0) 549 End 550 551 //wrapper to calculate the smeared model as an AAO-Struct 552 // fills the struct and calls the ususal function with the STRUCT parameter 553 // 554 // used only for the dependency, not for fitting 555 // 556 Function fSmearedFourLevel(coefW,yW,xW) 557 Wave coefW,yW,xW 558 559 String str = getWavesDataFolder(yW,0) 560 String DF="root:"+str+":" 561 562 WAVE resW = $(DF+str+"_res") 563 564 STRUCT ResSmearAAOStruct fs 565 WAVE fs.coefW = coefW 566 WAVE fs.yW = yW 567 WAVE fs.xW = xW 568 WAVE fs.resW = resW 569 570 Variable err 571 err = SmearedFourLevel(fs) 572 573 return (0) 574 End
Note: See TracChangeset
for help on using the changeset viewer.