Changeset 127 for sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/Cylinder_and_Struct.ipf
- Timestamp:
- Jul 24, 2007 3:23:44 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Analysis/branches/ajj_23APR07/IGOR_Package_Files/Put in User Procedures/SANS_Models_v3.00/Cylinder_and_Struct.ipf
r42 r127 1 1 #pragma rtGlobals=1 // Use modern global access method. 2 #pragma IgorVersion = 6.0 2 3 3 4 // be sure to include all the necessary files... … … 21 22 make/o/t parameters_CYL_HS = {"volume fraction","radius (A)","length (A)","contrast (A^-2)","incoh. bkg (cm^-1)"} 22 23 Edit parameters_CYL_HS,coef_CYL_HS 23 ywave_CYL_HS := Cylinder_HS(coef_CYL_HS,xwave_CYL_HS) 24 25 Variable/G root:g_CYL_HS 26 g_CYL_HS := Cylinder_HS(coef_CYL_HS,ywave_CYL_HS,xwave_CYL_HS) 24 27 Display ywave_CYL_HS vs xwave_CYL_HS 25 28 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 30 33 End 31 34 32 Proc PlotSmearedCylinder_HS() 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()) 35 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 36 Proc PlotSmearedCylinder_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) 38 42 Abort 39 43 endif 40 44 45 SetDataFolder $("root:"+str) 46 41 47 // Setup parameter table for model function 42 48 Make/O/D smear_coef_CYL_HS = {0.01,20.,400,3.0e-6,0.01} … … 46 52 // output smeared intensity wave, dimensions are identical to experimental QSIG values 47 53 // make extra copy of experimental q-values for easy plotting 48 Duplicate/O $ gQvalssmeared_CYL_HS,smeared_qvals54 Duplicate/O $(str+"_q") smeared_CYL_HS,smeared_qvals 49 55 SetScale d,0,0,"1/cm",smeared_CYL_HS 50 51 smeared_CYL_HS := SmearedCylinder_HS(smear_coef_CYL_HS,$gQvals) 56 57 Variable/G gs_CYL_HS=0 58 gs_CYL_HS := fSmearedCylinder_HS(smear_coef_CYL_HS,smeared_CYL_HS,smeared_qvals) //this wrapper fills the STRUCT 59 52 60 Display smeared_CYL_HS vs smeared_qvals 53 61 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 56 64 57 65 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 58 End 59 60 Function Cylinder_HS(w,x) : FitFunc 61 Wave w 62 Variable x 66 67 SetDataFolder root: 68 End 69 70 71 Function Cylinder_HS(w,yw,xw) : FitFunc 72 Wave w,yw,xw 63 73 64 74 Variable inten,rad,len … … 80 90 81 91 //calculate each and combine 82 inten = CylinderForm(form_CYL_HS,x) 83 inten *= HardSphereStruct(struct_CYL_HS,x) 84 inten *= w[0] 85 inten += w[4] 92 Duplicate/O xw temp_CYL_HS_PQ,temp_CYL_HS_SQ //make waves for the AAO 93 CylinderForm(form_CYL_HS,temp_CYL_HS_PQ,xw) 94 HardSphereStruct(struct_CYL_HS,temp_CYL_HS_SQ,xw) 95 yw = temp_CYL_HS_PQ * temp_CYL_HS_SQ 96 yw *= w[0] 97 yw += w[4] 86 98 87 99 //cleanup waves (don't do this - it takes a lot of time...) 88 100 // Killwaves/Z form_CYL_HS,struct_CYL_HS 89 101 90 return ( inten)102 return (0) 91 103 End 92 104 … … 102 114 make/o/t parameters_CYL_SW = {"volume fraction","radius (A)","length (A)","contrast (A^-2)","well depth (kT)","well width (diam.)","incoh. bkg (cm^-1)"} 103 115 Edit parameters_CYL_SW,coef_CYL_SW 104 ywave_CYL_SW := Cylinder_SW(coef_CYL_SW,xwave_CYL_SW) 116 117 Variable/G root:g_CYL_SW 118 g_CYL_SW := Cylinder_SW(coef_CYL_SW,ywave_CYL_SW,xwave_CYL_SW) 105 119 Display ywave_CYL_SW vs xwave_CYL_SW 106 120 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 111 125 End 112 126 113 Proc PlotSmearedCylinder_SW() 114 //no input parameters necessary, it MUST use the experimental q-values 115 // from the experimental data read in from an AVE/QSIG data file 116 117 // if no gQvals wave, data must not have been loaded => abort 118 if(ResolutionWavesMissing()) 127 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 128 Proc PlotSmearedCylinder_SW(str) 129 String str 130 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 131 132 // if any of the resolution waves are missing => abort 133 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 119 134 Abort 120 135 endif 136 137 SetDataFolder $("root:"+str) 121 138 122 139 // Setup parameter table for model function … … 127 144 // output smeared intensity wave, dimensions are identical to experimental QSIG values 128 145 // make extra copy of experimental q-values for easy plotting 129 Duplicate/O $ gQvalssmeared_CYL_SW,smeared_qvals146 Duplicate/O $(str+"_q") smeared_CYL_SW,smeared_qvals 130 147 SetScale d,0,0,"1/cm",smeared_CYL_SW 131 132 smeared_CYL_SW := SmearedCylinder_SW(smear_coef_CYL_SW,$gQvals) 148 149 Variable/G gs_CYL_SW=0 150 gs_CYL_SW := fSmearedCylinder_SW(smear_coef_CYL_SW,smeared_CYL_SW,smeared_qvals) //this wrapper fills the STRUCT 151 133 152 Display smeared_CYL_SW vs smeared_qvals 134 153 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 137 156 138 157 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 139 End 140 141 Function Cylinder_SW(w,x) : FitFunc 142 Wave w 143 Variable x 158 159 SetDataFolder root: 160 End 161 162 163 Function Cylinder_SW(w,yw,xw) : FitFunc 164 Wave w,yw,xw 144 165 145 166 Variable inten,rad,len … … 163 184 164 185 //calculate each and combine 165 inten = CylinderForm(form_CYL_SW,x) 166 inten *= SquareWellStruct(struct_CYL_SW,x) 167 inten *= w[0] 168 inten += w[6] 186 Duplicate/O xw temp_CYL_SW_PQ,temp_CYL_SW_SQ //make waves for the AAO 187 CylinderForm(form_CYL_SW,temp_CYL_SW_PQ,xw) 188 SquareWellStruct(struct_CYL_SW,temp_CYL_SW_SQ,xw) 189 yw = temp_CYL_SW_PQ * temp_CYL_SW_SQ 190 yw *= w[0] 191 yw += w[6] 169 192 170 193 //cleanup waves 171 194 // Killwaves/Z form_CYL_SW,struct_CYL_SW 172 195 173 return ( inten)196 return (0) 174 197 End 175 198 … … 192 215 make/o/t parameters_CYL_SC = {"volume fraction","radius (A)","length (A)","contrast (A^-2)","charge","movalent salt(M)","Temperature (K)","dielectric const","incoh. bkg (cm^-1)"} 193 216 Edit parameters_CYL_SC,coef_CYL_SC 194 ywave_CYL_SC := Cylinder_SC(coef_CYL_SC,xwave_CYL_SC) 217 218 Variable/G root:g_CYL_SC 219 g_CYL_SC := Cylinder_SC(coef_CYL_SC,ywave_CYL_SC,xwave_CYL_SC) 195 220 Display ywave_CYL_SC vs xwave_CYL_SC 196 221 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 201 226 End 202 227 203 Proc PlotSmearedCylinder_SC() 204 //no input parameters necessary, it MUST use the experimental q-values 205 // from the experimental data read in from an AVE/QSIG data file 206 207 // if no gQvals wave, data must not have been loaded => abort 208 if(ResolutionWavesMissing()) 228 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 229 Proc PlotSmearedCylinder_SC(str) 230 String str 231 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 232 233 // if any of the resolution waves are missing => abort 234 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 209 235 Abort 210 236 endif 211 237 238 SetDataFolder $("root:"+str) 239 212 240 if (DataFolderExists("root:HayPenMSA")) 213 241 Make/O/D/N=17 root:HayPenMSA:gMSAWave … … 224 252 // output smeared intensity wave, dimensions are identical to experimental QSIG values 225 253 // make extra copy of experimental q-values for easy plotting 226 Duplicate/O $ gQvalssmeared_CYL_SC,smeared_qvals254 Duplicate/O $(str+"_q") smeared_CYL_SC,smeared_qvals 227 255 SetScale d,0,0,"1/cm",smeared_CYL_SC 228 229 smeared_CYL_SC := SmearedCylinder_SC(smear_coef_CYL_SC,$gQvals) 256 257 Variable/G gs_CYL_SC=0 258 gs_CYL_SC := fSmearedCylinder_SC(smear_coef_CYL_SC,smeared_CYL_SC,smeared_qvals) //this wrapper fills the STRUCT 259 230 260 Display smeared_CYL_SC vs smeared_qvals 231 261 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 234 264 235 265 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 236 End 237 238 Function Cylinder_SC(w,x) : FitFunc 239 Wave w 240 Variable x 266 267 SetDataFolder root: 268 End 269 270 271 Function Cylinder_SC(w,yw,xw) : FitFunc 272 Wave w,yw,xw 241 273 242 274 Variable inten,rad,len … … 262 294 263 295 //calculate each and combine 264 inten = CylinderForm(form_CYL_SC,x) 265 inten *= HayterPenfoldMSA(struct_CYL_SC,x) 266 inten *= w[0] 267 inten += w[8] 296 Duplicate/O xw temp_CYL_SC_PQ,temp_CYL_SC_SQ //make waves for the AAO 297 CylinderForm(form_CYL_SC,temp_CYL_SC_PQ,xw) 298 HayterPenfoldMSA(struct_CYL_SC,temp_CYL_SC_SQ,xw) 299 yw = temp_CYL_SC_PQ * temp_CYL_SC_SQ 300 yw *= w[0] 301 yw += w[8] 268 302 269 303 //cleanup waves 270 304 // Killwaves/Z form_CYL_SC,struct_CYL_SC 271 305 272 return ( inten)306 return (0) 273 307 End 274 308 … … 285 319 make/o/t parameters_CYL_SHS = {"volume fraction","radius (A)","length (A)","contrast (A^-2)","perturbation parameter (0.1)","stickiness, tau","incoh. bkg (cm^-1)"} 286 320 Edit parameters_CYL_SHS,coef_CYL_SHS 287 ywave_CYL_SHS := Cylinder_SHS(coef_CYL_SHS,xwave_CYL_SHS) 321 322 Variable/G root:g_CYL_SHS 323 g_CYL_SHS := Cylinder_SHS(coef_CYL_SHS,ywave_CYL_SHS,xwave_CYL_SHS) 288 324 Display ywave_CYL_SHS vs xwave_CYL_SHS 289 325 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 294 330 End 295 331 296 Proc PlotSmearedCylinder_SHS() 297 //no input parameters necessary, it MUST use the experimental q-values 298 // from the experimental data read in from an AVE/QSIG data file 299 300 // if no gQvals wave, data must not have been loaded => abort 301 if(ResolutionWavesMissing()) 332 // - sets up a dependency to a wrapper, not the actual SmearedModelFunction 333 Proc PlotSmearedCylinder_SHS(str) 334 String str 335 Prompt str,"Pick the data folder conatining the resolution you want",popup,getAList(4) 336 337 // if any of the resolution waves are missing => abort 338 if(ResolutionWavesMissingDF(str)) //updated to NOT use global strings (in GaussUtils) 302 339 Abort 303 340 endif 341 342 SetDataFolder $("root:"+str) 304 343 305 344 // Setup parameter table for model function … … 310 349 // output smeared intensity wave, dimensions are identical to experimental QSIG values 311 350 // make extra copy of experimental q-values for easy plotting 312 Duplicate/O $ gQvalssmeared_CYL_SHS,smeared_qvals351 Duplicate/O $(str+"_q") smeared_CYL_SHS,smeared_qvals 313 352 SetScale d,0,0,"1/cm",smeared_CYL_SHS 314 315 smeared_CYL_SHS := SmearedCylinder_SHS(smear_coef_CYL_SHS,$gQvals) 353 354 Variable/G gs_CYL_SHS=0 355 gs_CYL_SHS := fSmearedCylinder_SHS(smear_coef_CYL_SHS,smeared_CYL_SHS,smeared_qvals) //this wrapper fills the STRUCT 356 316 357 Display smeared_CYL_SHS vs smeared_qvals 317 358 ModifyGraph log=1,marker=29,msize=2,mode=4 … … 320 361 321 362 AutoPositionWindow/M=1/R=$(WinName(0,1)) $WinName(0,2) 322 End 323 324 Function Cylinder_SHS(w,x) : FitFunc 325 Wave w 326 Variable x 363 364 SetDataFolder root: 365 End 366 367 368 Function Cylinder_SHS(w,yw,xw) : FitFunc 369 Wave w,yw,xw 327 370 328 371 Variable inten,rad,len … … 346 389 347 390 //calculate each and combine 348 inten = CylinderForm(form_CYL_SHS,x) 349 inten *= StickyHS_Struct(struct_CYL_SHS,x) 350 inten *= w[0] 351 inten += w[6] 391 Duplicate/O xw temp_CYL_SHS_PQ,temp_CYL_SHS_SQ //make waves for the AAO 392 CylinderForm(form_CYL_SHS,temp_CYL_SHS_PQ,xw) 393 StickyHS_Struct(struct_CYL_SHS,temp_CYL_SHS_SQ,xw) 394 yw = temp_CYL_SHS_PQ * temp_CYL_SHS_SQ 395 yw *= w[0] 396 yw += w[6] 352 397 353 398 //cleanup waves 354 399 // Killwaves/Z form_CYL_SHS,struct_CYL_SHS 355 400 356 return ( inten)401 return (0) 357 402 End 358 403 … … 360 405 361 406 // this is all there is to the smeared calculation! 362 Function SmearedCylinder_HS(w,x) :FitFunc 363 Wave w 364 Variable x 365 366 Variable ans 367 SVAR sq = gSig_Q 368 SVAR qb = gQ_bar 369 SVAR sh = gShadow 370 SVAR gQ = gQVals 371 372 //the name of your unsmeared model is the first argument 373 ans = Smear_Model_20(Cylinder_HS,$sq,$qb,$sh,$gQ,w,x) 374 375 return(ans) 407 Function SmearedCylinder_HS(s) :FitFunc 408 Struct ResSmearAAOStruct &s 409 410 // the name of your unsmeared model is the first argument 411 s.yW = Smear_Model_20(Cylinder_HS,s.coefW,s.xW,s.resW) 412 413 return(0) 376 414 End 377 415 378 416 // this is all there is to the smeared calculation! 379 Function SmearedCylinder_SW(w,x) :FitFunc 380 Wave w 381 Variable x 382 383 Variable ans 384 SVAR sq = gSig_Q 385 SVAR qb = gQ_bar 386 SVAR sh = gShadow 387 SVAR gQ = gQVals 388 389 //the name of your unsmeared model is the first argument 390 ans = Smear_Model_20(Cylinder_SW,$sq,$qb,$sh,$gQ,w,x) 391 392 return(ans) 417 Function SmearedCylinder_SW(s) :FitFunc 418 Struct ResSmearAAOStruct &s 419 420 // the name of your unsmeared model is the first argument 421 s.yW = Smear_Model_20(Cylinder_SW,s.coefW,s.xW,s.resW) 422 423 return(0) 393 424 End 394 425 395 426 // this is all there is to the smeared calculation! 396 Function SmearedCylinder_SC(w,x) :FitFunc 397 Wave w 398 Variable x 399 400 Variable ans 401 SVAR sq = gSig_Q 402 SVAR qb = gQ_bar 403 SVAR sh = gShadow 404 SVAR gQ = gQVals 405 406 //the name of your unsmeared model is the first argument 407 ans = Smear_Model_20(Cylinder_SC,$sq,$qb,$sh,$gQ,w,x) 408 409 return(ans) 427 Function SmearedCylinder_SC(s) :FitFunc 428 Struct ResSmearAAOStruct &s 429 430 // the name of your unsmeared model is the first argument 431 s.yW = Smear_Model_20(Cylinder_SC,s.coefW,s.xW,s.resW) 432 433 return(0) 410 434 End 411 435 412 436 // this is all there is to the smeared calculation! 413 Function SmearedCylinder_SHS(w,x) :FitFunc 414 Wave w 415 Variable x 416 417 Variable ans 418 SVAR sq = gSig_Q 419 SVAR qb = gQ_bar 420 SVAR sh = gShadow 421 SVAR gQ = gQVals 422 423 //the name of your unsmeared model is the first argument 424 ans = Smear_Model_20(Cylinder_SHS,$sq,$qb,$sh,$gQ,w,x) 425 426 return(ans) 427 End 437 Function SmearedCylinder_SHS(s) :FitFunc 438 Struct ResSmearAAOStruct &s 439 440 // the name of your unsmeared model is the first argument 441 s.yW = Smear_Model_20(Cylinder_SHS,s.coefW,s.xW,s.resW) 442 443 return(0) 444 End 445 446 //wrapper to calculate the smeared model as an AAO-Struct 447 // fills the struct and calls the ususal function with the STRUCT parameter 448 // 449 // used only for the dependency, not for fitting 450 // 451 Function fSmearedCylinder_HS(coefW,yW,xW) 452 Wave coefW,yW,xW 453 454 String str = getWavesDataFolder(yW,0) 455 String DF="root:"+str+":" 456 457 WAVE resW = $(DF+str+"_res") 458 459 STRUCT ResSmearAAOStruct fs 460 WAVE fs.coefW = coefW 461 WAVE fs.yW = yW 462 WAVE fs.xW = xW 463 WAVE fs.resW = resW 464 465 Variable err 466 err = SmearedCylinder_HS(fs) 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 fSmearedCylinder_SW(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 = SmearedCylinder_SW(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 fSmearedCylinder_SC(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 = SmearedCylinder_SC(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 fSmearedCylinder_SHS(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 = SmearedCylinder_SHS(fs) 542 543 return (0) 544 End
Note: See TracChangeset
for help on using the changeset viewer.