Ignore:
Timestamp:
Nov 2, 2009 10:55:37 AM (13 years ago)
Author:
srkline
Message:

Added conditional compile instructions to some reduction procedure files that have only minor facility-specific changes. These changes are not significant enough to merit a separate facility file that must be maintained with essentially duplicate functions.

#define SYMBOL was attempted, but did not work since the symbols weren't actually defined until after the compile... and I couldn't figure out how to define - then compile. in additon, the table is static until Igor is quit - so multiple symbols could be defined, and compiling would fail.

So... the method now that appears to work is to put a dummy function for each facility in its facility specific "Includes" file. Then the conditional compilation checks for exists("function").

Location:
sans/Dev/trunk/NCNR_User_Procedures
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Common/NCNR_Package_Loader.ipf

    r570 r588  
    335335 
    336336end 
     337 
     338Function WhatSymbolsAreDefined() 
     339 
     340#if (exists("QUOKKA")==6) 
     341                print "function QUOKKA defined" 
     342#else 
     343                print "function QUOKKA NOT defined" 
     344#endif 
     345         
     346#if(exists("HFIR")==6) 
     347                print "function HFIR defined" 
     348#else 
     349                print "function HFIR NOT defined" 
     350#endif 
     351         
     352#if(exists("ILL_D22")==6) 
     353                print "function ILL_D22 defined" 
     354#else 
     355                print "function ILL_D22 NOT defined" 
     356#endif 
     357 
     358 
     359 
     360// for a lot of reasons, defined symbols do not work 
     361// mostly, the procedures are compiled before the symbols are 
     362// defined (or re-defined) 
     363// another issues is that they are persistent, and  don't disappear 
     364// until Igor is quit.  
     365         
     366//      SetIgorOption poundDefine=QUOKKA? 
     367//      if(V_flag) 
     368//              print "QUOKKA defined" 
     369//      else 
     370//              print "QUOKKA NOT defined" 
     371//      endif 
     372//       
     373//      SetIgorOption poundDefine=HFIR? 
     374//      if(V_flag) 
     375//              print "HFIR defined" 
     376//      else 
     377//              print "HFIR NOT defined" 
     378//      endif 
     379//       
     380//      SetIgorOption poundDefine=ILL_D22? 
     381//      if(V_flag) 
     382//              print "ILL_D22 defined" 
     383//      else 
     384//              print "ILL_D22 NOT defined" 
     385//      endif 
     386 
     387        return(0) 
     388End 
     389 
     390Proc ClearDefinedSymbols() 
     391        SetIgorOption poundUnDefine=QUOKKA 
     392        SetIgorOption poundUnDefine=HFIR 
     393        SetIgorOption poundUnDefine=ILL_D22 
     394End 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/ANSTO_DataReadWrite.ipf

    r575 r588  
    18131813// not really necessary 
    18141814// 
    1815 Function Write_RawData_File(type,fullpath,dialog) 
     1815Function/S Write_RawData_File(type,fullpath,dialog) 
    18161816        String type,fullpath 
    18171817        Variable dialog         //=1 will present dialog for name 
     
    18201820        Print "Write_RawData_File stub" 
    18211821         
    1822         return(0) 
    1823 End 
     1822        return(fullpath) 
     1823End 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/CatVSTable.ipf

    r577 r588  
    2121//parsing the filenames in the list and (dispatching) to write out the  
    2222//appropriate information to the notebook window 
    23 Proc BuildCatVeryShortTable() 
     23Function BuildCatVeryShortTable() 
    2424         
    2525        Variable err 
     
    5555        Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Field" 
    5656        Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:MCR"              //added Mar 2008 
    57 //#ifdef ILL_D22 
    58 //      Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Reactorpower"       //activate for ILL, June 2008, 
    59 //#endif 
    60  
     57#if (exists("ILL_D22")==6) 
     58        Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:Reactorpower"       //activate for ILL, June 2008, 
     59        WAVE ReactorPower = $"root:myGlobals:CatVSHeaderInfo:Reactorpower" 
     60#endif 
     61 
     62        WAVE/T Filenames = $"root:myGlobals:CatVSHeaderInfo:Filenames" 
     63        WAVE/T Suffix = $"root:myGlobals:CatVSHeaderInfo:Suffix" 
     64        WAVE/T Labels = $"root:myGlobals:CatVSHeaderInfo:Labels" 
     65        WAVE/T DateAndTime = $"root:myGlobals:CatVSHeaderInfo:DateAndTime" 
     66        WAVE SDD = $"root:myGlobals:CatVSHeaderInfo:SDD" 
     67        WAVE Lambda = $"root:myGlobals:CatVSHeaderInfo:Lambda" 
     68        WAVE CntTime = $"root:myGlobals:CatVSHeaderInfo:CntTime" 
     69        WAVE TotCnts = $"root:myGlobals:CatVSHeaderInfo:TotCnts" 
     70        WAVE CntRate = $"root:myGlobals:CatVSHeaderInfo:CntRate" 
     71        WAVE Transmission = $"root:myGlobals:CatVSHeaderInfo:Transmission" 
     72        WAVE Thickness = $"root:myGlobals:CatVSHeaderInfo:Thickness" 
     73        WAVE XCenter = $"root:myGlobals:CatVSHeaderInfo:XCenter" 
     74        WAVE YCenter = $"root:myGlobals:CatVSHeaderInfo:YCenter" 
     75        //WAVE/B NumGuides = $"root:myGlobals:CatVSHeaderInfo:NumGuides" 
     76        WAVE/B NumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" 
     77        WAVE RunNumber = $"root:myGlobals:CatVSHeaderInfo:RunNumber" 
     78        WAVE IsTrans = $"root:myGlobals:CatVSHeaderInfo:IsTrans" 
     79        WAVE RotAngle = $"root:myGlobals:CatVSHeaderInfo:RotAngle" 
     80        WAVE Temperature = $"root:myGlobals:CatVSHeaderInfo:Temperature" 
     81        WAVE Field = $"root:myGlobals:CatVSHeaderInfo:Field" 
     82        WAVE MCR = $"root:myGlobals:CatVSHeaderInfo:MCR"                //added Mar 2008 
     83         
     84         
    6185        If(V_Flag==0) 
    6286                BuildTableWindow() 
     
    7498                ModifyTable width(:myGlobals:CatVSHeaderInfo:Field)=50 
    7599                ModifyTable width(:myGlobals:CatVSHeaderInfo:MCR)=50 
    76 //#ifdef ILL_D22 
    77 //              ModifyTable width(:myGlobals:CatVSHeaderInfo:Reactorpower)=50           //activate for ILL, June 2008 
    78 //#endif 
     100#if (exists("ILL_D22")==6) 
     101                ModifyTable width(:myGlobals:CatVSHeaderInfo:Reactorpower)=50           //activate for ILL, June 2008 
     102#endif 
    79103 
    80104                ModifyTable width(Point)=0              //JUN04, remove point numbers - confuses users since point != run 
     
    174198        Wave GField = $"root:myGlobals:CatVSHeaderInfo:Field" 
    175199        Wave GMCR = $"root:myGlobals:CatVSHeaderInfo:MCR"               //added Mar 2008 
    176 //#ifdef ILL_D22 
    177 //      Wave GReactPow = $"root:myGlobals:CatVSHeaderInfo:ReactorPower"         //activate for ILL June 2008 ( and the sort line too) 
    178 //      Sort GSuffix, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens,GRunNumber,GIsTrans,GRot,GTemp,GField,GMCR,GReactPow 
    179 //#else 
     200#if (exists("ILL_D22")==6) 
     201        Wave GReactPow = $"root:myGlobals:CatVSHeaderInfo:ReactorPower"         //activate for ILL June 2008 ( and the sort line too) 
     202        Sort GSuffix, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens,GRunNumber,GIsTrans,GRot,GTemp,GField,GMCR,GReactPow 
     203#else 
    180204        Sort GSuffix, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens,GRunNumber,GIsTrans,GRot,GTemp,GField,GMCR 
    181 //#endif 
     205#endif 
    182206 
    183207        return(0) 
     
    205229        Wave Field= $"root:myGlobals:CatVSHeaderInfo:Field" 
    206230        Wave MCR = $"root:myGlobals:CatVSHeaderInfo:MCR"                //added Mar 2008 
    207 //#ifdef ILL_D22 
     231#if (exists("ILL_D22")==6) 
    208232// for ILL 
    209 //      Wave ReactorPower = $"root:myGlobals:CatVSHeaderInfo:reactorpower"       //activate for ILL, June 08 (+ edit line) 
    210 //      Edit Filenames, Labels, DateAndTime, SDD, Lambda, CntTime, TotCnts, CntRate, Transmission, Thickness, XCenter, YCenter, NumAttens, RotAngle, Temperature, Field, MCR, ReactorPower as "Data File Catalog" 
    211 //#else 
     233        Wave ReactorPower = $"root:myGlobals:CatVSHeaderInfo:reactorpower"       //activate for ILL, June 08 (+ edit line) 
     234        Edit Filenames, Labels, DateAndTime, SDD, Lambda, CntTime, TotCnts, CntRate, Transmission, Thickness, XCenter, YCenter, NumAttens, RotAngle, Temperature, Field, MCR, ReactorPower as "Data File Catalog" 
     235#else 
    212236// original order, magnetic at the end 
    213237        Edit Filenames, Labels, DateAndTime, SDD, Lambda, CntTime, TotCnts, CntRate, Transmission, Thickness, XCenter, YCenter, NumAttens, RotAngle, Temperature, Field, MCR as "Data File Catalog" 
    214238// alternate ordering, put the magnetic information first 
    215239//      Edit Filenames, Labels, RotAngle, Temperature, Field, DateAndTime, SDD, Lambda, CntTime, TotCnts, CntRate, Transmission, Thickness, XCenter, YCenter, NumAttens as "Data File Catalog" 
    216 //#endif 
     240#endif 
    217241 
    218242        String name="CatVSTable" 
     
    254278        Wave GField = $"root:myGlobals:CatVSHeaderInfo:Field" 
    255279        Wave GMCR = $"root:myGlobals:CatVSHeaderInfo:MCR" 
    256 //#ifdef ILL_D22 
    257 //      Wave GReactpow = $"root:myGlobals:CatVSHeaderInfo:reactorpower"         //activate for ILL, Jne 2008, (+ last insert @ end of function)  
    258 //#endif 
     280#if (exists("ILL_D22")==6) 
     281        Wave GReactpow = $"root:myGlobals:CatVSHeaderInfo:reactorpower"         //activate for ILL, Jne 2008, (+ last insert @ end of function)  
     282#endif 
    259283        lastPoint = numpnts(GLambda) 
    260284                 
     
    344368        GMCR[lastPoint]  = getMonitorCount(fname)/ctime         //total monitor count / total count time 
    345369 
    346 //#ifdef ILL_D22         
    347 //      // Reactor Power (activate for ILL) 
    348 //      InsertPoints lastPoint,1,GReactpow 
    349 //      GReactPow[lastPoint]  = getReactorPower(fname) 
    350 //#endif         
     370#if (exists("ILL_D22")==6) 
     371        // Reactor Power (activate for ILL) 
     372        InsertPoints lastPoint,1,GReactpow 
     373        GReactPow[lastPoint]  = getReactorPower(fname) 
     374#endif   
    351375 
    352376        return(0) 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/HFIR_Includes_v520.ipf

    r575 r588  
    44 
    55 
    6 #define HFIR 
     6 
     7 
     8// to properly set up the template for HFIR Data Reduction, the dummy 
     9// function HFIR() must exist here in the Includes file. 
     10// 
     11Function HFIR() 
     12        //does nothing but define HFIR() 
     13        return(0) 
     14End 
     15 
    716 
    817 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/ILL_DataReadWrite.ipf

    r573 r588  
    21432143// not really necessary 
    21442144// 
    2145 Function Write_RawData_File(type,fullpath,dialog) 
     2145Function/S Write_RawData_File(type,fullpath,dialog) 
    21462146        String type,fullpath 
    21472147        Variable dialog         //=1 will present dialog for name 
     
    21502150        Print "Write_RawData_File stub" 
    21512151         
    2152         return(0) 
    2153 End 
     2152        return(fullPath) 
     2153End 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/Includes_ANSTO.ipf

    r575 r588  
    1010// nha. Edited for Quokka. 5/2/09 
    1111// 
    12 // these procedure files are those used in version 5.0 of the  
    13 // SANS Reduction macros, August 2006 
    1412 
    15 #define QUOKKA 
     13 
     14// to properly set up the template for QUOKKA Data Reduction, the dummy 
     15// function must exist in the Includes file. 
     16// 
     17Function QUOKKA() 
     18        //does nothing but declare QUOKKA 
     19        return(0) 
     20End 
     21 
    1622 
    1723 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/Includes_v520_ILL.ipf

    r576 r588  
    44 
    55 
    6 #define ILL_D22 
     6 
     7// to properly set up the template for ILL Data Reduction, the dummy 
     8// function ILL_D22() must exist here in the Includes file. 
     9// 
     10Function ILL_D22() 
     11        //does nothing but define ILL_D22() 
     12        return(0) 
     13End 
     14 
    715 
    816 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/MultScatter_MonteCarlo_2D.ipf

    r583 r588  
    102102         
    103103//      nthreads = 1 
    104          
    105         variable mt= ThreadGroupCreate(nthreads) 
     104        NVAR mt=root:myGlobals:gThreadGroupID 
     105        mt = ThreadGroupCreate(nthreads) 
    106106        NVAR gInitTime = root:Packages:NIST:SAS:gRanDateTime            //time that SASCALC was started 
    107  
     107        Print "thread group ID = ",mt 
    108108         
    109109        inputWave[0] = NNeutron/nthreads                //split up the number of neutrons 
     
    153153        while( tgs != 0 ) 
    154154        variable dummy= ThreadGroupRelease(mt) 
     155        mt=0 
    155156        Print "done with all threads" 
    156157 
     
    11041105        NVAR doMonteCarlo = root:Packages:NIST:SAS:gDoMonteCarlo                // == 1 if 2D MonteCarlo set by hidden flag 
    11051106        WAVE rw=root:Packages:NIST:SAS:realsRead 
     1107         
     1108// Try to nicely exit from a threading error, if possible 
     1109        Variable err=0 
     1110        if(!exists("root:myGlobals:gThreadGroupID")) 
     1111                Variable/G root:myGlobals:gThreadGroupID=0 
     1112        endif 
     1113        NVAR mt=root:myGlobals:gThreadGroupID 
     1114 
     1115        if(mt!=0)       //there was an error with the stopping of the threads, possibly user abort 
     1116                err = ThreadGroupRelease(mt) 
     1117                Print "threading err = ",err 
     1118                if(err == 0) 
     1119                        // all *should* be OK 
     1120                else 
     1121                        return(0) 
     1122                endif 
     1123        endif 
    11061124 
    11071125        NVAR imon = root:Packages:NIST:SAS:gImon 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/ProDiv.ipf

    r575 r588  
    7676        endif 
    7777 
    78 #ifdef QUOKKA    
     78#if (exists("QUOKKA")==6) 
    7979        //corrects edge rows and columns by copy data from adjacent column 
    8080        DoAlert 1,"Do edge correction for Quokka detector?" 
     
    376376                        ConvertFolderToLinearScale("COR") 
    377377                         
    378 #ifdef QUOKKA    
     378#if (exists("QUOKKA")==6) 
    379379                        //corrects edge rows and columns by copy data from adjacent column 
     380                        String ctrType="STO",offType="COR" 
    380381                        DoAlert 1,"Do edge correction for Quokka detector?" 
    381382                        if(V_flag==1) 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/ProtocolAsPanel.ipf

    r575 r588  
    18671867                String tempFilename = samStr 
    18681868                If(WaveExists(textPath) == 1) 
    1869 #ifdef QUOKKA 
     1869#if (exists("QUOKKA")==6) 
    18701870                        newFileName = ReplaceString(".nx.hdf", tempFilename, "") 
    18711871#else 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/WorkFileUtils.ipf

    r576 r588  
    141141        dscale = 1/(1-deadTime*cntrate) 
    142142 
    143 #ifdef ILL_D22 
     143#if (exists("ILL_D22")==6) 
    144144        Variable tubeSum 
    145145        // for D22 detector might need to use cntrate/128 as it is the tube response 
     
    161161        //update totals by adding RAW values to the local ones (write to work header at end of function) 
    162162        total_mon += raw_reals[0] 
    163 #ifdef ILL_D22 
     163#if (exists("ILL_D22")==6) 
    164164        total_det += sum(data,-inf,inf)                 //add the newly scaled detector array 
    165165#else 
     
    311311        dscale = 1/(1-deadTime*cntrate) 
    312312         
    313 #ifdef ILL_D22 
     313#if (exists("ILL_D22")==6) 
    314314        Variable tubeSum 
    315315        // for D22 detector might need to use cntrate/128 as it is the tube response 
     
    332332        //update totals to put in the work header (at the end of the function) 
    333333        total_mon += realsread[0] 
    334 #ifdef ILL_D22   
     334#if (exists("ILL_D22")==6) 
    335335        total_det += sum(data,-inf,inf)                 //add the newly scaled detector array 
    336336#else 
     
    496496                        // so divide here to get the correct answer (5/22/08 SRK) 
    497497                        if(doEfficiency) 
    498 #ifdef ILL_D22 
     498#if (exists("ILL_D22")==6) 
    499499                                data[ii][jj]  /= DetEffCorrILL(lambda,dtdist,xd)                //tube-by-tube corrections  
    500500                  solidAngle[ii][jj] = DetEffCorrILL(lambda,dtdist,xd) 
Note: See TracChangeset for help on using the changeset viewer.