Changeset 572
- Timestamp:
- Oct 16, 2009 11:35:04 AM (13 years ago)
- Location:
- sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/FACILITY_DataReadWrite.ipf
r571 r572 1146 1146 1147 1147 // Your file writing function here. Don't try to duplicate the VAX binary format... 1148 WriteVAXWorkFile(type) 1149 1150 return(0) 1151 End 1148 Print "Write_DIV_File stub" 1149 1150 return(0) 1151 End 1152 1153 ////// OCT 2009, facility specific bits from MonteCarlo functions() 1154 //"type" is the data folder that has the data array that is to be (re)written as a full 1155 // data file, as if it was a raw data file 1156 // 1157 // not really necessary 1158 // 1159 Function Write_RawData_File(type,fullpath,dialog) 1160 String type 1161 1162 // Your file writing function here. Don't try to duplicate the VAX binary format... 1163 Print "Write_RawData_File stub" 1164 1165 return(0) 1166 End -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/FACILITY_Utils.ipf
r570 r572 684 684 return(list) 685 685 End 686 687 //********************** 688 // 2D resolution function calculation - in terms of X and Y 689 // 690 // based on notes from David Mildner, 2008 691 // 692 // the final NCNR version is located in NCNR_Utils.ipf 693 // 694 Function/S get2DResolution(inQ,phi,lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,usingLenses,r_dist,SigmaQX,SigmaQY,fSubS) 695 Variable inQ, phi,lambda, lambdaWidth, DDet, apOff, S1, S2, L1, L2, BS, del_r,usingLenses,r_dist 696 Variable &SigmaQX,&SigmaQY,&fSubS //these are the output quantities at the input Q value 697 698 return("Function Empty") 699 End -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/HFIR_DataReadWrite.ipf
r571 r572 69 69 break 70 70 case -4: 71 errorMsg = filename+ " : \r\tNot supported version of xml or SPICE..."71 errorMsg = filename+ " ===> Not supported version of xml or SPICE..." 72 72 break 73 73 endswitch 74 74 SetDataFolder root: 75 print "Failed loading", filename, "..."75 //print "Failed loading", filename, "..." 76 76 DoAlert 0, errorMsg 77 77 //Clean up waves... … … 128 128 STRING/G errorMsg 129 129 Variable refNum 130 print "Loading", filename, "..."130 //print "Loading", filename, "..." 131 131 if (stringmatch(filename,"*.xml") <1) 132 print "\r ==> Failed: Not a *.xml file."132 //print "\r ==> Failed: Not a *.xml file." 133 133 return (-1) //Not *.xml. Do nothing... 134 134 endif … … 136 136 refNum = XmlOpenFile(filename) 137 137 if (refNum < 0) 138 print "\r ==> Failed: Not a standard xml file format."138 //print "\r ==> Failed: Not a standard xml file format." 139 139 return (-2) //Not a xml file. Do nothing... 140 140 endif … … 517 517 //actually open the file 518 518 if (stringmatch(fname,"*.xml") <1) 519 print "Failed: Not a *.xml file."519 //print "Failed: Not a *.xml file." 520 520 return (str) //Not *.xml. Do nothing... 521 521 endif … … 523 523 refNum = XmlOpenFile(fname) 524 524 if (refNum < 0) 525 print "Failed: Not a xml file."525 //print "Failed: Not a xml file." 526 526 return (str) //Not a xml file. Do nothing... 527 527 endif … … 564 564 String fname 565 565 566 return(getStringFromHeader(fname," suffix")) //!!!!!!!!!!!!!!!!!!!!!!!!!566 return(getStringFromHeader(fname,"assoc_suffix")) //!!!!!!!!!!!!!!!!!!!!!!!!! 567 567 End 568 568 … … 579 579 580 580 return(getStringFromHeader(fname,"start_time")) 581 End 582 583 // Check if the file is transmission file? 584 Function/S getIsTrans(fname) 585 String fname 586 return(getStringFromHeader(fname,"Transmission")) 581 587 End 582 588 … … 590 596 //actually open the file 591 597 if (stringmatch(fname,"*.xml") <1) 592 print "Failed: Not a *.xml file."598 //print "Failed: Not a *.xml file." 593 599 return 0 //Not *.xml. Do nothing... 594 600 endif … … 596 602 refNum = XmlOpenFile(fname) 597 603 if (refNum < 0) 598 print "Failed: Not a xml file."604 //print "Failed: Not a xml file." 599 605 return 0 //Not a xml file. Do nothing... 600 606 endif … … 790 796 791 797 ////// integer values 792 //////Not used !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 798 //////Not used !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 793 799 Function getIntegerFromHeader(fname,wanted) ///Not used !!!!!!!!! 794 800 String fname //full path:name … … 800 806 //actually open the file 801 807 if (stringmatch(fname,"*.xml") <1) 802 print "Failed: Not a *.xml file."808 //print "Failed: Not a *.xml file." 803 809 return 0 //Not *.xml. Do nothing... 804 810 endif … … 806 812 refNum = XmlOpenFile(fname) 807 813 if (refNum < 0) 808 print "Failed: Not a xml file."814 //print "Failed: Not a xml file." 809 815 return 0 //Not a xml file. Do nothing... 810 816 endif … … 819 825 return(0) 820 826 End 821 827 ////////////////////////////////////////////////////////////////////////////////// 822 828 823 829 //reads the wavelength from a reduced data file (not very reliable) … … 912 918 913 919 914 WriteHFIRHead(fname,suffix," suffix" ,"text")920 WriteHFIRHead(fname,suffix,"assoc_suffix" ,"text") 915 921 return(0) 916 922 end … … 1363 1369 endfor 1364 1370 //make sure not to have a left-over content (only for text; numbers are set to -1 later as a default if not found) 1365 1371 //else 1366 1372 endif 1367 1373 … … 1389 1395 String ntype = "" //Do not change this initial, "". 1390 1396 String nstr = "/SPICErack" //to add new nodes and content. 1391 String errorMsg =" Failed to parse ..."1392 1393 print "Loading", filename, "..."1397 String errorMsg ="" 1398 1399 //print "Loading", filename, "..." 1394 1400 if (stringmatch(filename,"*.xml") <1) 1395 print "\r ==> Failed: Not a *.xml file."1401 //print "\r ==> Failed: Not a *.xml file." 1396 1402 return 0 //Not *.xml. Do nothing... 1397 1403 endif … … 1402 1408 switch(refNum) 1403 1409 case -1: 1404 errorMsg = " ==> Not a standard xml file format; Please check if the file is not broken..."1410 errorMsg = errorMsg+filename+ " ==> Not a standard xml file format; Please check if the file is not broken..." 1405 1411 break 1406 1412 case -2: 1407 errorMsg = " ==> Please check if the file name is same as that written in the header..."1413 errorMsg = errorMsg+filename+" ==> Please check if the file name is same as that written in the header..." 1408 1414 break 1409 1415 endswitch … … 1489 1495 vresult = vals 1490 1496 endif 1491 print "*** Important note:*** \r *** No parameter named",wantedterm, "was found, so it was added to the end of your data file."1497 print "*** Note:*** \r *** No parameter named",wantedterm, "was found, so it was added to the end of your data file." 1492 1498 XMLsetAttr(refNum,nstr,"","type",ntype) 1493 1499 endif … … 1496 1502 if (strlen(wantedterm)==0 && vresult == -1) 1497 1503 XMLclosefile(refNum, 0) 1498 print "Failed writing",wantedterm, "on", filename, "..."1504 //print "Failed writing",wantedterm, "on", filename, "..." 1499 1505 else 1500 1506 XMLclosefile(refNum, 1) //save and close the file. 1501 print "Finished writing",wantedterm,"=",value,"[",NCunit,"] on", filename, "..."1507 //print "Finished writing",wantedterm,"=",value,"[",NCunit,"] on", filename, "..." 1502 1508 endif 1503 1509 return (vresult) … … 1537 1543 1538 1544 End 1545 1546 //Write whether Transmission is True or False. 1547 Function Write_isTransmissionToHeader(fname,str) 1548 String fname,str 1549 1550 WriteHFIRHead(fname,str, "Transmission","text") 1551 return(0) 1552 End 1539 1553 1540 1554 //sample transmission is a real value at byte 158 … … 1570 1584 1571 1585 String countsstr = "" 1572 sprintf countsstr, "% d", counts1586 sprintf countsstr, "%f", counts 1573 1587 1574 1588 WriteHFIRHead(fname,countsstr,"Box_Counts" ,"") … … 2000 2014 return(0) 2001 2015 End 2016 2017 ////// OCT 2009, facility specific bits from MonteCarlo functions() 2018 //"type" is the data folder that has the data array that is to be (re)written as a full 2019 // data file, as if it was a raw data file 2020 // 2021 // not really necessary 2022 // 2023 Function Write_RawData_File(type,fullpath,dialog) 2024 String type,fullpath 2025 Variable dialog //=1 will present dialog for name 2026 2027 // Your file writing function here. Don't try to duplicate the VAX binary format... 2028 Print "Write_RawData_File stub" 2029 2030 return(0) 2031 End -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/HFIR_Includes_v520.ipf
r570 r572 62 62 63 63 64 #include "TISANE"64 //#include "TISANE" 65 65 66 66 … … 70 70 // SRK JUN2009 71 71 #include "Smear_2D" //2D resolution calculation and smearing 72 73 // to include the analysis packages, uncomment the following74 // include statement and click "compile" at the bottom of this window.75 // ** the SANSModels menu will appear, and the packages will be76 // available under the Macros menu as usual.77 78 //#include "Analysis_SRK"79 72 80 73 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/HFIR_Utils.ipf
r570 r572 134 134 End 135 135 136 //**********************137 // 2D resolution function calculation - in terms of X and Y138 //139 // see same-named function in NCNR_Utils140 //141 Function/S get2DResolution(inQ,phi,lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,usingLenses,r_dist,SigmaQX,SigmaQY,fSubS)142 Variable inQ, phi,lambda, lambdaWidth, DDet, apOff, S1, S2, L1, L2, BS, del_r,usingLenses,r_dist143 Variable &SigmaQX,&SigmaQY,&fSubS //these are the output quantities at the input Q value144 145 146 String results = "success"147 Return results148 End149 136 150 137 … … 247 234 retStr=invalid 248 235 249 //your code here250 236 //find the "dot" 251 237 Variable pos = strsearch( LowerStr(item),".xml",0) … … 314 300 do 315 301 //parse through the list in this order: 316 // 1 - does item contain run number (as a string) "NAMESANS_expNN_scan####_####.xml" : Let the first ### is the run num.302 // 1 - does item contain run number (as a string) "NAMESANS_expNN_scan####_####.xml" : Let the first #### is the run num. 317 303 // 2 - exclude by isRaw? (to minimize disk access) 318 304 item = StringFromList(ii, list ,";" ) … … 418 404 String fname 419 405 406 //Check by key "transsmission" 407 if (stringmatch( getIsTrans(fName),"True")>0) 408 return (1) 409 else 410 //Check from beam stop motor position 420 411 Variable beamtrap_1y=0,beamtrap_2y=0,beamtrap_3y=0,beamtrap_4y=0 421 // if(your test here)412 // if(your test here) 422 413 beamtrap_1y=getRealValueFromHeader(fname,"trap_y_101mm","mm") 423 414 beamtrap_2y=getRealValueFromHeader(fname,"trap_y_25mm","mm") … … 426 417 427 418 if (beamtrap_1y<10 && beamtrap_2y<10 && beamtrap_3y<10 && beamtrap_4y<10) 428 //yes, its a transmisison file 419 //Write the flag ON 420 Write_isTransmissionToHeader(fName,"True") 429 421 return (1) 430 422 else … … 432 424 return (0) 433 425 endif 426 endif 427 return (0) 434 428 End 435 429 … … 839 833 // called by Correct.ipf, ProtocolAsPanel.ipf, Transmission.ipf 840 834 // 841 Function AttenuationFactor(fileStr,lam,atten percent)835 Function AttenuationFactor(fileStr,lam,attenuation) 842 836 String fileStr 843 Variable lam,atten percent837 Variable lam,attenuation // 0 =< attenuation <= 1 : where no attenuator stands for 0. 844 838 845 839 Variable attenFactor=1 846 840 847 841 // your code here 848 attenFactor = 1- atten percent /100//???Attenuate transmission842 attenFactor = 1- attenuation //???Attenuate transmission 849 843 850 844 return(attenFactor) … … 881 875 item = StringFromList(ii, list ,";") 882 876 //simply remove all that are not raw data files (SA1 SA2 SA3) 883 if( !stringmatch(item," *.xml") )877 if( !stringmatch(item,"HiResSANS*.xml") && !stringmatch(item,"BioSANS*.xml") ) 884 878 if( !stringmatch(item,".*") && !stringmatch(item,"*.pxp") && !stringmatch(item,"*.DIV")) //eliminate mac "hidden" files, pxp, and div files 885 879 newlist += item + ";" … … 921 915 endif 922 916 endif 917 if( stringmatch(item,"*.xml") ) 918 if (CheckIfRawData(S_path+item) >0) 919 newlist += item + ";" 920 endif 921 endif 923 922 endfor 924 923 newList = SortList(newList,";",0) 925 924 return(newList) 926 925 End 926 927 //********************** 928 // 2D resolution function calculation - in terms of X and Y 929 // 930 // based on notes from David Mildner, 2008 931 // 932 // the final NCNR version is located in NCNR_Utils.ipf 933 // 934 Function/S get2DResolution(inQ,phi,lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,usingLenses,r_dist,SigmaQX,SigmaQY,fSubS) 935 Variable inQ, phi,lambda, lambdaWidth, DDet, apOff, S1, S2, L1, L2, BS, del_r,usingLenses,r_dist 936 Variable &SigmaQX,&SigmaQY,&fSubS //these are the output quantities at the input Q value 937 938 return("Function Empty") 939 End -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/ILL_DataReadWrite.ipf
r571 r572 2134 2134 return(0) 2135 2135 End 2136 2137 ////// OCT 2009, facility specific bits from MonteCarlo functions() 2138 //"type" is the data folder that has the data array that is to be (re)written as a full 2139 // data file, as if it was a raw data file 2140 // 2141 // not really necessary 2142 // 2143 Function Write_RawData_File(type,fullpath,dialog) 2144 String type,fullpath 2145 Variable dialog //=1 will present dialog for name 2146 2147 // Your file writing function here. Don't try to duplicate the VAX binary format... 2148 Print "Write_RawData_File stub" 2149 2150 return(0) 2151 End -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/ILL_Utils.ipf
r570 r572 949 949 return(newlist) 950 950 End 951 952 //********************** 953 // 2D resolution function calculation - in terms of X and Y 954 // 955 // based on notes from David Mildner, 2008 956 // 957 // the final NCNR version is located in NCNR_Utils.ipf 958 // 959 Function/S get2DResolution(inQ,phi,lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,usingLenses,r_dist,SigmaQX,SigmaQY,fSubS) 960 Variable inQ, phi,lambda, lambdaWidth, DDet, apOff, S1, S2, L1, L2, BS, del_r,usingLenses,r_dist 961 Variable &SigmaQX,&SigmaQY,&fSubS //these are the output quantities at the input Q value 962 963 return("Function Empty") 964 End 965 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/Includes_ILL.ipf
r570 r572 48 48 #include "SANS_Utilities" //new in the 29MAR07 branch 49 49 50 // to include the analysis packages, uncomment the following51 // include statement and click "compile" at the bottom of this window.52 // ** the SANSModels menu will appear, and the packages will be53 // available under the Macros menu as usual.54 55 //#include "Analysis_SRK"56 57 50 58 51 // a simple list of items to add to the Beta menu -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/Includes_v520.ipf
r570 r572 71 71 #include "Smear_2D" //2D resolution calculation and smearing 72 72 73 // to include the analysis packages, uncomment the following74 // include statement and click "compile" at the bottom of this window.75 // ** the SANSModels menu will appear, and the packages will be76 // available under the Macros menu as usual.77 78 //#include "Analysis_SRK"79 73 80 74 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/Includes_v520_ILL.ipf
r570 r572 64 64 #include "PlotManager_v40" 65 65 66 // to include the analysis packages, uncomment the following67 // include statement and click "compile" at the bottom of this window.68 // ** the SANSModels menu will appear, and the packages will be69 // available under the Macros menu as usual.70 71 //#include "Analysis_SRK"72 73 66 74 67 // a simple list of items to add to the Beta menu -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/MainPanel.ipf
r570 r572 202 202 String ctrlName 203 203 204 Show_TISANE_Panel() 204 if(exists("Show_TISANE_Panel")==0) 205 // procedure file was not loaded 206 DoAlert 0,"This operation is not available in this set of macros" 207 else 208 Show_TISANE_Panel() 209 endif 210 205 211 End 206 212 … … 214 220 String ctrlName 215 221 216 if( root:myGlobals:isDemoVersion == 1)217 // comment out in DEMO_MODIFIED version, and show the alert218 DoAlert 0,"This operation is not available in th e Demo version of IGOR"222 if(exists("Init_for_RealTime")==0) 223 // procedure file was not loaded 224 DoAlert 0,"This operation is not available in this set of macros" 219 225 else 220 226 Show_RealTime_Panel() … … 227 233 Show_Preferences_Panel() 228 234 End 235 229 236 //////////////////////////////////////////////// 230 237 //************* NEW version of Main control Panel ***************** -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/MultScatter_MonteCarlo_2D.ipf
r570 r572 1040 1040 String ctrlName 1041 1041 1042 Write VAXData("SAS","",0)1042 Write_RawData_File("SAS","",0) 1043 1043 End 1044 1044 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_DataReadWrite.ipf
r571 r572 1861 1861 1862 1862 1863 ////// OCT 2009, facility specific bits from MonteCarlo functions() 1864 //"type" is the data folder that has the data array that is to be (re)written as a full 1865 // data file, as if it was a raw data file 1866 // 1867 Function Write_RawData_File(type,fullpath,dialog) 1868 String type,fullpath 1869 Variable dialog //=1 will present dialog for name 1870 1871 Write_VAXRaw_Data(type,fullpath,dialog) 1872 1873 return(0) 1874 End 1875 1863 1876 // given a data folder, write out the corresponding VAX binary data file. 1864 1877 // … … 1888 1901 // for now, 20 characters 01-JAN-2009 12:12:12 1889 1902 // 1890 1891 1903 // simulation should call as ("SAS","",0) to bypass the dialog, and to fill the header 1892 1904 // this could be modified in the future to be more generic 1893 1905 // 1894 1906 /// 1895 Function Write VAXData(type,fullpath,dialog)1907 Function Write_VAXRaw_Data(type,fullpath,dialog) 1896 1908 String type,fullpath 1897 1909 Variable dialog //=1 will present dialog for name -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_Utils.ipf
r570 r572 155 155 // 156 156 // 157 // this should end up in NCNR_Utils once it's fully functional157 // this should end up in FACILITY_Utils once it's fully functional 158 158 // 159 159 // lots of unnecessary junk... -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/TISANE.ipf
r570 r572 1 1 #pragma rtGlobals=1 // Use modern global access method. 2 2 #pragma IgorVersion=6.1 3 4 5 3 6 4
Note: See TracChangeset
for help on using the changeset viewer.