Changeset 940 for sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS
- Timestamp:
- May 21, 2014 3:52:02 PM (9 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/ANSTO_DataReadWrite.ipf
r800 r940 565 565 // end April 2011 additions 566 566 567 // read the detector deadtime (in seconds) 568 Function getDetectorDeadtime(fname) 569 String fname 570 571 return(0) 572 end 573 574 567 575 //whole transmission is NCNR-specific right now 568 576 // leave this stub empty … … 774 782 End 775 783 784 // Write the detector deadtime to the file header (in seconds) 785 Function WriteDeadtimeToHeader(fname,num) 786 String fname 787 Variable num 788 789 return(0) 790 End 776 791 777 792 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/FACILITY_DataReadWrite.ipf
r795 r940 764 764 End 765 765 766 766 // Write the detector deadtime to the file header (in seconds) 767 Function WriteDeadtimeToHeader(fname,num) 768 String fname 769 Variable num 770 771 return(0) 772 End 767 773 768 774 //////// ACCESSORS FOR READING DATA FROM THE HEADER ////////////// … … 1112 1118 1113 1119 return(value) 1120 end 1121 1122 // read the detector deadtime (in seconds) 1123 Function getDetectorDeadtime(fname) 1124 String fname 1125 1126 return(0) 1114 1127 end 1115 1128 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/HFIR_DataReadWrite.ipf
r804 r940 785 785 return(mtime) 786 786 end 787 788 789 // read the detector deadtime (in seconds) 790 Function getDetectorDeadtime(fname) 791 String fname 792 793 return(0) 794 end 795 787 796 788 797 ////// integer values … … 1755 1764 End 1756 1765 1766 // Write the detector deadtime to the file header (in seconds) 1767 Function WriteDeadtimeToHeader(fname,num) 1768 String fname 1769 Variable num 1770 1771 return(0) 1772 End 1773 1757 1774 // sample label 1758 1775 // limit to 60 characters -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/HFIR_Utils.ipf
r795 r940 166 166 // [dateAndTimeStr] is optional, and could be used as a switch for 167 167 // different historical detector configurations 168 Function DetectorDeadtime(fileStr,detStr,[dateAndTimeStr ])168 Function DetectorDeadtime(fileStr,detStr,[dateAndTimeStr,dtime]) 169 169 String fileStr,detStr,dateAndTimeStr 170 Variable dtime 170 171 171 172 Variable deadtime -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/ILL_DataReadWrite.ipf
r795 r940 920 920 End 921 921 922 // Write the detector deadtime to the file header (in seconds) 923 Function WriteDeadtimeToHeader(fname,num) 924 String fname 925 Variable num 926 927 return(0) 928 End 922 929 923 930 … … 1386 1393 end 1387 1394 1395 // read the detector deadtime (in seconds) 1396 Function getDetectorDeadtime(fname) 1397 String fname 1398 1399 return(0) 1400 end 1388 1401 1389 1402 //reads the wavelength from a reduced data file (not very reliable) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/ILL_Utils.ipf
r857 r940 177 177 // [dateAndTimeStr] is optional, and could be used as a switch for 178 178 // different historical detector configurations 179 Function DetectorDeadtime(fileStr,detStr,[dateAndTimeStr ])179 Function DetectorDeadtime(fileStr,detStr,[dateAndTimeStr,dtime]) 180 180 String fileStr,detStr,dateAndTimeStr 181 Variable dtime 181 182 182 183 Variable deadtime -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/KIST_DataReadWrite.ipf
r810 r940 764 764 End 765 765 766 766 // Write the detector deadtime to the file header (in seconds) 767 Function WriteDeadtimeToHeader(fname,num) 768 String fname 769 Variable num 770 771 return(0) 772 End 767 773 768 774 //////// ACCESSORS FOR READING DATA FROM THE HEADER ////////////// … … 1112 1118 1113 1119 return(value) 1120 end 1121 1122 // read the detector deadtime (in seconds) 1123 Function getDetectorDeadtime(fname) 1124 String fname 1125 1126 return(0) 1114 1127 end 1115 1128 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/MC_SimulationScripting.ipf
r924 r940 653 653 End 654 654 655 // instrName = "check NG3" or "checkNG7" or "checkNGB"655 // instrName = "checkCGB" or "checkNG7" or "checkNGB" (checkNG3 has been removed) 656 656 // these are the only allowable choices 657 657 Function Sim_SetInstrument(instrName) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_DataReadWrite.ipf
r926 r940 1315 1315 End 1316 1316 1317 // Write the detector deadtime to the file header (in seconds) @ byte 498 1318 Function WriteDeadtimeToHeader(fname,num) 1319 String fname 1320 Variable num 1321 1322 WriteVAXReal(fname,num,498) 1323 return(0) 1324 End 1325 1326 1327 1317 1328 //rewrite a text field back to the header 1318 1329 // fname is the full path:name … … 1693 1704 1694 1705 end 1706 1707 // read the detector deadtime (in seconds) 1708 Function getDetectorDeadtime(fname) 1709 String fname 1710 1711 return(getRealValueFromHeader(fname,498)) 1712 end 1713 1714 1715 1695 1716 1696 1717 ////// integer values … … 2901 2922 2902 2923 2924 // May 2014 - SRK 2925 // Detector Deadtime (possibly) written to file by ICE 2926 2927 Proc PatchDetectorDeadtime(firstFile,lastFile,deadtime) 2928 Variable firstFile=1,lastFile=100,deadtime 2929 2930 fPatchDetectorDeadtime(firstFile,lastFile,deadtime) 2931 2932 End 2933 2934 Proc ReadDetectorDeadtime(firstFile,lastFile) 2935 Variable firstFile=1,lastFile=100 2936 2937 fReadDetectorDeadtime(firstFile,lastFile) 2938 End 2939 2940 // simple utility to patch the detector deadtime in the file headers 2941 // pass in the account name as a string 2942 // lo is the first file number 2943 // hi is the last file number (inclusive) 2944 // 2945 Function fPatchDetectorDeadtime(lo,hi,deadtime) 2946 Variable lo,hi,deadtime 2947 2948 Variable ii 2949 String file 2950 2951 //loop over all files 2952 for(ii=lo;ii<=hi;ii+=1) 2953 file = FindFileFromRunNumber(ii) 2954 if(strlen(file) != 0) 2955 WriteDeadtimeToHeader(file,deadtime) 2956 else 2957 printf "run number %d not found\r",ii 2958 endif 2959 endfor 2960 2961 return(0) 2962 End 2963 2964 // simple utility to read the detector deadtime stored in the file header 2965 Function fReadDetectorDeadtime(lo,hi) 2966 Variable lo,hi 2967 2968 String file 2969 Variable ii,deadtime 2970 2971 for(ii=lo;ii<=hi;ii+=1) 2972 file = FindFileFromRunNumber(ii) 2973 if(strlen(file) != 0) 2974 deadtime = getDetectorDeadtime(file) 2975 printf "File %d: Detector Dead time (s) = %g\r",ii,deadtime 2976 else 2977 printf "run number %d not found\r",ii 2978 endif 2979 endfor 2980 2981 return(0) 2982 End 2983 2984 2985 2903 2986 ///// 2904 2987 Proc ReadDetectorCount(firstFile,lastFile) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_Utils.ipf
r925 r940 480 480 // Instrument Date measured deadtime constant 481 481 // NG3 DECEMBER 2009 1.5 microseconds 482 // NG7 APRIL 20102.3 microseconds482 // NG7 APRIL 2010 2.3 microseconds 483 483 // NGB JAN 2013 4 microseconds 484 484 // … … 490 490 // data collection date. 491 491 // 492 // 493 Function DetectorDeadtime(fileStr,detStr,[dateAndTimeStr]) 492 // May 2014 SRK -- optional parameter dtime is the dead time as read in from the file 493 // -- if if is non-zero, use it. If it's zero, go through tree and pick from the global constants 494 // 495 // MAY 2014 -- if the beam is CGB (now that the NG3 SANS has been moved to NGB), the logic 496 // drops to select the values from NG3, since nothing has changed. When it does, I'll add in specifics for CGB 497 // 498 Function DetectorDeadtime(fileStr,detStr,[dateAndTimeStr,dtime]) 494 499 String fileStr,detStr,dateAndTimeStr 500 Variable dtime 495 501 496 502 Variable deadtime … … 509 515 NVAR DeadtimeNGB_ORNL_ICE = root:myGlobals:DeadtimeNGB_ORNL_ICE 510 516 NVAR DeadtimeDefault = root:myGlobals:DeadtimeDefault 517 518 // if the deadtime passed in is good, return it and get out. MAY 2014 519 if(dtime > 0) 520 Print "Deadtime from the file = ",dtime 521 return(dtime) 522 endif 523 511 524 512 525 // if no date string is passed, default to the ICE values -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/QKK_ANSTO_DataReadWrite.ipf
r908 r940 2071 2071 end 2072 2072 2073 // read the detector deadtime (in seconds) 2074 Function getDetectorDeadtime(fname) 2075 String fname 2076 2077 return(0) 2078 end 2079 2080 // Write the detector deadtime to the file header (in seconds) 2081 Function WriteDeadtimeToHeader(fname,num) 2082 String fname 2083 Variable num 2084 2085 return(0) 2086 End 2073 2087 2074 2088 //reads the wavelength from a reduced data file (not very reliable) -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/SASCALC.ipf
r933 r940 32 32 // Configurations are outputted to text using command "SaveNICEConfigs()" 33 33 // 34 // MAY 2014 SRK -- changed nomenclature of NG3 to be CGB (shows on button as NGB30) - Nothing changes in the simulation 35 // so this change is nothing but cosmetic. I will need to update the flux calibration, but there is no need to keep the old. 36 // 37 // 38 // 34 39 // 35 40 // calculate what q-values you get based on the instruments settings … … 53 58 // the global -- root:Packages:NIST:SAS:instrument (search for it everywhere...) 54 59 // x- repair the naming/numbering scheme to look for the string "NGx" and switch on that, not a number, which is unreliable and confusing. 60 // 61 // 62 // TODO_CGB: 63 // For the moved NG3 instrument: 64 // -- update the flux values once some measurements have been done 65 // -- update the wavelength spread values once they have been measured 66 // -- be sure that no other dimensions have been changed after the move 67 // -- polarizer is gone now. Be sure apertures are correct in UpdateControls() 68 // -- any other changes??? 55 69 // 56 70 // use str2hex(str) (my function) to convert "A" to 10 … … 118 132 // for the panel 119 133 // Variable/G root:Packages:NIST:SAS:gInst=3 //or 7 for NG7 120 String/G root:Packages:NIST:SAS:gInstStr="NG3" //or "NG7" or "NGB"=10m or "CGB"=NG3 moved 134 // String/G root:Packages:NIST:SAS:gInstStr="NG3" //or "NG7" or "NGB"=10m or "CGB"=NG3 moved 135 String/G root:Packages:NIST:SAS:gInstStr="CGB" //or "NG7" or "NGB"=10m or "CGB"=NG3 moved 121 136 Variable/G root:Packages:NIST:SAS:gNg=0 122 137 Variable/G root:Packages:NIST:SAS:gTable=2 //2=chamber, 1=table … … 208 223 SetDataFolder root:Packages:NIST:SAS 209 224 210 String/G gSelectedInstrument="checkNG3" 211 String/G gInstStr = "NG3" 225 // String/G gSelectedInstrument="checkNG3" 226 // String/G gInstStr = "NG3" 227 String/G gSelectedInstrument="checkCGB" 228 String/G gInstStr = "CGB" 212 229 213 230 Variable/G s12 = 54.8 … … 340 357 /// this is the (incomplete) definition of the 10m SANS instrument 341 358 // on NG-B, which will be referred to as NGB here to keep the NG(number) notation 342 // reserving NGB for the moved NG3 instrument359 // reserving CGB for the moved NG3 instrument 343 360 // which may be simpler here to keep functions from breaking... 344 361 // … … 519 536 Slider SC_Slider_2,pos={394,21},size={47,65},proc=OffsetSliderProc,live=0,ticks=4 520 537 Slider SC_Slider_2,limits={0,25,1},variable= root:Packages:NIST:SAS:gOffset//,thumbColor= (1,16019,65535) 521 CheckBox checkNG3,pos={20,19},size={36,14},proc=SelectInstrumentCheckProc,title="NG3" 522 CheckBox checkNG3,value=1,mode=1 523 CheckBox checkNG7,pos={66,19},size={36,14},proc=SelectInstrumentCheckProc,title="NG7" 538 // CheckBox checkNG3,pos={20,19},size={36,14},proc=SelectInstrumentCheckProc,title="NG3" 539 // CheckBox checkNG3,value=1,mode=1 540 CheckBox checkCGB,pos={17,19},size={36,14},proc=SelectInstrumentCheckProc,title="NGB30" 541 CheckBox checkCGB,value=1,mode=1 542 CheckBox checkNG7,pos={70,19},size={36,14},proc=SelectInstrumentCheckProc,title="NG7" 524 543 CheckBox checkNG7,value=0,mode=1 525 544 … … 530 549 // -- hide/unhide the 10m SANS 531 550 if(show10mSANS) 532 CheckBox checkNGB,pos={11 0,19},size={40,14},proc=SelectInstrumentCheckProc,title="NGB"551 CheckBox checkNGB,pos={114,19},size={40,14},proc=SelectInstrumentCheckProc,title="NGB" 533 552 CheckBox checkNGB,value=0,mode=1 534 553 endif … … 551 570 Button ClearButton proc=S_ClearButtonProc 552 571 // GroupBox group0,pos={6,1},size={108,36},title="Instrument" 553 GroupBox group0,pos={6,1},size={160,3 6},title="Instrument"572 GroupBox group0,pos={6,1},size={160,39},title="Instrument" 554 573 SetDataFolder fldrSav0 555 574 … … 614 633 615 634 strswitch(selInstr) // string switch 635 case "CGB": 616 636 case "NG3": // 617 637 switch(ng) … … 830 850 831 851 strswitch(ctrlName) // string switch 832 case "check NG3": //833 checkBox check NG3,win=SASCALC, value=1852 case "checkCGB": // 853 checkBox checkCGB,win=SASCALC, value=1 834 854 checkBox checkNG7,win=SASCALC, value=0 835 855 checkBox checkNGB,win=SASCALC, value=0 836 856 initNG3() 837 break 857 break 858 // case "checkNG3": // 859 // checkBox checkNG3,win=SASCALC, value=1 860 // checkBox checkNG7,win=SASCALC, value=0 861 // checkBox checkNGB,win=SASCALC, value=0 862 // initNG3() 863 // break 838 864 case "checkNG7": // 839 checkBox checkNG3,win=SASCALC, value=0 865 // checkBox checkNG3,win=SASCALC, value=0 866 checkBox checkCGB,win=SASCALC, value=0 840 867 checkBox checkNG7,win=SASCALC, value=1 841 868 checkBox checkNGB,win=SASCALC, value=0 … … 843 870 break 844 871 case "checkNGB": // 10m SANS 845 checkBox checkNG3,win=SASCALC, value=0 872 // checkBox checkNG3,win=SASCALC, value=0 873 checkBox checkCGB,win=SASCALC, value=0 846 874 checkBox checkNG7,win=SASCALC, value=0 847 875 checkBox checkNGB,win=SASCALC, value=1 … … 922 950 lens = checked 923 951 strswitch(selInstr) // string switch 952 case "CGB": 924 953 case "NG3": 925 954 dist = 1317 … … 990 1019 991 1020 // instrument specific distance requirements 992 if(cmpstr(selInstr,"NG3") == 0 && dist != 1317) 1021 // if(cmpstr(selInstr,"NG3") == 0 && dist != 1317) 1022 if(cmpstr(selInstr,"CGB") == 0 && dist != 1317) 993 1023 lensNotAllowed=1 994 1024 endif … … 999 1029 1000 1030 // instrument specific wavelength requirements 1001 if(cmpstr(selInstr,"NG3") == 0 && !(lam == 8.4 || lam == 17.2) ) 1031 // if(cmpstr(selInstr,"NG3") == 0 && !(lam == 8.4 || lam == 17.2) ) 1032 if(cmpstr(selInstr,"CGB") == 0 && !(lam == 8.4 || lam == 17.2) ) 1002 1033 lensNotAllowed=1 1003 1034 endif … … 2181 2212 2182 2213 strswitch(selInstr) // string switch 2214 case "CGB": 2183 2215 case "NG3": 2184 2216 case "NG7": … … 2222 2254 2223 2255 strswitch(selInstr) // string switch 2256 case "CGB": 2224 2257 case "NG3": 2225 2258 case "NG7": -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/WorkFileUtils.ipf
r916 r940 146 146 147 147 //deadtime corrections to raw data 148 deadTime = DetectorDeadtime(raw_text[3],raw_text[9],dateAndTimeStr=raw_text[1] ) //pick the correct detector deadtime, switch on date too148 deadTime = DetectorDeadtime(raw_text[3],raw_text[9],dateAndTimeStr=raw_text[1],dtime=raw_reals[48]) //pick the correct detector deadtime, switch on date too 149 149 itim = raw_ints[2] 150 150 cntrate = sum(raw_data,-inf,inf)/itim //080802 use data sum, rather than scaler value … … 334 334 itim = integersread[2] 335 335 cntrate = sum(data,-inf,inf)/itim //use sum of detector counts rather than scaler value 336 deadtime = DetectorDeadtime(textread[3],textread[9],dateAndTimeStr=textRead[1] ) //pick the correct deadtime336 deadtime = DetectorDeadtime(textread[3],textread[9],dateAndTimeStr=textRead[1],dtime=realsRead[48]) //pick the correct deadtime 337 337 dscale = 1/(1-deadTime*cntrate) 338 338
Note: See TracChangeset
for help on using the changeset viewer.