Changeset 546
- Timestamp:
- Aug 10, 2009 3:40:06 PM (13 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/USANS_Includes.ipf
r544 r546 21 21 #include "GaussUtils_v40" //added Oct 2008 for unified file loading 22 22 23 // USANS simulation test23 // USANS simulation and required procedures 24 24 #include "U_CALC" 25 #include "MultScatter_MonteCarlo_2D" 26 #include "SASCALC" 27 #include "NCNR_DataReadWrite" 28 #include "SANS_Utilities" 29 #include "NCNR_Utils" 30 #include "MultipleReduce" -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/U_CALC.ipf
r544 r546 18 18 // 19 19 20 // 20 21 21 // need to add in empty and background corrections to see "reduced" data 22 22 // or at least compare to what the empty cell would give in the same count time … … 29 29 30 30 31 #include "MultScatter_MonteCarlo_2D"31 //#include "MultScatter_MonteCarlo_2D" 32 32 33 33 … … 99 99 String/G gFuncStr="" 100 100 String/G gTotTimeStr="" 101 Variable/G gAnalyzerOmega = 7.1e-7 //solid angle of the analyzer, in steradians 102 Variable/G gBeamCurrent=25000 //beam current Ed*I (n/s) for 5/8" diam = 25000 n/s 101 103 Variable/G gThick=0.1 //sample thickness (cm) 102 104 Variable/G gSamTrans=0.8 … … 137 139 GroupBox group2,pos={327,165},size={259,147},title="Results" 138 140 139 PopupMenu popup0,pos={17,18},size={165,20},title="Sample Aperture Diameter" 140 PopupMenu popup0,mode=10,popvalue="5/8\"",value="1/16\";1/8\";3/16\";1/4\";5/16\";3/8\";7/16\";1/2\";9/16\";5/8\";11/16\";3/4\";" 141 PopupMenu popup0,pos={17,18},size={165,20},title="Sample Aperture Diam (in)" 142 PopupMenu popup0,mode=2,popvalue="0.625",value="0.5;0.625;0.75;1.0;1.75;" 143 // PopupMenu popup0,proc=Sim_USANS_SamplAperPopMenuProc 141 144 PopupMenu popup2,pos={220,18},size={165,20},title="Presets" 142 145 PopupMenu popup2,mode=3,popvalue="Long Count",value="Short Count;Medium Count;Long Count;" … … 531 534 532 535 //sort after all loaded - not by angle, but by Q 536 // Get rid of the negative angles - the smearing integration does not like these! 537 // (may add them back in later, but probably not) 533 538 UDoAngleSort("SIM") 534 539 535 540 ConvertAngle2Qvals("SIM",0) 541 542 536 543 537 544 //fill the data with something … … 561 568 562 569 String coefStr="" 563 Variable sig_sas=0,wavelength = 2.4 ,omega570 Variable sig_sas=0,wavelength = 2.4 564 571 Variable Imon 565 572 566 573 567 568 omega = 7.1e-7 //solid angle of the detector 574 NVAR omega = root:Packages:NIST:USANS:Globals:U_Sim:gAnalyzerOmega 569 575 570 576 if(exists(funcStr) != 0) … … 590 596 591 597 Imon = GetUSANSBeamIntensity() //based on the aperture size, select the beam intensity 592 598 Print "imon=",imon 593 599 // calculate the scattering cross section simply to be able to estimate the transmission 594 600 … … 604 610 Duplicate/O qvals prob_i 605 611 606 prob_i = trans*thick*omega*Smeared_inten //probability of a neutron in q-bin(i) that has nCells612 prob_i = trans*thick*omega*Smeared_inten //probability of a neutron in q-bin(i) 607 613 608 614 Variable P_on = sum(prob_i,-inf,inf) … … 662 668 // include counting time and setNumber 663 669 // 670 // also trims the beginning of each data set so that it does not include any negative or zero angles 671 // 664 672 Function UDoAngleSort(type) 665 673 String type … … 676 684 677 685 Sort Angle DetCts,ErrDetCts,MonCts,TransCts,Angle,countingTime,SetNumber 686 687 Variable ii,num,numBad,ang,val 688 num=numpnts(angle) 689 ii=0 690 numBad=0 691 val = 0 //cutoff value 692 do 693 ang = angle[ii] 694 if(ang <= val) 695 numBad += 1 696 else //keep the points 697 Angle[ii-numBad] = ang 698 DetCts[ii-numBad] = DetCts[ii] 699 ErrDetCts[ii-numBad] = ErrDetCts[ii] 700 MonCts[ii-numBad] = MonCts[ii] 701 TransCts[ii-numBad] = TransCts[ii] 702 countingTime[ii-numBad] = countingTime[ii] 703 SetNumber[ii-numBad] = SetNumber[ii] 704 endif 705 ii += 1 706 while(ii<num) 707 //trim the end of the waves 708 DeletePoints num-numBad, numBad, DetCts,ErrDetCts,MonCts,TransCts,Angle,countingTime,SetNumber 709 710 678 711 return(0) 679 712 End … … 909 942 910 943 944 //Function Sim_USANS_SamplAperPopMenuProc(pa) : PopupMenuControl 945 // STRUCT WMPopupAction &pa 946 // 947 // switch( pa.eventCode ) 948 // case 2: // mouse up 949 // Variable popNum = pa.popNum 950 // String popStr = pa.popStr 951 // 952 // Variable diam=str2num(popStr) 953 // 954 // 955 // break 956 // endswitch 957 // 958 // return 0 959 //End 960 961 911 962 Function UCALC_PresetPopup(pa) : PopupMenuControl 912 963 STRUCT WMPopupAction &pa … … 1092 1143 // return the beam intensity based on the sample aperture diameter 1093 1144 // 1145 /// based on only TWO known values at 0.625 (=25000) and 1.75 in (=57000) diam 1146 // 1147 // so this is a BAD interpolation!!! 1148 // get proper numbers from John 1149 // 1094 1150 Function GetUSANSBeamIntensity() 1095 1151 1096 String popStr , list1097 Variable flux =100001152 String popStr 1153 Variable flux,diam 1098 1154 1099 1155 ControlInfo/W=UCALC popup0 1100 1156 popStr = S_Value 1101 1102 list = "1/16\";1/8\";3/16\";1/4\";5/16\";3/8\";7/16\";1/2\";9/16\";5/8\";11/16\";3/4\";" 1103 1104 // the WhichListItem or a strswitch to get the right flux value 1105 1157 diam=str2num(popStr) 1158 1159 // a switch would be easier, but cases need to be integer 1160 strswitch(popStr) // string switch 1161 case "0.625": // execute if case matches expression 1162 flux=25000 1163 break // exit from switch 1164 case "1.75": // execute if case matches expression 1165 flux=57000 1166 break 1167 default: // optional default expression executed 1168 flux=7200+28400*diam 1169 endswitch 1170 1106 1171 return(flux) 1107 1172 End
Note: See TracChangeset
for help on using the changeset viewer.