Changeset 572


Ignore:
Timestamp:
Oct 16, 2009 11:35:04 AM (13 years ago)
Author:
srkline
Message:

Merging changes:

NCNR_Utils -> merging these into FACILITY, HFIR, and ILL_Utils

HFIR files merged by hand to reflect JaeHie?'s 29JUL09 version

Changed MainPanel? to look for TISANE or RealTime? functions to prevent button procedures from being called when the procedures aren't there. Seemed easier than separate versions without the buttons. #define at the begining of TISANE.ipf -> #ifdef in MainPanel? didn't work for some reason?

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  
    11461146         
    11471147        // 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) 
     1151End 
     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// 
     1159Function 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) 
     1166End 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/FACILITY_Utils.ipf

    r570 r572  
    684684        return(list) 
    685685End 
     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// 
     694Function/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") 
     699End 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/HFIR_DataReadWrite.ipf

    r571 r572  
    6969                                break 
    7070                        case -4: 
    71                                 errorMsg = filename+ ": \r\t Not supported version of xml or SPICE..."   
     71                                errorMsg = filename+ " ===> Not supported version of xml or SPICE..."    
    7272                                break 
    7373                endswitch 
    7474                SetDataFolder root: 
    75                 print "Failed loading", filename, "..." 
     75                //print "Failed loading", filename, "..." 
    7676                DoAlert 0, errorMsg 
    7777                //Clean up waves... 
     
    128128        STRING/G errorMsg        
    129129        Variable refNum 
    130         print "Loading", filename, "..."         
     130        //print "Loading", filename, "..."       
    131131        if (stringmatch(filename,"*.xml") <1) 
    132                 print "\r  ==> Failed: Not a *.xml file." 
     132                //print "\r  ==> Failed: Not a *.xml file." 
    133133                return (-1)                             //Not *.xml. Do nothing... 
    134134        endif 
     
    136136        refNum = XmlOpenFile(filename)   
    137137        if (refNum < 0) 
    138                 print "\r  ==> Failed: Not a standard xml file format." 
     138                //print "\r  ==> Failed: Not a standard xml file format." 
    139139                return (-2)                             //Not a xml file. Do nothing... 
    140140        endif 
     
    517517        //actually open the file 
    518518        if (stringmatch(fname,"*.xml") <1) 
    519                 print "Failed: Not a *.xml file." 
     519                //print "Failed: Not a *.xml file." 
    520520                return (str)                            //Not *.xml. Do nothing... 
    521521        endif 
     
    523523        refNum = XmlOpenFile(fname)      
    524524        if (refNum < 0) 
    525                 print "Failed: Not a xml file." 
     525                //print "Failed: Not a xml file." 
    526526                return (str)                            //Not a xml file. Do nothing... 
    527527        endif 
     
    564564        String fname 
    565565         
    566         return(getStringFromHeader(fname,"suffix"))             //!!!!!!!!!!!!!!!!!!!!!!!!! 
     566        return(getStringFromHeader(fname,"assoc_suffix"))               //!!!!!!!!!!!!!!!!!!!!!!!!! 
    567567End 
    568568 
     
    579579  
    580580        return(getStringFromHeader(fname,"start_time")) 
     581End 
     582 
     583// Check if the file is transmission file? 
     584Function/S getIsTrans(fname) 
     585        String fname 
     586        return(getStringFromHeader(fname,"Transmission")) 
    581587End 
    582588 
     
    590596        //actually open the file 
    591597        if (stringmatch(fname,"*.xml") <1) 
    592                 print "Failed: Not a *.xml file." 
     598                //print "Failed: Not a *.xml file." 
    593599                return 0                                //Not *.xml. Do nothing... 
    594600        endif 
     
    596602        refNum = XmlOpenFile(fname)      
    597603        if (refNum < 0) 
    598                 print "Failed: Not a xml file." 
     604                //print "Failed: Not a xml file." 
    599605                return 0                                //Not a xml file. Do nothing... 
    600606        endif 
     
    790796 
    791797//////  integer values 
    792 //////Not used !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
     798//////Not used !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 
    793799Function getIntegerFromHeader(fname,wanted)   ///Not used !!!!!!!!! 
    794800        String fname                            //full path:name 
     
    800806        //actually open the file 
    801807        if (stringmatch(fname,"*.xml") <1) 
    802                 print "Failed: Not a *.xml file." 
     808                //print "Failed: Not a *.xml file." 
    803809                return 0                                //Not *.xml. Do nothing... 
    804810        endif 
     
    806812        refNum = XmlOpenFile(fname)      
    807813        if (refNum < 0) 
    808                 print "Failed: Not a xml file." 
     814                //print "Failed: Not a xml file." 
    809815                return 0                                //Not a xml file. Do nothing... 
    810816        endif 
     
    819825        return(0) 
    820826End 
    821  
     827////////////////////////////////////////////////////////////////////////////////// 
    822828 
    823829//reads the wavelength from a reduced data file (not very reliable) 
     
    912918                 
    913919         
    914         WriteHFIRHead(fname,suffix,"suffix" ,"text")  
     920        WriteHFIRHead(fname,suffix,"assoc_suffix" ,"text")  
    915921        return(0) 
    916922end 
     
    13631369                endfor    
    13641370        //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          else 
     1371        //else 
    13661372        endif 
    13671373         
     
    13891395        String ntype = ""       //Do not change this initial, "". 
    13901396        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, "..." 
    13941400        if (stringmatch(filename,"*.xml") <1) 
    1395                 print "\r  ==>  Failed: Not a *.xml file." 
     1401                //print "\r  ==>  Failed: Not a *.xml file." 
    13961402                return 0                                //Not *.xml. Do nothing... 
    13971403        endif 
     
    14021408                switch(refNum)                                   
    14031409                        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..." 
    14051411                        break 
    14061412                        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..." 
    14081414                        break 
    14091415                endswitch 
     
    14891495                        vresult = vals           
    14901496                 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." 
    14921498                 XMLsetAttr(refNum,nstr,"","type",ntype)         
    14931499        endif 
     
    14961502        if      (strlen(wantedterm)==0 && vresult == -1) 
    14971503                XMLclosefile(refNum, 0) 
    1498                 print "Failed writing",wantedterm, "on", filename, "..." 
     1504                //print "Failed writing",wantedterm, "on", filename, "..." 
    14991505        else 
    15001506                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, "..." 
    15021508        endif 
    15031509        return (vresult) 
     
    15371543 
    15381544 End 
     1545  
     1546//Write whether Transmission is True or False. 
     1547Function Write_isTransmissionToHeader(fname,str) 
     1548        String fname,str 
     1549 
     1550        WriteHFIRHead(fname,str, "Transmission","text")          
     1551        return(0) 
     1552End 
    15391553 
    15401554//sample transmission is a real value at byte 158 
     
    15701584 
    15711585        String countsstr = "" 
    1572         sprintf countsstr, "%d", counts 
     1586        sprintf countsstr, "%f", counts 
    15731587 
    15741588        WriteHFIRHead(fname,countsstr,"Box_Counts" ,"")          
     
    20002014        return(0) 
    20012015End 
     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// 
     2023Function 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) 
     2031End 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/HFIR_Includes_v520.ipf

    r570 r572  
    6262 
    6363 
    64 #include "TISANE" 
     64//#include "TISANE" 
    6565 
    6666 
     
    7070// SRK JUN2009 
    7171#include "Smear_2D"             //2D resolution calculation and smearing 
    72  
    73 // to include the analysis packages, uncomment the following 
    74 // include statement and click "compile" at the bottom of this window. 
    75 // ** the SANSModels menu will appear, and the packages will be  
    76 // available under the Macros menu as usual. 
    77  
    78 //#include "Analysis_SRK" 
    7972 
    8073 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/HFIR_Utils.ipf

    r570 r572  
    134134End 
    135135 
    136 //********************** 
    137 // 2D resolution function calculation - in terms of X and Y 
    138 // 
    139 // see same-named function in NCNR_Utils 
    140 // 
    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_dist 
    143         Variable &SigmaQX,&SigmaQY,&fSubS               //these are the output quantities at the input Q value 
    144  
    145  
    146         String results = "success" 
    147         Return results 
    148 End 
    149136 
    150137 
     
    247234        retStr=invalid 
    248235         
    249         //your code here 
    250236        //find the "dot" 
    251237        Variable pos = strsearch( LowerStr(item),".xml",0) 
     
    314300        do 
    315301                //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. 
    317303                // 2 - exclude by isRaw? (to minimize disk access) 
    318304                item = StringFromList(ii, list  ,";" ) 
     
    418404        String fname 
    419405         
     406        //Check by key "transsmission" 
     407        if (stringmatch( getIsTrans(fName),"True")>0) 
     408                return (1) 
     409        else 
     410                //Check from beam stop motor position 
    420411        Variable beamtrap_1y=0,beamtrap_2y=0,beamtrap_3y=0,beamtrap_4y=0 
    421 //      if(your test here) 
     412        //      if(your test here) 
    422413        beamtrap_1y=getRealValueFromHeader(fname,"trap_y_101mm","mm") 
    423414        beamtrap_2y=getRealValueFromHeader(fname,"trap_y_25mm","mm") 
     
    426417 
    427418         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") 
    429421                return (1) 
    430422        else 
     
    432424                return (0) 
    433425        endif 
     426        endif 
     427        return (0) 
    434428End 
    435429 
     
    839833// called by Correct.ipf, ProtocolAsPanel.ipf, Transmission.ipf 
    840834// 
    841 Function AttenuationFactor(fileStr,lam,attenpercent) 
     835Function AttenuationFactor(fileStr,lam,attenuation) 
    842836        String fileStr 
    843         Variable lam,attenpercent 
     837        Variable lam,attenuation  //    0 =< attenuation <= 1 : where no attenuator stands for 0. 
    844838         
    845839        Variable attenFactor=1 
    846840         
    847841        // your code here 
    848         attenFactor = 1- attenpercent /100  //???Attenuate transmission 
     842        attenFactor = 1- attenuation  //???Attenuate transmission 
    849843 
    850844        return(attenFactor) 
     
    881875                item = StringFromList(ii, list  ,";") 
    882876                //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") ) 
    884878                        if( !stringmatch(item,".*") && !stringmatch(item,"*.pxp") && !stringmatch(item,"*.DIV"))                //eliminate mac "hidden" files, pxp, and div files 
    885879                                newlist += item + ";" 
     
    921915                        endif 
    922916                endif 
     917                if( stringmatch(item,"*.xml") ) 
     918                        if (CheckIfRawData(S_path+item) >0) 
     919                                newlist += item + ";" 
     920                        endif 
     921                endif 
    923922        endfor 
    924923        newList = SortList(newList,";",0) 
    925924        return(newList) 
    926925End 
     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// 
     934Function/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") 
     939End 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/ILL_DataReadWrite.ipf

    r571 r572  
    21342134        return(0) 
    21352135End 
     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// 
     2143Function 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) 
     2151End 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/ILL_Utils.ipf

    r570 r572  
    949949        return(newlist) 
    950950End 
     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// 
     959Function/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") 
     964End 
     965 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/Includes_ILL.ipf

    r570 r572  
    4848#include "SANS_Utilities"                                                               //new in the 29MAR07 branch 
    4949 
    50 // to include the analysis packages, uncomment the following 
    51 // include statement and click "compile" at the bottom of this window. 
    52 // ** the SANSModels menu will appear, and the packages will be  
    53 // available under the Macros menu as usual. 
    54  
    55 //#include "Analysis_SRK" 
    56  
    5750 
    5851// a simple list of items to add to the Beta menu 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/Includes_v520.ipf

    r570 r572  
    7171#include "Smear_2D"             //2D resolution calculation and smearing 
    7272 
    73 // to include the analysis packages, uncomment the following 
    74 // include statement and click "compile" at the bottom of this window. 
    75 // ** the SANSModels menu will appear, and the packages will be  
    76 // available under the Macros menu as usual. 
    77  
    78 //#include "Analysis_SRK" 
    7973 
    8074 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/Includes_v520_ILL.ipf

    r570 r572  
    6464#include "PlotManager_v40" 
    6565 
    66 // to include the analysis packages, uncomment the following 
    67 // include statement and click "compile" at the bottom of this window. 
    68 // ** the SANSModels menu will appear, and the packages will be  
    69 // available under the Macros menu as usual. 
    70  
    71 //#include "Analysis_SRK" 
    72  
    7366 
    7467// a simple list of items to add to the Beta menu 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/MainPanel.ipf

    r570 r572  
    202202        String ctrlName 
    203203         
    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         
    205211End 
    206212 
     
    214220        String ctrlName 
    215221 
    216         if(root:myGlobals:isDemoVersion == 1) 
    217                 //      comment out in DEMO_MODIFIED version, and show the alert 
    218                 DoAlert 0,"This operation is not available in the 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" 
    219225        else 
    220226                Show_RealTime_Panel() 
     
    227233        Show_Preferences_Panel() 
    228234End 
     235 
    229236//////////////////////////////////////////////// 
    230237//************* NEW version of Main control Panel ***************** 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/MultScatter_MonteCarlo_2D.ipf

    r570 r572  
    10401040        String ctrlName 
    10411041 
    1042         WriteVAXData("SAS","",0) 
     1042        Write_RawData_File("SAS","",0) 
    10431043End 
    10441044 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_DataReadWrite.ipf

    r571 r572  
    18611861 
    18621862 
     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// 
     1867Function 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) 
     1874End 
     1875 
    18631876// given a data folder, write out the corresponding VAX binary data file. 
    18641877// 
     
    18881901// for now, 20 characters 01-JAN-2009 12:12:12 
    18891902// 
    1890  
    18911903// simulation should call as ("SAS","",0) to bypass the dialog, and to fill the header 
    18921904// this could be modified in the future to be more generic 
    18931905// 
    18941906/// 
    1895 Function WriteVAXData(type,fullpath,dialog) 
     1907Function Write_VAXRaw_Data(type,fullpath,dialog) 
    18961908        String type,fullpath 
    18971909        Variable dialog         //=1 will present dialog for name 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_Utils.ipf

    r570 r572  
    155155// 
    156156// 
    157 //      this should end up in NCNR_Utils once it's fully functional 
     157//      this should end up in FACILITY_Utils once it's fully functional 
    158158// 
    159159// lots of unnecessary junk... 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/TISANE.ipf

    r570 r572  
    11#pragma rtGlobals=1             // Use modern global access method. 
    22#pragma IgorVersion=6.1 
    3  
    4  
    53 
    64 
Note: See TracChangeset for help on using the changeset viewer.