Changeset 128 for sans/Analysis/branches/ajj_23APR07
- Timestamp:
- Jul 25, 2007 3:07:20 PM (16 years ago)
- Location:
- sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006
- Files:
-
- 28 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 -
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/BimodalSchulzSpheres.ipf
r127 r128 26 26 parameters_bss[4,9] = {"volume fraction(2)","Radius (2)","polydispersity(2)","SLD(2)","SLD (solvent)","background (cm-1 sr-1)"} 27 27 Edit parameters_bss,coef_bss 28 ywave_bss := BimodalSchulzSpheres(coef_bss,xwave_bss) 28 29 Variable/G root:g_bss 30 g_bss := BimodalSchulzSpheres(coef_bss,ywave_bss,xwave_bss) 29 31 Display ywave_bss vs xwave_bss 30 32 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 36 38 37 39 /////////////////////////////////////////////////////////// 38 39 Proc PlotSmearedBimodalSchulzSpheres( )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 PlotSmearedBimodalSchulzSpheres(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 … … 55 59 // output smeared intensity wave, dimensions are identical to experimental QSIG values 56 60 // make extra copy of experimental q-values for easy plotting 57 Duplicate/O $ gQvalssmeared_bss,smeared_qvals61 Duplicate/O $(str+"_q") smeared_bss,smeared_qvals 58 62 SetScale d,0,0,"1/cm",smeared_bss 59 60 smeared_bss := SmearedBimodalSchulzSpheres(smear_coef_bss,$gQvals) 63 64 Variable/G gs_bss=0 65 gs_bss := fSmearedBimodalSchulzSpheres(smear_coef_bss,smeared_bss,smeared_qvals) //this wrapper fills the STRUCT 66 61 67 Display smeared_bss vs smeared_qvals 62 68 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 64 70 Label left "Intensity (cm\\S-1\\M)" 65 71 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 66 End 72 73 SetDataFolder root: 74 End 75 67 76 68 77 // Calculates some characteristic parameters for bimodal Shulz distribution … … 170 179 // unsmeared model calculation 171 180 /////////////////////////// 172 Function BimodalSchulzSpheres(w,k) : FitFunc 173 Wave w // the coefficient wave 174 Variable k // the x values, as a variable181 // now AAO function 182 Function BimodalSchulzSpheres(w,yw,xw) : FitFunc 183 Wave w,yw,xw // the coefficient wave, y, x 175 184 176 185 Variable ans=0 … … 192 201 193 202 //calculate both models and sum (add background here) 194 ans = SchulzSpheres(temp_coef_1,k) 195 ans += SchulzSpheres(temp_coef_2,k) 196 ans += w[9] //background 197 198 return(ans) 203 Duplicate/O xw tmp_ss1,tmp_ss2 204 SchulzSpheres(temp_coef_1,tmp_ss1,xw) 205 SchulzSpheres(temp_coef_2,tmp_ss2,xw) 206 yw = tmp_ss1 + tmp_ss2 207 yw += w[9] //background 208 209 return(0) 199 210 End 200 211 … … 208 219 End 209 220 221 //wrapper to calculate the smeared model as an AAO-Struct 222 // fills the struct and calls the ususal function with the STRUCT parameter 223 // 224 // used only for the dependency, not for fitting 225 // 226 Function fSmearedBimodalSchulzSpheres(coefW,yW,xW) 227 Wave coefW,yW,xW 228 229 String str = getWavesDataFolder(yW,0) 230 String DF="root:"+str+":" 231 232 WAVE resW = $(DF+str+"_res") 233 234 STRUCT ResSmearAAOStruct fs 235 WAVE fs.coefW = coefW 236 WAVE fs.yW = yW 237 WAVE fs.xW = xW 238 WAVE fs.resW = resW 239 240 Variable err 241 err = SmearedBimodalSchulzSpheres(fs) 242 243 return (0) 244 End 245 210 246 // this is all there is to the smeared calculation! 211 Function SmearedBimodalSchulzSpheres(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(BimodalSchulzSpheres,$sq,$qb,$sh,$gQ,w,x) 223 224 return(ans) 225 End 226 247 Function SmearedBimodalSchulzSpheres(s) :FitFunc 248 Struct ResSmearAAOStruct &s 249 250 // the name of your unsmeared model (AAO) is the first argument 251 s.yW = Smear_Model_20(BimodalSchulzSpheres,s.coefW,s.xW,s.resW) 252 253 return(0) 254 End 255 256 257 -
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 -
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 -
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/Cylinder_PolyRadius.ipf
r127 r128 28 28 make/o/t parameters_cypr = {"scale","radius (A)","length (A)","polydispersity of Radius","SLD diff (A^-2)","incoh. bkg (cm^-1)"} 29 29 Edit parameters_cypr,coef_cypr 30 ywave_cypr := Cyl_PolyRadius(coef_cypr,xwave_cypr) 30 31 Variable/G root:g_cypr 32 g_cypr := Cyl_PolyRadius(coef_cypr,ywave_cypr,xwave_cypr) 31 33 Display ywave_cypr vs xwave_cypr 32 34 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 37 39 38 40 /////////////////////////////////////////////////////////// 39 40 Proc PlotSmearedCyl_PolyRadius( )41 //no input parameters necessary, it MUST use the experimental q-values42 // from the experimental data read in from an AVE/QSIG data file43 44 // if no gQvals wave, data must not have been loaded=> abort45 if(ResolutionWavesMissing ())41 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 42 Proc PlotSmearedCyl_PolyRadius(str) 43 String str 44 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 45 46 // if any of the resolution waves are missing => abort 47 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 46 48 Abort 47 49 endif 50 51 SetDataFolder $("root:"+str) 48 52 49 53 // Setup parameter table for model function … … 54 58 // output smeared intensity wave, dimensions are identical to experimental QSIG values 55 59 // make extra copy of experimental q-values for easy plotting 56 Duplicate/O $ gQvalssmeared_cypr,smeared_qvals60 Duplicate/O $(str+"_q") smeared_cypr,smeared_qvals 57 61 SetScale d,0,0,"1/cm",smeared_cypr 58 59 smeared_cypr := SmearedCyl_PolyRadius(smear_coef_cypr,$gQvals) 62 63 Variable/G gs_cypr=0 64 gs_cypr := fSmearedCyl_PolyRadius(smear_coef_cypr,smeared_cypr,smeared_qvals) //this wrapper fills the STRUCT 65 60 66 Display smeared_cypr vs smeared_qvals 61 67 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 63 69 Label left "Intensity (cm\\S-1\\M)" 64 70 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 65 End 66 67 Function Cyl_PolyRadius(w,x) :FitFunc 71 72 SetDataFolder root: 73 End 74 75 76 77 //AAO version, uses XOP if available 78 // simply calls the original single point calculation with 79 // a wave assignment (this will behave nicely if given point ranges) 80 Function Cyl_PolyRadius(cw,yw,xw) : FitFunc 81 Wave cw,yw,xw 82 83 #if exists("Cyl_PolyRadiusX") 84 yw = Cyl_PolyRadiusX(cw,xw) 85 #else 86 yw = fCyl_PolyRadius(cw,xw) 87 #endif 88 return(0) 89 End 90 91 Function fCyl_PolyRadius(w,x) :FitFunc 68 92 Wave w 69 93 Variable x … … 185 209 kp[4] = 0 //bkg fixed at 0 186 210 187 Pq = CylinderForm(kp,qw) 188 // Pq = CylinderFormX(kp,qw) //from the XOP 211 #if exists("CylinderFormX") 212 Pq = CylinderFormX(kp,qw) 213 #else 214 Pq = fCylinderForm(kp,qw) 215 #endif 189 216 190 217 // undo the normalization that CylinderForm does … … 210 237 End 211 238 239 //wrapper to calculate the smeared model as an AAO-Struct 240 // fills the struct and calls the ususal function with the STRUCT parameter 241 // 242 // used only for the dependency, not for fitting 243 // 244 Function fSmearedCyl_PolyRadius(coefW,yW,xW) 245 Wave coefW,yW,xW 246 247 String str = getWavesDataFolder(yW,0) 248 String DF="root:"+str+":" 249 250 WAVE resW = $(DF+str+"_res") 251 252 STRUCT ResSmearAAOStruct fs 253 WAVE fs.coefW = coefW 254 WAVE fs.yW = yW 255 WAVE fs.xW = xW 256 WAVE fs.resW = resW 257 258 Variable err 259 err = SmearedCyl_PolyRadius(fs) 260 261 return (0) 262 End 263 212 264 // this is all there is to the smeared calculation! 213 Function SmearedCyl_PolyRadius(w,x) :FitFunc 214 Wave w 215 Variable x 216 217 Variable ans 218 SVAR sq = gSig_Q 219 SVAR qb = gQ_bar 220 SVAR sh = gShadow 221 SVAR gQ = gQVals 222 223 //the name of your unsmeared model is the first argument 224 ans = Smear_Model_20(Cyl_PolyRadius,$sq,$qb,$sh,$gQ,w,x) 225 226 return(ans) 227 End 265 Function SmearedCyl_PolyRadius(s) :FitFunc 266 Struct ResSmearAAOStruct &s 267 268 // the name of your unsmeared model (AAO) is the first argument 269 s.yW = Smear_Model_20(Cyl_PolyRadius,s.coefW,s.xW,s.resW) 270 271 return(0) 272 End -
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/Debye.ipf
r127 r128 15 15 make/O/T parameters_deb = {"scale","Rg (A)","bkg (cm-1)"} 16 16 Edit parameters_deb,coef_deb 17 ywave_deb := Debye(coef_deb,xwave_deb) 17 18 Variable/G root:g_deb 19 g_deb := Debye(coef_deb,ywave_deb,xwave_deb) 18 20 Display ywave_deb vs xwave_deb 19 21 ModifyGraph marker=29,msize=2,mode=4,log=1 … … 24 26 25 27 /////////////////////////////////////////////////////////// 26 Proc PlotSmearedDebye() 27 //no input parameters necessary, it MUST use the experimental q-values 28 // from the experimental data read in from an AVE/QSIG data file 28 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 29 Proc PlotSmearedDebye(str) 30 String str 31 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 29 32 30 // if no gQvals wave, data must not have been loaded=> abort31 if(ResolutionWavesMissing ())33 // if any of the resolution waves are missing => abort 34 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 32 35 Abort 33 36 endif 37 38 SetDataFolder $("root:"+str) 34 39 35 40 // Setup parameter table for model function … … 39 44 40 45 // output smeared intensity wave 41 Duplicate/O $ gQvalssmeared_deb,smeared_qvals46 Duplicate/O $(str+"_q") smeared_deb,smeared_qvals 42 47 SetScale d,0,0,"1/cm",smeared_deb 43 44 smeared_deb := SmearedDebye(smear_coef_deb,$gQvals) 48 49 Variable/G gs_deb=0 50 gs_deb := fSmearedDebye(smear_coef_deb,smeared_deb,smeared_qvals) //this wrapper fills the STRUCT 51 45 52 Display smeared_deb vs smeared_qvals 46 53 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 48 55 Label left "Intensity (cm\\S-1\\M)" 49 56 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 57 58 SetDataFolder root: 50 59 End 60 61 51 62 /////////////////////////////////////////////////////////////// 52 63 53 64 54 Function Debye(w,x) : FitFunc 65 //AAO version, uses XOP if available 66 // simply calls the original single point calculation with 67 // a wave assignment (this will behave nicely if given point ranges) 68 Function Debye(cw,yw,xw) : FitFunc 69 Wave cw,yw,xw 70 71 #if exists("DebyeX") 72 yw = DebyeX(cw,xw) 73 #else 74 yw = fDebye(cw,xw) 75 #endif 76 return(0) 77 End 78 79 Function fDebye(w,x) : FitFunc 55 80 Wave w 56 81 Variable x … … 78 103 End 79 104 105 //wrapper to calculate the smeared model as an AAO-Struct 106 // fills the struct and calls the ususal function with the STRUCT parameter 107 // 108 // used only for the dependency, not for fitting 109 // 110 Function fSmearedDebye(coefW,yW,xW) 111 Wave coefW,yW,xW 112 113 String str = getWavesDataFolder(yW,0) 114 String DF="root:"+str+":" 115 116 WAVE resW = $(DF+str+"_res") 117 118 STRUCT ResSmearAAOStruct fs 119 WAVE fs.coefW = coefW 120 WAVE fs.yW = yW 121 WAVE fs.xW = xW 122 WAVE fs.resW = resW 123 124 Variable err 125 err = SmearedDebye(fs) 126 127 return (0) 128 End 129 80 130 // this is all there is to the smeared calculation! 81 Function SmearedDebye(w,x) :FitFunc 82 Wave w 83 Variable x 131 Function SmearedDebye(s) :FitFunc 132 Struct ResSmearAAOStruct &s 133 134 // the name of your unsmeared model (AAO) is the first argument 135 s.yW = Smear_Model_20(Debye,s.coefW,s.xW,s.resW) 136 137 return(0) 138 End 84 139 85 Variable ans86 SVAR sq = gSig_Q87 SVAR qb = gQ_bar88 SVAR sh = gShadow89 SVAR gQ = gQVals90 91 //the name of your unsmeared model is the first argument92 ans = Smear_Model_20(Debye,$sq,$qb,$sh,$gQ,w,x)93 94 return(ans)95 End -
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/EllipticalCylinder.ipf
r127 r128 30 30 make/o/t parameters_ecf = {"scale","minor radius (A)","nu = major/minor (-)","length ()","SLD diff (A^-2)","incoh. bkg (cm^-1)"} 31 31 Edit parameters_ecf,coef_ecf 32 ywave_ecf := EllipCylForm(coef_ecf,xwave_ecf) 32 33 Variable/G root:g_ecf 34 g_ecf := EllipCyl20(coef_ecf,ywave_ecf,xwave_ecf) 33 35 Display ywave_ecf vs xwave_ecf 34 36 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 39 41 /////////////////////////////////////////////////////////// 40 42 41 Proc PlotSmearedEllipCylForm() 42 //no input parameters necessary, it MUST use the experimental q-values 43 // from the experimental data read in from an AVE/QSIG data file 44 45 // if no gQvals wave, data must not have been loaded => abort 46 if(ResolutionWavesMissing()) 43 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 44 Proc PlotSmearedEllipCylForm(str) 45 String str 46 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 47 48 // if any of the resolution waves are missing => abort 49 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 47 50 Abort 48 51 endif 52 53 SetDataFolder $("root:"+str) 49 54 50 55 // Setup parameter table for model function … … 55 60 // output smeared intensity wave, dimensions are identical to experimental QSIG values 56 61 // make extra copy of experimental q-values for easy plotting 57 Duplicate/O $ gQvalssmeared_ecf,smeared_qvals62 Duplicate/O $(str+"_q") smeared_ecf,smeared_qvals 58 63 SetScale d,0,0,"1/cm",smeared_ecf 59 60 smeared_ecf := SmearedEllipCylForm(smear_coef_ecf,$gQvals) 64 65 Variable/G gs_ecf=0 66 gs_ecf := fSmearedEllipCylForm(smear_coef_ecf,smeared_ecf,smeared_qvals) //this wrapper fills the STRUCT 67 61 68 Display smeared_ecf vs smeared_qvals 62 69 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 64 71 Label left "Intensity (cm\\S-1\\M)" 65 72 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 73 74 SetDataFolder root: 75 End 76 77 78 79 //AAO version, uses XOP if available 80 // simply calls the original single point calculation with 81 // a wave assignment (this will behave nicely if given point ranges) 82 Function EllipCyl20(cw,yw,xw) : FitFunc 83 Wave cw,yw,xw 84 85 #if exists("EllipCyl20X") 86 yw = EllipCyl20X(cw,xw) 87 #else 88 yw = fEllipCyl20(cw,xw) 89 #endif 90 return(0) 66 91 End 67 92 … … 70 95 // 20 points of quadrature seems to be sufficient for both integrals 71 96 // 72 Function EllipCylForm(w,x) : FitFunc97 Function fEllipCyl20(w,x) : FitFunc 73 98 Wave w 74 99 Variable x … … 139 164 End 140 165 166 //wrapper to calculate the smeared model as an AAO-Struct 167 // fills the struct and calls the ususal function with the STRUCT parameter 168 // 169 // used only for the dependency, not for fitting 170 // 171 Function fSmearedEllipCylForm(coefW,yW,xW) 172 Wave coefW,yW,xW 173 174 String str = getWavesDataFolder(yW,0) 175 String DF="root:"+str+":" 176 177 WAVE resW = $(DF+str+"_res") 178 179 STRUCT ResSmearAAOStruct fs 180 WAVE fs.coefW = coefW 181 WAVE fs.yW = yW 182 WAVE fs.xW = xW 183 WAVE fs.resW = resW 184 185 Variable err 186 err = SmearedEllipCylForm(fs) 187 188 return (0) 189 End 190 141 191 // this is all there is to the smeared calculation! 142 Function SmearedEllipCylForm(w,x) :FitFunc 143 Wave w 144 Variable x 145 146 Variable ans 147 SVAR sq = gSig_Q 148 SVAR qb = gQ_bar 149 SVAR sh = gShadow 150 SVAR gQ = gQVals 151 152 //the name of your unsmeared model is the first argument 153 ans = Smear_Model_20(EllipCylForm,$sq,$qb,$sh,$gQ,w,x) 154 155 return(ans) 156 End 192 Function SmearedEllipCylForm(s) :FitFunc 193 Struct ResSmearAAOStruct &s 194 195 // the name of your unsmeared model (AAO) is the first argument 196 s.yW = Smear_Model_20(EllipCyl20,s.coefW,s.xW,s.resW) 197 198 return(0) 199 End 200 -
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/FlexCyl_EllipCross.ipf
r127 r128 27 27 make/o/t parameters_fleell = {"scale","Contour Length (A)","Kuhn Length, b (A)","Minor Radius (a) (A)","Axis Ratio = major/a","contrast (A^-2)","bkgd (arb)"} 28 28 Edit parameters_fleell,coef_fleell 29 ywave_fleell := FlexCyl_Ellip(coef_fleell,xwave_fleell) 29 30 Variable/G root:g_fleell 31 g_fleell := FlexCyl_Ellip(coef_fleell,ywave_fleell,xwave_fleell) 30 32 Display ywave_fleell vs xwave_fleell 31 33 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 35 37 End 36 38 37 // setup the smeared model calculation38 // 39 Proc PlotSmeared_FlexCyl_Ellip() 40 // if no gQvals wave, data must not have been loaded => abort39 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 40 Proc PlotSmeared_FlexCyl_Ellip(str) 41 String str 42 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 41 43 42 if(ResolutionWavesMissing()) 44 // if any of the resolution waves are missing => abort 45 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 43 46 Abort 44 47 endif 48 49 SetDataFolder $("root:"+str) 45 50 46 51 // Setup parameter table for model function … … 51 56 // output smeared intensity wave, dimensions are identical to experimental QSIG values 52 57 // make extra copy of experimental q-values for easy plotting 53 Duplicate/O $ gQvalssmeared_fleell,smeared_qvals //58 Duplicate/O $(str+"_q") smeared_fleell,smeared_qvals // 54 59 SetScale d,0,0,"1/cm",smeared_fleell // 55 56 smeared_fleell := SmearedFlexCyl_Ellip(smear_coef_fleell,$gQvals) // SMEARED function name 60 61 Variable/G gs_fleell=0 62 gs_fleell := fSmearedFlexCyl_Ellip(smear_coef_fleell,smeared_fleell,smeared_qvals) //this wrapper fills the STRUCT 63 57 64 Display smeared_fleell vs smeared_qvals // 58 65 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 60 67 Label left "I(q) (cm\\S-1\\M)" 61 68 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 62 End // end macro 69 70 SetDataFolder root: 71 End 72 63 73 64 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 FlexCyl_Ellip(cw,yw,xw) : FitFunc 80 Wave cw,yw,xw 81 82 #if exists("FlexCyl_EllipX") 83 yw = FlexCyl_EllipX(cw,xw) 84 #else 85 yw = fFlexCyl_Ellip(cw,xw) 86 #endif 87 return(0) 88 End 89 65 90 // 66 Function FlexCyl_Ellip(ww,x) :FitFunc91 Function fFlexCyl_Ellip(ww,x) :FitFunc 67 92 Wave ww 68 93 Variable x … … 124 149 End 125 150 126 // this is all there is to the smeared calculation! 127 Function SmearedFlexCyl_Ellip(w,x) :FitFunc 128 Wave w 129 Variable x 151 //wrapper to calculate the smeared model as an AAO-Struct 152 // fills the struct and calls the ususal function with the STRUCT parameter 153 // 154 // used only for the dependency, not for fitting 155 // 156 Function fSmearedFlexCyl_Ellip(coefW,yW,xW) 157 Wave coefW,yW,xW 130 158 131 Variable ans 132 SVAR sq = gSig_Q 133 SVAR qb = gQ_bar 134 SVAR sh = gShadow 135 SVAR gQ = gQVals 159 String str = getWavesDataFolder(yW,0) 160 String DF="root:"+str+":" 136 161 137 //the name of your unsmeared model is the first argument 138 ans = Smear_Model_20(FlexCyl_Ellip,$sq,$qb,$sh,$gQ,w,x) 139 140 return(ans) 162 WAVE resW = $(DF+str+"_res") 163 164 STRUCT ResSmearAAOStruct fs 165 WAVE fs.coefW = coefW 166 WAVE fs.yW = yW 167 WAVE fs.xW = xW 168 WAVE fs.resW = resW 169 170 Variable err 171 err = SmearedFlexCyl_Ellip(fs) 172 173 return (0) 141 174 End 142 175 176 // this is all there is to the smeared calculation! 177 Function SmearedFlexCyl_Ellip(s) :FitFunc 178 Struct ResSmearAAOStruct &s 179 180 // the name of your unsmeared model (AAO) is the first argument 181 s.yW = Smear_Model_20(FlexCyl_Ellip,s.coefW,s.xW,s.resW) 182 183 return(0) 184 End 185 186 -
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/FlexCyl_PolyLen.ipf
r127 r128 20 20 make/o/t parameters_flepl = {"scale","Contour Length (A)","polydispersity of Contour Length","Kuhn Length, b (A)","Radius (A)","contrast (A^-2)","bkgd (cm^-1)"} 21 21 Edit parameters_flepl,coef_flepl 22 ywave_flepl := FlexCyl_PolyLen(coef_flepl,xwave_flepl) 22 23 Variable/G root:g_flepl 24 g_flepl := FlexCyl_PolyLen(coef_flepl,ywave_flepl,xwave_flepl) 23 25 Display ywave_flepl vs xwave_flepl 24 26 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 28 30 End 29 31 30 Proc PlotSmeared_FlexCyl_PolyLen() //MyModel 31 // if no gQvals wave, data must not have been loaded => abort 32 33 if(ResolutionWavesMissing()) 32 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 33 Proc PlotSmeared_FlexCyl_PolyLen(str) 34 String str 35 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 36 37 // if any of the resolution waves are missing => abort 38 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 34 39 Abort 35 40 endif 41 42 SetDataFolder $("root:"+str) 36 43 37 44 // Setup parameter table for model function … … 42 49 // output smeared intensity wave, dimensions are identical to experimental QSIG values 43 50 // make extra copy of experimental q-values for easy plotting 44 Duplicate/O $ gQvalssmeared_flepl,smeared_qvals //51 Duplicate/O $(str+"_q") smeared_flepl,smeared_qvals // 45 52 SetScale d,0,0,"1/cm",smeared_flepl // 46 47 smeared_flepl := SmearedFlexCyl_PolyLen(smear_coef_flepl,$gQvals) // SMEARED function name 53 54 Variable/G gs_flepl=0 55 gs_flepl := fSmearedFlexCyl_PolyLen(smear_coef_flepl,smeared_flepl,smeared_qvals) //this wrapper fills the STRUCT 56 48 57 Display smeared_flepl vs smeared_qvals // 49 58 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 51 60 Label left "I(q) (cm\\S-1\\M)" 52 61 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 53 End // end macro 62 63 SetDataFolder root: 64 End 65 54 66 55 67 Function Schulz_Point_flepl(x,avg,zz) … … 65 77 End 66 78 67 Function FlexCyl_PolyLen(w,x) : FitFunc 79 80 //AAO version, uses XOP if available 81 // simply calls the original single point calculation with 82 // a wave assignment (this will behave nicely if given point ranges) 83 Function FlexCyl_PolyLen(cw,yw,xw) : FitFunc 84 Wave cw,yw,xw 85 86 #if exists("FlexCyl_PolyLenX") 87 yw = FlexCyl_PolyLenX(cw,xw) 88 #else 89 yw = fFlexCyl_PolyLen(cw,xw) 90 #endif 91 return(0) 92 End 93 94 Function fFlexCyl_PolyLen(w,x) : FitFunc 68 95 Wave w 69 96 Variable x … … 172 199 kp[5] = 0 //bkg fixed at 0 173 200 174 Pq = FlexExclVolCyl(kp,qw) 201 #if exists("FlexExclVolCylX") 202 Pq = FlexExclVolCylX(kp,qw) 203 #else 204 Pq = fFlexExclVolCyl(kp,qw) 205 #endif 206 175 207 vcyl=Pi*rad*rad*len_i 176 208 Pq *= vcyl … … 182 214 End 183 215 216 //wrapper to calculate the smeared model as an AAO-Struct 217 // fills the struct and calls the ususal function with the STRUCT parameter 218 // 219 // used only for the dependency, not for fitting 220 // 221 Function fSmearedFlexCyl_PolyLen(coefW,yW,xW) 222 Wave coefW,yW,xW 223 224 String str = getWavesDataFolder(yW,0) 225 String DF="root:"+str+":" 226 227 WAVE resW = $(DF+str+"_res") 228 229 STRUCT ResSmearAAOStruct fs 230 WAVE fs.coefW = coefW 231 WAVE fs.yW = yW 232 WAVE fs.xW = xW 233 WAVE fs.resW = resW 234 235 Variable err 236 err = SmearedFlexCyl_PolyLen(fs) 237 238 return (0) 239 End 240 184 241 // this is all there is to the smeared calculation! 185 Function SmearedFlexCyl_PolyLen(w,x) :FitFunc 186 Wave w 187 Variable x 188 189 Variable ans 190 SVAR sq = gSig_Q 191 SVAR qb = gQ_bar 192 SVAR sh = gShadow 193 SVAR gQ = gQVals 194 195 //the name of your unsmeared model is the first argument 196 ans = Smear_Model_20(FlexCyl_PolyLen,$sq,$qb,$sh,$gQ,w,x) 197 198 return(ans) 199 End 242 Function SmearedFlexCyl_PolyLen(s) :FitFunc 243 Struct ResSmearAAOStruct &s 244 245 // the name of your unsmeared model (AAO) is the first argument 246 s.yW = Smear_Model_20(FlexCyl_PolyLen,s.coefW,s.xW,s.resW) 247 248 return(0) 249 End -
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/FlexCyl_PolyRadius.ipf
r127 r128 18 18 make/o/t parameters_fcpr = {"scale","Contour Length (A)","Kuhn Length, b (A)","Radius (A)","polydispersity of radius","contrast (A^-2)","bkgd (cm^-1)"} 19 19 Edit parameters_fcpr,coef_fcpr 20 ywave_fcpr := FlexCylPolyRad(coef_fcpr,xwave_fcpr) 20 21 Variable/G root:g_fcpr 22 g_fcpr := FlexCyl_PolyRad(coef_fcpr,ywave_fcpr,xwave_fcpr) 21 23 Display ywave_fcpr vs xwave_fcpr 22 24 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 26 28 End 27 29 28 29 Proc PlotSmearedFlexCyl_PolyRad( )30 //no input parameters necessary, it MUST use the experimental q-values31 // from the experimental data read in from an AVE/QSIG data file32 33 // if no gQvals wave, data must not have been loaded=> abort34 if(ResolutionWavesMissing ())30 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 31 Proc PlotSmearedFlexCyl_PolyRad(str) 32 String str 33 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 34 35 // if any of the resolution waves are missing => abort 36 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 35 37 Abort 36 38 endif 39 40 SetDataFolder $("root:"+str) 37 41 38 42 // Setup parameter table for model function … … 43 47 // output smeared intensity wave, dimensions are identical to experimental QSIG values 44 48 // make extra copy of experimental q-values for easy plotting 45 Duplicate/O $ gQvalssmeared_fcpr,smeared_qvals49 Duplicate/O $(str+"_q") smeared_fcpr,smeared_qvals 46 50 SetScale d,0,0,"1/cm",smeared_fcpr 47 48 smeared_fcpr := SmearedFlexCyl_PolyRad(smear_coef_fcpr,$gQvals) 51 52 Variable/G gs_fcpr=0 53 gs_fcpr := fSmearedFlexCyl_PolyRad(smear_coef_fcpr,smeared_fcpr,smeared_qvals) //this wrapper fills the STRUCT 54 49 55 Display smeared_fcpr vs smeared_qvals 50 56 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 52 58 Label left "Intensity (cm\\S-1\\M)" 53 59 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 60 61 SetDataFolder root: 62 End 63 64 65 66 //AAO version, uses XOP if available 67 // simply calls the original single point calculation with 68 // a wave assignment (this will behave nicely if given point ranges) 69 Function FlexCyl_PolyRad(cw,yw,xw) : FitFunc 70 Wave cw,yw,xw 71 72 #if exists("FlexCyl_PolyRadX") 73 yw = FlexCyl_PolyRadX(cw,xw) 74 #else 75 yw = fFlexCyl_PolyRad(cw,xw) 76 #endif 77 return(0) 54 78 End 55 79 … … 57 81 // to account for the polydispersity of the radius. 58 82 // 59 Function FlexCylPolyRad(w,x) : FitFunc83 Function fFlexCyl_PolyRad(w,x) : FitFunc 60 84 Wave w 61 85 Variable x … … 180 204 kp[5] = 0 //bkg fixed at 0 181 205 182 //Pq = CylinderForm(kp,qw) 183 Pq = FlexExclVolCyl(kp,qw) //from the XOP 206 #if exists("FlexExclVolCylX") 207 Pq = FlexExclVolCylX(kp,qw) 208 #else 209 Pq = fFlexExclVolCyl(kp,qw) 210 #endif 184 211 185 212 // undo the normalization that the form factor does … … 205 232 End 206 233 234 //wrapper to calculate the smeared model as an AAO-Struct 235 // fills the struct and calls the ususal function with the STRUCT parameter 236 // 237 // used only for the dependency, not for fitting 238 // 239 Function fSmearedFlexCyl_PolyRad(coefW,yW,xW) 240 Wave coefW,yW,xW 241 242 String str = getWavesDataFolder(yW,0) 243 String DF="root:"+str+":" 244 245 WAVE resW = $(DF+str+"_res") 246 247 STRUCT ResSmearAAOStruct fs 248 WAVE fs.coefW = coefW 249 WAVE fs.yW = yW 250 WAVE fs.xW = xW 251 WAVE fs.resW = resW 252 253 Variable err 254 err = SmearedFlexCyl_PolyRad(fs) 255 256 return (0) 257 End 258 207 259 // this is all there is to the smeared calculation! 208 Function SmearedFlexCyl_PolyRad(w,x) :FitFunc 209 Wave w 210 Variable x 211 212 Variable ans 213 SVAR sq = gSig_Q 214 SVAR qb = gQ_bar 215 SVAR sh = gShadow 216 SVAR gQ = gQVals 217 218 //the name of your unsmeared model is the first argument 219 ans = Smear_Model_20(FlexCylPolyRad,$sq,$qb,$sh,$gQ,w,x) 220 221 return(ans) 222 End 260 Function SmearedFlexCyl_PolyRad(s) :FitFunc 261 Struct ResSmearAAOStruct &s 262 263 // the name of your unsmeared model (AAO) is the first argument 264 s.yW = Smear_Model_20(FlexCyl_PolyRad,s.coefW,s.xW,s.resW) 265 266 return(0) 267 End -
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/FlexibleCylinder.ipf
r127 r128 30 30 make/o/t parameters_fle = {"scale","Contour Length (A)","Kuhn Length, b (A)","Radius (A)","contrast (A^-2)","bkgd (cm^-1)"} 31 31 Edit parameters_fle,coef_fle 32 ywave_fle := FlexExclVolCyl(coef_fle,xwave_fle) 32 33 Variable/G root:g_fle 34 g_fle := FlexExclVolCyl(coef_fle,ywave_fle,xwave_fle) 33 35 Display ywave_fle vs xwave_fle 34 36 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 39 41 /////////////////////////////////////////////////////////// 40 42 41 Proc PlotSmearedFlexExclVolCyl() 42 //no input parameters necessary, it MUST use the experimental q-values 43 // from the experimental data read in from an AVE/QSIG data file 44 45 // if no gQvals wave, data must not have been loaded => abort 46 if(ResolutionWavesMissing()) 43 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 44 Proc PlotSmearedFlexExclVolCyl(str) 45 String str 46 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 47 48 // if any of the resolution waves are missing => abort 49 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 47 50 Abort 48 51 endif 52 53 SetDataFolder $("root:"+str) 49 54 50 55 // Setup parameter table for model function … … 55 60 // output smeared intensity wave, dimensions are identical to experimental QSIG values 56 61 // make extra copy of experimental q-values for easy plotting 57 Duplicate/O $ gQvalssmeared_fle,smeared_qvals62 Duplicate/O $(str+"_q") smeared_fle,smeared_qvals 58 63 SetScale d,0,0,"1/cm",smeared_fle 59 60 smeared_fle := SmearedFlexExclVolCyl(smear_coef_fle,$gQvals) 64 65 Variable/G gs_fle=0 66 gs_fle := fSmearedFlexExclVolCyl(smear_coef_fle,smeared_fle,smeared_qvals) //this wrapper fills the STRUCT 67 61 68 Display smeared_fle vs smeared_qvals 62 69 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 64 71 Label left "Intensity (cm\\S-1\\M)" 65 72 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 73 74 SetDataFolder root: 66 75 End 67 68 // 69 Function FlexExclVolCyl(ww,x) 76 77 78 //AAO version, uses XOP if available 79 // simply calls the original single point calculation with 80 // a wave assignment (this will behave nicely if given point ranges) 81 Function FlexExclVolCyl(cw,yw,xw) : FitFunc 82 Wave cw,yw,xw 83 84 #if exists("FlexExclVolCylX") 85 yw = FlexExclVolCylX(cw,xw) 86 #else 87 yw = fFlexExclVolCyl(cw,xw) 88 #endif 89 return(0) 90 End 91 92 // 93 Function fFlexExclVolCyl(ww,x) 70 94 Wave ww 71 95 Variable x … … 468 492 ////////////////// 469 493 494 //wrapper to calculate the smeared model as an AAO-Struct 495 // fills the struct and calls the ususal function with the STRUCT parameter 496 // 497 // used only for the dependency, not for fitting 498 // 499 Function fSmearedFlexExclVolCyl(coefW,yW,xW) 500 Wave coefW,yW,xW 501 502 String str = getWavesDataFolder(yW,0) 503 String DF="root:"+str+":" 504 505 WAVE resW = $(DF+str+"_res") 506 507 STRUCT ResSmearAAOStruct fs 508 WAVE fs.coefW = coefW 509 WAVE fs.yW = yW 510 WAVE fs.xW = xW 511 WAVE fs.resW = resW 512 513 Variable err 514 err = SmearedFlexExclVolCyl(fs) 515 516 return (0) 517 End 518 470 519 // this is all there is to the smeared calculation! 471 Function SmearedFlexExclVolCyl(w,x) :FitFunc 472 Wave w 473 Variable x 474 475 Variable ans 476 SVAR sq = gSig_Q 477 SVAR qb = gQ_bar 478 SVAR sh = gShadow 479 SVAR gQ = gQVals 480 481 //the name of your unsmeared model is the first argument 482 ans = Smear_Model_20(FlexExclVolCyl,$sq,$qb,$sh,$gQ,w,x) 483 484 return(ans) 520 Function SmearedFlexExclVolCyl(s) :FitFunc 521 Struct ResSmearAAOStruct &s 522 523 // the name of your unsmeared model (AAO) is the first argument 524 s.yW = Smear_Model_20(FlexExclVolCyl,s.coefW,s.xW,s.resW) 525 526 return(0) 485 527 End -
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/Fractal.ipf
r127 r128 20 20 Make/O/D coef_fra = {0.05,5,2,100,2e-6,6.35e-6,0} 21 21 make/o/t parameters_fra = {"Volume Fraction (scale)","Block Radius (A)","fractal dimension","correlation length (A)","SLD block (A-2)","SLD solvent (A-2)","bkgd (cm^-1 sr^-1)"} 22 Edit parameters_fra,coef_fra 23 ywave_fra := Fractal(coef_fra,xwave_fra) 22 Edit parameters_fra,coef_fra 23 24 Variable/G root:g_fra 25 g_fra := Fractal(coef_fra,ywave_fra,xwave_fra) 24 26 Display ywave_fra vs xwave_fra 25 27 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 29 31 End 30 32 31 Proc PlotSmearedFractal() 33 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 34 Proc PlotSmearedFractal(str) 35 String str 36 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 32 37 33 // if no gQvals wave, data must not have been loaded=> abort34 If(ResolutionWavesMissing()) //part of GaussUtils38 // if any of the resolution waves are missing => abort 39 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 35 40 Abort 36 41 endif 42 43 SetDataFolder $("root:"+str) 37 44 38 45 // Setup parameter table for model function … … 43 50 // output smeared intensity wave, dimensions are identical to experimental QSIG values 44 51 // make extra copy of experimental q-values for easy plotting 45 Duplicate/O $ gQvalssmeared_fractal,smeared_qvals //52 Duplicate/O $(str+"_q") smeared_fractal,smeared_qvals // 46 53 SetScale d,0,0,"1/cm",smeared_fractal // 47 48 smeared_fractal := SmearedFractal(smear_coef_fractal,$gQvals) 54 55 Variable/G gs_fractal=0 56 gs_fractal := fSmearedFractal(smear_coef_fractal,smeared_fractal,smeared_qvals) //this wrapper fills the STRUCT 57 49 58 Display smeared_fractal vs smeared_qvals 50 59 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 52 61 Label left "I(q) (cm\\S-1\\M)" 53 62 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 54 End // end macro 63 64 SetDataFolder root: 65 End 66 67 55 68 56 69 //calculates the physical parameters related to the … … 86 99 End 87 100 101 //AAO version, uses XOP if available 102 // simply calls the original single point calculation with 103 // a wave assignment (this will behave nicely if given point ranges) 104 Function Fractal(cw,yw,xw) : FitFunc 105 Wave cw,yw,xw 106 107 #if exists("FractalX") 108 yw = FractalX(cw,xw) 109 #else 110 yw = fFractal(cw,xw) 111 #endif 112 return(0) 113 End 114 88 115 //fractal scattering function 89 Function Fractal(w,x) :FitFunc116 Function fFractal(w,x) :FitFunc 90 117 wave w 91 118 variable x … … 114 141 End 115 142 143 //wrapper to calculate the smeared model as an AAO-Struct 144 // fills the struct and calls the ususal function with the STRUCT parameter 145 // 146 // used only for the dependency, not for fitting 147 // 148 Function fSmearedFractal(coefW,yW,xW) 149 Wave coefW,yW,xW 150 151 String str = getWavesDataFolder(yW,0) 152 String DF="root:"+str+":" 153 154 WAVE resW = $(DF+str+"_res") 155 156 STRUCT ResSmearAAOStruct fs 157 WAVE fs.coefW = coefW 158 WAVE fs.yW = yW 159 WAVE fs.xW = xW 160 WAVE fs.resW = resW 161 162 Variable err 163 err = SmearedFractal(fs) 164 165 return (0) 166 End 167 116 168 //the smeared model calculation 117 Function SmearedFractal(w,x) :FitFunc 118 Wave w 119 Variable x 120 121 Variable ans 122 SVAR sq = gSig_Q 123 SVAR qb = gQ_bar 124 SVAR sh = gShadow 125 SVAR gQ = gQVals 126 127 ans = Smear_Model_20(Fractal,$sq,$qb,$sh,$gQ,w,x) 169 Function SmearedFractal(s) :FitFunc 170 Struct ResSmearAAOStruct &s 128 171 129 return(ans) 172 // the name of your unsmeared model (AAO) is the first argument 173 s.yW = Smear_Model_20(Fractal,s.coefW,s.xW,s.resW) 174 175 return(0) 130 176 End -
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/GaussSpheres.ipf
r127 r128 22 22 make/O/T parameters_pgs = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","bkg (cm-1 sr-1)"} 23 23 Edit parameters_pgs,coef_pgs 24 ywave_pgs := GaussPolySphere(coef_pgs,xwave_pgs) 24 25 Variable/G root:g_pgs 26 g_pgs := GaussPolySphere(coef_pgs,ywave_pgs,xwave_pgs) 25 27 Display ywave_pgs vs xwave_pgs 26 28 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 30 32 End 31 33 32 Proc PlotSmearedGaussPolySpheres() 33 //no input parameters necessary, it MUST use the experimental q-values 34 // from the experimental data read in from an AVE/QSIG data file 35 36 // if no gQvals wave, data must not have been loaded => abort 37 if(ResolutionWavesMissing()) 34 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 35 Proc PlotSmearedGaussPolySpheres(str) 36 String str 37 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 38 39 // if any of the resolution waves are missing => abort 40 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 38 41 Abort 39 42 endif 43 44 SetDataFolder $("root:"+str) 40 45 41 46 // Setup parameter table for model function … … 46 51 // output smeared intensity wave, dimensions are identical to experimental QSIG values 47 52 // make extra copy of experimental q-values for easy plotting 48 Duplicate/O $ gQvalssmeared_pgs,smeared_qvals53 Duplicate/O $(str+"_q") smeared_pgs,smeared_qvals 49 54 SetScale d,0,0,"1/cm",smeared_pgs 50 51 smeared_pgs := SmearedGaussPolySphere(smear_coef_pgs,$gQvals) 55 56 Variable/G gs_pgs=0 57 gs_pgs := fSmearedGaussPolySphere(smear_coef_pgs,smeared_pgs,smeared_qvals) //this wrapper fills the STRUCT 58 52 59 Display smeared_pgs vs smeared_qvals 53 60 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 55 62 Label left "Intensity (cm\\S-1\\M)" 56 63 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 57 End 58 59 60 Function GaussPolySphere(w,x) : FitFunc 64 65 SetDataFolder root: 66 End 67 68 69 70 71 //AAO version, uses XOP if available 72 // simply calls the original single point calculation with 73 // a wave assignment (this will behave nicely if given point ranges) 74 Function GaussPolySphere(cw,yw,xw) : FitFunc 75 Wave cw,yw,xw 76 77 #if exists("GaussPolySphereX") 78 yw = GaussPolySphereX(cw,xw) 79 #else 80 yw = fGaussPolySphere(cw,xw) 81 #endif 82 return(0) 83 End 84 85 Function fGaussPolySphere(w,x) : FitFunc 61 86 wave w 62 87 variable x … … 122 147 123 148 summ = 0.0 // initialize integral 149 Make/O/N=1 tmp_w 124 150 for(ii=0;ii<nord;ii+=1) 125 151 // calculate Gauss points on integration interval (r-value for evaluation) … … 127 153 sphere_temp[1] = zi 128 154 // calculate sphere scattering 129 yy = gauWt[ii] * Gauss_distr(sig,rad,zi) * SphereForm(sphere_temp,x) 155 SphereForm(sphere_temp,tmp_w,x) // AAO calculation, one point 156 yy = gauWt[ii] * Gauss_distr(sig,rad,zi) * tmp_w[0] 130 157 yy *= 4*pi/3*zi*zi*zi //un-normalize by current sphere volume 131 158 … … 144 171 End 145 172 173 //wrapper to calculate the smeared model as an AAO-Struct 174 // fills the struct and calls the ususal function with the STRUCT parameter 175 // 176 // used only for the dependency, not for fitting 177 // 178 Function fSmearedGaussPolySphere(coefW,yW,xW) 179 Wave coefW,yW,xW 180 181 String str = getWavesDataFolder(yW,0) 182 String DF="root:"+str+":" 183 184 WAVE resW = $(DF+str+"_res") 185 186 STRUCT ResSmearAAOStruct fs 187 WAVE fs.coefW = coefW 188 WAVE fs.yW = yW 189 WAVE fs.xW = xW 190 WAVE fs.resW = resW 191 192 Variable err 193 err = SmearedGaussPolySphere(fs) 194 195 return (0) 196 End 197 146 198 // this is all there is to the smeared calculation! 147 Function SmearedGaussPolySphere(w,x) :FitFunc 148 Wave w 149 Variable x 150 151 Variable ans 152 SVAR sq = gSig_Q 153 SVAR qb = gQ_bar 154 SVAR sh = gShadow 155 SVAR gQ = gQVals 156 157 //the name of your unsmeared model is the first argument 158 ans = Smear_Model_20(GaussPolySphere,$sq,$qb,$sh,$gQ,w,x) 159 160 return(ans) 161 End 199 Function SmearedGaussPolySphere(s) :FitFunc 200 Struct ResSmearAAOStruct &s 201 202 // the name of your unsmeared model (AAO) is the first argument 203 s.yW = Smear_Model_20(GaussPolySphere,s.coefW,s.xW,s.resW) 204 205 return(0) 206 End 207 162 208 163 209 -
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/GaussSpheres_and_Struct.ipf
r127 r128 23 23 make/O/T parameters_pgs_HS = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","bkg (cm-1 sr-1)"} 24 24 Edit parameters_pgs_HS,coef_pgs_HS 25 ywave_pgs_HS := GaussPolySphere_HS(coef_pgs_HS,xwave_pgs_HS) 25 26 Variable/G root:g_pgs_HS 27 g_pgs_HS := GaussPolySphere_HS(coef_pgs_HS,ywave_pgs_HS,xwave_pgs_HS) 26 28 Display ywave_pgs_HS vs xwave_pgs_HS 27 29 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 31 33 End 32 34 33 Proc PlotSmearedGaussPolySphere_HS() 34 //no input parameters necessary, it MUST use the experimental q-values 35 // from the experimental data read in from an AVE/QSIG data file 36 37 // if no gQvals wave, data must not have been loaded => abort 38 if(ResolutionWavesMissing()) 35 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 36 Proc PlotSmearedGaussPolySphere_HS(str) 37 String str 38 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 39 40 // if any of the resolution waves are missing => abort 41 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 39 42 Abort 40 43 endif 44 45 SetDataFolder $("root:"+str) 41 46 42 47 // Setup parameter table for model function … … 47 52 // output smeared intensity wave, dimensions are identical to experimental QSIG values 48 53 // make extra copy of experimental q-values for easy plotting 49 Duplicate/O $ gQvalssmeared_pgs_HS,smeared_qvals54 Duplicate/O $(str+"_q") smeared_pgs_HS,smeared_qvals 50 55 SetScale d,0,0,"1/cm",smeared_pgs_HS 51 52 smeared_pgs_HS := SmearedGaussPolySphere_HS(smear_coef_pgs_HS,$gQvals) 56 57 Variable/G gs_pgs_HS=0 58 gs_pgs_HS := fSmearedGaussPolySphere_HS(smear_coef_pgs_HS,smeared_pgs_HS,smeared_qvals) //this wrapper fills the STRUCT 59 53 60 Display smeared_pgs_HS vs smeared_qvals 54 61 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 56 63 Label left "Intensity (cm\\S-1\\M)" 57 64 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 58 End 59 60 Function GaussPolySphere_HS(w,x) : FitFunc 61 Wave w 62 Variable x 65 66 SetDataFolder root: 67 End 68 69 70 71 Function GaussPolySphere_HS(w,yw,xw) : FitFunc 72 Wave w,yw,xw 63 73 64 74 Variable inten … … 88 98 89 99 //calculate each and combine 90 inten = GaussPolySphere(form_pgs_HS,x) 91 inten *= HardSphereStruct(struct_pgs_HS,x) 92 inten *= w[0] 93 inten += w[5] 100 Duplicate/O xw tmp_pgs_HS_PQ,tmp_pgs_HS_SQ 101 GaussPolySphere(form_pgs_HS,tmp_pgs_HS_PQ,xw) 102 HardSphereStruct(struct_pgs_HS,tmp_pgs_HS_SQ,xw) 103 yw = tmp_pgs_HS_PQ * tmp_pgs_HS_SQ 104 yw *= w[0] 105 yw += w[5] 94 106 95 107 //cleanup waves 96 108 // Killwaves/Z form_pgs_HS,struct_pgs_HS 97 109 98 return ( inten)110 return (0) 99 111 End 100 112 … … 111 123 make/O/T parameters_pgs_SW = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","well depth (kT)","well width (diam.)","bkg (cm-1 sr-1)"} 112 124 Edit parameters_pgs_SW,coef_pgs_SW 113 ywave_pgs_SW := GaussPolySphere_SW(coef_pgs_SW,xwave_pgs_SW) 125 126 Variable/G root:g_pgs_SW 127 g_pgs_SW := GaussPolySphere_SW(coef_pgs_SW,ywave_pgs_SW,xwave_pgs_SW) 114 128 Display ywave_pgs_SW vs xwave_pgs_SW 115 129 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 119 133 End 120 134 121 Proc PlotSmearedGaussPolySphere_SW() 122 //no input parameters necessary, it MUST use the experimental q-values 123 // from the experimental data read in from an AVE/QSIG data file 124 125 // if no gQvals wave, data must not have been loaded => abort 126 if(ResolutionWavesMissing()) 135 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 136 Proc PlotSmearedGaussPolySphere_SW(str) 137 String str 138 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 139 140 // if any of the resolution waves are missing => abort 141 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 127 142 Abort 128 143 endif 144 145 SetDataFolder $("root:"+str) 129 146 130 147 // Setup parameter table for model function … … 135 152 // output smeared intensity wave, dimensions are identical to experimental QSIG values 136 153 // make extra copy of experimental q-values for easy plotting 137 Duplicate/O $ gQvalssmeared_pgs_SW,smeared_qvals154 Duplicate/O $(str+"_q") smeared_pgs_SW,smeared_qvals 138 155 SetScale d,0,0,"1/cm",smeared_pgs_SW 139 140 smeared_pgs_SW := SmearedGaussPolySphere_SW(smear_coef_pgs_SW,$gQvals) 156 157 Variable/G gs_pgs_SW=0 158 gs_pgs_SW := fSmearedGaussPolySphere_SW(smear_coef_pgs_SW,smeared_pgs_SW,smeared_qvals) //this wrapper fills the STRUCT 159 141 160 Display smeared_pgs_SW vs smeared_qvals 142 161 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 144 163 Label left "Intensity (cm\\S-1\\M)" 145 164 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 146 End 147 148 Function GaussPolySphere_SW(w,x) : FitFunc 149 Wave w 150 Variable x 165 166 SetDataFolder root: 167 End 168 169 170 Function GaussPolySphere_SW(w,yw,xw) : FitFunc 171 Wave w,yw,xw 151 172 152 173 Variable inten … … 177 198 178 199 //calculate each and combine 179 inten = GaussPolySphere(form_pgs_SW,x) 180 inten *= SquareWellStruct(struct_pgs_SW,x) 181 inten *= w[0] 182 inten += w[7] 200 Duplicate/O xw tmp_pgs_SW_PQ,tmp_pgs_SW_SQ 201 GaussPolySphere(form_pgs_SW,tmp_pgs_SW_PQ,xw) 202 SquareWellStruct(struct_pgs_SW,tmp_pgs_SW_SQ,xw) 203 yw = tmp_pgs_SW_PQ * tmp_pgs_SW_SQ 204 yw *= w[0] 205 yw += w[7] 183 206 184 207 //cleanup waves 185 208 // Killwaves/Z form_pgs_SW,struct_pgs_SW 186 209 187 return ( inten)210 return (0) 188 211 End 189 212 … … 208 231 make/O/T parameters_pgs_SC = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","charge","movalent salt(M)","Temperature (K)","dielectric const","bkg (cm-1 sr-1)"} 209 232 Edit parameters_pgs_SC,coef_pgs_SC 210 ywave_pgs_SC := GaussPolySphere_SC(coef_pgs_SC,xwave_pgs_SC) 233 234 Variable/G root:g_pgs_SC 235 g_pgs_SC := GaussPolySphere_SC(coef_pgs_SC,ywave_pgs_SC,xwave_pgs_SC) 211 236 Display ywave_pgs_SC vs xwave_pgs_SC 212 237 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 216 241 End 217 242 218 Proc PlotSmearedGaussPolySphere_SC() 219 //no input parameters necessary, it MUST use the experimental q-values 220 // from the experimental data read in from an AVE/QSIG data file 221 222 // if no gQvals wave, data must not have been loaded => abort 223 if(ResolutionWavesMissing()) 243 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 244 Proc PlotSmearedGaussPolySphere_SC(str) 245 String str 246 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 247 248 // if any of the resolution waves are missing => abort 249 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 224 250 Abort 225 251 endif 226 252 253 SetDataFolder $("root:"+str) 254 227 255 if (DataFolderExists("root:HayPenMSA")) 228 256 Make/O/D/N=17 root:HayPenMSA:gMSAWave … … 239 267 // output smeared intensity wave, dimensions are identical to experimental QSIG values 240 268 // make extra copy of experimental q-values for easy plotting 241 Duplicate/O $ gQvalssmeared_pgs_SC,smeared_qvals269 Duplicate/O $(str+"_q") smeared_pgs_SC,smeared_qvals 242 270 SetScale d,0,0,"1/cm",smeared_pgs_SC 243 244 smeared_pgs_SC := SmearedGaussPolySphere_SC(smear_coef_pgs_SC,$gQvals) 271 272 Variable/G gs_pgs_SC=0 273 gs_pgs_SC := fSmearedGaussPolySphere_SC(smear_coef_pgs_SC,smeared_pgs_SC,smeared_qvals) //this wrapper fills the STRUCT 274 245 275 Display smeared_pgs_SC vs smeared_qvals 246 276 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 248 278 Label left "Intensity (cm\\S-1\\M)" 249 279 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 250 End 251 252 Function GaussPolySphere_SC(w,x) : FitFunc 253 Wave w 254 Variable x 280 281 SetDataFolder root: 282 End 283 284 285 Function GaussPolySphere_SC(w,yw,xw) : FitFunc 286 Wave w,yw,xw 255 287 256 288 Variable inten … … 283 315 284 316 //calculate each and combine 285 inten = GaussPolySphere(form_pgs_SC,x) 286 inten *= HayterPenfoldMSA(struct_pgs_SC,x) 287 inten *= w[0] 288 inten += w[9] 317 Duplicate/O xw tmp_pgs_SC_PQ,tmp_pgs_SC_SQ 318 GaussPolySphere(form_pgs_SC,tmp_pgs_SC_PQ,xw) 319 HayterPenfoldMSA(struct_pgs_SC,tmp_pgs_SC_SQ,xw) 320 yw = tmp_pgs_SC_PQ * tmp_pgs_SC_SQ 321 yw *= w[0] 322 yw += w[9] 289 323 290 324 //cleanup waves 291 325 // Killwaves/Z form_pgs_SC,struct_pgs_SC 292 326 293 return ( inten)327 return (0) 294 328 End 295 329 … … 306 340 make/O/T parameters_pgs_SHS = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","perturbation parameter (0.1)","stickiness, tau","bkg (cm-1 sr-1)"} 307 341 Edit parameters_pgs_SHS,coef_pgs_SHS 308 ywave_pgs_SHS := GaussPolySphere_SHS(coef_pgs_SHS,xwave_pgs_SHS) 342 343 Variable/G root:g_pgs_SHS 344 g_pgs_SHS := GaussPolySphere_SHS(coef_pgs_SHS,ywave_pgs_SHS,xwave_pgs_SHS) 309 345 Display ywave_pgs_SHS vs xwave_pgs_SHS 310 346 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 314 350 End 315 351 316 Proc PlotSmearedGaussPolySphere_SHS() 317 //no input parameters necessary, it MUST use the experimental q-values 318 // from the experimental data read in from an AVE/QSIG data file 319 320 // if no gQvals wave, data must not have been loaded => abort 321 if(ResolutionWavesMissing()) 352 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 353 Proc PlotSmearedGaussPolySphere_SHS(str) 354 String str 355 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 356 357 // if any of the resolution waves are missing => abort 358 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 322 359 Abort 323 360 endif 361 362 SetDataFolder $("root:"+str) 324 363 325 364 // Setup parameter table for model function … … 330 369 // output smeared intensity wave, dimensions are identical to experimental QSIG values 331 370 // make extra copy of experimental q-values for easy plotting 332 Duplicate/O $ gQvalssmeared_pgs_SHS,smeared_qvals371 Duplicate/O $(str+"_q") smeared_pgs_SHS,smeared_qvals 333 372 SetScale d,0,0,"1/cm",smeared_pgs_SHS 334 335 smeared_pgs_SHS := SmearedGaussPolySphere_SHS(smear_coef_pgs_SHS,$gQvals) 373 374 Variable/G gs_pgs_SHS=0 375 gs_pgs_SHS := fSmearedGaussPolySphere_SHS(smear_coef_pgs_SHS,smeared_pgs_SHS,smeared_qvals) //this wrapper fills the STRUCT 376 336 377 Display smeared_pgs_SHS vs smeared_qvals 337 378 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 339 380 Label left "Intensity (cm\\S-1\\M)" 340 381 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 341 End 342 343 Function GaussPolySphere_SHS(w,x) : FitFunc 344 Wave w 345 Variable x 382 383 SetDataFolder root: 384 End 385 386 387 Function GaussPolySphere_SHS(w,yw,xw) : FitFunc 388 Wave w,yw,xw 346 389 347 390 Variable inten … … 372 415 373 416 //calculate each and combine 374 inten = GaussPolySphere(form_pgs_SHS,x) 375 inten *= StickyHS_Struct(struct_pgs_SHS,x) 376 inten *= w[0] 377 inten += w[7] 417 Duplicate/O xw tmp_pgs_SHS_PQ,tmp_pgs_SHS_SQ 418 GaussPolySphere(form_pgs_SHS,tmp_pgs_SHS_PQ,xw) 419 StickyHS_Struct(struct_pgs_SHS,tmp_pgs_SHS_SQ,xw) 420 yw = tmp_pgs_SHS_PQ * tmp_pgs_SHS_SQ 421 yw *= w[0] 422 yw += w[7] 378 423 379 424 //cleanup waves 380 425 // Killwaves/Z form_pgs_SHS,struct_pgs_SHS 381 426 382 return ( inten)427 return (0) 383 428 End 384 429 … … 386 431 387 432 // this is all there is to the smeared calculation! 388 Function SmearedGaussPolySphere_HS(w,x) :FitFunc 389 Wave w 390 Variable x 391 392 Variable ans 393 SVAR sq = gSig_Q 394 SVAR qb = gQ_bar 395 SVAR sh = gShadow 396 SVAR gQ = gQVals 397 398 //the name of your unsmeared model is the first argument 399 ans = Smear_Model_20(GaussPolySphere_HS,$sq,$qb,$sh,$gQ,w,x) 400 401 return(ans) 433 Function SmearedGaussPolySphere_HS(s) : FitFunc 434 Struct ResSmearAAOStruct &s 435 436 // the name of your unsmeared model (AAO) is the first argument 437 s.yW = Smear_Model_20(GaussPolySphere_HS,s.coefW,s.xW,s.resW) 438 439 return(0) 402 440 End 403 441 404 442 // this is all there is to the smeared calculation! 405 Function SmearedGaussPolySphere_SW(w,x) :FitFunc 406 Wave w 407 Variable x 408 409 Variable ans 410 SVAR sq = gSig_Q 411 SVAR qb = gQ_bar 412 SVAR sh = gShadow 413 SVAR gQ = gQVals 414 415 //the name of your unsmeared model is the first argument 416 ans = Smear_Model_20(GaussPolySphere_SW,$sq,$qb,$sh,$gQ,w,x) 417 418 return(ans) 443 Function SmearedGaussPolySphere_SW(s) : FitFunc 444 Struct ResSmearAAOStruct &s 445 446 // the name of your unsmeared model (AAO) is the first argument 447 s.yW = Smear_Model_20(GaussPolySphere_SW,s.coefW,s.xW,s.resW) 448 449 return(0) 419 450 End 420 451 421 452 // this is all there is to the smeared calculation! 422 Function SmearedGaussPolySphere_SC(w,x) :FitFunc 423 Wave w 424 Variable x 425 426 Variable ans 427 SVAR sq = gSig_Q 428 SVAR qb = gQ_bar 429 SVAR sh = gShadow 430 SVAR gQ = gQVals 431 432 //the name of your unsmeared model is the first argument 433 ans = Smear_Model_20(GaussPolySphere_SC,$sq,$qb,$sh,$gQ,w,x) 434 435 return(ans) 453 Function SmearedGaussPolySphere_SC(s) : FitFunc 454 Struct ResSmearAAOStruct &s 455 456 // the name of your unsmeared model (AAO) is the first argument 457 s.yW = Smear_Model_20(GaussPolySphere_SC,s.coefW,s.xW,s.resW) 458 459 return(0) 436 460 End 437 461 438 462 // this is all there is to the smeared calculation! 439 Function SmearedGaussPolySphere_SHS(w,x) :FitFunc 440 Wave w 441 Variable x 442 443 Variable ans 444 SVAR sq = gSig_Q 445 SVAR qb = gQ_bar 446 SVAR sh = gShadow 447 SVAR gQ = gQVals 448 449 //the name of your unsmeared model is the first argument 450 ans = Smear_Model_20(GaussPolySphere_SHS,$sq,$qb,$sh,$gQ,w,x) 451 452 return(ans) 453 End 463 Function SmearedGaussPolySphere_SHS(s) : FitFunc 464 Struct ResSmearAAOStruct &s 465 466 // the name of your unsmeared model (AAO) is the first argument 467 s.yW = Smear_Model_20(GaussPolySphere_SHS,s.coefW,s.xW,s.resW) 468 469 return(0) 470 End 471 472 //wrapper to calculate the smeared model as an AAO-Struct 473 // fills the struct and calls the ususal function with the STRUCT parameter 474 // 475 // used only for the dependency, not for fitting 476 // 477 Function fSmearedGaussPolySphere_HS(coefW,yW,xW) 478 Wave coefW,yW,xW 479 480 String str = getWavesDataFolder(yW,0) 481 String DF="root:"+str+":" 482 483 WAVE resW = $(DF+str+"_res") 484 485 STRUCT ResSmearAAOStruct fs 486 WAVE fs.coefW = coefW 487 WAVE fs.yW = yW 488 WAVE fs.xW = xW 489 WAVE fs.resW = resW 490 491 Variable err 492 err = SmearedGaussPolySphere_HS(fs) 493 494 return (0) 495 End 496 497 //wrapper to calculate the smeared model as an AAO-Struct 498 // fills the struct and calls the ususal function with the STRUCT parameter 499 // 500 // used only for the dependency, not for fitting 501 // 502 Function fSmearedGaussPolySphere_SW(coefW,yW,xW) 503 Wave coefW,yW,xW 504 505 String str = getWavesDataFolder(yW,0) 506 String DF="root:"+str+":" 507 508 WAVE resW = $(DF+str+"_res") 509 510 STRUCT ResSmearAAOStruct fs 511 WAVE fs.coefW = coefW 512 WAVE fs.yW = yW 513 WAVE fs.xW = xW 514 WAVE fs.resW = resW 515 516 Variable err 517 err = SmearedGaussPolySphere_SW(fs) 518 519 return (0) 520 End 521 522 //wrapper to calculate the smeared model as an AAO-Struct 523 // fills the struct and calls the ususal function with the STRUCT parameter 524 // 525 // used only for the dependency, not for fitting 526 // 527 Function fSmearedGaussPolySphere_SC(coefW,yW,xW) 528 Wave coefW,yW,xW 529 530 String str = getWavesDataFolder(yW,0) 531 String DF="root:"+str+":" 532 533 WAVE resW = $(DF+str+"_res") 534 535 STRUCT ResSmearAAOStruct fs 536 WAVE fs.coefW = coefW 537 WAVE fs.yW = yW 538 WAVE fs.xW = xW 539 WAVE fs.resW = resW 540 541 Variable err 542 err = SmearedGaussPolySphere_SC(fs) 543 544 return (0) 545 End 546 547 //wrapper to calculate the smeared model as an AAO-Struct 548 // fills the struct and calls the ususal function with the STRUCT parameter 549 // 550 // used only for the dependency, not for fitting 551 // 552 Function fSmearedGaussPolySphere_SHS(coefW,yW,xW) 553 Wave coefW,yW,xW 554 555 String str = getWavesDataFolder(yW,0) 556 String DF="root:"+str+":" 557 558 WAVE resW = $(DF+str+"_res") 559 560 STRUCT ResSmearAAOStruct fs 561 WAVE fs.coefW = coefW 562 WAVE fs.yW = yW 563 WAVE fs.xW = xW 564 WAVE fs.resW = resW 565 566 Variable err 567 err = SmearedGaussPolySphere_SHS(fs) 568 569 return (0) 570 End 571 -
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/LamellarFF.ipf
r127 r128 33 33 Edit parameters_LamellarFF, coef_LamellarFF 34 34 ModifyTable width(parameters_LamellarFF)=160 35 ywave_LamellarFF := LamellarFF(coef_LamellarFF, xwave_LamellarFF) 35 36 Variable/G root:g_LamellarFF 37 g_LamellarFF := LamellarFF(coef_LamellarFF, ywave_LamellarFF,xwave_LamellarFF) 36 38 Display ywave_LamellarFF vs xwave_LamellarFF 37 39 ModifyGraph marker=29, msize=2, mode=4 … … 43 45 End 44 46 45 // 46 //this macro sets up all the necessary parameters and waves that are 47 //needed to calculate the smeared model function. 48 // 49 //no input parameters are necessary, it MUST use the experimental q-values 50 // from the experimental data read in from an AVE/QSIG data file 51 //////////////////////////////////////////////////// 52 Proc PlotSmeared_LamellarFF() //Lamellar 47 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 48 Proc PlotSmeared_LamellarFF(str) 49 String str 50 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 53 51 54 // if no gQvals wave, data must not have been loaded=> abort55 If(ResolutionWavesMissing()) //part of GaussUtils52 // if any of the resolution waves are missing => abort 53 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 56 54 Abort 57 55 endif 56 57 SetDataFolder $("root:"+str) 58 58 59 59 // Setup parameter table for model function … … 64 64 // output smeared intensity wave, dimensions are identical to experimental QSIG values 65 65 // make extra copy of experimental q-values for easy plotting 66 Duplicate/O $ gQvalssmeared_LamellarFF,smeared_qvals //66 Duplicate/O $(str+"_q") smeared_LamellarFF,smeared_qvals // 67 67 SetScale d,0,0,"1/cm",smeared_LamellarFF // 68 69 smeared_LamellarFF := LamellarFF_Smeared(smear_coef_LamellarFF,$gQvals) // SMEARED function name 68 69 Variable/G gs_LamellarFF=0 70 gs_LamellarFF := fLamellarFF_Smeared(smear_coef_LamellarFF,smeared_LamellarFF,smeared_qvals) //this wrapper fills the STRUCT 71 70 72 Display smeared_LamellarFF vs smeared_qvals // 71 73 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 73 75 Label left "I(q) (cm\\S-1\\M)" 74 76 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 75 End // end macro 77 78 SetDataFolder root: 79 End 80 //////////////////////////////////////////////////// 81 82 83 84 //AAO version, uses XOP if available 85 // simply calls the original single point calculation with 86 // a wave assignment (this will behave nicely if given point ranges) 87 Function LamellarFF(cw,yw,xw) : FitFunc 88 Wave cw,yw,xw 89 90 #if exists("LamellarFFX") 91 yw = LamellarFFX(cw,xw) 92 #else 93 yw = fLamellarFF(cw,xw) 94 #endif 95 return(0) 96 End 76 97 77 98 //CH#1 … … 80 101 // based on the wave (array) of parameters that you send it (w) 81 102 // 82 Function LamellarFF(w,x) : FitFunc103 Function fLamellarFF(w,x) : FitFunc 83 104 Wave w 84 105 Variable x … … 115 136 End 116 137 117 //the smeared model calculation 118 Function LamellarFF_Smeared(w,x) :FitFunc 119 Wave w 120 Variable x 138 //wrapper to calculate the smeared model as an AAO-Struct 139 // fills the struct and calls the ususal function with the STRUCT parameter 140 // 141 // used only for the dependency, not for fitting 142 // 143 Function fLamellarFF_Smeared(coefW,yW,xW) 144 Wave coefW,yW,xW 121 145 122 Variable ans 123 SVAR sq = gSig_Q 124 SVAR qb = gQ_bar 125 SVAR sh = gShadow 126 SVAR gQ = gQVals 146 String str = getWavesDataFolder(yW,0) 147 String DF="root:"+str+":" 127 148 128 ans = Smear_Model_20(LamellarFF,$sq,$qb,$sh,$gQ,w,x) 129 130 return(ans) 149 WAVE resW = $(DF+str+"_res") 150 151 STRUCT ResSmearAAOStruct fs 152 WAVE fs.coefW = coefW 153 WAVE fs.yW = yW 154 WAVE fs.xW = xW 155 WAVE fs.resW = resW 156 157 Variable err 158 err = LamellarFF_Smeared(fs) 159 160 return (0) 131 161 End 132 162 163 //the smeared model calculation 164 Function LamellarFF_Smeared(s) :FitFunc 165 Struct ResSmearAAOStruct &s 166 167 // the name of your unsmeared model (AAO) is the first argument 168 s.yW = Smear_Model_20(LamellarFF,s.coefW,s.xW,s.resW) 169 170 return(0) 171 End -
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/LamellarFF_HG.ipf
r127 r128 35 35 Edit parameters_LamellarFF_HG, coef_LamellarFF_HG 36 36 ModifyTable width(parameters_LamellarFF_HG)=160 37 ywave_LamellarFF_HG := LamellarFF_HG(coef_LamellarFF_HG, xwave_LamellarFF_HG) 37 38 Variable/G root:g_LamellarFF_HG 39 g_LamellarFF_HG := LamellarFF_HG(coef_LamellarFF_HG, ywave_LamellarFF_HG, xwave_LamellarFF_HG) 38 40 Display ywave_LamellarFF_HG vs xwave_LamellarFF_HG 39 41 ModifyGraph marker=29, msize=2, mode=4 … … 45 47 End 46 48 47 // 48 //this macro sets up all the necessary parameters and waves that are 49 //needed to calculate the smeared model function. 50 // 51 //no input parameters are necessary, it MUST use the experimental q-values 52 // from the experimental data read in from an AVE/QSIG data file 53 //////////////////////////////////////////////////// 54 Proc PlotSmeared_LamellarFF_HG() //Lamellar 49 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 50 Proc PlotSmeared_LamellarFF_HG(str) 51 String str 52 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 55 53 56 // if no gQvals wave, data must not have been loaded=> abort57 If(ResolutionWavesMissing()) //part of GaussUtils54 // if any of the resolution waves are missing => abort 55 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 58 56 Abort 59 57 endif 58 59 SetDataFolder $("root:"+str) 60 60 61 61 // Setup parameter table for model function … … 66 66 // output smeared intensity wave, dimensions are identical to experimental QSIG values 67 67 // make extra copy of experimental q-values for easy plotting 68 Duplicate/O $ gQvalssmeared_LamellarFF_HG,smeared_qvals //68 Duplicate/O $(str+"_q") smeared_LamellarFF_HG,smeared_qvals // 69 69 SetScale d,0,0,"1/cm",smeared_LamellarFF_HG // 70 71 smeared_LamellarFF_HG := LamellarFF_HG_Smeared(smear_coef_LamellarFF_HG,$gQvals) // SMEARED function name 70 71 Variable/G gs_LamellarFF_HG=0 72 gs_LamellarFF_HG := fLamellarFF_HG_Smeared(smear_coef_LamellarFF_HG,smeared_LamellarFF_HG,smeared_qvals) //this wrapper fills the STRUCT 73 72 74 Display smeared_LamellarFF_HG vs smeared_qvals // 73 75 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 75 77 Label left "I(q) (cm\\S-1\\M)" 76 78 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 77 End // end macro 79 80 SetDataFolder root: 81 End 82 83 84 85 //AAO version, uses XOP if available 86 // simply calls the original single point calculation with 87 // a wave assignment (this will behave nicely if given point ranges) 88 Function LamellarFF_HG(cw,yw,xw) : FitFunc 89 Wave cw,yw,xw 90 91 #if exists("LamellarFF_HGX") 92 yw = LamellarFF_HGX(cw,xw) 93 #else 94 yw = fLamellarFF_HG(cw,xw) 95 #endif 96 return(0) 97 End 78 98 79 99 //CH#1 … … 82 102 // based on the wave (array) of parameters that you send it (w) 83 103 // 84 Function LamellarFF_HG(w,x) : FitFunc104 Function fLamellarFF_HG(w,x) : FitFunc 85 105 Wave w 86 106 Variable x … … 124 144 End 125 145 146 //wrapper to calculate the smeared model as an AAO-Struct 147 // fills the struct and calls the ususal function with the STRUCT parameter 148 // 149 // used only for the dependency, not for fitting 150 // 151 Function fLamellarFF_HG_Smeared(coefW,yW,xW) 152 Wave coefW,yW,xW 153 154 String str = getWavesDataFolder(yW,0) 155 String DF="root:"+str+":" 156 157 WAVE resW = $(DF+str+"_res") 158 159 STRUCT ResSmearAAOStruct fs 160 WAVE fs.coefW = coefW 161 WAVE fs.yW = yW 162 WAVE fs.xW = xW 163 WAVE fs.resW = resW 164 165 Variable err 166 err = LamellarFF_HG_Smeared(fs) 167 168 return (0) 169 End 170 126 171 //the smeared model calculation 127 Function LamellarFF_HG_Smeared(w,x) :FitFunc 128 Wave w 129 Variable x 130 131 Variable ans 132 SVAR sq = gSig_Q 133 SVAR qb = gQ_bar 134 SVAR sh = gShadow 135 SVAR gQ = gQVals 136 137 ans = Smear_Model_20(LamellarFF_HG,$sq,$qb,$sh,$gQ,w,x) 172 Function LamellarFF_HG_Smeared(s) :FitFunc 173 Struct ResSmearAAOStruct &s 138 174 139 return(ans) 175 // the name of your unsmeared model (AAO) is the first argument 176 s.yW = Smear_Model_20(LamellarFF_HG,s.coefW,s.xW,s.resW) 177 178 return(0) 140 179 End -
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/LamellarPS.ipf
r127 r128 63 63 Edit parameters_LamellarPS, coef_LamellarPS 64 64 ModifyTable width(parameters_LamellarPS)=160 65 ywave_LamellarPS := LamellarPS(coef_LamellarPS, xwave_LamellarPS) 65 66 Variable/G root:g_LamellarPS 67 g_LamellarPS := LamellarPS(coef_LamellarPS, ywave_LamellarPS, xwave_LamellarPS) 66 68 Display ywave_LamellarPS vs xwave_LamellarPS 67 69 ModifyGraph marker=29, msize=2, mode=4 … … 77 79 End 78 80 79 //// 80 ////this macro sets up all the necessary parameters and waves that are 81 ////needed to calculate the smeared model function. 82 //// 83 ////no input parameters are necessary, it MUST use the experimental q-values 84 //// from the experimental data read in from an AVE/QSIG data file 85 ////////////////////////////////////////////////////// 86 //Macro PlotSmeared_LamellarPS() //Lamellar 87 // 88 // 89 // // if no gQvals wave, data must not have been loaded => abort 90 // If(ResolutionWavesMissing()) //part of GaussUtils 81 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 82 //Proc PlotSmeared_LamellarPS(str) 83 // String str 84 // Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 85 // 86 // // if any of the resolution waves are missing => abort 87 // if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 91 88 // Abort 92 89 // endif 90 // 91 // SetDataFolder $("root:"+str) 93 92 // 94 93 // // constants … … 102 101 // // output smeared intensity wave, dimensions are identical to experimental QSIG values 103 102 // // make extra copy of experimental q-values for easy plotting 104 // Duplicate/O $ gQvalssmeared_LamellarPS,smeared_qvals //103 // Duplicate/O $(str+"_q") smeared_LamellarPS,smeared_qvals // 105 104 // SetScale d,0,0,"1/cm",smeared_LamellarPS // 106 // 107 // smeared_LamellarPS := LamellarPS_Smeared(smear_coef_LamellarPS,$gQvals) // SMEARED function name 108 // Display smeared_LamellarPS vs $gQvals // 105 // 106 // Variable/G gs_LamellarPS=0 107 // gs_LamellarPS := fLamellarPS_Smeared(smear_coef_LamellarPS,smeared_LamellarPS,smeared_qvals) //this wrapper fills the STRUCT 108 // 109 // Display smeared_LamellarPS vs smeared_qvals // 109 110 // ModifyGraph log=1,marker=29,msize=2,mode=4 110 111 // Label bottom "q (\\S-1\\M)" 111 112 // Label left "I(q) (cm\\S-1\\M)" 112 // 113 //End // end macro 113 // 114 // SetDataFolder root: 115 //End 116 117 118 119 120 121 //AAO version, uses XOP if available 122 // simply calls the original single point calculation with 123 // a wave assignment (this will behave nicely if given point ranges) 124 Function LamellarPS(cw,yw,xw) : FitFunc 125 Wave cw,yw,xw 126 127 #if exists("LamellarPSX") 128 yw = LamellarPSX(cw,xw) 129 #else 130 yw = fLamellarPS(cw,xw) 131 #endif 132 return(0) 133 End 114 134 115 135 // instrument resolution IS included here in S(Q) 116 Function LamellarPS(w,x) : FitFunc136 Function fLamellarPS(w,x) : FitFunc 117 137 Wave w 118 138 Variable x … … 191 211 Return (inten+bkg) 192 212 End 193 213 214 //wrapper to calculate the smeared model as an AAO-Struct 215 // fills the struct and calls the ususal function with the STRUCT parameter 216 // 217 // used only for the dependency, not for fitting 218 // 219 //Function fLamellarPS_Smeared(coefW,yW,xW) 220 // Wave coefW,yW,xW 221 // 222 // String str = getWavesDataFolder(yW,0) 223 // String DF="root:"+str+":" 224 // 225 // WAVE resW = $(DF+str+"_res") 226 // 227 // STRUCT ResSmearAAOStruct fs 228 // WAVE fs.coefW = coefW 229 // WAVE fs.yW = yW 230 // WAVE fs.xW = xW 231 // WAVE fs.resW = resW 232 // 233 // Variable err 234 // err = LamellarPS_Smeared(fs) 235 // 236 // return (0) 237 //End 238 194 239 //the smeared model calculation 195 //Function LamellarPS_Smeared(w,x) :FitFunc 196 // Wave w 197 // Variable x 198 // 199 // Variable ans 200 // SVAR sq = gSig_Q 201 // SVAR qb = gQ_bar 202 // SVAR sh = gShadow 203 // SVAR gQ = gQVals 204 // 205 // ans = Smear_Model_20(LamellarPS,$sq,$qb,$sh,$gQ,w,x) 206 // 207 // return(ans) 240 //Function LamellarPS_Smeared(s) :FitFunc 241 // Struct ResSmearAAOStruct &s 242 // 243 //// the name of your unsmeared model (AAO) is the first argument 244 // s.yW = Smear_Model_20(LamellarPS,s.coefW,s.xW,s.resW) 245 // 246 // return(0) 208 247 //End 209 // 248 //// -
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/LamellarPS_HG.ipf
r127 r128 63 63 Edit parameters_LamellarPS_HG, coef_LamellarPS_HG 64 64 ModifyTable width(parameters_LamellarPS_HG)=160 65 ywave_LamellarPS_HG := LamellarPS_HG(coef_LamellarPS_HG, xwave_LamellarPS_HG) 65 66 Variable/G root:g_LamellarPS_HS 67 g_LamellarPS_HG := LamellarPS_HG(coef_LamellarPS_HG, ywave_LamellarPS_HG,xwave_LamellarPS_HG) 66 68 Display ywave_LamellarPS_HG vs xwave_LamellarPS_HG 67 69 ModifyGraph marker=29, msize=2, mode=4 … … 77 79 End 78 80 79 // 80 //this macro sets up all the necessary parameters and waves that are 81 //needed to calculate the smeared model function. 82 // 83 //no input parameters are necessary, it MUST use the experimental q-values 84 // from the experimental data read in from an AVE/QSIG data file 85 //////////////////////////////////////////////////// 86 //Proc PlotSmeared_LamellarPS_HG() //Lamellar 87 // 88 // // if no gQvals wave, data must not have been loaded => abort 89 // If(ResolutionWavesMissing()) //part of GaussUtils 81 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 82 //Proc PlotSmeared_LamellarPS_HG(str) 83 // String str 84 // Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 85 // 86 // // if any of the resolution waves are missing => abort 87 // if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 90 88 // Abort 91 89 // endif 90 // 91 // SetDataFolder $("root:"+str) 92 92 // 93 93 // // constants … … 101 101 // // output smeared intensity wave, dimensions are identical to experimental QSIG values 102 102 // // make extra copy of experimental q-values for easy plotting 103 // Duplicate/O $ gQvalssmeared_LamellarPS_HG,smeared_qvals //103 // Duplicate/O $(str+"_q") smeared_LamellarPS_HG,smeared_qvals // 104 104 // SetScale d,0,0,"1/cm",smeared_LamellarPS_HG // 105 // 106 // smeared_LamellarPS_HG := LamellarPS_HG_Smeared(smear_coef_LamellarPS_HG,$gQvals) // SMEARED function name 107 // Display smeared_LamellarPS_HG vs $gQvals // 105 // 106 // Variable/G gs_LamellarPS_HG =0 107 // gs_LamellarPS_HG := fLamellarPS_HG_Smeared(smear_coef_LamellarPS_HG ,smeared_LamellarPS_HG ,smeared_qvals) //this wrapper fills the STRUCT 108 // 109 // Display smeared_LamellarPS_HG vs smeared_qvals // 108 110 // ModifyGraph log=1,marker=29,msize=2,mode=4 109 111 // Label bottom "q (\\S-1\\M)" 110 112 // Label left "I(q) (cm\\S-1\\M)" 111 // 112 //End // end macro 113 114 115 // 116 Function LamellarPS_HG(w,x) : FitFunc 113 // 114 // SetDataFolder root: 115 //End 116 117 118 119 //AAO version, uses XOP if available 120 // simply calls the original single point calculation with 121 // a wave assignment (this will behave nicely if given point ranges) 122 Function LamellarPS_HG(cw,yw,xw) : FitFunc 123 Wave cw,yw,xw 124 125 #if exists("LamellarPS_HGX") 126 yw = LamellarPS_HGX(cw,xw) 127 #else 128 yw = fLamellarPS_HG(cw,xw) 129 #endif 130 return(0) 131 End 132 133 // 134 Function fLamellarPS_HG(w,x) : FitFunc 117 135 Wave w 118 136 Variable x … … 202 220 End 203 221 204 ////the smeared model calculation 205 //Function LamellarPS_HG_Smeared(w,x) :FitFunc 206 // Wave w 207 // Variable x 208 // 209 // Variable ans 210 // SVAR sq = gSig_Q 211 // SVAR qb = gQ_bar 212 // SVAR sh = gShadow 213 // SVAR gQ = gQVals 214 // 215 // ans = Smear_Model_20(LamellarPS_HG,$sq,$qb,$sh,$gQ,w,x) 216 // 217 // return(ans) 218 //End 222 //wrapper to calculate the smeared model as an AAO-Struct 223 // fills the struct and calls the ususal function with the STRUCT parameter 224 // 225 // used only for the dependency, not for fitting 226 // 227 //Function fLamellarPS_HG_Smeared(coefW,yW,xW) 228 // Wave coefW,yW,xW 229 // 230 // String str = getWavesDataFolder(yW,0) 231 // String DF="root:"+str+":" 232 // 233 // WAVE resW = $(DF+str+"_res") 234 // 235 // STRUCT ResSmearAAOStruct fs 236 // WAVE fs.coefW = coefW 237 // WAVE fs.yW = yW 238 // WAVE fs.xW = xW 239 // WAVE fs.resW = resW 240 // 241 // Variable err 242 // err = LamellarPS_HG_Smeared(fs) 243 // 244 // return (0) 245 //End 246 247 //////the smeared model calculation 248 //Function LamellarPS_HG_Smeared(s) :FitFunc 249 // Struct ResSmearAAOStruct &s 250 // 251 //// the name of your unsmeared model (AAO) is the first argument 252 // s.yW = Smear_Model_20(LamellarPS_HG,s.coefW,s.xW,s.resW) 253 // 254 // return(0) 255 //End 256 -
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/LogNormSpheres_and_Struct.ipf
r127 r128 23 23 make/O/T parameters_lns_HS = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","bkg (cm-1 sr-1)"} 24 24 Edit parameters_lns_HS,coef_lns_HS 25 ywave_lns_HS := LogNormalSphere_HS(coef_lns_HS,xwave_lns_HS) 25 26 Variable/G root:g_lns_HS 27 g_lns_HS := LogNormalSphere_HS(coef_lns_HS,ywave_lns_HS,xwave_lns_HS) 26 28 Display ywave_lns_HS vs xwave_lns_HS 27 29 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 31 33 End 32 34 33 Proc PlotSmearedLogNormalSphere_HS() 34 //no input parameters necessary, it MUST use the experimental q-values 35 // from the experimental data read in from an AVE/QSIG data file 36 37 // if no gQvals wave, data must not have been loaded => abort 38 if(ResolutionWavesMissing()) 35 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 36 Proc PlotSmearedLogNormalSphere_HS(str) 37 String str 38 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 39 40 // if any of the resolution waves are missing => abort 41 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 39 42 Abort 40 43 endif 44 45 SetDataFolder $("root:"+str) 41 46 42 47 // Setup parameter table for model function … … 47 52 // output smeared intensity wave, dimensions are identical to experimental QSIG values 48 53 // make extra copy of experimental q-values for easy plotting 49 Duplicate/O $ gQvalssmeared_lns_HS,smeared_qvals54 Duplicate/O $(str+"_q") smeared_lns_HS,smeared_qvals 50 55 SetScale d,0,0,"1/cm",smeared_lns_HS 51 52 smeared_lns_HS := SmearedLogNormalSphere_HS(smear_coef_lns_HS,$gQvals) 56 57 Variable/G gs_lns_HS=0 58 gs_lns_HS := fSmearedLogNormalSphere_HS(smear_coef_lns_HS,smeared_lns_HS,smeared_qvals) //this wrapper fills the STRUCT 59 53 60 Display smeared_lns_HS vs smeared_qvals 54 61 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 56 63 Label left "Intensity (cm\\S-1\\M)" 57 64 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 58 End 59 60 Function LogNormalSphere_HS(w,x) : FitFunc 61 Wave w 62 Variable x 65 66 SetDataFolder root: 67 End 68 69 70 Function LogNormalSphere_HS(w,yw,xw) : FitFunc 71 Wave w,yw,xw 63 72 64 73 Variable inten … … 88 97 89 98 //calculate each and combine 90 inten = LogNormalPolySphere(form_lns_HS,x) 91 inten *= HardSphereStruct(struct_lns_HS,x) 92 inten *= w[0] 93 inten += w[5] 99 Duplicate/O xw tmp_lns_HS_PQ,tmp_lns_HS_SQ 100 LogNormalPolySphere(form_lns_HS,tmp_lns_HS_PQ,xw) 101 HardSphereStruct(struct_lns_HS,tmp_lns_HS_SQ,xw) 102 yw = tmp_lns_HS_PQ *tmp_lns_HS_SQ 103 yw *= w[0] 104 yw += w[5] 94 105 95 106 //cleanup waves 96 107 // Killwaves/Z form_lns_HS,struct_lns_HS 97 108 98 return ( inten)109 return (0) 99 110 End 100 111 … … 111 122 make/O/T parameters_lns_SW = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","well depth (kT)","well width (diam.)","bkg (cm-1 sr-1)"} 112 123 Edit parameters_lns_SW,coef_lns_SW 113 ywave_lns_SW := LogNormalSphere_SW(coef_lns_SW,xwave_lns_SW) 124 125 Variable/G root:g_lns_SW 126 g_lns_SW := LogNormalSphere_SW(coef_lns_SW,ywave_lns_SW,xwave_lns_SW) 114 127 Display ywave_lns_SW vs xwave_lns_SW 115 128 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 119 132 End 120 133 121 Proc PlotSmearedLogNormalSphere_SW() 122 //no input parameters necessary, it MUST use the experimental q-values 123 // from the experimental data read in from an AVE/QSIG data file 124 125 // if no gQvals wave, data must not have been loaded => abort 126 if(ResolutionWavesMissing()) 134 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 135 Proc PlotSmearedLogNormalSphere_SW(str) 136 String str 137 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 138 139 // if any of the resolution waves are missing => abort 140 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 127 141 Abort 128 142 endif 143 144 SetDataFolder $("root:"+str) 129 145 130 146 // Setup parameter table for model function … … 135 151 // output smeared intensity wave, dimensions are identical to experimental QSIG values 136 152 // make extra copy of experimental q-values for easy plotting 137 Duplicate/O $ gQvalssmeared_lns_SW,smeared_qvals153 Duplicate/O $(str+"_q") smeared_lns_SW,smeared_qvals 138 154 SetScale d,0,0,"1/cm",smeared_lns_SW 139 140 smeared_lns_SW := SmearedLogNormalSphere_SW(smear_coef_lns_SW,$gQvals) 155 156 Variable/G gs_lns_SW=0 157 gs_lns_SW := fSmearedLogNormalSphere_SW(smear_coef_lns_SW,smeared_lns_SW,smeared_qvals) //this wrapper fills the STRUCT 158 141 159 Display smeared_lns_SW vs smeared_qvals 142 160 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 144 162 Label left "Intensity (cm\\S-1\\M)" 145 163 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 146 End 147 148 Function LogNormalSphere_SW(w,x) : FitFunc 149 Wave w 150 Variable x 164 165 SetDataFolder root: 166 End 167 168 169 Function LogNormalSphere_SW(w,yw,xw) : FitFunc 170 Wave w,yw,xw 151 171 152 172 Variable inten … … 177 197 178 198 //calculate each and combine 179 inten = LogNormalPolySphere(form_lns_SW,x) 180 inten *= SquareWellStruct(struct_lns_SW,x) 181 inten *= w[0] 182 inten += w[7] 199 Duplicate/O xw tmp_lns_SW_PQ,tmp_lns_SW_SQ 200 LogNormalPolySphere(form_lns_SW,tmp_lns_SW_PQ,xw) 201 SquareWellStruct(struct_lns_SW,tmp_lns_SW_SQ,xw) 202 yw = tmp_lns_SW_PQ * tmp_lns_SW_SQ 203 yw *= w[0] 204 yw += w[7] 183 205 184 206 //cleanup waves 185 207 // Killwaves/Z form_lns_SW,struct_lns_SW 186 208 187 return ( inten)209 return (0) 188 210 End 189 211 … … 208 230 make/O/T parameters_lns_SC = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","charge","movalent salt(M)","Temperature (K)","dielectric const","bkg (cm-1 sr-1)"} 209 231 Edit parameters_lns_SC,coef_lns_SC 210 ywave_lns_SC := LogNormalSphere_SC(coef_lns_SC,xwave_lns_SC) 232 233 Variable/G root:g_lns_SC 234 g_lns_SC := LogNormalSphere_SC(coef_lns_SC,ywave_lns_SC,xwave_lns_SC) 211 235 Display ywave_lns_SC vs xwave_lns_SC 212 236 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 216 240 End 217 241 218 Proc PlotSmearedLogNormalSphere_SC() 219 //no input parameters necessary, it MUST use the experimental q-values 220 // from the experimental data read in from an AVE/QSIG data file 221 222 // if no gQvals wave, data must not have been loaded => abort 223 if(ResolutionWavesMissing()) 242 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 243 Proc PlotSmearedLogNormalSphere_SC(str) 244 String str 245 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 246 247 // if any of the resolution waves are missing => abort 248 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 224 249 Abort 225 250 endif 226 251 252 SetDataFolder $("root:"+str) 253 227 254 if (DataFolderExists("root:HayPenMSA")) 228 255 Make/O/D/N=17 root:HayPenMSA:gMSAWave … … 239 266 // output smeared intensity wave, dimensions are identical to experimental QSIG values 240 267 // make extra copy of experimental q-values for easy plotting 241 Duplicate/O $ gQvalssmeared_lns_SC,smeared_qvals268 Duplicate/O $(str+"_q") smeared_lns_SC,smeared_qvals 242 269 SetScale d,0,0,"1/cm",smeared_lns_SC 243 244 smeared_lns_SC := SmearedLogNormalSphere_SC(smear_coef_lns_SC,$gQvals) 270 271 Variable/G gs_lns_SC=0 272 gs_lns_SC := fSmearedLogNormalSphere_SC(smear_coef_lns_SC,smeared_lns_SC,smeared_qvals) //this wrapper fills the STRUCT 273 245 274 Display smeared_lns_SC vs smeared_qvals 246 275 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 248 277 Label left "Intensity (cm\\S-1\\M)" 249 278 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 250 End 251 252 Function LogNormalSphere_SC(w,x) : FitFunc 253 Wave w 254 Variable x 279 280 SetDataFolder root: 281 End 282 283 284 285 Function LogNormalSphere_SC(w,yw,xw) : FitFunc 286 Wave w,yw,xw 255 287 256 288 Variable inten … … 283 315 284 316 //calculate each and combine 285 inten = LogNormalPolySphere(form_lns_SC,x) 286 inten *= HayterPenfoldMSA(struct_lns_SC,x) 287 inten *= w[0] 288 inten += w[9] 317 Duplicate/O xw tmp_lns_SC_PQ,tmp_lns_SC_SQ 318 LogNormalPolySphere(form_lns_SC,tmp_lns_SC_PQ,xw) 319 HayterPenfoldMSA(struct_lns_SC,tmp_lns_SC_SQ,xw) 320 yw = tmp_lns_SC_PQ * tmp_lns_SC_SQ 321 yw *= w[0] 322 yw += w[9] 289 323 290 324 //cleanup waves 291 325 // Killwaves/Z form_lns_SC,struct_lns_SC 292 326 293 return ( inten)327 return (0) 294 328 End 295 329 … … 306 340 make/O/T parameters_lns_SHS = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","perturbation parameter (0.1)","stickiness, tau","bkg (cm-1 sr-1)"} 307 341 Edit parameters_lns_SHS,coef_lns_SHS 308 ywave_lns_SHS := LogNormalSphere_SHS(coef_lns_SHS,xwave_lns_SHS) 342 343 Variable/G root:g_lns_SHS 344 g_lns_SHS := LogNormalSphere_SHS(coef_lns_SHS,ywave_lns_SHS,xwave_lns_SHS) 309 345 Display ywave_lns_SHS vs xwave_lns_SHS 310 346 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 314 350 End 315 351 316 Proc PlotSmearedLogNormalSphere_SHS() 317 //no input parameters necessary, it MUST use the experimental q-values 318 // from the experimental data read in from an AVE/QSIG data file 319 320 // if no gQvals wave, data must not have been loaded => abort 321 if(ResolutionWavesMissing()) 352 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 353 Proc PlotSmearedLogNormalSphere_SHS(str) 354 String str 355 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 356 357 // if any of the resolution waves are missing => abort 358 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 322 359 Abort 323 360 endif 361 362 SetDataFolder $("root:"+str) 324 363 325 364 // Setup parameter table for model function … … 330 369 // output smeared intensity wave, dimensions are identical to experimental QSIG values 331 370 // make extra copy of experimental q-values for easy plotting 332 Duplicate/O $ gQvalssmeared_lns_SHS,smeared_qvals371 Duplicate/O $(str+"_q") smeared_lns_SHS,smeared_qvals 333 372 SetScale d,0,0,"1/cm",smeared_lns_SHS 334 335 smeared_lns_SHS := SmearedLogNormalSphere_SHS(smear_coef_lns_SHS,$gQvals) 373 374 Variable/G gs_lns_SHS=0 375 gs_lns_SHS := fSmearedLogNormalSphere_SHS(smear_coef_lns_SHS,smeared_lns_SHS,smeared_qvals) //this wrapper fills the STRUCT 376 336 377 Display smeared_lns_SHS vs smeared_qvals 337 378 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 339 380 Label left "Intensity (cm\\S-1\\M)" 340 381 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 341 End 342 343 Function LogNormalSphere_SHS(w,x) : FitFunc 344 Wave w 345 Variable x 382 383 SetDataFolder root: 384 End 385 386 387 Function LogNormalSphere_SHS(w,yw,xw) : FitFunc 388 Wave w,yw,xw 346 389 347 390 Variable inten … … 372 415 373 416 //calculate each and combine 374 inten = LogNormalPolySphere(form_lns_SHS,x) 375 inten *= StickyHS_Struct(struct_lns_SHS,x) 376 inten *= w[0] 377 inten += w[7] 417 Duplicate/O xw tmp_lns_SHS_PQ,tmp_lns_SHS_SQ 418 LogNormalPolySphere(form_lns_SHS,tmp_lns_SHS_PQ,xw) 419 StickyHS_Struct(struct_lns_SHS,tmp_lns_SHS_SQ,xw) 420 yw = tmp_lns_SHS_PQ * tmp_lns_SHS_SQ 421 yw *= w[0] 422 yw += w[7] 378 423 379 424 //cleanup waves 380 425 // Killwaves/Z form_lns_SHS,struct_lns_SHS 381 426 382 return ( inten)427 return (0) 383 428 End 384 429 385 430 386 431 // this is all there is to the smeared calculation! 387 Function SmearedLogNormalSphere_HS(w,x) :FitFunc 388 Wave w 389 Variable x 390 391 Variable ans 392 SVAR sq = gSig_Q 393 SVAR qb = gQ_bar 394 SVAR sh = gShadow 395 SVAR gQ = gQVals 396 397 //the name of your unsmeared model is the first argument 398 ans = Smear_Model_20(LogNormalSphere_HS,$sq,$qb,$sh,$gQ,w,x) 399 400 return(ans) 432 Function SmearedLogNormalSphere_HS(s) : FitFunc 433 Struct ResSmearAAOStruct &s 434 435 // the name of your unsmeared model (AAO) is the first argument 436 s.yW = Smear_Model_20(LogNormalSphere_HS,s.coefW,s.xW,s.resW) 437 438 return(0) 401 439 End 402 440 403 441 // this is all there is to the smeared calculation! 404 Function SmearedLogNormalSphere_SW(w,x) :FitFunc 405 Wave w 406 Variable x 407 408 Variable ans 409 SVAR sq = gSig_Q 410 SVAR qb = gQ_bar 411 SVAR sh = gShadow 412 SVAR gQ = gQVals 413 414 //the name of your unsmeared model is the first argument 415 ans = Smear_Model_20(LogNormalSphere_SW,$sq,$qb,$sh,$gQ,w,x) 416 417 return(ans) 442 Function SmearedLogNormalSphere_SW(s) : FitFunc 443 Struct ResSmearAAOStruct &s 444 445 // the name of your unsmeared model (AAO) is the first argument 446 s.yW = Smear_Model_20(LogNormalSphere_SW,s.coefW,s.xW,s.resW) 447 448 return(0) 418 449 End 419 450 420 451 // this is all there is to the smeared calculation! 421 Function SmearedLogNormalSphere_SC(w,x) :FitFunc 422 Wave w 423 Variable x 424 425 Variable ans 426 SVAR sq = gSig_Q 427 SVAR qb = gQ_bar 428 SVAR sh = gShadow 429 SVAR gQ = gQVals 430 431 //the name of your unsmeared model is the first argument 432 ans = Smear_Model_20(LogNormalSphere_SC,$sq,$qb,$sh,$gQ,w,x) 433 434 return(ans) 452 Function SmearedLogNormalSphere_SC(s) : FitFunc 453 Struct ResSmearAAOStruct &s 454 455 // the name of your unsmeared model (AAO) is the first argument 456 s.yW = Smear_Model_20(LogNormalSphere_SC,s.coefW,s.xW,s.resW) 457 458 return(0) 435 459 End 436 460 437 461 // this is all there is to the smeared calculation! 438 Function SmearedLogNormalSphere_SHS(w,x) :FitFunc 439 Wave w 440 Variable x 441 442 Variable ans 443 SVAR sq = gSig_Q 444 SVAR qb = gQ_bar 445 SVAR sh = gShadow 446 SVAR gQ = gQVals 447 448 //the name of your unsmeared model is the first argument 449 ans = Smear_Model_20(LogNormalSphere_SHS,$sq,$qb,$sh,$gQ,w,x) 450 451 return(ans) 452 End 462 Function SmearedLogNormalSphere_SHS(s) : FitFunc 463 Struct ResSmearAAOStruct &s 464 465 // the name of your unsmeared model (AAO) is the first argument 466 s.yW = Smear_Model_20(LogNormalSphere_SHS,s.coefW,s.xW,s.resW) 467 468 return(0) 469 End 470 471 //wrapper to calculate the smeared model as an AAO-Struct 472 // fills the struct and calls the ususal function with the STRUCT parameter 473 // 474 // used only for the dependency, not for fitting 475 // 476 Function fSmearedLogNormalSphere_HS(coefW,yW,xW) 477 Wave coefW,yW,xW 478 479 String str = getWavesDataFolder(yW,0) 480 String DF="root:"+str+":" 481 482 WAVE resW = $(DF+str+"_res") 483 484 STRUCT ResSmearAAOStruct fs 485 WAVE fs.coefW = coefW 486 WAVE fs.yW = yW 487 WAVE fs.xW = xW 488 WAVE fs.resW = resW 489 490 Variable err 491 err = SmearedLogNormalSphere_HS(fs) 492 493 return (0) 494 End 495 496 //wrapper to calculate the smeared model as an AAO-Struct 497 // fills the struct and calls the ususal function with the STRUCT parameter 498 // 499 // used only for the dependency, not for fitting 500 // 501 Function fSmearedLogNormalSphere_SW(coefW,yW,xW) 502 Wave coefW,yW,xW 503 504 String str = getWavesDataFolder(yW,0) 505 String DF="root:"+str+":" 506 507 WAVE resW = $(DF+str+"_res") 508 509 STRUCT ResSmearAAOStruct fs 510 WAVE fs.coefW = coefW 511 WAVE fs.yW = yW 512 WAVE fs.xW = xW 513 WAVE fs.resW = resW 514 515 Variable err 516 err = SmearedLogNormalSphere_SW(fs) 517 518 return (0) 519 End 520 521 //wrapper to calculate the smeared model as an AAO-Struct 522 // fills the struct and calls the ususal function with the STRUCT parameter 523 // 524 // used only for the dependency, not for fitting 525 // 526 Function fSmearedLogNormalSphere_SC(coefW,yW,xW) 527 Wave coefW,yW,xW 528 529 String str = getWavesDataFolder(yW,0) 530 String DF="root:"+str+":" 531 532 WAVE resW = $(DF+str+"_res") 533 534 STRUCT ResSmearAAOStruct fs 535 WAVE fs.coefW = coefW 536 WAVE fs.yW = yW 537 WAVE fs.xW = xW 538 WAVE fs.resW = resW 539 540 Variable err 541 err = SmearedLogNormalSphere_SC(fs) 542 543 return (0) 544 End 545 546 //wrapper to calculate the smeared model as an AAO-Struct 547 // fills the struct and calls the ususal function with the STRUCT parameter 548 // 549 // used only for the dependency, not for fitting 550 // 551 Function fSmearedLogNormalSphere_SHS(coefW,yW,xW) 552 Wave coefW,yW,xW 553 554 String str = getWavesDataFolder(yW,0) 555 String DF="root:"+str+":" 556 557 WAVE resW = $(DF+str+"_res") 558 559 STRUCT ResSmearAAOStruct fs 560 WAVE fs.coefW = coefW 561 WAVE fs.yW = yW 562 WAVE fs.xW = xW 563 WAVE fs.resW = resW 564 565 Variable err 566 err = SmearedLogNormalSphere_SHS(fs) 567 568 return (0) 569 End 570 -
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/LogNormalSphere.ipf
r127 r128 19 19 make/O/T parameters_lns = {"Volume Fraction (scale)","exp(mu)=median Radius (A)","sigma","SLD sphere (A-2)","SLD solvent (A-2)","bkg (cm-1 sr-1)"} 20 20 Edit parameters_lns,coef_lns 21 ywave_lns := LogNormalPolySphere(coef_lns,xwave_lns) 21 22 Variable/G root:g_lns 23 g_lns := LogNormalPolySphere(coef_lns,ywave_lns,xwave_lns) 22 24 Display ywave_lns vs xwave_lns 23 25 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 27 29 End 28 30 29 Proc PlotSmearLogNormPolySphere() 30 //no input parameters necessary, it MUST use the experimental q-values 31 // from the experimental data read in from an AVE/QSIG data file 32 33 // if no gQvals wave, data must not have been loaded => abort 34 if(ResolutionWavesMissing()) 31 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 32 Proc PlotSmearLogNormPolySphere(str) 33 String str 34 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 35 36 // if any of the resolution waves are missing => abort 37 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 35 38 Abort 36 39 endif 40 41 SetDataFolder $("root:"+str) 37 42 38 43 // Setup parameter table for model function … … 43 48 // output smeared intensity wave, dimensions are identical to experimental QSIG values 44 49 // make extra copy of experimental q-values for easy plotting 45 Duplicate/O $ gQvalssmeared_lns,smeared_qvals50 Duplicate/O $(str+"_q") smeared_lns,smeared_qvals 46 51 SetScale d,0,0,"1/cm",smeared_lns 47 48 smeared_lns := SmearLogNormSphere(smear_coef_lns,$gQvals) 52 53 Variable/G gs_lns=0 54 gs_lns := fSmearLogNormSphere(smear_coef_lns,smeared_lns,smeared_qvals) //this wrapper fills the STRUCT 55 49 56 Display smeared_lns vs smeared_qvals 50 57 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 52 59 Label left "Intensity (cm\\S-1\\M)" 53 60 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 61 62 SetDataFolder root: 63 End 64 65 66 67 68 //AAO version, uses XOP if available 69 // simply calls the original single point calculation with 70 // a wave assignment (this will behave nicely if given point ranges) 71 Function LogNormalPolySphere(cw,yw,xw) : FitFunc 72 Wave cw,yw,xw 73 74 #if exists("LogNormalPolySphereX") 75 yw = LogNormalPolySphereX(cw,xw) 76 #else 77 yw = fLogNormalPolySphere(cw,xw) 78 #endif 79 return(0) 54 80 End 55 81 … … 59 85 // 76 points is slower, but reccommended to remove high-q oscillations 60 86 // 61 Function LogNormalPolySphere(w,x): FitFunc87 Function fLogNormalPolySphere(w,x): FitFunc 62 88 wave w 63 89 variable x … … 127 153 128 154 summ = 0.0 // initialize integral 155 Make/O/N=1 tmp_w 129 156 for(ii=0;ii<nord;ii+=1) 130 157 // calculate Gauss points on integration interval (r-value for evaluation) … … 132 159 sphere_temp[1] = zi 133 160 // calculate sphere scattering 134 yy = gauWt[ii] * LogNormal_distr(sig,mu,zi) * SphereForm(sphere_temp,x) 161 SphereForm(sphere_temp,tmp_w,x) //AAO calculation, one point wave 162 yy = gauWt[ii] * LogNormal_distr(sig,mu,zi) * tmp_w[0] 135 163 yy *= 4*pi/3*zi*zi*zi //un-normalize by current sphere volume 136 164 … … 151 179 End 152 180 181 //wrapper to calculate the smeared model as an AAO-Struct 182 // fills the struct and calls the ususal function with the STRUCT parameter 183 // 184 // used only for the dependency, not for fitting 185 // 186 Function fSmearLogNormSphere(coefW,yW,xW) 187 Wave coefW,yW,xW 188 189 String str = getWavesDataFolder(yW,0) 190 String DF="root:"+str+":" 191 192 WAVE resW = $(DF+str+"_res") 193 194 STRUCT ResSmearAAOStruct fs 195 WAVE fs.coefW = coefW 196 WAVE fs.yW = yW 197 WAVE fs.xW = xW 198 WAVE fs.resW = resW 199 200 Variable err 201 err = SmearLogNormSphere(fs) 202 203 return (0) 204 End 205 153 206 // this is all there is to the smeared calculation! 154 Function SmearLogNormSphere(w,x) :FitFunc 155 Wave w 156 Variable x 157 158 Variable ans 159 SVAR sq = gSig_Q 160 SVAR qb = gQ_bar 161 SVAR sh = gShadow 162 SVAR gQ = gQVals 163 164 //the name of your unsmeared model is the first argument 165 ans = Smear_Model_20(LogNormalPolySphere,$sq,$qb,$sh,$gQ,w,x) 166 167 return(ans) 168 End 207 Function SmearLogNormSphere(s) :FitFunc 208 Struct ResSmearAAOStruct &s 209 210 // the name of your unsmeared model (AAO) is the first argument 211 s.yW = Smear_Model_20(LogNormalPolySphere,s.coefW,s.xW,s.resW) 212 213 return(0) 214 End 215 216 169 217 170 218 // normalization is correct, using 3rd moment of lognormal distribution -
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/MultiShell.ipf
r127 r128 22 22 make/O/T parameters_mss = {"scale","core radius (A)","shell thickness (A)","water thickness","core & solvent SLD (A-2)","Shell SLD (A-2)","number of water/shell pairs","bkg (cm-1)"} 23 23 Edit/K=1 parameters_mss,coef_mss 24 ywave_mss := MultiShellForm(coef_mss,xwave_mss) 24 25 Variable/G root:g_mss 26 g_mss := MultiShellForm(coef_mss,ywave_mss,xwave_mss) 25 27 Display/K=1 ywave_mss vs xwave_mss 26 28 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 30 32 End 31 33 32 Proc PlotSmearedMultiShell() 33 //no input parameters necessary, it MUST use the experimental q-values 34 // from the experimental data read in from an AVE/QSIG data file 34 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 35 Proc PlotSmearedMultiShell(str) 36 String str 37 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 35 38 36 // if no gQvals wave, data must not have been loaded => abort 37 if(Exists("gQvals") != 2) // 2 = string or numeric variable exists 38 Abort "6-column QSIG data not loaded. Use LoadQSIGData macro" 39 else 40 if(WaveExists($gQvals) ==0) //wave ref does not exist 41 Abort "6-column QSIG waves are missing. Re-load with LoadQSIGData macro" 42 endif 39 // if any of the resolution waves are missing => abort 40 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 41 Abort 43 42 endif 43 44 SetDataFolder $("root:"+str) 44 45 45 46 // Setup parameter table for model function … … 50 51 // output smeared intensity wave, dimensions are identical to experimental QSIG values 51 52 // make extra copy of experimental q-values for easy plotting 52 Duplicate/O $ gQvalssmeared_mss,smeared_qvals53 Duplicate/O $(str+"_q") smeared_mss,smeared_qvals 53 54 SetScale d,0,0,"1/cm",smeared_mss 54 55 smeared_mss := SmearedMultiShell(smear_coef_mss,$gQvals) 55 56 Variable/G gs_mss=0 57 gs_mss := fSmearedMultiShell(smear_coef_mss,smeared_mss,smeared_qvals) //this wrapper fills the STRUCT 58 56 59 Display/K=1 smeared_mss vs smeared_qvals 57 60 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 59 62 Label left "Intensity (cm\\S-1\\M)" 60 63 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 64 65 SetDataFolder root: 61 66 End 62 67 63 Function MultiShellForm(w,x) :FitFunc 68 69 70 71 //AAO version, uses XOP if available 72 // simply calls the original single point calculation with 73 // a wave assignment (this will behave nicely if given point ranges) 74 Function MultiShellForm(cw,yw,xw) : FitFunc 75 Wave cw,yw,xw 76 77 #if exists("MultiShellFormX") 78 yw = MultiShellFormX(cw,xw) 79 #else 80 yw = fMultiShellForm(cw,xw) 81 #endif 82 return(0) 83 End 84 85 Function fMultiShellForm(w,x) :FitFunc 64 86 Wave w 65 87 Variable x … … 136 158 //End 137 159 160 //wrapper to calculate the smeared model as an AAO-Struct 161 // fills the struct and calls the ususal function with the STRUCT parameter 162 // 163 // used only for the dependency, not for fitting 164 // 165 Function fSmearedMultiShell(coefW,yW,xW) 166 Wave coefW,yW,xW 167 168 String str = getWavesDataFolder(yW,0) 169 String DF="root:"+str+":" 170 171 WAVE resW = $(DF+str+"_res") 172 173 STRUCT ResSmearAAOStruct fs 174 WAVE fs.coefW = coefW 175 WAVE fs.yW = yW 176 WAVE fs.xW = xW 177 WAVE fs.resW = resW 178 179 Variable err 180 err = SmearedMultiShell(fs) 181 182 return (0) 183 End 184 138 185 // this is all there is to the smeared calculation! 139 Function SmearedMultiShell(w,x) :FitFunc 140 Wave w 141 Variable x 186 Function SmearedMultiShell(s) :FitFunc 187 Struct ResSmearAAOStruct &s 188 189 // the name of your unsmeared model (AAO) is the first argument 190 s.yW = Smear_Model_20(MultiShellForm,s.coefW,s.xW,s.resW) 191 192 return(0) 193 End 142 194 143 Variable ans144 SVAR sq = gSig_Q145 SVAR qb = gQ_bar146 SVAR sh = gShadow147 SVAR gQ = gQVals148 149 //the name of your unsmeared model is the first argument150 ans = Smear_Model_76(MultiShellForm,$sq,$qb,$sh,$gQ,w,x)151 152 return(ans)153 End -
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/Parallelepiped.ipf
r127 r128 38 38 make/o/t parameters_Parallelepiped = {"Scale Factor","Shortest Edge A ()","B ()","Longest Edge C ()","Contrast (^-2)","Incoherent Bgd (cm-1)"} //CH#3 39 39 Edit parameters_Parallelepiped, coef_Parallelepiped 40 ywave_Parallelepiped := Parallelepiped(coef_Parallelepiped, xwave_Parallelepiped) 40 41 Variable/G root:g_Parallelepiped 42 g_Parallelepiped := Parallelepiped(coef_Parallelepiped,ywave_Parallelepiped, xwave_Parallelepiped) 41 43 Display ywave_Parallelepiped vs xwave_Parallelepiped 42 44 ModifyGraph marker=29, msize=2, mode=4 … … 48 50 End 49 51 50 // 51 //this macro sets up all the necessary parameters and waves that are 52 //needed to calculate the smeared model function. 53 // 54 //no input parameters are necessary, it MUST use the experimental q-values 55 // from the experimental data read in from an AVE/QSIG data file 56 //////////////////////////////////////////////////// 57 Proc PlotSmeared_Parallelepiped() //Parallelepiped 58 // if no gQvals wave, data must not have been loaded => abort 59 if(ResolutionWavesMissing()) 52 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 53 Proc PlotSmeared_Parallelepiped(str) 54 String str 55 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 56 57 // if any of the resolution waves are missing => abort 58 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 60 59 Abort 61 60 endif 62 61 62 SetDataFolder $("root:"+str) 63 63 64 64 // Setup parameter table for model function … … 69 69 // output smeared intensity wave, dimensions are identical to experimental QSIG values 70 70 // make extra copy of experimental q-values for easy plotting 71 Duplicate/O $ gQvalssmeared_Parallelepiped,smeared_qvals //71 Duplicate/O $(str+"_q") smeared_Parallelepiped,smeared_qvals // 72 72 SetScale d,0,0,"1/cm",smeared_Parallelepiped // 73 74 smeared_Parallelepiped := Parallelepiped_Smeared(smear_coef_Parallelepiped,$gQvals) // SMEARED function name 73 74 Variable/G gs_Parallelepiped=0 75 gs_Parallelepiped := fParallelepiped_Smeared(smear_coef_Parallelepiped,smeared_Parallelepiped,smeared_qvals) //this wrapper fills the STRUCT 76 75 77 Display smeared_Parallelepiped vs smeared_qvals // 76 78 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 78 80 Label left "I(q) (cm\\S-1\\M)" 79 81 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 80 End // end macro 82 83 SetDataFolder root: 84 End 85 86 87 88 //AAO version, uses XOP if available 89 // simply calls the original single point calculation with 90 // a wave assignment (this will behave nicely if given point ranges) 91 Function Parallelepiped(cw,yw,xw) : FitFunc 92 Wave cw,yw,xw 93 94 #if exists("ParallelepipedX") 95 yw = ParallelepipedX(cw,xw) 96 #else 97 yw = fParallelepiped(cw,xw) 98 #endif 99 return(0) 100 End 81 101 82 102 // calculates the form factor of a rectangular solid 83 103 // - a double integral - choose points wisely 84 104 // 85 Function Parallelepiped(w,x) : FitFunc105 Function fParallelepiped(w,x) : FitFunc 86 106 Wave w 87 107 Variable x … … 178 198 End 179 199 200 //wrapper to calculate the smeared model as an AAO-Struct 201 // fills the struct and calls the ususal function with the STRUCT parameter 202 // 203 // used only for the dependency, not for fitting 204 // 205 Function fParallelepiped_Smeared(coefW,yW,xW) 206 Wave coefW,yW,xW 207 208 String str = getWavesDataFolder(yW,0) 209 String DF="root:"+str+":" 210 211 WAVE resW = $(DF+str+"_res") 212 213 STRUCT ResSmearAAOStruct fs 214 WAVE fs.coefW = coefW 215 WAVE fs.yW = yW 216 WAVE fs.xW = xW 217 WAVE fs.resW = resW 218 219 Variable err 220 err = Parallelepiped_Smeared(fs) 221 222 return (0) 223 End 180 224 181 225 // this is all there is to the smeared calculation! 182 Function Parallelepiped_Smeared(w,x) :FitFunc 183 Wave w 184 Variable x 185 186 Variable ans 187 SVAR sq = gSig_Q 188 SVAR qb = gQ_bar 189 SVAR sh = gShadow 190 SVAR gQ = gQVals 191 192 //the name of your unsmeared model is the first argument 193 ans = Smear_Model_20(Parallelepiped,$sq,$qb,$sh,$gQ,w,x) 194 195 return(ans) 196 End 226 Function Parallelepiped_Smeared(s) :FitFunc 227 Struct ResSmearAAOStruct &s 228 229 // the name of your unsmeared model (AAO) is the first argument 230 s.yW = Smear_Model_20(Parallelepiped,s.coefW,s.xW,s.resW) 231 232 return(0) 233 End -
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/PolyCoreShellCylinder.ipf
r127 r128 33 33 ModifyTable width(parameters_CSCpr)=162 34 34 35 ywave_CSCpr:= PolyCoShCylinder(coef_CSCpr,xwave_CSCpr) 35 Variable/G root:g_CSCpr 36 g_CSCpr := PolyCoShCylinder(coef_CSCpr,ywave_CSCpr,xwave_CSCpr) 36 37 Display ywave_CSCpr vs xwave_CSCpr 37 38 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 41 42 End 42 43 43 44 Proc PlotSmearedPolyCoShCylinder( )45 //no input parameters necessary, it MUST use the experimental q-values46 // from the experimental data read in from an AVE/QSIG data file47 48 // if no gQvals wave, data must not have been loaded=> abort49 if(ResolutionWavesMissing ())44 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 45 Proc PlotSmearedPolyCoShCylinder(str) 46 String str 47 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 48 49 // if any of the resolution waves are missing => abort 50 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 50 51 Abort 51 52 endif 53 54 SetDataFolder $("root:"+str) 52 55 53 56 // Setup parameter table for model function … … 59 62 // make extra copy of experimental q-values for easy plotting 60 63 61 Duplicate/O $ gQvalssmeared_CSCpr,smeared_qvals64 Duplicate/O $(str+"_q") smeared_CSCpr,smeared_qvals 62 65 SetScale d,0,0,"1/cm",smeared_CSCpr 63 64 smeared_CSCpr := SmearedPolyCoShCylinder(smear_coef_CSCpr,$gQvals) 66 67 Variable/G gs_CSCpr=0 68 gs_CSCpr := fSmearedPolyCoShCylinder(smear_coef_CSCpr,smeared_CSCpr,smeared_qvals) //this wrapper fills the STRUCT 69 65 70 Display smeared_CSCpr vs smeared_qvals 66 71 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 68 73 Label left "Intensity (cm\\S-1\\M)" 69 74 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 75 76 SetDataFolder root: 77 End 78 79 80 81 //AAO version, uses XOP if available 82 // simply calls the original single point calculation with 83 // a wave assignment (this will behave nicely if given point ranges) 84 Function PolyCoShCylinder(cw,yw,xw) : FitFunc 85 Wave cw,yw,xw 86 87 #if exists("PolyCoShCylinderX") 88 yw = PolyCoShCylinderX(cw,xw) 89 #else 90 yw = fPolyCoShCylinder(cw,xw) 91 #endif 92 return(0) 70 93 End 71 94 … … 75 98 /////////////////////////////////////////////////////////////////////////////// 76 99 77 Function PolyCoShCylinder(w,x) : FitFunc100 Function fPolyCoShCylinder(w,x) : FitFunc 78 101 Wave w 79 102 Variable x … … 278 301 End //Function CScyl() 279 302 303 //wrapper to calculate the smeared model as an AAO-Struct 304 // fills the struct and calls the ususal function with the STRUCT parameter 305 // 306 // used only for the dependency, not for fitting 307 // 308 Function fSmearedPolyCoShCylinder(coefW,yW,xW) 309 Wave coefW,yW,xW 310 311 String str = getWavesDataFolder(yW,0) 312 String DF="root:"+str+":" 313 314 WAVE resW = $(DF+str+"_res") 315 316 STRUCT ResSmearAAOStruct fs 317 WAVE fs.coefW = coefW 318 WAVE fs.yW = yW 319 WAVE fs.xW = xW 320 WAVE fs.resW = resW 321 322 Variable err 323 err = SmearedPolyCoShCylinder(fs) 324 325 return (0) 326 End 327 280 328 // this is all there is to the smeared calculation! 281 Function SmearedPolyCoShCylinder(w,x) :FitFunc 282 Wave w 283 Variable x 284 285 Variable ans 286 SVAR sq = gSig_Q 287 SVAR qb = gQ_bar 288 SVAR sh = gShadow 289 SVAR gQ = gQVals 290 291 //the name of your unsmeared model is the first argument 292 ans = Smear_Model_20(PolyCoShCylinder,$sq,$qb,$sh,$gQ,w,x) 293 294 return(ans) 295 End 296 297 329 Function SmearedPolyCoShCylinder(s) :FitFunc 330 Struct ResSmearAAOStruct &s 331 332 // the name of your unsmeared model (AAO) is the first argument 333 s.yW = Smear_Model_20(PolyCoShCylinder,s.coefW,s.xW,s.resW) 334 335 return(0) 336 End 337 -
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/SchulzSpheres.ipf
r127 r128 20 20 make/O/T parameters_sch = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","bkg (cm-1 sr-1)"} 21 21 Edit parameters_sch,coef_sch 22 ywave_sch := SchulzSpheres(coef_sch,xwave_sch) 22 23 Variable/G root:g_sch 24 g_sch := SchulzSpheres(coef_sch,ywave_sch,xwave_sch) 23 25 Display ywave_sch vs xwave_sch 24 26 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 28 30 End 29 31 30 Proc PlotSmearedSchulzPolySpheres() 31 //no input parameters necessary, it MUST use the experimental q-values 32 // from the experimental data read in from an AVE/QSIG data file 33 34 // if no gQvals wave, data must not have been loaded => abort 35 if(ResolutionWavesMissing()) 32 33 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 34 Proc PlotSmearedSchulzPolySpheres(str) 35 String str 36 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 37 38 // if any of the resolution waves are missing => abort 39 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 36 40 Abort 37 41 endif 42 43 SetDataFolder $("root:"+str) 38 44 39 45 // Setup parameter table for model function … … 44 50 // output smeared intensity wave, dimensions are identical to experimental QSIG values 45 51 // make extra copy of experimental q-values for easy plotting 46 Duplicate/O $ gQvalssmeared_sch,smeared_qvals52 Duplicate/O $(str+"_q") smeared_sch,smeared_qvals 47 53 SetScale d,0,0,"1/cm",smeared_sch 48 49 smeared_sch := SmearedSchulzSpheres(smear_coef_sch,$gQvals) 54 55 Variable/G gs_sch=0 56 gs_sch := fSmearedSchulzSpheres(smear_coef_sch,smeared_sch,smeared_qvals) //this wrapper fills the STRUCT 57 50 58 Display smeared_sch vs smeared_qvals 51 59 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 53 61 Label left "Intensity (cm\\S-1\\M)" 54 62 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 55 End 63 64 SetDataFolder root: 65 End 66 56 67 57 68 … … 65 76 End 66 77 78 79 //AAO version, uses XOP if available 80 // simply calls the original single point calculation with 81 // a wave assignment (this will behave nicely if given point ranges) 82 Function SchulzSpheres(cw,yw,xw) : FitFunc 83 Wave cw,yw,xw 84 85 #if exists("SchulzSpheresX") 86 yw = SchulzSpheresX(cw,xw) 87 #else 88 yw = fSchulzSpheres(cw,xw) 89 #endif 90 return(0) 91 End 92 67 93 //use the analytic formula from Kotlarchyk & Chen, JCP 79 (1983) 2461 68 94 //equations 23-30 … … 70 96 // need to calculate in terms of logarithms to avoid numerical errors 71 97 // 72 Function SchulzSpheres(w,x) : FitFunc98 Function fSchulzSpheres(w,x) : FitFunc 73 99 Wave w 74 100 Variable x … … 159 185 End 160 186 161 187 //wrapper to calculate the smeared model as an AAO-Struct 188 // fills the struct and calls the ususal function with the STRUCT parameter 189 // 190 // used only for the dependency, not for fitting 191 // 192 Function fSmearedSchulzSpheres(coefW,yW,xW) 193 Wave coefW,yW,xW 194 195 String str = getWavesDataFolder(yW,0) 196 String DF="root:"+str+":" 197 198 WAVE resW = $(DF+str+"_res") 199 200 STRUCT ResSmearAAOStruct fs 201 WAVE fs.coefW = coefW 202 WAVE fs.yW = yW 203 WAVE fs.xW = xW 204 WAVE fs.resW = resW 205 206 Variable err 207 err = SmearedSchulzSpheres(fs) 208 209 return (0) 210 End 162 211 163 212 // this is all there is to the smeared calculation! 164 Function SmearedSchulzSpheres(w,x) :FitFunc 165 Wave w 166 Variable x 167 168 Variable ans 169 SVAR sq = gSig_Q 170 SVAR qb = gQ_bar 171 SVAR sh = gShadow 172 SVAR gQ = gQVals 173 174 //the name of your unsmeared model is the first argument 175 ans = Smear_Model_20(SchulzSpheres,$sq,$qb,$sh,$gQ,w,x) 176 177 return(ans) 213 Function SmearedSchulzSpheres(s) :FitFunc 214 Struct ResSmearAAOStruct &s 215 216 // the name of your unsmeared model (AAO) is the first argument 217 s.yW = Smear_Model_20(SchulzSpheres,s.coefW,s.xW,s.resW) 218 219 return(0) 178 220 End 179 221 -
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/SchulzSpheres_and_Struct.ipf
r127 r128 23 23 make/O/T parameters_sch_HS = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","bkg (cm-1 sr-1)"} 24 24 Edit parameters_sch_HS,coef_sch_HS 25 ywave_sch_HS := SchulzSpheres_HS(coef_sch_HS,xwave_sch_HS) 25 26 Variable/G root:g_sch_HS 27 g_sch_HS := SchulzSpheres_HS(coef_sch_HS,ywave_sch_HS,xwave_sch_HS) 26 28 Display ywave_sch_HS vs xwave_sch_HS 27 29 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 31 33 End 32 34 33 Proc PlotSmearedSchulzSpheres_HS() 34 //no input parameters necessary, it MUST use the experimental q-values 35 // from the experimental data read in from an AVE/QSIG data file 36 37 // if no gQvals wave, data must not have been loaded => abort 38 if(ResolutionWavesMissing()) 35 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 36 Proc PlotSmearedSchulzSpheres_HS(str) 37 String str 38 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 39 40 // if any of the resolution waves are missing => abort 41 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 39 42 Abort 40 43 endif 44 45 SetDataFolder $("root:"+str) 41 46 42 47 // Setup parameter table for model function … … 47 52 // output smeared intensity wave, dimensions are identical to experimental QSIG values 48 53 // make extra copy of experimental q-values for easy plotting 49 Duplicate/O $ gQvalssmeared_sch_HS,smeared_qvals54 Duplicate/O $(str+"_q") smeared_sch_HS,smeared_qvals 50 55 SetScale d,0,0,"1/cm",smeared_sch_HS 51 52 smeared_sch_HS := SmearedSchulzSpheres_HS(smear_coef_sch_HS,$gQvals) 56 57 Variable/G gs_sch_HS=0 58 gs_sch_HS := fSmearedSchulzSpheres_HS(smear_coef_sch_HS,smeared_sch_HS,smeared_qvals) //this wrapper fills the STRUCT 59 53 60 Display smeared_sch_HS vs smeared_qvals 54 61 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 56 63 Label left "Intensity (cm\\S-1\\M)" 57 64 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 58 End 59 60 Function SchulzSpheres_HS(w,x) : FitFunc 61 Wave w 62 Variable x 65 66 SetDataFolder root: 67 End 68 69 70 71 Function SchulzSpheres_HS(w,yw,xw) : FitFunc 72 Wave w,yw,xw 63 73 64 74 Variable inten … … 89 99 90 100 //calculate each and combine 91 inten = SchulzSpheres(form_sch_HS,x) 92 inten *= HardSphereStruct(struct_sch_HS,x) 93 inten *= w[0] 94 inten += w[5] 101 Duplicate/O xw tmp_sch_HS_PQ,tmp_sch_HS_SQ 102 SchulzSpheres(form_sch_HS,tmp_sch_HS_PQ,xw) 103 HardSphereStruct(struct_sch_HS,tmp_sch_HS_SQ,xw) 104 yw = tmp_sch_HS_PQ * tmp_sch_HS_SQ 105 yw *= w[0] 106 yw += w[5] 95 107 96 108 //cleanup waves 97 109 // Killwaves/Z form_sch_HS,struct_sch_HS 98 110 99 return ( inten)111 return (0) 100 112 End 101 113 … … 112 124 make/O/T parameters_sch_SW = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","well depth (kT)","well width (diam.)","bkg (cm-1 sr-1)"} 113 125 Edit parameters_sch_SW,coef_sch_SW 114 ywave_sch_SW := SchulzSpheres_SW(coef_sch_SW,xwave_sch_SW) 126 127 Variable/G root:g_sch_SW 128 g_sch_SW := SchulzSpheres_SW(coef_sch_SW,ywave_sch_SW,xwave_sch_SW) 115 129 Display ywave_sch_SW vs xwave_sch_SW 116 130 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 120 134 End 121 135 122 Proc PlotSmearedSchulzSpheres_SW() 123 //no input parameters necessary, it MUST use the experimental q-values 124 // from the experimental data read in from an AVE/QSIG data file 125 126 // if no gQvals wave, data must not have been loaded => abort 127 if(ResolutionWavesMissing()) 136 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 137 Proc PlotSmearedSchulzSpheres_SW(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) 128 143 Abort 129 144 endif 145 146 SetDataFolder $("root:"+str) 130 147 131 148 // Setup parameter table for model function … … 136 153 // output smeared intensity wave, dimensions are identical to experimental QSIG values 137 154 // make extra copy of experimental q-values for easy plotting 138 Duplicate/O $ gQvalssmeared_sch_SW,smeared_qvals155 Duplicate/O $(str+"_q") smeared_sch_SW,smeared_qvals 139 156 SetScale d,0,0,"1/cm",smeared_sch_SW 140 141 smeared_sch_SW := SmearedSchulzSpheres_SW(smear_coef_sch_SW,$gQvals) 157 158 Variable/G gs_sch_SW=0 159 gs_sch_SW := fSmearedSchulzSpheres_SW(smear_coef_sch_SW,smeared_sch_SW,smeared_qvals) //this wrapper fills the STRUCT 160 142 161 Display smeared_sch_SW vs smeared_qvals 143 162 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 145 164 Label left "Intensity (cm\\S-1\\M)" 146 165 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 147 End 148 149 Function SchulzSpheres_SW(w,x) : FitFunc 150 Wave w 151 Variable x 166 167 SetDataFolder root: 168 End 169 170 171 172 Function SchulzSpheres_SW(w,yw,xw) : FitFunc 173 Wave w,yw,xw 152 174 153 175 Variable inten … … 179 201 180 202 //calculate each and combine 181 inten = SchulzSpheres(form_sch_SW,x) 182 inten *= SquareWellStruct(struct_sch_SW,x) 183 inten *= w[0] 184 inten += w[7] 203 Duplicate/O xw tmp_sch_SW_PQ,tmp_sch_SW_SQ 204 SchulzSpheres(form_sch_SW,tmp_sch_SW_PQ,xw) 205 SquareWellStruct(struct_sch_SW,tmp_sch_SW_SQ,xw) 206 yw = tmp_sch_SW_PQ * tmp_sch_SW_SQ 207 yw *= w[0] 208 yw += w[7] 185 209 186 210 //cleanup waves 187 211 // Killwaves/Z form_sch_SW,struct_sch_SW 188 212 189 return ( inten)213 return (0) 190 214 End 191 215 … … 210 234 make/O/T parameters_sch_SC = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","charge","movalent salt(M)","Temperature (K)","dielectric const","bkg (cm-1 sr-1)"} 211 235 Edit parameters_sch_SC,coef_sch_SC 212 ywave_sch_SC := SchulzSpheres_SC(coef_sch_SC,xwave_sch_SC) 236 237 Variable/G root:g_sch_SC 238 g_sch_SC := SchulzSpheres_SC(coef_sch_SC,ywave_sch_SC,xwave_sch_SC) 213 239 Display ywave_sch_SC vs xwave_sch_SC 214 240 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 218 244 End 219 245 220 Proc PlotSmearedSchulzSpheres_SC() 221 //no input parameters necessary, it MUST use the experimental q-values 222 // from the experimental data read in from an AVE/QSIG data file 223 224 // if no gQvals wave, data must not have been loaded => abort 225 if(ResolutionWavesMissing()) 246 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 247 Proc PlotSmearedSchulzSpheres_SC(str) 248 String str 249 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 250 251 // if any of the resolution waves are missing => abort 252 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 226 253 Abort 227 254 endif 228 255 256 SetDataFolder $("root:"+str) 257 229 258 if (DataFolderExists("root:HayPenMSA")) 230 259 Make/O/D/N=17 root:HayPenMSA:gMSAWave … … 241 270 // output smeared intensity wave, dimensions are identical to experimental QSIG values 242 271 // make extra copy of experimental q-values for easy plotting 243 Duplicate/O $ gQvalssmeared_sch_SC,smeared_qvals272 Duplicate/O $(str+"_q") smeared_sch_SC,smeared_qvals 244 273 SetScale d,0,0,"1/cm",smeared_sch_SC 245 246 smeared_sch_SC := SmearedSchulzSpheres_SC(smear_coef_sch_SC,$gQvals) 274 275 Variable/G gs_sch_SC=0 276 gs_sch_SC := fSmearedSchulzSpheres_SC(smear_coef_sch_SC,smeared_sch_SC,smeared_qvals) //this wrapper fills the STRUCT 277 247 278 Display smeared_sch_SC vs smeared_qvals 248 279 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 250 281 Label left "Intensity (cm\\S-1\\M)" 251 282 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 252 End 253 254 Function SchulzSpheres_SC(w,x) : FitFunc 255 Wave w 256 Variable x 283 284 SetDataFolder root: 285 End 286 287 288 Function SchulzSpheres_SC(w,yw,xw) : FitFunc 289 Wave w,yw,xw 257 290 258 291 Variable inten … … 286 319 287 320 //calculate each and combine 288 inten = SchulzSpheres(form_sch_SC,x) 289 inten *= HayterPenfoldMSA(struct_sch_SC,x) 290 inten *= w[0] 291 inten += w[9] 321 Duplicate/O xw tmp_sch_SC_PQ,tmp_sch_SC_SQ 322 SchulzSpheres(form_sch_SC,tmp_sch_SC_PQ,xw) 323 HayterPenfoldMSA(struct_sch_SC,tmp_sch_SC_SQ,xw) 324 yw = tmp_sch_SC_PQ *tmp_sch_SC_SQ 325 yw *= w[0] 326 yw += w[9] 292 327 293 328 //cleanup waves 294 329 // Killwaves/Z form_sch_SC,struct_sch_SC 295 330 296 return ( inten)331 return (0) 297 332 End 298 333 … … 309 344 make/O/T parameters_sch_SHS = {"Volume Fraction (scale)","mean radius (A)","polydisp (sig/avg)","SLD sphere (A-2)","SLD solvent (A-2)","perturbation parameter (0.1)","stickiness, tau","bkg (cm-1 sr-1)"} 310 345 Edit parameters_sch_SHS,coef_sch_SHS 311 ywave_sch_SHS := SchulzSpheres_SHS(coef_sch_SHS,xwave_sch_SHS) 346 347 Variable/G root:g_sch_SHS 348 g_sch_SHS := SchulzSpheres_SHS(coef_sch_SHS,ywave_sch_SHS,xwave_sch_SHS) 312 349 Display ywave_sch_SHS vs xwave_sch_SHS 313 350 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 317 354 End 318 355 319 Proc PlotSmearedSchulzSpheres_SHS() 320 //no input parameters necessary, it MUST use the experimental q-values 321 // from the experimental data read in from an AVE/QSIG data file 322 323 // if no gQvals wave, data must not have been loaded => abort 324 if(ResolutionWavesMissing()) 356 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 357 Proc PlotSmearedSchulzSpheres_SHS(str) 358 String str 359 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 360 361 // if any of the resolution waves are missing => abort 362 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 325 363 Abort 326 364 endif 365 366 SetDataFolder $("root:"+str) 327 367 328 368 // Setup parameter table for model function … … 333 373 // output smeared intensity wave, dimensions are identical to experimental QSIG values 334 374 // make extra copy of experimental q-values for easy plotting 335 Duplicate/O $ gQvalssmeared_sch_SHS,smeared_qvals375 Duplicate/O $(str+"_q") smeared_sch_SHS,smeared_qvals 336 376 SetScale d,0,0,"1/cm",smeared_sch_SHS 337 338 smeared_sch_SHS := SmearedSchulzSpheres_SHS(smear_coef_sch_SHS,$gQvals) 377 378 Variable/G gs_sch_SHS=0 379 gs_sch_SHS := fSmearedSchulzSpheres_SHS(smear_coef_sch_SHS,smeared_sch_SHS,smeared_qvals) //this wrapper fills the STRUCT 380 339 381 Display smeared_sch_SHS vs smeared_qvals 340 382 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 342 384 Label left "Intensity (cm\\S-1\\M)" 343 385 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 344 End 345 346 Function SchulzSpheres_SHS(w,x) : FitFunc 347 Wave w 348 Variable x 386 387 SetDataFolder root: 388 End 389 390 391 Function SchulzSpheres_SHS(w,yw,xw) : FitFunc 392 Wave w,yw,xw 349 393 350 394 Variable inten … … 376 420 377 421 //calculate each and combine 378 inten = SchulzSpheres(form_sch_SHS,x) 379 inten *= StickyHS_Struct(struct_sch_SHS,x) 380 inten *= w[0] 381 inten += w[7] 422 Duplicate/O xw tmp_sch_SHS_PQ,tmp_sch_SHS_SQ 423 SchulzSpheres(form_sch_SHS,tmp_sch_SHS_PQ,xw) 424 StickyHS_Struct(struct_sch_SHS,tmp_sch_SHS_PQ,xw) 425 yw = tmp_sch_SHS_PQ * tmp_sch_SHS_SQ 426 yw *= w[0] 427 yw += w[7] 382 428 383 429 //cleanup waves 384 430 // Killwaves/Z form_sch_SHS,struct_sch_SHS 385 431 386 return ( inten)432 return (0) 387 433 End 388 434 … … 390 436 391 437 // this is all there is to the smeared calculation! 392 Function SmearedSchulzSpheres_HS(w,x) :FitFunc 393 Wave w 394 Variable x 395 396 Variable ans 397 SVAR sq = gSig_Q 398 SVAR qb = gQ_bar 399 SVAR sh = gShadow 400 SVAR gQ = gQVals 401 402 //the name of your unsmeared model is the first argument 403 ans = Smear_Model_20(SchulzSpheres_HS,$sq,$qb,$sh,$gQ,w,x) 404 405 return(ans) 438 Function SmearedSchulzSpheres_HS(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(SchulzSpheres_HS,s.coefW,s.xW,s.resW) 443 444 return(0) 406 445 End 407 446 408 447 // this is all there is to the smeared calculation! 409 Function SmearedSchulzSpheres_SW(w,x) :FitFunc 410 Wave w 411 Variable x 412 413 Variable ans 414 SVAR sq = gSig_Q 415 SVAR qb = gQ_bar 416 SVAR sh = gShadow 417 SVAR gQ = gQVals 418 419 //the name of your unsmeared model is the first argument 420 ans = Smear_Model_20(SchulzSpheres_SW,$sq,$qb,$sh,$gQ,w,x) 421 422 return(ans) 448 Function SmearedSchulzSpheres_SW(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(SchulzSpheres_SW,s.coefW,s.xW,s.resW) 453 454 return(0) 423 455 End 424 456 425 457 // this is all there is to the smeared calculation! 426 Function SmearedSchulzSpheres_SC(w,x) :FitFunc 427 Wave w 428 Variable x 429 430 Variable ans 431 SVAR sq = gSig_Q 432 SVAR qb = gQ_bar 433 SVAR sh = gShadow 434 SVAR gQ = gQVals 435 436 //the name of your unsmeared model is the first argument 437 ans = Smear_Model_20(SchulzSpheres_SC,$sq,$qb,$sh,$gQ,w,x) 438 439 return(ans) 458 Function SmearedSchulzSpheres_SC(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(SchulzSpheres_SC,s.coefW,s.xW,s.resW) 463 464 return(0) 440 465 End 441 466 442 467 // this is all there is to the smeared calculation! 443 Function SmearedSchulzSpheres_SHS(w,x) :FitFunc 444 Wave w 445 Variable x 446 447 Variable ans 448 SVAR sq = gSig_Q 449 SVAR qb = gQ_bar 450 SVAR sh = gShadow 451 SVAR gQ = gQVals 452 453 //the name of your unsmeared model is the first argument 454 ans = Smear_Model_20(SchulzSpheres_SHS,$sq,$qb,$sh,$gQ,w,x) 455 456 return(ans) 457 End 468 Function SmearedSchulzSpheres_SHS(s) : FitFunc 469 Struct ResSmearAAOStruct &s 470 471 // the name of your unsmeared model (AAO) is the first argument 472 s.yW = Smear_Model_20(SchulzSpheres_SHS,s.coefW,s.xW,s.resW) 473 474 return(0) 475 End 476 477 //wrapper to calculate the smeared model as an AAO-Struct 478 // fills the struct and calls the ususal function with the STRUCT parameter 479 // 480 // used only for the dependency, not for fitting 481 // 482 Function fSmearedSchulzSpheres_HS(coefW,yW,xW) 483 Wave coefW,yW,xW 484 485 String str = getWavesDataFolder(yW,0) 486 String DF="root:"+str+":" 487 488 WAVE resW = $(DF+str+"_res") 489 490 STRUCT ResSmearAAOStruct fs 491 WAVE fs.coefW = coefW 492 WAVE fs.yW = yW 493 WAVE fs.xW = xW 494 WAVE fs.resW = resW 495 496 Variable err 497 err = SmearedSchulzSpheres_HS(fs) 498 499 return (0) 500 End 501 502 //wrapper to calculate the smeared model as an AAO-Struct 503 // fills the struct and calls the ususal function with the STRUCT parameter 504 // 505 // used only for the dependency, not for fitting 506 // 507 Function fSmearedSchulzSpheres_SW(coefW,yW,xW) 508 Wave coefW,yW,xW 509 510 String str = getWavesDataFolder(yW,0) 511 String DF="root:"+str+":" 512 513 WAVE resW = $(DF+str+"_res") 514 515 STRUCT ResSmearAAOStruct fs 516 WAVE fs.coefW = coefW 517 WAVE fs.yW = yW 518 WAVE fs.xW = xW 519 WAVE fs.resW = resW 520 521 Variable err 522 err = SmearedSchulzSpheres_SW(fs) 523 524 return (0) 525 End 526 527 //wrapper to calculate the smeared model as an AAO-Struct 528 // fills the struct and calls the ususal function with the STRUCT parameter 529 // 530 // used only for the dependency, not for fitting 531 // 532 Function fSmearedSchulzSpheres_SC(coefW,yW,xW) 533 Wave coefW,yW,xW 534 535 String str = getWavesDataFolder(yW,0) 536 String DF="root:"+str+":" 537 538 WAVE resW = $(DF+str+"_res") 539 540 STRUCT ResSmearAAOStruct fs 541 WAVE fs.coefW = coefW 542 WAVE fs.yW = yW 543 WAVE fs.xW = xW 544 WAVE fs.resW = resW 545 546 Variable err 547 err = SmearedSchulzSpheres_SC(fs) 548 549 return (0) 550 End 551 552 //wrapper to calculate the smeared model as an AAO-Struct 553 // fills the struct and calls the ususal function with the STRUCT parameter 554 // 555 // used only for the dependency, not for fitting 556 // 557 Function fSmearedSchulzSpheres_SHS(coefW,yW,xW) 558 Wave coefW,yW,xW 559 560 String str = getWavesDataFolder(yW,0) 561 String DF="root:"+str+":" 562 563 WAVE resW = $(DF+str+"_res") 564 565 STRUCT ResSmearAAOStruct fs 566 WAVE fs.coefW = coefW 567 WAVE fs.yW = yW 568 WAVE fs.xW = xW 569 WAVE fs.resW = resW 570 571 Variable err 572 err = SmearedSchulzSpheres_SHS(fs) 573 574 return (0) 575 End 576 -
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/NewModels_2006/TriaxialEllipsoid.ipf
r127 r128 34 34 make/o/t parameters_triax = {"Scale Factor","Semi-axis A [smallest]()","Semi-axis B ()","Semi-axis C [largest]()","Contrast (^-2)","Incoherent Bgd (cm-1)"} //CH#3 35 35 Edit parameters_triax, coef_triax 36 ywave_triax := TriaxialEllipsoid(coef_triax, xwave_triax) 36 37 Variable/G root:g_triax 38 g_triax := TriaxialEllipsoid(coef_triax, ywave_triax, xwave_triax) 37 39 Display ywave_triax vs xwave_triax 38 40 ModifyGraph marker=29, msize=2, mode=4 … … 44 46 End 45 47 46 // 47 //this Proc sets up all the necessary parameters and waves that are 48 //needed to calculate the smeared model function. 49 // 50 //no input parameters are necessary, it MUST use the experimental q-values 51 // from the experimental data read in from an AVE/QSIG data file 52 //////////////////////////////////////////////////// 53 Proc PlotSmeared_TriAxEllipsoid() //triax 54 // if no gQvals wave, data must not have been loaded => abort 55 if(ResolutionWavesMissing()) 48 49 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 50 Proc PlotSmeared_TriAxEllipsoid(str) 51 String str 52 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 53 54 // if any of the resolution waves are missing => abort 55 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 56 56 Abort 57 57 endif 58 59 SetDataFolder $("root:"+str) 58 60 59 61 // Setup parameter table for model function … … 64 66 // output smeared intensity wave, dimensions are identical to experimental QSIG values 65 67 // make extra copy of experimental q-values for easy plotting 66 Duplicate/O $ gQvalssmeared_triax,smeared_qvals //68 Duplicate/O $(str+"_q") smeared_triax,smeared_qvals // 67 69 SetScale d,0,0,"1/cm",smeared_triax // 68 69 smeared_triax := Triax_Smeared(smear_coef_triax,$gQvals) // SMEARED function name 70 71 Variable/G gs_triax=0 72 gs_triax := fTriax_Smeared(smear_coef_triax,smeared_triax,smeared_qvals) //this wrapper fills the STRUCT 73 70 74 Display smeared_triax vs smeared_qvals&