- Timestamp:
- Oct 15, 2008 5:13:05 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/SASCALC.ipf
r428 r429 73 73 // data 74 74 Make/O/D/N=(128,128) root:Packages:NIST:SAS:data,root:Packages:NIST:SAS:linear_data 75 Make/O/D/N=2 root:Packages:NIST:SAS:aveint,root:Packages:NIST:SAS:qval 75 Make/O/D/N=2 root:Packages:NIST:SAS:aveint,root:Packages:NIST:SAS:qval,root:Packages:NIST:SAS:sigave 76 76 root:Packages:NIST:SAS:data = 1 77 77 root:Packages:NIST:SAS:linear_data = 1 … … 82 82 // -(hard coded right now - look for NVAR declarations) 83 83 Variable/G root:Packages:NIST:SAS:gBinWidth=1 84 Variable/G root:Packages:NIST:SAS:gisLogScale=0 85 String/G root:Packages:NIST:SAS:FileList = "SASCALC" 84 86 85 87 // for the panel … … 99 101 Variable/G root:Packages:NIST:SAS:gUsingLenses = 0 //0=no lenses, 1=lenses(or prisms) 100 102 Variable/G root:Packages:NIST:SAS:gModelOffsetFactor = 1 103 104 // for the MC simulation 105 Variable/G root:Packages:NIST:SAS:gImon = 10000 106 Variable/G root:Packages:NIST:SAS:gThick = 0.1 107 Variable/G root:Packages:NIST:SAS:gSig_incoh = 0.1 108 String/G root:Packages:NIST:SAS:gFuncStr = "SphereForm" 109 Variable/G root:Packages:NIST:SAS:gR2 = 2.54/2 110 Variable/G root:Packages:NIST:SAS:gDoMonteCarlo = 0 111 Make/O/D/N=10 root:Packages:NIST:SAS:results = 0 112 Make/O/T/N=10 root:Packages:NIST:SAS:results_desc = {"total X-section (1/cm)","SAS X-section (1/cm)","# reaching detector","fraction reaching detector","# that interact","fraction singly scattered","fraction transmitted","","",""} 101 113 102 114 //tick labels for SDD slider … … 239 251 rw[17] = 64 // beamcenter Y 240 252 241 rw[10] = 5 //detector resolution (5mm) and calibration constants (linearity)253 rw[10] = 5.08 //detector resolution (5mm) and calibration constants (linearity) 242 254 rw[11] = 10000 243 rw[13] = 5 255 rw[12] = 0 256 rw[13] = 5.08 244 257 rw[14] = 10000 258 rw[15] = 0 245 259 246 260 rw[20] = 65 // det size in cm … … 267 281 Display /W=(5,44,463,570)/K=1 aveint vs qval as "SASCALC" 268 282 DoWindow/C SASCALC 269 SetDataFolder fldrSav0270 283 ModifyGraph cbRGB=(49151,53155,65535) 271 284 ModifyGraph mode=3 … … 275 288 Modifygraph grid=1 276 289 Modifygraph mirror=2 290 ModifyGraph msize(aveint)=2 291 ErrorBars/T=0 aveint Y,wave=(sigave,sigave) 277 292 Label bottom, "Q (1/A)" 278 293 Label left, "Relative Intensity" 279 294 legend 280 295 SetDataFolder fldrSav0 296 297 281 298 ControlBar 200 282 299 … … 316 333 317 334 SetVariable setvar0_3,pos={140,94},size={110,15},title="Diam (mm)",disable=1 318 SetVariable setvar0_3,limits={0,100,0.1},value= root:Packages:NIST:SAS:gSamApOther,proc=S ourceApOtherSetVarProc335 SetVariable setvar0_3,limits={0,100,0.1},value= root:Packages:NIST:SAS:gSamApOther,proc=SampleApOtherSetVarProc 319 336 320 337 CheckBox checkLens,pos={6,155},size={44,14},proc=LensCheckProc,title="Lenses?" … … 628 645 endif 629 646 647 // do the simulation here 648 Variable r1,xCtr,yCtr,sdd,pixSize,wavelength 649 String coefStr 650 651 // Variable imon,thick,r2,sig_incoh 652 // String funcStr 653 // imon = 10000 654 // thick = 0.1 655 // sig_incoh = 0.1 656 // funcStr = "SphereForm" 657 // r2 = 2.54/2 //typical 1" diameter sample, convert to radius in cm 658 659 NVAR doMonteCarlo = root:Packages:NIST:SAS:gDoMonteCarlo // == 1 if MC, 0 if other 660 SVAR funcStr = root:Packages:NIST:SAS:gFuncStr 661 662 if(doMonteCarlo == 1) 663 WAVE rw=root:Packages:NIST:SAS:realsRead 664 665 NVAR imon = root:Packages:NIST:SAS:gImon 666 NVAR thick = root:Packages:NIST:SAS:gThick 667 NVAR sig_incoh = root:Packages:NIST:SAS:gSig_incoh 668 NVAR r2 = root:Packages:NIST:SAS:gR2 669 670 r1 = rw[24]/2/10 // sample diameter convert diam in [mm] to radius in cm 671 xCtr = rw[16] 672 yCtr = rw[17] 673 sdd = rw[18]*100 //conver header of [m] to [cm] 674 pixSize = rw[10]/10 // convert pix size in mm to cm 675 wavelength = rw[26] 676 coefStr = MC_getFunctionCoef(funcStr) 677 678 if(!MC_CheckFunctionAndCoef(funcStr,coefStr)) 679 Abort "The coefficients and function type do not match. Please correct the selections in the popup menus." 680 endif 681 682 FUNCREF SANSModelAAO_MCproto func=$funcStr 683 WAVE results = root:Packages:NIST:SAS:results 684 results = 0 685 686 Monte_SANS(imon,r1,r2,xCtr,yCtr,sdd,pixSize,thick,wavelength,sig_incoh,func,$coefStr,results) 687 688 // convert to absolute scale 689 Variable kappa,beaminten = beamIntensity() 690 // results[6] is the fraction transmitted 691 // kappa = beamInten*pi*r1*r1*thick*(pixSize/sdd)^2*results[6]*(iMon/beaminten) 692 kappa = thick*(pixSize/sdd)^2*results[6]*iMon *2 //why the factor of 2? 693 694 WAVE linear_data = root:Packages:NIST:SAS:linear_data 695 WAVE data = root:Packages:NIST:SAS:data 696 linear_data = linear_data / kappa 697 data = linear_data 698 699 endif 700 630 701 // update the wave with the beamstop diameter here, since I don't know what 631 702 // combinations of parameters will change the BS - but anytime the curve is … … 642 713 643 714 //aveint = S_SphereForm(1,80,1e-6,0,qval) 644 aveint = S_Debye(1000,100,0.0,qval) 645 646 // multiply by beamstop shadowing 715 if(doMonteCarlo != 1) 716 if(exists(funcStr) != 0) 717 FUNCREF SANSModelAAO_MCproto func=$funcStr 718 coefStr = MC_getFunctionCoef(funcStr) 719 720 if(!MC_CheckFunctionAndCoef(funcStr,coefStr)) 721 Abort "The coefficients and function type do not match. Please correct the selections in the popup menus." 722 endif 723 func($coefStr,aveint,qval) 724 else 725 aveint = S_Debye(1000,100,0.0,qval) 726 endif 727 endif 728 729 // multiply either estimate by beamstop shadowing 647 730 aveint *= fSubS 648 731 … … 1367 1450 1368 1451 // change the sample aperture to a non-standard value 1369 Function S ourceApOtherSetVarProc(ctrlName,varNum,varStr,varName) : SetVariableControl1452 Function SampleApOtherSetVarProc(ctrlName,varNum,varStr,varName) : SetVariableControl 1370 1453 String ctrlName 1371 1454 Variable varNum
Note: See TracChangeset
for help on using the changeset viewer.