- Timestamp:
- Aug 18, 2019 11:12:25 PM (3 years ago)
- Location:
- sans/Dev/branches/quokka_update
- Files:
-
- 2 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/branches/quokka_update/NCNR_Igor_Procedures/NCNR_Package_Loader.ipf
r1124 r1202 188 188 Execute/P "COMPILEPROCEDURES " 189 189 Execute/P ("Initialize()") 190 Execute/P ("Init_MainUSANS()") 190 191 Execute/P ("DoIgorMenu \"Control\" \"Retrieve All Windows\"") 191 192 -
sans/Dev/branches/quokka_update/NCNR_User_Procedures/Common/NIST_XML_v40.ipf
r1091 r1202 3 3 #pragma IgorVersion=6.1 4 4 5 6 5 //#if( exists("XmlOpenFile") && exists("NCNR_VSANS") ) 7 #if ( exists("XmlOpenFile") && exists("NCNR_VSANS") )6 #if ( exists("XmlOpenFile") ) 8 7 9 8 #include "cansasXML", version >= 1.10 … … 1105 1104 1106 1105 Function WriteNISTXML(fileName, NISTfile) 1107 String fileName, NISTfile 1106 String fileName 1107 Struct NISTXMLfile &NISTfile 1108 1108 1109 Abort "XML function provided by XMLutils XOP is not available, get the XOP from : http://www.igorexchange.com/project/XMLutils (see http://www.smallangles.net/wgwiki/index.php/cansas1d_binding_IgorPro for details)" 1109 1110 RETURN(-6) 1110 1111 End 1111 1112 1112 1113 Function WriteXMLWaves_W_Protocol(type,fullpath,dialog) 1113 1114 String type,fullpath -
sans/Dev/branches/quokka_update/NCNR_User_Procedures/Reduction/SANS/QKK_ANSTO_DataReadWrite.ipf
r940 r1202 81 81 82 82 Make/D/O/N=23 $"root:Packages:NIST:RAW:IntegersRead" 83 Make/D/O/N=5 2$"root:Packages:NIST:RAW:RealsRead"83 Make/D/O/N=57 $"root:Packages:NIST:RAW:RealsRead" 84 84 Make/O/T/N=11 $"root:Packages:NIST:RAW:TextRead" 85 85 Make/O/N=7 $"root:Packages:NIST:RAW:LogicalsRead" … … 103 103 104 104 // user account identifier (currently used only for NCNR-specific operations) 105 textw[3]= ""105 textw[3]= getInstrumentType(fname) 106 106 107 107 // sample label … … 110 110 // identifier of detector type, useful for setting detector constants 111 111 //(currently used only for NCNR-specific operations) 112 textw[9]= ""112 textw[9]= getDetectorType(fname) 113 113 114 114 //total counting time in seconds … … 177 177 realw[27] = getWavelengthSpread(fname) 178 178 179 // If lens configuraiton is used, put in a 1, otherwise 0 180 realw[28] = getLens(fname) 181 179 182 // beam stop X-position (motor reading, approximate cm from zero position) 180 183 // currently NCNR-specific use to identify transmission measurements 181 184 // you return 0 182 185 realw[37] = 0 186 187 // add the 4 stAl and stHe constants (scale and thickness by 2) 188 realw[52] = getDetectorParameter(fname, "stAlScale") 189 realw[53] = getDetectorParameter(fname, "stAlWindow") 190 realw[54] = getDetectorParameter(fname, "stHeScale") 191 realw[55] = getDetectorParameter(fname, "stHeWindow") 192 realw[56] = getDetectorParameter(fname, "deadtime") 183 193 184 194 // the actual data array, dimensions are set as globals in … … 437 447 String destFolder 438 448 Make/O/D/N=23 $("root:Packages:NIST:"+destFolder+":IntegersRead") 439 Make/O/D/N=5 2$("root:Packages:NIST:"+destFolder+":RealsRead")449 Make/O/D/N=57 $("root:Packages:NIST:"+destFolder+":RealsRead") 440 450 Make/O/T/N=11 $("root:Packages:NIST:"+destFolder+":TextRead") 441 451 … … 775 785 776 786 Wave hmm_xy = $(dfName+":data:hmm_xy") 787 Wave hmm = $(dfName+":data:hmm") 777 788 778 789 //redimension /I /N = (dimsize(hmm_xy, 2), dimsize(hmm_xy, 1)), data 779 790 //nha. Count arrays need to be floating point, since the data will be divided, normalised etc. 780 redimension /N = (dimsize(hmm_xy, 2), dimsize(hmm_xy, 1)), data 781 data[][] = hmm_xy[0][q][p] 791 792 if (WaveExists(hmm_xy)) 793 if (dimsize(hmm_xy, 2) == 0) 794 redimension /N = (dimsize(hmm_xy, 1), dimsize(hmm_xy, 0)), data 795 data[][] = hmm_xy[q][p] 796 else 797 redimension /N = (dimsize(hmm_xy, 2), dimsize(hmm_xy, 1)), data 798 data[][] = hmm_xy[0][q][p] 799 endif 800 elseif (WaveExists(hmm)) 801 redimension /N = (dimsize(hmm, 3), dimsize(hmm, 2)), data 802 data[][] = hmm[0][0][q][p] 803 else 804 print "hmm or hmm_xy was not found" 805 endif 782 806 783 807 //nha workaround. for wrongly dimensioned Quokka data 191x192 … … 864 888 End 865 889 890 // get the detector effeciency parameters for the app. detector 891 // ideally try to get it from the hdf file and use the 892 // defaults based on the detector type 893 // TBD - the HDF parameter names need to be updated 894 Function getDetectorParameter(fname, pmtag) 895 String fname, pmtag 896 897 String dfName = "" 898 hdfReadSimulated(fname, dfName) 899 900 Variable value, scaleAl, thickAl, scaleHe, depthHe 901 Variable deadtime 902 903 String detType = getDetectorType(fname) 904 strswitch(detType) 905 case "BNL": 906 deadtime = 24.2e-9 907 scaleAl = 0.00967 908 thickAl = 2.02 909 scaleHe = 0.146 910 depthHe = 4.0 911 break 912 case "ORD": 913 default: 914 deadtime = 2.14e-6 915 scaleAl = 0.00967 916 thickAl = 1.52 917 scaleHe = 0.055553 918 depthHe = 6.35 919 endswitch 920 strswitch(pmtag) 921 case "deadtime": 922 value = getHdfParameterValue(fname, "deadtime", deadtime) 923 break 924 case "stAlScale": 925 value = scaleAl 926 break 927 case "stAlWindow": 928 value = getHdfParameterValue(fname, "al_window_thickness", thickAl) 929 break 930 case "stHeScale": 931 value = scaleHe 932 break 933 case "stHeWindow": 934 value = getHdfParameterValue(fname, "he_window_thickness", depthHe) 935 break 936 endswitch 937 return (value) 938 End 939 940 // instrument type 941 Function/S getInstrumentType(fpath) 942 String fpath 943 944 // just uses the the first 3 characters of the fname 945 String fname = ParseFilePath(0, fpath, ":", 1, 0) 946 String instr = fname[0,2] 947 948 return (instr) 949 End 950 951 // detector type for QKK is based on date 952 // QKK switch from Ordela to BNL detector on 9-Nov-2018 953 Function/S getDetectorType(fpath) 954 String fpath 955 956 String detType = "---" 957 String instr = getInstrumentType(fpath) 958 If (cmpstr(instr, "QKK") == 0) 959 String dateStr = getFileCreationDate(fpath) 960 961 // convert string to igor date 962 Variable rDate = stringDate2Secs("2018-11-09 0:0:0") 963 Variable cDate = stringDate2Secs(dateStr) 964 if (cDate >= rDate) 965 detType = "BNL" 966 else 967 detType = "ORD" 968 endif 969 Endif 970 return detType 971 End 972 866 973 // file creation date 867 974 Function/S getFileCreationDate(fname) … … 903 1010 End 904 1011 1012 // expected format YYYY-MM-DD HH:MM:SS 1013 Function stringDate2Secs(dateStr) 1014 String dateStr 1015 Variable year, month, day, hours, mins, secs 1016 String formatStr = "%d-%d-%d %d:%d:%d" 1017 sscanf dateStr, formatStr, year, month, day, hours, mins, secs 1018 Variable dt = date2Secs(year, month, day) + 3600 * hours + 60 * mins + secs 1019 return dt 1020 End 1021 1022 Function getHdfParameterValue(fname, pmtag, defvalue) 1023 String fname, pmtag 1024 Variable defvalue 1025 1026 String dfName = "" 1027 hdfReadSimulated(fname, dfName) 1028 1029 Variable value 1030 Wave pmwave = $(dfName + ":" + pmtag) 1031 if(WaveExists(pmwave)) 1032 value = pmwave[0] 1033 else 1034 print "Can't find parameter " + nameofwave(pmwave) 1035 value = defvalue 1036 endif 1037 1038 return (value) 1039 End 905 1040 906 1041 //monitor count 907 1042 Function getMonitorCount(fname) 908 1043 String fname 909 Variable value 1044 Variable value, bmTime, detTime 910 1045 Variable att, err 911 1046 string dfName = "" … … 928 1063 print "Can't find Monitor Count in " + fname 929 1064 endif 1065 1066 //[geish] 1067 //scale the monitor count to the detector acquisition time 1068 Wave wTime1 = $(dfName+":instrument:detector:time0") 1069 Wave wTime2 = $(dfName+":monitor:bm1_time") 1070 1071 if (WaveExists(wTime1) && WaveExists(wTime2)) 1072 detTime = wTime1[0] 1073 bmTime = wTime2[0] 1074 value = round( value * detTime / bmTime ) 1075 else 1076 print "Can't find Count Time in " + fname 1077 endif 930 1078 931 1079 // davidm … … 1254 1402 // [davidm] 1255 1403 hdfReadSimulated(fname, dfName) 1256 if (exists(dfName+":sample:tc1:sensor:value") != 1) 1404 1405 if(!WaveExists($(dfName+":sample:tc1:sensor:value")) && !WaveExists($(dfName+":sample:tc1:sensor:sensorValueA")) && !WaveExists($(dfName+":sample:tc1:Loop1:start_temperature"))) 1257 1406 err = hdfRead(fname, dfName) 1258 1407 //err not handled here 1259 1408 endif 1260 1261 Wave wSample_tc1_value = $(dfName+":sample:tc1:sensor:value") 1262 if (WaveExists(wSample_tc1_value)) 1263 value = wSample_tc1_value[0] 1264 else 1265 print "Can't find Sample Rotation Angle in " + fname 1409 1410 if (WaveExists($(dfName+":sample:tc1:sensor:value"))) 1411 Wave values = $(dfName+":sample:tc1:sensor:value") 1412 value = values[0] 1413 elseif(WaveExists($(dfName+":sample:tc1:sensor:sensorValueA"))) 1414 Wave values = $(dfName+":sample:tc1:sensor:sensorValueA") 1415 value = values[0] 1416 elseif(WaveExists($(dfName+":sample:tc1:Loop1:start_temperature"))) 1417 Wave values = $(dfName+":sample:tc1:Loop1:start_temperature") 1418 value = values[0] 1419 else 1420 print "Can't find Temperature in " + fname 1421 endif 1422 1423 // [davidm] 1424 //KillWaves wSample_tc1_value 1425 1426 return(value) 1427 end 1428 1429 // magnetic field strength 1430 Function getHtrSw(fname) 1431 String fname 1432 Variable value 1433 1434 // your code returning value 1435 variable err 1436 string dfName = "" 1437 1438 // [davidm] 1439 hdfReadSimulated(fname, dfName) 1440 1441 variable flag = 0 1442 if (WaveExists($(dfName+":sample:ma1:htr_sw"))) 1443 flag = 1 1444 elseif (WaveExists($(dfName+":sample:ma1:magnet:htr_sw"))) 1445 flag = 1 1446 endif 1447 1448 if (flag == 0) 1449 err = hdfRead(fname, dfName) 1450 //err not handled here 1451 endif 1452 1453 if (WaveExists($(dfName+":sample:ma1:htr_sw"))) 1454 Wave values = $(dfName+":sample:ma1:htr_sw") 1455 value = values[0] 1456 elseif (WaveExists($(dfName+":sample:ma1:magnet:htr_sw"))) 1457 Wave values = $(dfName+":sample:ma1:magnet:htr_sw") 1458 value = values[0] 1459 else 1460 value = -1 1461 endif 1462 1463 return(value) 1464 end 1465 Function getMSetpoint(fname) 1466 String fname 1467 Variable value 1468 1469 // your code returning value 1470 variable err 1471 string dfName = "" 1472 1473 // [davidm] 1474 hdfReadSimulated(fname, dfName) 1475 1476 variable flag = 0 1477 if (WaveExists($(dfName+":sample:ma1:setpoint"))) 1478 flag = 1 1479 elseif (WaveExists($(dfName+":sample:ma1:magnet:setpoint"))) 1480 flag = 1 1481 endif 1482 1483 if (flag == 0) 1484 err = hdfRead(fname, dfName) 1485 //err not handled here 1486 endif 1487 1488 if (WaveExists($(dfName+":sample:ma1:setpoint"))) 1489 Wave values = $(dfName+":sample:ma1:setpoint") 1490 value = values[0] 1491 elseif (WaveExists($(dfName+":sample:ma1:magnet:setpoint"))) 1492 Wave values = $(dfName+":sample:ma1:magnet:setpoint") 1493 value = values[0] 1494 else 1495 print "Can't find Magnetic Field Setpoint in " + fname 1496 endif 1497 1498 return(value) 1499 end 1500 Function getMField(fname) 1501 String fname 1502 Variable value 1503 1504 // your code returning value 1505 variable err 1506 string dfName = "" 1507 1508 // [davidm] 1509 hdfReadSimulated(fname, dfName) 1510 1511 variable flag = 0 1512 if (WaveExists($(dfName+":sample:ma1:field"))) 1513 flag = 1 1514 elseif (WaveExists($(dfName+":sample:ma1:magnet:field"))) 1515 flag = 1 1516 endif 1517 1518 if (flag == 0) 1519 err = hdfRead(fname, dfName) 1520 //err not handled here 1521 endif 1522 1523 if (WaveExists($(dfName+":sample:ma1:field"))) 1524 Wave values = $(dfName+":sample:ma1:field") 1525 value = values[0] 1526 elseif (WaveExists($(dfName+":sample:ma1:magnet:field"))) 1527 Wave values = $(dfName+":sample:ma1:magnet:field") 1528 value = values[0] 1529 else 1530 print "Can't find Magnetic Field Strength in " + fname 1531 endif 1532 1533 if (getHtrSw(fname) == 0) 1534 value = getMSetpoint(fname) 1535 endif 1536 1537 // [davidm] 1538 //KillWaves wSample_tc1_value 1539 1540 return(value) 1541 end 1542 1543 // electric field strength 1544 Function getEField(fname) 1545 String fname 1546 Variable value 1547 1548 // your code returning value 1549 variable err 1550 string dfName = "" 1551 1552 // [davidm] 1553 hdfReadSimulated(fname, dfName) 1554 1555 if(!WaveExists($(dfName+":sample:volts1"))) 1556 err = hdfRead(fname, dfName) 1557 //err not handled here 1558 endif 1559 1560 if (WaveExists($(dfName+":sample:volts1"))) 1561 Wave values = $(dfName+":sample:volts1") 1562 value = values[0] 1563 else 1564 print "Can't find Electric Field Strength in " + fname 1266 1565 endif 1267 1566 … … 1870 2169 end 1871 2170 2171 2172 2173 2174 //lens 2175 Function getLens(fname) 2176 String fname 2177 String str 2178 Variable value = 0 2179 // your code returning value 2180 variable err 2181 string dfName = "" 2182 //err = hdfRead(fname, dfName) 2183 //err not handled here 2184 2185 // [davidm] 2186 hdfReadSimulated(fname, dfName) 2187 2188 variable flag = 0 2189 if(WaveExists($(dfName+":instrument:parameters:GuideConfig"))) //canonical location 2190 flag = 1 2191 endif 2192 2193 if(flag == 0) 2194 err = hdfRead(fname, dfName) 2195 //err not handled here 2196 endif 2197 2198 if(WaveExists($(dfName+":instrument:parameters:GuideConfig"))) //canonical location 2199 Wave/T guideConfig = $(dfName+":instrument:parameters:GuideConfig") 2200 str = guideConfig[0] 2201 value = StringMatch(str, "lens") 2202 else 2203 print "Can't find Guide Config in " + fname 2204 endif 2205 2206 KillWaves guideConfig 2207 2208 return(value) 2209 end 2210 2211 1872 2212 //wavelength spread (FWHM) 1873 2213 Function WriteWavelengthDistrToHeader(fname,wavelengthSpread) … … 1948 2288 end 1949 2289 1950 1951 // totalcount time (seconds)2290 //[geish] 2291 // getCountTime returns the total detector count time (seconds) 1952 2292 Function getCountTime(fname) 1953 2293 String fname … … 1960 2300 1961 2301 // [davidm] 2302 // [geish] 2303 // 'time' is a keyword in IGOR and the HDF parameter 'time' is renamed 2304 // to 'time0' after the HDF file is loaded 1962 2305 hdfReadSimulated(fname, dfName) 1963 if (exists(dfName+": monitor:bm1_time")!= 1)2306 if (exists(dfName+":instrument:detector:time0")!= 1) 1964 2307 err = hdfRead(fname, dfName) 1965 2308 //err not handled here 1966 2309 endif 1967 2310 1968 Wave wTime1 = $(dfName+": monitor:bm1_time")2311 Wave wTime1 = $(dfName+":instrument:detector:time0") 1969 2312 1970 2313 if (WaveExists(wTime1)) … … 2071 2414 end 2072 2415 2073 // read the detector deadtime (in seconds)2074 Function getDetectorDeadtime(fname)2075 String fname2076 2077 return(0)2078 end2079 2080 // Write the detector deadtime to the file header (in seconds)2081 Function WriteDeadtimeToHeader(fname,num)2082 String fname2083 Variable num2084 2085 return(0)2086 End2087 2416 2088 2417 //reads the wavelength from a reduced data file (not very reliable) -
sans/Dev/branches/quokka_update/NCNR_User_Procedures/Reduction/SANS/QKK_ANSTO_Transmission.ipf
r986 r1202 367 367 368 368 do 369 //Execute "ProgressWindow spin"369 //Execute "ProgressWindow spin" 370 370 xpath_config = xpath_SampleEnv + "/config[" + num2str(jj) + "]" //there may be multiple config per report 371 371 … … 733 733 variable FilesAreMissing = 0 734 734 735 //Execute "ProgressWindow open, text=\"Loading Table...\""735 //Execute "ProgressWindow open, text=\"Loading Table...\"" 736 736 737 737 ii = 0 … … 741 741 emp_fname = S_path + EMP_Filenames[ii] 742 742 743 //Execute "ProgressWindow text=\"Loading Table...\n" + S_Filenames[ii] + "\""743 //Execute "ProgressWindow text=\"Loading Table...\n" + S_Filenames[ii] + "\"" 744 744 745 745 InsertPoints ii,1,S_Labels … … 816 816 817 817 ii+=1 818 //Execute "ProgressWindow percent=" + Num2Str(100*ii/lastPoint)818 //Execute "ProgressWindow percent=" + Num2Str(100*ii/lastPoint) 819 819 820 820 while(ii<lastPoint) 821 821 822 //Execute "ProgressWindow close"822 //Execute "ProgressWindow close" 823 823 824 824 if (FilesAreMissing) -
sans/Dev/branches/quokka_update/NCNR_User_Procedures/Reduction/SANS/QKK_ANSTO_Utils.ipf
r986 r1202 23 23 Variable/G root:myGlobals:gNPixelsX=192 // number of X and Y pixels 24 24 Variable/G root:myGlobals:gNPixelsY=192 25 26 // pixel dimensions are now read directly from the file header.27 // Variable/G root:myGlobals:PixelResDefault = 0.5 //pixel resolution in cm28 29 Variable/G root:myGlobals:DeadtimeDefault = 2.14e-6 // 3.4e-6 //deadtime in seconds ???nha30 25 31 26 Variable/G root:myGlobals:apOff = 5.0 // (cm) distance from sample aperture to sample position … … 156 151 157 152 return(DDet) 158 End159 160 //Utility function that returns the detector deadtime (in seconds)161 //Global values are set in the Initialize procedure162 //163 // - called by WorkFileUtils.ipf164 //165 // fileStr is passed as TextRead[3] and is the filename166 // detStr is passed as TextRead[9] and is an identifier for the detector167 //168 Function DetectorDeadtime(fileStr,detStr)169 String fileStr,detStr170 171 // [davidm]172 nvar DeadtimeDefault = root:myGlobals:DeadtimeDefault173 174 return DeadtimeDefault175 176 153 End 177 154 … … 690 667 End 691 668 669 Function/S CollapseRuns(lo, hi) 670 Variable lo, hi 671 672 String seqn 673 if (lo < hi) 674 seqn = num2istr(lo) + "-" + num2istr(hi) 675 else 676 seqn = num2istr(lo) 677 endif 678 return seqn 679 End 680 681 // generates a comma separate sequence of runs using '-' 682 // collapse a sequential sequence of numbers 683 Function/S RunListToSequence(runs, emptyValue) 684 WAVE runs 685 Variable emptyValue 686 687 Variable numRuns = numpnts(runs) 688 String seqn = "" 689 if (numRuns == 0) 690 return (seqn) 691 endif 692 Variable ix, prv, lo, hi 693 prv = runs[0] 694 lo = runs[0] 695 hi = runs[0] 696 Variable nonEmpty = (hi != emptyValue) 697 for (ix = 1; ix < numRuns; ix += 1) 698 hi = runs[ix] 699 if (hi != emptyValue) 700 nonEmpty = 1 701 endif 702 if (lo == emptyValue) // leave blank and restart 703 seqn += "," 704 lo = hi 705 prv = hi 706 elseif (hi == prv + 1) 707 prv = hi 708 else 709 seqn += CollapseRuns(lo, prv) + "," 710 lo = hi 711 prv = hi 712 endif 713 endfor 714 if ((lo != emptyValue) && (hi != emptyValue)) 715 if (lo != hi) 716 seqn += num2istr(lo) + "-" + num2istr(hi) 717 else 718 seqn += num2istr(hi) 719 endif 720 endif 721 722 if (nonEmpty) 723 return (seqn + ",") 724 else 725 return "" 726 endif 727 End 728 692 729 //input is a list of run numbers, and output is a list of filenames (not the full path) 693 730 //*** input list must be COMMA delimited*** … … 709 746 710 747 String newList="",item="",tempStr="" 711 Variable num,ii,runNum 748 Variable num,ii,runNum, checkAlerts = 1 712 749 713 750 //expand number ranges, if any … … 725 762 //valid name, add to list 726 763 //Print "it's a file" 727 if( strlen(newList)==0)764 if(ii==0) 728 765 newList = tempStr 729 766 else 730 767 newList += "," + tempStr 731 768 endif 732 769 else 733 770 //not a valid name 734 771 //is it a number? … … 736 773 //print runnum 737 774 if(numtype(runNum) != 0) 738 //not a number - maybe an error 739 DoAlert 0,"List item "+item+" is not a valid run number or filename. Please enter a valid number or filename." 740 return("") 775 //not a number - maybe an error 776 if (checkAlerts) 777 DoAlert 1,"List item "+item+" is not a valid run number or filename. Leave items empty and continue?" 778 if (V_Flag == 1) 779 checkAlerts = 0 780 else 781 Abort "Aborting request. Fix run sequence and retry." 782 endif 783 endif 784 // comma is inserted before item so skip if first item 785 if (ii > 0) 786 newList += "," 787 endif 741 788 else 742 789 //a run number or an error … … 747 794 return("") 748 795 else 749 newList += tempStr + ","796 newList += "," + tempStr 750 797 endif 751 798 endif … … 753 800 endfor //loop over all items in list 754 801 802 // check if the len newList matches list, if not pad with trailing commas 803 Variable n 804 For (n = itemsinlist(newList,","); n < num; n += 1) 805 newList += "," 806 EndFor 807 755 808 return(newList) 756 809 End … … 810 863 endif 811 864 for(ii=lo;ii<=hi;ii+=1) 812 numList += num2str(ii) + ","865 numList += RunDigitString(ii) + "," 813 866 endfor 814 867 … … 855 908 endif 856 909 857 // if( (lambda < 5) || (lambda > 5 ) ) 858 // Abort "Wavelength out of calibration range (5A). You must manually enter the absolute parameters" 859 // Endif 860 861 if(!(WaveExists($attStr)) || !(WaveExists($lamStr)) ) 862 Execute "MakeAttenTable()" 863 Endif 910 if(WaveExists($attStr)) 911 KillWaves $attStr 912 endif 913 if(WaveExists($lamStr)) 914 KillWaves $lamStr 915 endif 916 917 Execute "MakeAttenTable()" 864 918 //just in case creating the tables fails.... 865 919 if(!(WaveExists($attStr)) || !(WaveExists($lamStr)) ) … … 867 921 Endif 868 922 923 Wave att = $attStr 924 Wave lam = $lamstr 925 926 // check range 927 Variable lamMin = WaveMin(lam) 928 Variable lamMax = WaveMax(lam) 929 if ((lambda < lamMin) || (lambda > lamMax)) 930 Abort "Wavelength out of calibration range. You must manually enter the absolute parameters" 931 endif 932 869 933 //lookup the value by interpolating the wavelength 870 934 //the attenuator must always be an integer 871 872 873 Wave att = $attStr 874 Wave lam = $lamstr 875 //nha - commented below out until we have attenuation factors over multiple lambda values 876 //trans = interp(lambda,lam,att) 877 878 // Print "trans = ",trans 879 //nha - delete this line when multiple lambda values 880 trans = att[0] 935 trans = interp(lambda,lam,att) 936 937 print "lambda: ", lambda, " attenuator:", trans 881 938 882 939 return trans … … 888 945 //do explicitly to avoid data folder problems, redundant, but it must work without fail 889 946 890 //Quokka specific nha.891 Variable num= 12947 //Quokka specific 948 Variable num=9 892 949 893 950 Make/O/N=(num) root:myGlobals:Attenuators:att0 … … 903 960 Make/O/N=(num) root:myGlobals:Attenuators:att10 904 961 Make/O/N=(num) root:myGlobals:Attenuators:att11 905 962 906 963 // epg 907 964 // note 5A only at this stage but other wavelengths as measured 908 965 // these values have to be re-determined as were measured on time and not monitor counts 909 //Make/O/N=(num) root:myGlobals:Attenuators:lambda={5} 910 Make/O/N=(num) root:myGlobals:Attenuators:lambda={4.94} 966 //Make/O/N=(num) root:myGlobals:Attenuators:lambda={4.94} 967 //Make/O/N=(num) root:myGlobals:Attenuators:lambda={5, 6, 7, 8, 9} 968 Make/O/N=(num) root:myGlobals:Attenuators:lambda={2.55, 3.5, 4.501, 5, 6, 7, 8, 9, 10, 11, 12} 911 969 912 970 //Quokka attenuator factors. 19/1/09 nha … … 929 987 930 988 // [davidm] 19/12/2011 new attenuators 931 root:myGlobals:Attenuators:att0 = {1} 932 root:myGlobals:Attenuators:att1 = {0.493851474862975} 933 root:myGlobals:Attenuators:att2 = {0.172954232066555} 934 root:myGlobals:Attenuators:att3 = {0.0730333204657658} 935 root:myGlobals:Attenuators:att4 = {0.0338860321760628} 936 root:myGlobals:Attenuators:att5 = {0.0123806637881081} 937 root:myGlobals:Attenuators:att6 = {0.00547518298963546} 938 root:myGlobals:Attenuators:att7 = {0.00243389583698184} 939 root:myGlobals:Attenuators:att8 = {0.000833797438995085} 940 root:myGlobals:Attenuators:att9 = {0.000314495412044638} 941 root:myGlobals:Attenuators:att10 = {6.18092704241135e-05} 942 root:myGlobals:Attenuators:att11 = {1.1150347032482e-06} 989 // root:myGlobals:Attenuators:att0 = {1} 990 // root:myGlobals:Attenuators:att1 = {0.493851474862975} 991 // root:myGlobals:Attenuators:att2 = {0.172954232066555} 992 // root:myGlobals:Attenuators:att3 = {0.0730333204657658} 993 // root:myGlobals:Attenuators:att4 = {0.0338860321760628} 994 // root:myGlobals:Attenuators:att5 = {0.0123806637881081} 995 // root:myGlobals:Attenuators:att6 = {0.00547518298963546} 996 // root:myGlobals:Attenuators:att7 = {0.00243389583698184} 997 // root:myGlobals:Attenuators:att8 = {0.000833797438995085} 998 // root:myGlobals:Attenuators:att9 = {0.000314495412044638} 999 // root:myGlobals:Attenuators:att10 = {6.18092704241135e-05} 1000 // root:myGlobals:Attenuators:att11 = {1.1150347032482e-06} 1001 1002 // [davidm] 07/06/2013 new attenuators 1003 // root:myGlobals:Attenuators:att0 = {1, 1, 1, 1, 1} 1004 // root:myGlobals:Attenuators:att1 = {0.4851907714365690, 0.4690588000946720, 0.4476524578618430, 0.4242186524985810, 0.4064643249758360} 1005 // root:myGlobals:Attenuators:att2 = {0.1749832052428250, 0.1533207360856960, 0.1334775844094730, 0.1193958669543340, 0.1076837185558930} 1006 // root:myGlobals:Attenuators:att3 = {0.0740102935513494, 0.0607995713605108, 0.0502589403877112, 0.0423552403243808, 0.0367911673784652} 1007 // root:myGlobals:Attenuators:att4 = {0.0338662640088968, 0.0263695325927806, 0.0206752375996348, 0.0163968351793478, 0.0136583575078807} 1008 // root:myGlobals:Attenuators:att5 = {0.0129316048762597, 0.0092424708747183, 0.0068177214056475, 0.0050849439569495, 0.0040301873995815} 1009 // root:myGlobals:Attenuators:att6 = {0.0057659775936329, 0.0038824010252366, 0.0027324743768650, 0.0019309536935497, 0.0014790015704855} 1010 // root:myGlobals:Attenuators:att7 = {0.0025701666721922, 0.0016193521455181, 0.0010771127904439, 0.0007309304781609, 0.0005396690171419} 1011 // root:myGlobals:Attenuators:att8 = {0.0008805002197972, 0.0005182454618666, 0.0003263459159077, 0.0002160554020075, 0.0001648875531385} 1012 // root:myGlobals:Attenuators:att9 = {0.0003360142267874, 0.0001881638518150, 0.0001174132554013, 0.0000835561000000, 0.0000673555000000} 1013 // root:myGlobals:Attenuators:att10 = {0.0000724312302049, 0.0000424158975402, 0.0000320186000000, 0.0000281932718010, 0.0000260300000000} 1014 // root:myGlobals:Attenuators:att11 = {0.0000011150347032, 0.0000011150347032, 0.0000011150347032, 0.0000011150347032, 0.0000011150347032} 1015 1016 // [davidm] 06/09/2013 new attenuators 1017 // root:myGlobals:Attenuators:att0 = {1, 1, 1, 1, 1, 1, 1, 1, 1} 1018 // root:myGlobals:Attenuators:att1 = {0.5015120154857073, 0.4851907391153646, 0.4690588000946720, 0.4476524578618430, 0.4242186524985810, 0.4064643249758360, 0.3915825187818079, 0.383155417316738, 0.3691476334100751} 1019 // root:myGlobals:Attenuators:att2 = {0.1879599996486973, 0.1749831534458974, 0.1533207360856960, 0.1334775844094730, 0.1193958669543340, 0.1076837185558930, 0.146780838516843, 0.09070379140896381, 0.08469695381015514} 1020 // root:myGlobals:Attenuators:att3 = {0.0830522756360301, 0.07401023541505114, 0.0607995713605108, 0.0502589403877112, 0.0423552403243808, 0.0367911673784652, 0.09732611681072782, 0.02850777154582489, 0.02512618567498705} 1021 // root:myGlobals:Attenuators:att4 = {0.04126295911722724, 0.03386620335224088, 0.0263695325927806, 0.0206752375996348, 0.0163968351793478, 0.0136583575078807, 0.07443250666451248, 0.009988519969243473, 0.008641262326618814} 1022 // root:myGlobals:Attenuators:att5 = {0.01585079879042115, 0.01293154290526562, 0.0092424708747183, 0.0068177214056475, 0.0050849439569495, 0.0040301873995815, 0.02056800794367422, 0.00272693052867672, 0.002208661232545322} 1023 // root:myGlobals:Attenuators:att6 = {0.007385904293214549, 0.005754264308460257, 0.0038824010252366, 0.0027324743768650, 0.0019309536935497, 0.0014790015704855, 0.007278118324039542, 0.0009569347878502309, 0.0007197877270150088} 1024 // root:myGlobals:Attenuators:att7 = {0.003442395510483513, 0.002583673513066073, 0.0016193521455181, 0.0010771127904439, 0.0007309304781609, 0.0005396690171419, 0.002711562994361441, 0.0003282078764354223, 0.0002481189736315548} 1025 // root:myGlobals:Attenuators:att8 = {0.001252411237481238, 0.0008803260406144675, 0.0005182454618666, 0.0003263459159077, 0.0002160554020075, 0.0001648875531385, 0.0007746800906738829, 9.65128643341844e-05, 6.892342768233427e-05} 1026 // root:myGlobals:Attenuators:att9 = {0.0004894124083498131, 0.0003406723119465761, 0.0001881638518150, 0.0001174132554013, 0.0000835561000000, 0.0000673555000000, 0.0003052956213536012, 4.18080108490353e-05, 3.065566944060116e-05} 1027 // root:myGlobals:Attenuators:att10 = {0.0001094104254873829, 7.344149189383619e-05, 0.0000424158975402, 0.0000320186000000, 0.0000281932718010, 0.0000260300000000, 0.000127680099859085, 2.112291309365988e-05, 1.57968144929931e-05} 1028 // root:myGlobals:Attenuators:att11 = {9.569103942045486e-06, 1.66985e-06, 0.0000011150347032, 0.0000011150347032, 0.0000011150347032, 0.0000011150347032, 6.459382963805258e-05, 1.168373206643029e-05, 9.114523175100284e-06} 1029 1030 // [davidm] 17/04/2015 new attenuators 1031 root:myGlobals:Attenuators:att0 = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} 1032 root:myGlobals:Attenuators:att1 = {0.5833466663785198, 0.5445353434014982, 0.5015120154857073, 0.4851907391153646, 0.4690588000946720, 0.4476524578618430, 0.4242186524985810, 0.4064643249758360, 0.3915864257771861, 0.383155417316738, 0.3691476334100751} 1033 root:myGlobals:Attenuators:att2 = {0.2639110962334992, 0.2212212220703998, 0.1879599996486973, 0.1749831534458974, 0.1533207360856960, 0.1334775844094730, 0.1193958669543340, 0.1076837185558930, 0.0978267819972345, 0.09070379140896381, 0.08469695381015514} 1034 root:myGlobals:Attenuators:att3 = {0.1372597677635557, 0.1076917120035716, 0.0830522756360301, 0.07401023541505114, 0.0607995713605108, 0.0502589403877112, 0.0423552403243808, 0.0367911673784652, 0.0324241778063643, 0.02850777154582489, 0.02512618567498705} 1035 root:myGlobals:Attenuators:att4 = {0.07647885821139964, 0.05518044441708623, 0.04126295911722724, 0.03386620335224088, 0.0263695325927806, 0.0206752375996348, 0.0163968351793478, 0.0136583575078807, 0.01239678492410995, 0.009988519969243473, 0.008641262326618814} 1036 root:myGlobals:Attenuators:att5 = {0.03658821871096959, 0.02408611980401762, 0.01585079879042115, 0.01293154290526562, 0.0092424708747183, 0.0068177214056475, 0.0050849439569495, 0.0040301873995815, 0.003425615799080442, 0.00272693052867672, 0.002208661232545322} 1037 root:myGlobals:Attenuators:att6 = {0.02005392374000794, 0.0120842415105319, 0.007385904293214549, 0.005754264308460257, 0.0038824010252366, 0.0027324743768650, 0.0019309536935497, 0.0014790015704855, 0.001212175587771235, 0.0009569347878502309, 0.0007197877270150088} 1038 root:myGlobals:Attenuators:att7 = {0.0108062446668512, 0.006010377629875024, 0.003442395510483513, 0.002583673513066073, 0.0016193521455181, 0.0010771127904439, 0.0007309304781609, 0.0005396690171419, 0.0004516126724145509, 0.0003282078764354223, 0.0002481189736315548} 1039 root:myGlobals:Attenuators:att8 = {0.004805949253881572, 0.002382365795428234, 0.001252411237481238, 0.0008803260406144675, 0.0005182454618666, 0.0003263459159077, 0.0002160554020075, 0.0001648875531385, 0.0001290234992670594, 9.65128643341844e-05, 6.892342768233427e-05} 1040 root:myGlobals:Attenuators:att9 = {0.002296371755067186, 0.001040815202883871, 0.0004894124083498131, 0.0003406723119465761, 0.0001881638518150, 0.0001174132554013, 0.0000835561000000, 0.0000673555000000, 5.084719467062561e-05, 4.18080108490353e-05, 3.065566944060116e-05} 1041 root:myGlobals:Attenuators:att10 = {0.0006618554731030182, 0.0002589844830011295, 0.0001094104254873829, 7.344149189383619e-05, 0.0000424158975402, 0.0000320186000000, 0.0000281932718010, 0.0000260300000000, 2.126520801155025e-05, 2.112291309365988e-05, 1.57968144929931e-05} 1042 root:myGlobals:Attenuators:att11 = {4.646119982685115e-05, 1.701737969038749e-05, 9.569103942045486e-06, 1.66985e-06, 0.0000011150347032, 0.0000011150347032, 0.0000011150347032, 0.0000011150347032, 1.075814653208927e-05, 1.168373206643029e-05, 9.114523175100284e-06} 943 1043 944 1044 End … … 977 1077 item = StringFromList(ii, list ,";") 978 1078 //simply remove all that are not raw data files (SA1 SA2 SA3) 979 if( !stringmatch(item,"*.SA1*") && !stringmatch(item,"*.SA2*") && !stringmatch(item,"*.SA3*") ) 980 if( !stringmatch(item,".*") && !stringmatch(item,"*.pxp") && !stringmatch(item,"*.DIV")) //eliminate mac "hidden" files, pxp, and div files 981 newlist += item + ";" 1079 // hdf and other file removed on 18th May 2017 by David and Jitendra 1080 if( !stringmatch(item,"*.HDF") && !stringmatch(item,"*.XML") && !stringmatch(item,"*.CSV") && !stringmatch(item,"*.PDF") && !stringmatch(item,"*.BMP") && !stringmatch(item,"*.MAS") && !stringmatch(item,"*.DB")) 1081 if( !stringmatch(item,"*.SA1*") && !stringmatch(item,"*.SA2*") && !stringmatch(item,"*.SA3*") ) 1082 if( !stringmatch(item,".*") && !stringmatch(item,"*.pxp") && !stringmatch(item,"*.DIV")) //eliminate mac "hidden" files, pxp, and div files 1083 newlist += item + ";" 1084 endif 982 1085 endif 983 1086 endif … … 1184 1287 //For ANSTO 1185 1288 Wave GSSD = $"root:myGlobals:CatVSHeaderInfo:SSD" 1186 Wave/T GSICS = $"root:myGlobals:CatVSHeaderInfo:SICS"1289 //Wave/T GSICS = $"root:myGlobals:CatVSHeaderInfo:SICS" 1187 1290 Wave/T GHDF = $"root:myGlobals:CatVSHeaderInfo:HDF" 1188 1291 … … 1201 1304 1202 1305 case "SortFilenamesButton": 1203 Sort GFilenames, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR, G SICS, GHDF1306 Sort GFilenames, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR, GHDF 1204 1307 break 1205 1308 1206 1309 case "SortLabelsButton": 1207 Sort GLabels, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR, G SICS, GHDF1310 Sort GLabels, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR, GHDF 1208 1311 break 1209 1312 1210 1313 case "SortDateAndTimeButton": 1211 Sort GDateTime, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR, G SICS, GHDF1314 Sort GDateTime, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR, GHDF 1212 1315 break 1213 1316 1214 1317 case "SortSSDButton": 1215 Sort GSSD, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR, G SICS, GHDF1318 Sort GSSD, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR, GHDF 1216 1319 break 1217 1320 1218 1321 case "SortSDDButton": 1219 Sort GSDD, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR, G SICS, GHDF1322 Sort GSDD, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR, GHDF 1220 1323 break 1221 1324 1222 1325 case "SortLambdaButton": 1223 Sort GLambda, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR, G SICS, GHDF1326 Sort GLambda, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR, GHDF 1224 1327 break 1225 1328 1226 1329 case "SortCountTimButton": 1227 Sort GCntTime, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR, G SICS, GHDF1330 Sort GCntTime, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR, GHDF 1228 1331 break 1229 1332 1230 1333 case "SortTotalCountsButton": 1231 Sort GTotCnts, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR, G SICS, GHDF1334 Sort GTotCnts, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR, GHDF 1232 1335 break 1233 1336 1234 1337 case "SortCountRateButton": 1235 Sort GCntRate, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR, G SICS, GHDF1338 Sort GCntRate, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR, GHDF 1236 1339 break 1237 1340 1238 1341 case "SortMonitorCountsButton": 1239 Sort GMonCnts, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR, G SICS, GHDF1342 Sort GMonCnts, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR, GHDF 1240 1343 break 1241 1344 1242 1345 case "SortTransmissionButton": 1243 Sort GTransmission, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR, G SICS, GHDF1346 Sort GTransmission, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR, GHDF 1244 1347 break 1245 1348 1246 1349 case "SortThicknessButton": 1247 Sort GThickness, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR, G SICS, GHDF1350 Sort GThickness, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens, GRunNumber, GIsTrans, GRot, GTemp, GField, GMCR, GHDF 1248 1351 break 1249 1352 -
sans/Dev/branches/quokka_update/NCNR_User_Procedures/Reduction/SANS/QKK_CatVSTable.ipf
r917 r1202 21 21 //parsing the filenames in the list and (dispatching) to write out the 22 22 //appropriate information to the notebook window 23 Function BuildCatVeryShortTable() 23 Function BuildCatVeryShortTable(ctrlName) 24 String ctrlName 24 25 25 26 Variable err 26 27 Variable t1 = ticks 28 Variable reload = (cmpstr(ctrlName,"FileCatalogButton")==0) 27 29 28 30 PathInfo catPathName … … 36 38 DoWindow/F CatVSTable 37 39 38 Make/O/T/N=0 $"root:myGlobals:CatVSHeaderInfo:Filenames" 39 Make/O/T/N=0 $"root:myGlobals:CatVSHeaderInfo:Suffix" 40 Make/O/T/N=0 $"root:myGlobals:CatVSHeaderInfo:Labels" 41 Make/O/T/N=0 $"root:myGlobals:CatVSHeaderInfo:DateAndTime" 42 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:SDD" 43 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Lambda" 44 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:CntTime" 45 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:TotCnts" 46 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:CntRate" 47 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:MonCnts" 48 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Transmission" 49 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Thickness" 50 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:XCenter" 51 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:YCenter" 52 Make/O/B/N=0 $"root:myGlobals:CatVSHeaderInfo:nGuides" 53 Make/O/B/N=0 $"root:myGlobals:CatVSHeaderInfo:NumAttens" 54 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:RunNumber" 55 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:IsTrans" 56 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:RotAngle" 57 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Temperature" 58 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Field" 59 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:MCR" //added Mar 2008 60 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Pos" //added Mar 2010 61 //For ANSTO 62 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:SSD" // [davidm] for Quokka 63 Make/O/T/N=0 $"root:myGlobals:CatVSHeaderInfo:SICS" 64 Make/O/T/N=0 $"root:myGlobals:CatVSHeaderInfo:HDF" 65 66 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Reactorpower" //only used for for ILL, June 2008, 40 If(V_Flag==0) 41 Make/O/T/N=0 $"root:myGlobals:CatVSHeaderInfo:Filenames" 42 Make/O/T/N=0 $"root:myGlobals:CatVSHeaderInfo:Suffix" 43 Make/O/T/N=0 $"root:myGlobals:CatVSHeaderInfo:Labels" 44 Make/O/T/N=0 $"root:myGlobals:CatVSHeaderInfo:DateAndTime" 45 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:SDD" 46 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Lambda" 47 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:CntTime" 48 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:TotCnts" 49 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:CntRate" 50 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:MonCnts" 51 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Transmission" 52 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Thickness" 53 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:XCenter" 54 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:YCenter" 55 Make/O/B/N=0 $"root:myGlobals:CatVSHeaderInfo:nGuides" 56 Make/O/B/N=0 $"root:myGlobals:CatVSHeaderInfo:NumAttens" 57 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:RunNumber" 58 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:IsTrans" 59 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:RotAngle" 60 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Temperature" 61 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Field" 62 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:MCR" //added Mar 2008 63 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Pos" //added Mar 2010 64 //For ANSTO 65 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:SSD" // [davidm] for Quokka 66 //Make/O/T/N=0 $"root:myGlobals:CatVSHeaderInfo:SICS" 67 Make/O/T/N=0 $"root:myGlobals:CatVSHeaderInfo:HDF" 68 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:M_Field" 69 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:E_Field" 70 71 Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Reactorpower" //only used for for ILL, June 2008, 72 Endif 73 67 74 WAVE ReactorPower = $"root:myGlobals:CatVSHeaderInfo:Reactorpower" 68 75 … … 92 99 //For ANSTO 93 100 WAVE SSD = $"root:myGlobals:CatVSHeaderInfo:SSD" // [davidm] 94 WAVE SICS = $"root:myGlobals:CatVSHeaderInfo:SICS"101 //WAVE SICS = $"root:myGlobals:CatVSHeaderInfo:SICS" 95 102 WAVE HDF = $"root:myGlobals:CatVSHeaderInfo:HDF" 103 WAVE M_Field = $"root:myGlobals:CatVSHeaderInfo:M_Field" 104 WAVE E_Field = $"root:myGlobals:CatVSHeaderInfo:E_Field" 105 106 If (reload) 107 Variable rows = numpnts(Filenames) 108 DeletePoints 0, rows, Filenames,Suffix,Labels,DateAndTime,SDD,Lambda,CntTime,TotCnts,CntRate,MonCnts,Transmission 109 DeletePoints 0, rows, Thickness,XCenter,YCenter,nGuides,NumAttens,RunNumber,IsTrans,RotAngle,Temperature,Field,MCR,Pos 110 DeletePoints 0, rows, SSD,HDF,M_Field,E_Field 111 Endif 96 112 97 113 If(V_Flag==0) … … 109 125 ModifyTable width(:myGlobals:CatVSHeaderInfo:NumAttens)=30 110 126 ModifyTable width(:myGlobals:CatVSHeaderInfo:RotAngle)=50 111 ModifyTable width(:myGlobals:CatVSHeaderInfo:Field)=50 127 ModifyTable width(:myGlobals:CatVSHeaderInfo:Temperature)=70 128 //ModifyTable width(:myGlobals:CatVSHeaderInfo:Field)=50 112 129 ModifyTable width(:myGlobals:CatVSHeaderInfo:MCR)=50 113 130 #if (exists("QUOKKA")==6) 114 131 //ANSTO 115 132 ModifyTable width(:myGlobals:CatVSHeaderInfo:SSD)=40 // [davidm] 116 ModifyTable width(:myGlobals:CatVSHeaderInfo:SICS)=80 117 ModifyTable width(:myGlobals:CatVSHeaderInfo:HDF)=40 133 //ModifyTable width(:myGlobals:CatVSHeaderInfo:SICS)=80 134 //ModifyTable width(:myGlobals:CatVSHeaderInfo:HDF)=40 135 ModifyTable width(:myGlobals:CatVSHeaderInfo:M_Field)=50 136 ModifyTable width(:myGlobals:CatVSHeaderInfo:E_Field)=50 118 137 #endif 119 138 … … 142 161 //***version numbers have been removed*** 143 162 String str,fullName 144 Variable lastPoint 163 Variable lastPoint, loadFile 145 164 ii=0 146 165 147 //Execute "ProgressWindow open, text=\"Loading Table...\""166 //Execute "ProgressWindow open, text=\"Loading Table...\"" 148 167 149 168 Make/T/O/N=0 notRAWlist 169 170 // If it is updating the file list then remove the non-RAW files otherwise the column lengths are not 171 // equal when the sort is invoked 172 Variable fileCount = numpnts(Filenames) 173 Variable rawCount = numpnts(Labels) 174 Variable notRAWcount = fileCount - rawCount 175 if (notRAWcount > 0) 176 InsertPoints 0,notRAWcount,notRAWlist 177 notRAWlist[0, notRAWcount-1] = Filenames[p+rawCount] 178 DeletePoints rawCount, notRAWcount, Filenames 179 endif 180 150 181 do 151 182 … … 165 196 Endif 166 197 else 167 // Execute "ProgressWindow text=\"Loading Table...\n" + tempName + "\""168 169 198 //prepend path to tempName for read routine 170 199 PathInfo catPathName 171 200 FullName = S_path + tempName 172 //make sure the file is really a RAW data file 173 ok = (numtype(str2num(partialName[0])) != 0) && CheckIfRawData(fullName) // first character needs to be a letter 174 if (!ok) 175 //write to notebook that file was not a RAW SANS file 176 lastPoint = numpnts(notRAWlist) 177 InsertPoints lastPoint,1,notRAWlist 178 notRAWlist[lastPoint]=tempname 201 202 if (!reload) 203 FindValue/TEXT=tempName Filenames 204 loadFile = (V_Value == -1) 179 205 else 180 //go write the header information to the Notebook 181 GetHeaderInfoToWave(fullName,tempName) 206 loadFile = 1 207 Endif 208 if (loadFile) 209 //Execute "ProgressWindow text=\"Loading Table...\n" + tempName + "\"" 210 211 //make sure the file is really a RAW data file 212 ok = (numtype(str2num(partialName[0])) != 0) && CheckIfRawData(fullName) // first character needs to be a letter 213 if (!ok) 214 //write to notebook that file was not a RAW SANS file 215 lastPoint = numpnts(notRAWlist) 216 InsertPoints lastPoint,1,notRAWlist 217 notRAWlist[lastPoint]=tempname 218 else 219 //go write the header information to the Notebook 220 GetHeaderInfoToWave(fullName,tempName) 221 Endif 182 222 Endif 183 223 Endif 184 224 185 225 ii+=1 186 //Execute "ProgressWindow percent=" + Num2Str(100*ii/numitems)226 //Execute "ProgressWindow percent=" + Num2Str(100*ii/numitems) 187 227 188 228 while(ii<numitems) … … 192 232 AppendNotRAWFiles(notRAWlist) 193 233 KillWaves/Z notRAWlist 194 //Execute "ProgressWindow close"234 //Execute "ProgressWindow close" 195 235 // 196 236 // Print "Total time (s) = ",(ticks - t1)/60.15 … … 242 282 //For ANSTO 243 283 Wave GSSD = $"root:myGlobals:CatVSHeaderInfo:SSD" 244 Wave/T GSICS = $"root:myGlobals:CatVSHeaderInfo:SICS"284 //Wave/T GSICS = $"root:myGlobals:CatVSHeaderInfo:SICS" 245 285 Wave/T GHDF = $"root:myGlobals:CatVSHeaderInfo:HDF" 286 Wave GM_Field = $"root:myGlobals:CatVSHeaderInfo:M_Field" 287 Wave GE_Field = $"root:myGlobals:CatVSHeaderInfo:E_Field" 246 288 247 289 #if (exists("ILL_D22")==6) … … 251 293 #elif (exists("QUOKKA")==6) 252 294 //ANSTO 253 Sort GFilenames, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens,GRunNumber,GIsTrans,GRot,GTemp,GField,GMCR, G SICS, GHDF295 Sort GFilenames, GSuffix, GFilenames, GLabels, GDateTime, GSSD, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens,GRunNumber,GIsTrans,GRot,GTemp,GField,GMCR, GHDF, GM_Field, GE_Field // , GSICS 254 296 #else 255 297 Sort GSuffix, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GMonCnts, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens,GRunNumber,GIsTrans,GRot,GTemp,GField,GMCR 256 298 #endif 257 258 299 259 300 return(0) … … 285 326 Wave Pos = $"root:myGlobals:CatVSHeaderInfo:Pos" 286 327 Wave/Z ReactorPower = $"root:myGlobals:CatVSHeaderInfo:reactorpower" //activate for ILL, June 08 (+ edit line) 287 Wave/Z SICS = $"root:myGlobals:CatVSHeaderInfo:SICS" // For ANSTO June 2010328 //Wave/Z SICS = $"root:myGlobals:CatVSHeaderInfo:SICS" // For ANSTO June 2010 288 329 Wave/Z HDF = $"root:myGlobals:CatVSHeaderInfo:HDF" // For ANSTO June 2010 330 Wave M_Field = $"root:myGlobals:CatVSHeaderInfo:M_Field" // For ANSTO June 2016 331 Wave E_Field = $"root:myGlobals:CatVSHeaderInfo:E_Field" // For ANSTO June 2016 289 332 290 333 #if (exists("ILL_D22")==6) … … 299 342 #elif (exists("QUOKKA")==6) 300 343 //ANSTO 301 Edit/K=1 Filenames, Labels, DateAndTime, SSD, SDD, Lambda, CntTime, TotCnts, CntRate, MonCnts, Transmission, Thickness, XCenter, YCenter, NumAttens, RotAngle, Temperature, Field, MCR,SICS, HDFas "Data File Catalog"344 Edit/K=1 Filenames, Labels, DateAndTime, SSD, SDD, Lambda, CntTime, TotCnts, CntRate, MonCnts, Transmission, Thickness, XCenter, YCenter, NumAttens, RotAngle, M_Field, E_Field, Temperature, MCR as "Data File Catalog" 302 345 #else 303 346 // HFIR or anything else … … 328 371 //ANSTO 329 372 Wave GSSD = $"root:myGlobals:CatVSHeaderInfo:SSD" // [davidm] 330 Wave/T GSICS = $"root:myGlobals:CatVSHeaderInfo:SICS"373 //Wave/T GSICS = $"root:myGlobals:CatVSHeaderInfo:SICS" 331 374 Wave/T GHDF = $"root:myGlobals:CatVSHeaderInfo:HDF" 375 Wave GM_Field = $"root:myGlobals:CatVSHeaderInfo:M_Field" 376 Wave GE_Field = $"root:myGlobals:CatVSHeaderInfo:E_Field" 332 377 //END ANSTO 333 378 Wave GSDD = $"root:myGlobals:CatVSHeaderInfo:SDD" … … 376 421 377 422 #if (exists("QUOKKA")==6) 378 InsertPoints lastPoint,1,GSICS379 GSICS[lastPoint]=getSICSVersion(fname)423 //InsertPoints lastPoint,1,GSICS 424 //GSICS[lastPoint]=getSICSVersion(fname) 380 425 381 426 //read the HDF version 382 427 InsertPoints lastPoint,1,GHDF 383 428 GHDF[lastPoint]=getHDFVersion(fname) 429 430 // M_Field 431 InsertPoints lastPoint,1,GM_Field 432 GM_Field[lastPoint]=getMField(fname) 433 434 // E_Field 435 InsertPoints lastPoint,1,GE_Field 436 GE_Field[lastPoint]=getEField(fname) 384 437 #endif 385 438 -
sans/Dev/branches/quokka_update/NCNR_User_Procedures/Reduction/SANS/QKK_Correct.ipf
r908 r1202 251 251 WAVE cor_data=$"root:Packages:NIST:COR:data" 252 252 WAVE/T cor_text=$"root:Packages:NIST:COR:textread" 253 NVAR emp_scale=$"root:Packages:NIST:EMP:scale" 253 254 254 255 //get sam and bgd attenuation factors … … 315 316 //do the subtraction 316 317 fsam=1 318 317 319 femp = tmonsam/tmonemp //this should be ==1 since normalized files 320 femp *= emp_scale //user scale of the empty data 318 321 fbgd = tmonsam/tmonbgd //this should be ==1 since normalized files 319 322 cor1 = fsam*sam_data/sam_attenFactor - fbgd*bgd_temp/bgd_attenFactor … … 424 427 WAVE cor_data=$"root:Packages:NIST:COR:data" 425 428 WAVE/T cor_text=$"root:Packages:NIST:COR:textread" 429 NVAR emp_scale=$"root:Packages:NIST:EMP:scale" 426 430 427 431 //get sam and bgd attenuation factors … … 474 478 fsam = 1 475 479 femp = tmonsam/tmonemp //this should be ==1 since normalized files 480 femp *= emp_scale // user defined scale factor 476 481 477 482 cor1 = fsam*sam_data/sam_AttenFactor - femp*(tsam/temp)*emp_temp/emp_AttenFactor … … 549 554 WAVE cor_data=$"root:Packages:NIST:COR:data" 550 555 WAVE/T cor_text=$"root:Packages:NIST:COR:textread" 556 NVAR emp_scale=$"root:Packages:NIST:EMP:scale" 551 557 552 558 //get sam and bgd attenuation factors … … 621 627 fsam=1 622 628 femp = tmonsam/tmonemp //this should be ==1 since normalized files 629 femp *= emp_scale //user defined scale factor 623 630 fbgd = tmonsam/tmonbgd //this should be ==1 since normalized files 624 631 cor1 = fsam*sam_data/sam_attenFactor … … 743 750 WAVE cor_data=$"root:Packages:NIST:COR:data" 744 751 WAVE/T cor_text=$"root:Packages:NIST:COR:textread" 752 NVAR emp_scale=$"root:Packages:NIST:EMP:scale" 745 753 746 754 //get sam and bgd attenuation factors (DRK irrelevant) … … 800 808 fsam = 1 801 809 femp = tmonsam/tmonemp //this should be ==1 since normalized files 810 femp *= emp_scale //user defined scale factor 802 811 803 812 cor1 = fsam*sam_data/sam_AttenFactor - femp*(tsam/temp)*emp_temp/emp_AttenFactor -
sans/Dev/branches/quokka_update/NCNR_User_Procedures/Reduction/SANS/QKK_Includes_ANSTO.ipf
r909 r1202 20 20 End 21 21 22 23 24 22 #include "QKK_AvgGraphics" version>=5.0 25 23 #include "QKK_Buttons" version>=5.0 … … 39 37 //#include "PlotUtils" version>=5.0 40 38 //AJJ October 2008 - switch to shared file loader 39 41 40 #include "PlotUtilsMacro_v40" 42 41 #include "NIST_XML_v40" … … 83 82 #include "WriteModelData_v40" 84 83 84 // Added Desmearing functionality 85 #include "QKK_DesmearingUtils" 86 #include "QKK_LakeDesmearing_JB" 85 87 86 88 // a simple list of items to add to the Beta menu -
sans/Dev/branches/quokka_update/NCNR_User_Procedures/Reduction/SANS/QKK_MainPanel.ipf
r908 r1202 155 155 156 156 //BuildCatVeryShortNotebook() 157 BuildCatVeryShortTable( )157 BuildCatVeryShortTable(ctrlName) 158 158 End 159 159 … … 286 286 Window Main_Panel() 287 287 PauseUpdate; Silent 1 // building window... 288 NewPanel /W=(500,60, 924,320) /K=2 as "SANS Reduction Controls"288 NewPanel /W=(500,60,1015,320) /K=2 as "SANS Reduction Controls" 289 289 ModifyPanel cbRGB=(65535,58981,27524) 290 290 ModifyPanel fixedSize=1 291 291 ////// 292 292 //on main portion of panel 293 Button MainButtonA,pos={ 9,8},size={74,20},title="Pick Path",proc=PickPath_MainButtonProc293 Button MainButtonA,pos={5,8},size={80,20},title="Pick Path",proc=PickPath_MainButtonProc 294 294 Button MainButtonA,help={"Pick the local data folder that contains the SANS data"} 295 Button MainButtonB,pos={92,8},size={74,20},proc=CatVShort_MainButtonProc,title="File Catalog" 296 Button MainButtonB,help={"This will generate a condensed CATalog table of all files in a specified local folder"} 295 Button FileCatalogButton,pos={90,8},size={80,20},proc=CatVShort_MainButtonProc,title="File Catalog" 296 Button FileCatalogButton,help={"This will generate a condensed CATalog table of all files in the specified local folder"} 297 Button MainButtonU,pos={175,8},size={80,20},proc=CatVShort_MainButtonProc,title="Refresh" 298 Button MainButtonU,help={"This will add any new files to the CATalog table."} 297 299 // [davidm] create sort Button 298 Button MainButtonS,pos={ 175,8},size={74,20},proc=CatVShort_SortButtonProc,title="Sort Catalog"300 Button MainButtonS,pos={260,8},size={80,20},proc=CatVShort_SortButtonProc,title="Sort Catalog" 299 301 Button MainButtonS,help={"This will display a dialog to sort the CATalog"} 300 302 301 Button MainButtonC,pos={ 258,8},size={74,20},proc=HelpMainButtonProc,title="Help"303 Button MainButtonC,pos={345,8},size={80,20},proc=HelpMainButtonProc,title="Help" 302 304 Button MainButtonC,help={"Display the help file"} 303 Button MainButtonD,pos={ 341,8},size={74,20},proc=SR_OpenTracTicketPage,title="Feedback"305 Button MainButtonD,pos={430,8},size={80,20},proc=SR_OpenTracTicketPage,title="Feedback" 304 306 Button MainButtonD,help={"Submit bug reports or feature requests"} 305 307 306 TabControl MainTab,pos={7,49},size={ 410,202},tabLabel(0)="Raw Data",proc=MainTabProc308 TabControl MainTab,pos={7,49},size={501,202},tabLabel(0)="Raw Data",proc=MainTabProc 307 309 TabControl MainTab,tabLabel(1)="Reduction",tabLabel(2)="1-D Ops",tabLabel(3)="2-D Ops",tabLabel(4)="Misc Ops" 308 310 TabControl MainTab,value=0 -
sans/Dev/branches/quokka_update/NCNR_User_Procedures/Reduction/SANS/QKK_Menu.ipf
r908 r1202 54 54 End 55 55 56 Menu "USANS" 57 "Desmear USANS Data",Desmear() 58 End 56 59 Function SANSHelp() 57 60 DisplayHelpTopic/Z/K=1 "SANS Data Reduction Tutorial" -
sans/Dev/branches/quokka_update/NCNR_User_Procedures/Reduction/SANS/QKK_MultipleReduce.ipf
r908 r1202 40 40 //no, create the folder and the globals 41 41 NewDataFolder/O root:myGlobals:MRED 42 // String/G root:myGlobals:MRED:gMRedMatchStr = "*"43 42 PathInfo catPathName 44 43 If(V_flag==1) … … 48 47 String/G root:myGlobals:MRED:gCatPathStr = "no path selected" 49 48 endif 50 String/G root:myGlobals:MRED:gMRedList = "none" 49 String/G root:myGlobals:MRED:gMRedSampleList = "none" 50 String/G root:myGlobals:MRED:gMRedEmptyList = "none" 51 51 String/G root:myGlobals:MRED:gMRProtoList = "none" 52 String/G root:myGlobals:MRED:g FileNumList=""53 // String/G root:myGlobals:MRED:gMRS1 = "no file selected"54 // String/G root:myGlobals:MRED:gMRS2 = "no file selected"55 // String/G root:myGlobals:MRED:gMRS3 = "no box selected"56 // Variable/G root:myGlobals:MRED:gMRV1 =0 57 // Variable/G root:myGlobals:MRED:gMRV2 = 999 52 String/G root:myGlobals:MRED:gSampleRuns = "" 53 String/G root:myGlobals:MRED:gEmptyRuns = "" 54 String/G root:myGlobals:MRED:actSampleRuns = "" 55 String/G root:myGlobals:MRED:actEmptyRuns = "" 56 String/G root:myGLobals:MRED:gScaleEMP = "" 57 String/G root:myGlobals:MRED:actScaleEMP = "" 58 58 Endif 59 59 End … … 62 62 // 63 63 Window Multiple_Reduce_Panel() 64 65 // Layout 66 // 67 // [Pick Path] Path [ path selected ] [?] 68 // ------------------------------------------------ 69 // Sample Runs [ sample runs ] 70 // Empty Runs [ empty runs ] 71 // ------------------------------------------------ 72 // [Runs to Table] [SDD List] [Table to Runs] 73 // [Protocol] [Reduce All] [Done] 74 64 75 PauseUpdate; Silent 1 // building window... 65 NewPanel /W=(535,72,95 1,228) /K=1 as "Multiple File Reduction"76 NewPanel /W=(535,72,955,237) /K=1 as "Multiple File Reduction" 66 77 ModifyPanel cbRGB=(65535,49151,29490) 67 78 ModifyPanel fixedSize=1 68 SetDrawLayer UserBack 69 DrawLine 7,30,422,30 79 70 80 SetVariable PathDisplay,pos={77,7},size={300,13},title="Path" 71 81 SetVariable PathDisplay,help={"This is the path to the folder that will be used to find the SANS data while reducing. If no files appear in the popup, make sure that this folder is set correctly"} … … 75 85 Button helpButton,pos={385,3},size={25,20},proc=ShowMRHelp,title="?" 76 86 Button helpButton,help={"Show the help file for reducing multiple files using the same protocol"} 77 PopupMenu MRFilesPopup,pos={3,72},size={167,19},proc=MRedPopMenuProc,title="File(s) to Reduce" 78 PopupMenu MRFilesPopup,help={"The displayed file is the one that will be reduced. The entire list will be reduced if \"Reduce All..\" is selected. \r If no items, or the wrong items appear, click on the popup to refresh."} 79 PopupMenu MRFilesPopup,mode=1,popvalue="none",value= #"root:myGlobals:MRED:gMRedList" 80 SetVariable MRList,pos={3,48},size={350,13},proc=FileNumberListProc,title="File number list: " 81 SetVariable MRList,help={"Enter a comma delimited list of file numbers to reduce. Ranges can be entered using a dash."} 82 SetVariable MRList,limits={-Inf,Inf,1},value= root:myGlobals:MRED:gFileNumList 83 Button ReduceAllButton,pos={3,128},size={180,20},proc=ReduceAllPopupFiles,title="Reduce All Files in Popup" 87 88 SetDrawLayer UserBack 89 DrawLine 4,30,416,30 90 91 SetVariable MRSampleList,pos={10,48},size={350,13},proc=FileNumberListProc,title = "Sample Runs:" 92 SetVariable MRSampleList,help={"Enter a comma delimited list of file numbers to reduce. Ranges can be entered using a dash."} 93 SetVariable MRSampleList,limits={-Inf,Inf,1},value= root:myGlobals:MRED:gSampleRuns 94 95 SetVariable MREmptyList,pos={10,74},size={300,13},proc=FileNumberListProc,title = "Empty Runs:" 96 SetVariable MREmptyList,help={"Enter a comma delimited list of file numbers to reduce. Ranges can be entered using a dash."} 97 SetVariable MREmptyList,limits={-Inf,Inf,1},value= root:myGlobals:MRED:gEmptyRuns 98 99 SetVariable MRScaleEMP,pos={320,74},size={80,13},proc=FileNumberListProc,title = "Scale:" 100 SetVariable MRScaleEMP,help={"Scale to be applied to the empty runs."} 101 SetVariable MRScaleEMP,limits={-Inf,Inf,0},value= root:myGlobals:MRED:gScaleEMP 102 103 SetDrawLayer UserBack 104 DrawLine 4,105,416,105 105 106 PopupMenu MRProto_pop,pos={4,112},size={120,19},proc=MRProtoPopMenuProc,title="Protocol " 107 PopupMenu MRProto_pop,help={"All of the data files in the popup will be reduced using this protocol"} 108 PopupMenu MRProto_pop,mode=1,popvalue="none",value= #"root:myGlobals:MRED:gMRProtoList" 109 Button ReductionTableBtn,pos={127,112},size={100,20},proc=ShowMRReductionTable,title="Runs to Table" 110 Button ReductionTableBtn,help={"Generates a table that shows the reduction files per row."} 111 Button sddList,pos={232,112},size={90,20},proc=ScatteringAtSDDTableButton,title="Files at SDD" 112 Button sddList,help={"Use this button to generate a table of scattering files at a given ample to detector distance."} 113 Button mapToRuns,pos={327,112},size={90,20},proc=MapTableToRuns,title="Table to Runs" 114 Button mapToRuns,help={"Accept the list of files to reduce."} 115 116 //SetDrawLayer UserBack 117 //DrawLine 4,135,416,135 118 119 Button ReduceAllButton,pos={232,140},size={120,20},proc=ReduceAllSampleFiles,title="Reduce All" 84 120 Button ReduceAllButton,help={"This will reduce ALL of the files in the popup list, not just the top file."} 85 Button DoneButton,pos={ 280,128},size={110,20},proc=MRDoneButtonProc,title="Done Reducing"121 Button DoneButton,pos={357,140},size={60,20},proc=MRDoneButtonProc,title="Done" 86 122 Button DoneButton,help={"When done reducing files, this will close this control panel."} 87 // Button cat_short,pos={310,72},size={90,20},proc=DoCatShort,title="File Catalog" 88 // Button cat_short,help={"Use this button to generate a table with file header information. Very useful for identifying files."} 89 // Button show_cat_short,pos={280,98},size={120,20},proc=ShowCatShort_MRED,title="Show File Catalog" 90 // Button show_cat_short,help={"Use this button to bring the File Catalog window to the front."} 91 Button sddList,pos={280,72},size={120,20},proc=ScatteringAtSDDTableButton,title="Files at SDD List" 92 Button sddList,help={"Use this button to generate a table of scattering files at a given ample to detector distance."} 93 Button acceptList,pos={280,98},size={120,20},proc=AcceptMREDList,title="Accept List" 94 Button acceptList,help={"Accept the list of files to reduce."} 95 PopupMenu MRProto_pop,pos={3,98},size={119,19},proc=MRProtoPopMenuProc,title="Protocol " 96 PopupMenu MRProto_pop,help={"All of the data files in the popup will be reduced using this protocol"} 97 PopupMenu MRProto_pop,mode=1,popvalue="none",value= #"root:myGlobals:MRED:gMRProtoList" 123 124 125 98 126 EndMacro 99 127 … … 109 137 End 110 138 139 Function/S RunToQuokkaFile(num) 140 Variable num 141 142 String fname 143 sprintf fname, "QKK%07u.nx.hdf", num 144 return (fname) 145 End 111 146 112 147 //function takes a list of filenames (just the name, no path , no extension) … … 255 290 String list = GetValidMRedPopupList() 256 291 // 257 String/G root:myGlobals:MRED:gM redList = list292 String/G root:myGlobals:MRED:gMRedSampleList = list 258 293 ControlUpdate MRFilesPopup 259 294 … … 270 305 271 306 String commaList="",semiList="" 272 SVAR numList=root:myGLobals:MRED:g FileNumList307 SVAR numList=root:myGLobals:MRED:gSampleRuns 273 308 274 309 commaList = ParseRunNumberList(numList) … … 321 356 DoWindow/K Multiple_Reduce_Panel 322 357 323 DoWindow/K SDDTable358 DoWindow/K CatMRTable 324 359 KillDataFolder root:myGlobals:MRED 360 End 361 362 Function CreateMRTable() 363 364 Make/O/D/N=0 $"root:myGlobals:MRED:SampleRuns" 365 Make/O/T/N=0 $"root:myGlobals:MRED:EmptyRuns" 366 Make/O/T/N=0 $"root:myGlobals:MRED:Suffix" 367 Make/O/T/N=0 $"root:myGlobals:MRED:Labels" 368 Make/O/D/N=0 $"root:myGlobals:MRED:SDD" 369 Make/O/D/N=0 $"root:myGlobals:MRED:IsTrans" 370 Make/O/T/N=0 $"root:myGlobals:MRED:Scale" 371 372 SetDataFolder root:myGlobals:MRED 373 Edit SampleRuns, EmptyRuns, Scale, SDD, Labels as "Multiple Reduction Sequence" 374 DoWindow/C $"CatMRTable" 375 376 ModifyTable format(SampleRuns)=1 //so that HFIR 8-digit numbers are interpreted correctly as integers 377 ModifyTable format(EmptyRuns)=1 //so that HFIR 8-digit numbers are interpreted correctly as integers 378 ModifyTable width(Scale)=40 379 ModifyTable width(SDD)=40 380 ModifyTable width(Labels)=180 381 382 ModifyTable width(Point)=0 //JUN04, remove point numbers - confuses users since point != run 383 End 384 385 Function ClearMRTable() 386 387 WAVE SampleRuns = $"root:myGlobals:MRED:SampleRuns" 388 WAVE/T EmptyRuns = $"root:myGlobals:MRED:EmptyRuns" 389 WAVE/T Suffix = $"root:myGlobals:MRED:Suffix" 390 WAVE/T Labels = $"root:myGlobals:MRED:Labels" 391 WAVE SDD = $"root:myGlobals:MRED:SDD" 392 WAVE IsTrans = $"root:myGlobals:MRED:IsTrans" 393 WAVE/T ScaleEMP = $"root:myGlobals:MRED:Scale" 394 395 DeletePoints 0, numpnts(SampleRuns), SampleRuns 396 DeletePoints 0, numpnts(EmptyRuns), EmptyRuns 397 DeletePoints 0, numpnts(ScaleEMP), ScaleEMP 398 DeletePoints 0, numpnts(Suffix), Suffix 399 DeletePoints 0, numpnts(Labels), Labels 400 DeletePoints 0, numpnts(SDD), SDD 401 DeletePoints 0, numpnts(IsTrans), IsTrans 402 End 403 404 Function ShowMRReductionTable(ctrlName) : ButtonControl 405 String ctrlName 406 407 // Builds a table that lists the reduction steps to be performed but 408 // it needs the path to the data 409 Variable err 410 PathInfo catPathName 411 if(v_flag==0) 412 err = PickPath() //sets the local path to the data (catPathName) 413 if(err) 414 Abort "No path to data was selected, no catalog can be made - use PickPath button" 415 Endif 416 Endif 417 418 DoWindow/F CatMRTable 419 420 If(V_Flag==0) 421 CreateMRTable() 422 Else 423 ClearMRTable() 424 Endif 425 426 // Get a list of the sample and empty files from the runs 427 String sampleCSV="",emptyCSV="" 428 SVAR sampleRuns=root:myGLobals:MRED:gSampleRuns 429 SVAR emptyRuns=root:myGLobals:MRED:gEmptyRuns 430 SVAR scaleEmpty=root:myGLobals:MRED:gScaleEMP 431 432 // reset the act runs to test need for update 433 String/G root:myGlobals:MRED:actSampleRuns = sampleRuns 434 String/G root:myGlobals:MRED:actEmptyRuns = emptyRuns 435 String/G root:myGLobals:MRED:actScaleEMP = scaleEmpty 436 437 sampleCSV = ParseRunNumberList(sampleRuns) 438 emptyCSV = ParseRunNumberList(emptyRuns) 439 440 // If the runs are not empty and not equal raise a warning. 441 Variable numSamples = ItemsInList(sampleCSV,",") 442 Variable numEmpty = ItemsInList(emptyCSV,",") 443 if (numSamples == 0) 444 DoAlert 0,"Specify a valid set of samples runs to run this function" 445 Return(1) 446 Endif 447 Variable fillEmpty = 0 448 if (numEmpty > 0 && numEmpty != numSamples) 449 DoAlert 1,"No 1-1 mapping to the sample runs - fill empty runs with trailing value?" 450 fillEmpty = (V_Flag == 1) 451 Endif 452 453 Variable ix 454 String sfile, efile, spath, erun 455 String elast = "" 456 for (ix = 0; ix < numSamples; ix += 1) 457 458 sfile = StringFromList(ix,sampleCSV,",") 459 efile = StringFromList(ix,emptyCSV,",") 460 If (ix < numEmpty) 461 elast = efile 462 Else 463 If (fillEmpty) 464 efile = elast 465 Endif 466 Endif 467 If (cmpstr(sfile,"") == 0) 468 DoAlert 0, "Empty sample run included in the list, do you wish to continue?" 469 If (V_Flag == 1) 470 continue 471 Else 472 return (1) 473 EndIf 474 Endif 475 PathInfo catPathName 476 spath = S_path + sfile 477 478 GetHeaderInfoToSDDWave(spath,sfile,efile,scaleEmpty) 479 480 EndFor 481 325 482 End 326 483 … … 331 488 // also sets the current protocol to a global accessible to the list processing routine 332 489 // 333 Function ReduceAll PopupFiles(ctrlName) : ButtonControl490 Function ReduceAllSampleFiles(ctrlName) : ButtonControl 334 491 String ctrlName 335 492 336 //popup (and global list) is a semicolon separated list of files, WITHOUT extensions 337 //transform this list into a COMMA delimited list of FULL filenames, and then they can be processed 338 339 SVAR semiList = root:myGlobals:MRED:gMredList 340 341 //process each item in the list, and generate commaList 342 Variable num = ItemsInList(semiList,";" ) 343 Variable ii=0 344 String commaList = "",item = "" 345 do 346 item = StringFromList(ii, semiList ,";" ) 347 348 // commaList += RunNumberListToFilenameList(item) + "," 349 commaList += item + "," 493 // Firstly confirm that there is a list of files to be processed 494 DoWindow/F CatMRTable 495 If(V_Flag==0) 496 ShowMRReductionTable(ctrlName) 497 Else 498 // check if the runs sequence or scale has changed since the table was built 499 SVAR sampleRunsStr = root:myGlobals:MRED:gSampleRuns 500 SVAR emptyRunsStr = root:myGlobals:MRED:gEmptyRuns 501 SVAR scaleEMPStr = root:myGlobals:MRED:gScaleEMP 502 SVAR sampleTblStr = root:myGlobals:MRED:actSampleRuns 503 SVAR emptyTblStr = root:myGlobals:MRED:actEmptyRuns 504 SVAR scaleTableStr = root:myGlobals:MRED:actScaleEMP 350 505 351 ii+=1 352 while(ii<num) 353 //080601 - send only the comma list of filenames, not full path:name 354 //commaList = FullNameListFromFileList(commaList) //gets the full file names (including extension) for each item in list 355 356 //get the selected protocol, and pass as a global 506 If (cmpstr(sampleRunsStr, sampleTblStr) != 0 || cmpstr(emptyRunsStr, emptyTblStr) != 0 || cmpstr(scaleEMPStr, scaleTableStr) != 0) 507 ShowMRReductionTable(ctrlName) 508 Endif 509 Endif 510 511 // Define a copy of the protocol after recovering the protocol from the popup. 512 // The protocol is just a text wave array. The copy just replaces the empty filename. 513 SetDataFolder root:myGlobals:Protocols 357 514 ControlInfo MRProto_pop 358 515 String protocolNameStr = S_Value 359 String/G root:myGlobals:Protocols:gMredProtoStr = "root:myGlobals:Protocols:"+protocolNameStr 360 361 //also set this as the current protocol, for the function that writes the averaged waves 362 String/G root:myGlobals:Protocols:gProtoStr = protocolNameStr 363 364 //reduce all the files in the list here, using the global protocol(the full reference) 365 //DoReduceList is found in MultipleReduce.ipf 366 DoReduceList(commaList) 367 368 Return 0 516 String/G root:myGlobals:Protocols:gMRedProtoStr = "root:myGlobals:Protocols:" + protocolNameStr 517 SVAR baseProtocol = root:myGlobals:Protocols:gMRedProtoStr 518 519 WAVE/T prot = $baseProtocol 520 Duplicate/O prot copyMRedProto 521 String/G root:myGlobals:Protocols:gProtoStr = NameOfWave(copyMRedProto) 522 String actProtStr = "root:myGlobals:Protocols:" + NameOfWave(copyMRedProto) 523 WAVE/T actProt = $actProtStr 524 525 // Set up the list of files from the table 526 WAVE SampleRuns = $"root:myGlobals:MRED:SampleRuns" 527 WAVE/T EmptyRuns = $"root:myGlobals:MRED:EmptyRuns" 528 WAVE/T ScaleEMP = $"root:myGlobals:MRED:Scale" 529 530 // Run through the list of sample files 531 Variable ix 532 Variable numScale = numpnts(ScaleEMP) 533 Variable numSample = numpnts(SampleRuns) 534 for (ix = 0; ix < numSample; ix += 1) 535 536 String sfile = RunToQuokkaFile(SampleRuns[ix]) 537 String efile = "" 538 String erun = EmptyRuns[ix] 539 Variable scale = 1.0 540 541 // check if an empty file is required by the protocol 542 // replace file name if "ask" or "", skip if "none" 543 if (cmpstr(prot[1],"ask") == 0 || cmpstr(prot[1],"") == 0) 544 If (cmpstr(erun, "") != 0) 545 efile = RunToQuokkaFile(str2num(erun)) 546 Endif 547 if (cmpstr(efile,"") != 0) 548 actProt[1] = efile 549 else 550 actProt[1] = prot[1] 551 Endif 552 Else 553 actProt[1] = prot[1] 554 Endif 555 // 556 If (ix < numScale && cmpstr(ScaleEMP[ix],"") != 0) 557 scale = str2num(ScaleEMP[ix]) 558 If (scale == NaN) 559 DoAlert 0, "Invalid empty scale value in the list, continue with scale = 1?" 560 If (V_Flag == 1) 561 scale = 1 562 continue 563 Else 564 return (1) 565 EndIf 566 Endif 567 actProt[7] = num2str(scale) 568 Else 569 actProt[7] = prot[7] 570 Endif 571 ExecuteProtocol(actProtStr, sfile) 572 EndFor 573 574 return(0) 575 369 576 End 370 577 … … 529 736 Function ScatteringAtSDDTableButton(ctrlName) 530 737 String ctrlName 738 739 Variable err 740 PathInfo catPathName 741 if(v_flag==0) 742 err = PickPath() //sets the local path to the data (catPathName) 743 if(err) 744 Abort "No path to data was selected, no catalog can be made - use PickPath button" 745 Endif 746 Endif 531 747 532 748 Execute "CreateScatteringAtSDDTable()" … … 534 750 End 535 751 536 Function AcceptMREDList(ctrlName)752 Function MapTableToRuns(ctrlName) 537 753 String ctrlName 538 754 539 SVAR/Z list = root:myGlobals:MRED:gFileNumList 540 if(SVAR_Exists(list)==0) //check for myself 755 // maps the sample and empty in the table to the runs 756 SVAR/Z slist = root:myGlobals:MRED:gSampleRuns 757 SVAR/Z elist = root:myGLobals:MRED:gEmptyRuns 758 if(SVAR_Exists(slist)==0 || SVAR_Exists(elist) == 0) //check for myself 541 759 DoAlert 0,"The Multiple Reduce Panel must be open for you to use this function" 542 760 Return(1) 543 761 endif 544 762 545 // convert the wave to a comma-delimited List 546 wave/Z numW = $"root:myGlobals:MRED:RunNumber" 547 if(waveExists(numW)==0 || numpnts(numW)==0) 548 DoAlert 0, "Generate a list of files at a specific detector distance using the Files at SDD List button" 549 return(0) 550 Endif 551 552 list = NumWave2IntegerCommaList(numW) 553 554 //force an update If the SVAR exists, then the panel does too - MRED cleans up after itself when done 555 DoWindow/F Multiple_Reduce_Panel //bring to front 556 MRedPopMenuProc("MRFilesPopup",0,"") //parse the list, pop the menu 557 763 // convert the sample runs 764 Wave/Z sruns = $"root:myGlobals:MRED:SampleRuns" 765 slist = RunListToSequence(sruns, 0) 766 767 // the empty runs is a string list so convert to a list of numbers and use 768 // 0 as the empty value 769 Wave/T/Z eruns = $"root:myGlobals:MRED:EmptyRuns" 770 Variable ix, num = numpnts(eruns) 771 MAKE/U/O/N=(num) temp 772 for (ix = 0; ix < num; ix += 1) 773 String run = eruns[ix] 774 if (cmpstr(run,"") != 0) 775 temp[ix] = str2num(run) 776 else 777 temp[ix] = 0 778 endif 779 endfor 780 elist = RunListToSequence(temp, 0) 781 782 // copy the act run list to the table 783 String/G root:myGlobals:MRED:actSampleRuns = slist 784 String/G root:myGlobals:MRED:actEmptyRuns = elist 558 785 559 786 return(0) … … 565 792 566 793 NewDataFolder/O root:myGlobals:MRED 567 DoWindow/F SDDTable 568 569 Make/O/T/N=0 $"root:myGlobals:MRED:Filenames" 570 Make/O/T/N=0 $"root:myGlobals:MRED:Suffix" 571 Make/O/T/N=0 $"root:myGlobals:MRED:Labels" 572 Make/O/D/N=0 $"root:myGlobals:MRED:SDD" 573 Make/O/D/N=0 $"root:myGlobals:MRED:RunNumber" 574 Make/O/D/N=0 $"root:myGlobals:MRED:IsTrans" 575 794 DoWindow/F CatMRTable 576 795 If(V_Flag==0) 577 SetDataFolder root:myGlobals:MRED 578 Edit Labels, SDD, runNumber as "Scattering at SDD" 579 DoWindow/C $"SDDTable" 580 581 ModifyTable width(SDD)=40 582 ModifyTable width(Labels)=180 583 ModifyTable format(RunNumber)=1 //so that HFIR 8-digit numbers are interpreted correctly as integers 584 585 ModifyTable width(Point)=0 //JUN04, remove point numbers - confuses users since point != run 796 CreateMRTable() 586 797 SetDataFolder root: 798 Else 799 ClearMRTable() 587 800 Endif 588 801 … … 629 842 else 630 843 //go write the header information to the Notebook 631 GetHeaderInfoToSDDWave(fullName,tempName) 844 GetHeaderInfoToSDDWave(fullName,tempName,"","") 845 // add the scale factor 632 846 Endif 633 847 Endif … … 657 871 Function RemoveLabeledFromSDDList(findThisStr) 658 872 String findThisStr 659 W ave/T filenames = $"root:myGlobals:MRED:Filenames"660 W ave/T suffix = $"root:myGlobals:MRED:Suffix"661 W ave/T labels = $"root:myGlobals:MRED:Labels"662 W ave sdd = $"root:myGlobals:MRED:SDD"663 W ave runnum = $"root:myGlobals:MRED:RunNumber"664 W ave isTrans = $"root:myGlobals:MRED:IsTrans"873 WAVE SampleRuns = $"root:myGlobals:MRED:SampleRuns" 874 WAVE/T EmptyRuns = $"root:myGlobals:MRED:EmptyRuns" 875 WAVE/T Suffix = $"root:myGlobals:MRED:Suffix" 876 WAVE/T Labels = $"root:myGlobals:MRED:Labels" 877 WAVE SDD = $"root:myGlobals:MRED:SDD" 878 WAVE IsTrans = $"root:myGlobals:MRED:IsTrans" 665 879 666 880 Variable num=numpnts(Labels),ii,loc … … 670 884 if(loc != -1) 671 885 Print "Remove w[ii] = ",num," ",labels[ii] 672 DeletePoints ii, 1, filenames,suffix,labels,sdd,runnum,isTrans886 DeletePoints ii, 1, SampleRuns,EmptyRuns,Suffix,Labels,SDD,IsTrans 673 887 endif 674 888 ii-=1 … … 682 896 Variable tSDD 683 897 684 W ave/T filenames = $"root:myGlobals:MRED:Filenames"685 W ave/T suffix = $"root:myGlobals:MRED:Suffix"686 W ave/T labels = $"root:myGlobals:MRED:Labels"687 W ave sdd = $"root:myGlobals:MRED:SDD"688 W ave runnum = $"root:myGlobals:MRED:RunNumber"689 W ave isTrans = $"root:myGlobals:MRED:IsTrans"898 WAVE SampleRuns = $"root:myGlobals:MRED:SampleRuns" 899 WAVE/T EmptyRuns = $"root:myGlobals:MRED:EmptyRuns" 900 WAVE/T Suffix = $"root:myGlobals:MRED:Suffix" 901 WAVE/T Labels = $"root:myGlobals:MRED:Labels" 902 WAVE SDD = $"root:myGlobals:MRED:SDD" 903 WAVE IsTrans = $"root:myGlobals:MRED:IsTrans" 690 904 691 905 Variable num=numpnts(sdd),ii,tol = 0.1 … … 693 907 do 694 908 // if(abs(sdd[ii] - tSDD) > tol) //if numerically more than 0.001 m different, they're not the same 695 // DeletePoints ii, 1, filenames,suffix,labels,sdd,runnum,isTrans909 // DeletePoints ii, 1, SampleRuns,EmptyRuns,Suffix,Labels,SDD,IsTrans 696 910 // endif 697 911 if(trunc(abs(sdd[ii] - tSDD)) > tol) //just get the integer portion of the difference - very coarse comparison 698 DeletePoints ii, 1, filenames,suffix,labels,sdd,runnum,isTrans912 DeletePoints ii, 1, SampleRuns,EmptyRuns,Suffix,Labels,SDD,IsTrans 699 913 endif 700 914 ii-=1 … … 702 916 703 917 // now sort 704 Sort RunNum, filenames,suffix,labels,sdd,runnum,isTrans918 Sort SampleRuns, SampleRuns,EmptyRuns,Suffix,Labels,SDD,IsTrans 705 919 return(0) 706 920 End … … 708 922 709 923 Function RemoveTransFilesFromSDDList() 710 W ave/T filenames = $"root:myGlobals:MRED:Filenames"711 W ave/T suffix = $"root:myGlobals:MRED:Suffix"712 W ave/T labels = $"root:myGlobals:MRED:Labels"713 W ave sdd = $"root:myGlobals:MRED:SDD"714 W ave runnum = $"root:myGlobals:MRED:RunNumber"715 W ave isTrans = $"root:myGlobals:MRED:IsTrans"924 WAVE SampleRuns = $"root:myGlobals:MRED:SampleRuns" 925 WAVE/T EmptyRuns = $"root:myGlobals:MRED:EmptyRuns" 926 WAVE/T Suffix = $"root:myGlobals:MRED:Suffix" 927 WAVE/T Labels = $"root:myGlobals:MRED:Labels" 928 WAVE SDD = $"root:myGlobals:MRED:SDD" 929 WAVE IsTrans = $"root:myGlobals:MRED:IsTrans" 716 930 717 931 Variable num=numpnts(isTrans),ii … … 719 933 do 720 934 if(isTrans[ii] != 0) 721 DeletePoints ii, 1, filenames,suffix,labels,sdd,runnum,isTrans935 DeletePoints ii, 1, SampleRuns,EmptyRuns,Suffix,Labels,SDD,IsTrans 722 936 endif 723 937 ii-=1 … … 730 944 //which alreay was found to exist. sname is the file;vers to be written out, 731 945 //avoiding the need to re-extract it from fname. 732 Function GetHeaderInfoToSDDWave(fname,sname )733 String fname,sname 946 Function GetHeaderInfoToSDDWave(fname,sname,ename, empscale) 947 String fname,sname,ename,empscale 734 948 735 949 String textstr,temp,lbl,date_time,suffix … … 737 951 Variable lastPoint, beamstop 738 952 739 Wave/T GFilenames = $"root:myGlobals:MRED:Filenames"740 953 Wave/T GSuffix = $"root:myGlobals:MRED:Suffix" 741 954 Wave/T GLabels = $"root:myGlobals:MRED:Labels" 742 955 Wave GSDD = $"root:myGlobals:MRED:SDD" 743 Wave GRunNumber = $"root:myGlobals:MRED:RunNumber" 956 Wave GSampleRuns = $"root:myGlobals:MRED:SampleRuns" 957 Wave/T GEmptyRuns = $"root:myGlobals:MRED:EmptyRuns" 958 Wave/T GScaleEMP = $"root:myGlobals:MRED:Scale" 744 959 Wave GIsTrans = $"root:myGlobals:MRED:IsTrans" 745 960 746 lastPoint = numpnts(G Lambda)961 lastPoint = numpnts(GSampleRuns) 747 962 748 InsertPoints lastPoint,1,GFilenames 749 GFilenames[lastPoint]=sname 963 //the run number 964 InsertPoints lastPoint,1,GSampleRuns 965 GSampleRuns[lastPoint] = GetRunNumFromFile(sname) 966 967 //the empty runs are left as text as they may be empty 968 InsertPoints lastPoint,1,GEmptyRuns 969 If (cmpstr(ename,"")!= 0) 970 GEmptyRuns[lastPoint] = num2istr(GetRunNumFromFile(ename)) 971 Else 972 GEmptyRuns[lastPoint] = "" 973 EndIf 974 975 // add the scale factor 976 InsertPoints lastPoint,1,GScaleEMP 977 GScaleEMP[lastPoint] = empscale 750 978 751 979 //read the file suffix … … 760 988 InsertPoints lastPoint,1,GSDD 761 989 GSDD[lastPoint]= getSDD(fname) 762 763 //the run number (not displayed in the table, but carried along) 764 InsertPoints lastPoint,1,GRunNumber 765 GRunNumber[lastPoint] = GetRunNumFromFile(sname) 766 990 767 991 // 0 if the file is a scattering file, 1 (truth) if the file is a transmission file 768 992 InsertPoints lastPoint,1,GIsTrans -
sans/Dev/branches/quokka_update/NCNR_User_Procedures/Reduction/SANS/QKK_PatchFiles.ipf
r908 r1202 204 204 //make a three character string of the run number 205 205 if(val<10) 206 numStr = "00"+ num2str(val)206 numStr = "00"+item 207 207 else 208 208 if(val<100) 209 numStr = "0"+ num2str(val)209 numStr = "0"+item 210 210 else 211 numStr = num2str(val)211 numStr = item 212 212 Endif 213 213 Endif -
sans/Dev/branches/quokka_update/NCNR_User_Procedures/Reduction/SANS/QKK_ProDiv.ipf
r908 r1202 393 393 proto[1] = fileStr 394 394 #if (exists("QUOKKA")==6) 395 err = CheckDIVBeamCenter(fileStr,3 9,96)395 err = CheckDIVBeamCenter(fileStr,34,96) 396 396 #else 397 397 err = CheckDIVBeamCenter(str,105,65) … … 407 407 if(strlen(str) > 0) 408 408 #if (exists("QUOKKA")==6) 409 err = CheckDIVBeamCenter(fileStr,3 9,96)409 err = CheckDIVBeamCenter(fileStr,34,96) 410 410 #else 411 411 err = CheckDIVBeamCenter(str,105,65) … … 673 673 Variable xc,yc 674 674 675 Variable err,ii,num,tmpX,tmpY,badCtr,tol= 5675 Variable err,ii,num,tmpX,tmpY,badCtr,tol=10 676 676 String fileStr,pathStr 677 677 -
sans/Dev/branches/quokka_update/NCNR_User_Procedures/Reduction/SANS/QKK_ProtocolAsPanel.ipf
r908 r1202 90 90 String/G root:myGlobals:Protocols:gAVE="AVTYPE=Circular;SAVE=Yes;NAME=Auto;PLOT=Yes;" 91 91 String/G root:myGlobals:Protocols:gDRK="DRK=none,DRKMODE=0," 92 Variable/G root:myGlobals:Protocols:gScaleEMP = 1.0 92 93 93 94 SetDataFolder root: … … 185 186 Wave/T w=$("root:myGlobals:Protocols:" + nameStr) 186 187 187 String fullPath="",comma=",",list="",nameList="",PathStr="",item="" 188 String fullPath="",comma=",",list="",nameList="",PathStr="",item="",strValue="" 188 189 Variable ii=0,numItems,checked,specialProtocol 189 190 … … 215 216 String/G root:myGlobals:Protocols:gEMP = nameList 216 217 CheckBox prot_check_1 win=ProtocolPanel,value=checked 218 219 //empty scale 220 Variable scaleFactor = str2num(w[7]) 221 If (scaleFactor == NaN) 222 scaleFactor = 1.0 223 Endif 224 Variable/G root:myGlobals:Protocols:gScaleEMP = scaleFactor 217 225 218 226 //DIV file … … 496 504 w[6] = drkStr 497 505 498 //w[7] 499 //currently unused500 w[7] = ""506 //w[7] = empty scale factor 507 NVAR scale = root:myGlobals:Protocols:gScaleEMP 508 w[7] = num2str(scale) 501 509 502 510 return(0) … … 827 835 CheckBox prot_check,help={"If checked, the specified background file will be included in the data reduction. If the file name is \"ask\", then the user will be prompted for the file"} 828 836 CheckBox prot_check,value= 1 829 Button pick_bgd,pos={1 14,75},size={100,20},proc=PickBGDButton,title="set BGD file"837 Button pick_bgd,pos={105,75},size={100,20},proc=PickBGDButton,title="set BGD file" 830 838 Button pick_bgd,help={"This button will set the file selected in the File Catalog table to be the background file."} 831 839 Button recallProt,pos={7,406},size={107,20},proc=RecallProtocolButton,title="Recall Protocol" … … 846 854 CheckBox prot_check_3,help={"If checked, the specified mask file will be included in the data reduction. If the file name is \"ask\", then the user will be prompted for the file"} 847 855 CheckBox prot_check_3,value= 1 848 Button pick_emp,pos={1 13,125},size={100,20},proc=PickEMPButton,title="set EMP file"856 Button pick_emp,pos={105,125},size={100,20},proc=PickEMPButton,title="set EMP file" 849 857 Button pick_emp,help={"This button will set the file selected in the File Catalog table to be the empty cell file."} 850 Button pick_DIV,pos={1 14,173},size={100,20},proc=PickDIVButton,title="set DIV file"858 Button pick_DIV,pos={105,173},size={100,20},proc=PickDIVButton,title="set DIV file" 851 859 Button pick_DIV,help={"This button will set the file selected in the File Catalog table to be the sensitivity file."} 852 Button pick_MASK,pos={1 19,266},size={100,20},proc=PickMASKButton,title="set MASK file"860 Button pick_MASK,pos={105,266},size={100,20},proc=PickMASKButton,title="set MASK file" 853 861 Button pick_MASK,help={"This button will set the file selected in the File Catalog table to be the mask file."} 854 862 SetVariable bgdStr,pos={7,98},size={250,15},title="file:" … … 858 866 SetVariable empStr,help={"Filename of the empty cell file(s) to be used in the data reduction"} 859 867 SetVariable empStr,limits={-Inf,Inf,0},value= root:myGlobals:Protocols:gEMP 868 SetVariable empScale,pos={210,125},size={80,15},title="scale:" 869 SetVariable empScale,help={"Scale the empty cell file(s) to be used in the reduction"} 870 SetVariable empScale,limits={-Inf,Inf,0},value=root:myGlobals:Protocols:gScaleEMP 860 871 SetVariable divStr,pos={9,197},size={250,15},title="file:" 861 872 SetVariable divStr,help={"Filename of the detector sensitivity file to be used in the data reduction"} … … 869 880 CheckBox prot_check_4,help={"If checked, the specified sample file will be included in the data reduction. If the file name is \"ask\", then the user will be prompted for the file"} 870 881 CheckBox prot_check_4,value= 1 871 Button pick_sam,pos={1 15,28},size={100,20},proc=PickSAMButton,title="set SAM file"882 Button pick_sam,pos={105,28},size={100,20},proc=PickSAMButton,title="set SAM file" 872 883 Button pick_sam,help={"This button will set the file selected in the File Catalog table to be the sample file"} 873 884 SetVariable samStr,pos={6,50},size={250,15},title="file:" 874 885 SetVariable samStr,help={"Filename of the sample file(s) to be used in the data reduction"} 875 886 SetVariable samStr,limits={-Inf,Inf,0},value= root:myGlobals:Protocols:gSAM 876 Button pick_ABS,pos={1 15,220},size={110,20},proc=SetABSParamsButton,title="set ABS params"887 Button pick_ABS,pos={100,220},size={110,20},proc=SetABSParamsButton,title="set ABS params" 877 888 Button pick_ABS,help={"This button will prompt the user for absolute scaling parameters"} 878 889 CheckBox prot_check_9,pos={7,222},size={59,14},title="Absolute" … … 887 898 CheckBox prot_check_5,help={"If checked, the specified averaging will be performed at the end of the data reduction."} 888 899 CheckBox prot_check_5,value= 1 889 Button pick_AVE,pos={ 108,313},size={150,20},proc=SetAverageParamsButtonProc,title="set AVERAGE params"900 Button pick_AVE,pos={80,313},size={150,20},proc=SetAverageParamsButtonProc,title="set AVERAGE params" 890 901 Button pick_AVE,help={"Prompts the user for the type of 1-D averaging to perform, as well as saving options"} 891 902 SetVariable aveStr,pos={9,336},size={250,15},title="parameters:" … … 1597 1608 activeType = "EMP" 1598 1609 do 1610 // Update the empty scale factor 1611 Variable scale = 1 1612 if(cmpstr(prot[7],"") != 0) 1613 scale = str2num(prot[7]) 1614 if (scale == NaN) 1615 scale = 1 1616 endif 1617 endif 1618 Add_scale_to_work(activeType, scale) 1619 1599 1620 if(cmpstr(prot[1],"ask") == 0) 1600 1621 err = LoadRawSANSData(msgStr) //will prompt for file -
sans/Dev/branches/quokka_update/NCNR_User_Procedures/Reduction/SANS/QKK_WorkFileUtils.ipf
r908 r1202 20 20 //*************************** 21 21 22 22 Function Add_scale_to_work(newType, scale) 23 String newType 24 Variable scale 25 26 String dest = "root:Packages:NIST:"+newType+":scale" 27 NVAR/Z factor = $(dest) 28 If (NVAR_Exists(factor)) 29 factor = scale 30 Else 31 Variable/G $(dest) = scale 32 Endif 33 End 34 23 35 //testing procedure, not called anymore 24 36 Proc Add_to_Workfile(type, add) … … 135 147 endif 136 148 137 //deadtime corrections to raw data138 deadTime = DetectorDeadtime(raw_text[3],raw_text[9]) //pick the correct detector deadtime149 //deadtime is added to the reals read when file is loaded 150 deadTime = raw_reals[56] 139 151 itim = raw_ints[2] 140 152 cntrate = sum(raw_data,-inf,inf)/itim //080802 use data sum, rather than scaler value … … 305 317 endif 306 318 307 //deadtime corrections319 //deadtime is added to the reals read when file is loaded 308 320 itim = integersread[2] 309 321 cntrate = sum(data,-inf,inf)/itim //use sum of detector counts rather than scaler value 310 deadtime = DetectorDeadtime(textread[3],textread[9]) //pick the correct deadtime322 deadtime = realsread[56] 311 323 dscale = 1/(1-deadTime*cntrate) 312 324 … … 509 521 solidAngle[ii][jj] = DetEffCorrILL(lambda,dtdist,xd) 510 522 #else 511 data[ii][jj] /= DetEffCorr( lambda,dtdist,xd,yd)512 // solidAngle[ii][jj] /= DetEffCorr( lambda,dtdist,xd,yd) //testing only523 data[ii][jj] /= DetEffCorr(realsread,lambda,dtdist,xd,yd) 524 // solidAngle[ii][jj] /= DetEffCorr(realsread,lambda,dtdist,xd,yd) //testing only 513 525 #endif 514 526 endif … … 588 600 // xd and yd are distances from the beam center to the current pixel 589 601 // 590 Function DetEffCorr(lambda,dtdist,xd,yd) 602 Function DetEffCorr(realsread,lambda,dtdist,xd,yd) 603 Wave realsread 591 604 Variable lambda,dtdist,xd,yd 592 605 593 606 Variable theta,cosT,ff,stAl,stHe 607 Variable alScl = realsread[52] 608 Variable alWnd = realsRead[53] 609 Variable heScl = realsread[54] 610 Variable heWnd = realsread[55] 594 611 595 612 theta = atan( (sqrt(xd^2 + yd^2))/dtdist ) 596 613 cosT = cos(theta) 597 614 598 stAl = 0.00967 * lambda * 1.52//dimensionless, constants provided by epg599 stHe = 0.055553 * lambda * 3.81615 stAl = alScl * lambda * alWnd //dimensionless, constants provided by epg 616 stHe = heScl * lambda * heWnd 600 617 601 618 ff = exp(-stAl/cosT)*(1-exp(-stHe/cosT)) / ( exp(-stAl)*(1-exp(-stHe)) )
Note: See TracChangeset
for help on using the changeset viewer.