Changeset 82


Ignore:
Timestamp:
Apr 11, 2007 12:21:15 PM (16 years ago)
Author:
srkline
Message:
  • Documentation of what parameters are passed to some "Generic" functions. There are only a few of these, like AttenuationFactor?, and they are passed a set parameter list that is always taken from the R/T/I waves that are loaded with the data. If filled properly from the loader, all will work, or the accessor can be fudged to work.
  • A new initialization global was added for beamstop XTol for isTransFile()
  • A new initialization global was added for sample aperture offset (apOff)
Location:
sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/CatVSTable.ipf

    r76 r82  
    314314        // 0 if the file is a scattering  file, 1 (truth) if the file is a transmission file 
    315315        InsertPoints lastPoint,1,GIsTrans 
    316         GIsTrans[lastPoint]  = isTransFile(fname, -5)           //returns one if beamstop is "out" 
     316        GIsTrans[lastPoint]  = isTransFile(fname)               //returns one if beamstop is "out" 
    317317         
    318318        return(0) 
  • sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/CircSectAve.ipf

    r76 r82  
    326326        //good values 
    327327 
    328         Variable DDet, apOff=0.0 
     328        Variable DDet 
     329        NVAR apOff = root:myGlobals:apOff               //in cm 
    329330        DDet = DetectorPixelResolution(fileStr,detStr)          //needs detector type and beamline 
    330331         
  • sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/NCNR_DataReadWrite.ipf

    r80 r82  
    12291229// str is the CORRECT length - it will all be written - pad before sending 
    12301230// start is the start byte 
    1231 Function RewriteTextToHeader(fname,str,start) 
     1231Function WriteTextToHeader(fname,str,start) 
    12321232        String fname,str 
    12331233        Variable start 
     
    12461246end 
    12471247 
     1248// sample label, starts at byte 98 
     1249// limit to 60 characters 
    12481250Function WriteSamLabelToHeader(fname,str) 
    12491251        String fname,str 
    12501252         
    1251         RewriteTextToHeader(fname,str,98) 
     1253        if(strlen(str) > 60) 
     1254                str = str[0,59] 
     1255        endif 
     1256        WriteTextToHeader(fname,str,98) 
    12521257        return(0) 
    12531258End 
     
    15841589//associated file suffix is the first 4 characters of a text field starting 
    15851590// at byte 404 
     1591// suffix must be four characters long, if not, it's truncated 
     1592// 
    15861593Function WriteAssocFileSuffixToHeader(fname,suffix) 
    15871594        String fname,suffix 
    1588          
    1589         Variable refnum 
    1590          
    1591         Open/A/T="????TEXT" refnum as fname 
    1592         FSetPos refnum,404 
    1593         FBinWrite refnum, suffix 
    1594         FStatus refnum 
    1595         FSetPos refnum,V_logEOF 
    1596         Close refnum 
    1597          
    1598         return(0) 
    1599 end 
     1595                 
     1596        suffix = suffix[0,3]            //limit to 4 characters 
     1597        WriteTextToHeader(fname,suffix,404) 
     1598         
     1599        return(0) 
     1600end 
  • sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/NCNR_Utils.ipf

    r81 r82  
    3939        Variable/G root:myGlobals:DeadtimeNG7_ORNL = 3.4e-6 
    4040        Variable/G root:myGlobals:DeadtimeDefault = 3.4e-6 
     41         
     42        //new 11APR07 
     43        Variable/G root:myGlobals:BeamstopXTol = -5                     // (cm) is BS Xpos is -5 cm or less, it's a trans measurement 
     44        // sample aperture offset is NOT stored in the VAX header, but it should be 
     45        // - when it is, remove the global and write an accessor AND make a place for  
     46        // it in the RealsRead  
     47        Variable/G root:myGlobals:apOff = 5.0                           // (cm) distance from sample aperture to sample position 
     48 
    4149End 
    4250 
     
    5462//          raw data header to indicate the presence of lenses. 
    5563// 
    56 // 
    5764// - called by CircSectAvg.ipf and RectAnnulAvg.ipf 
     65// 
     66// passed values are read from RealsRead 
     67// except DDet and apOff, which are set from globals before passing 
    5868// 
    5969Function/S getResolution(inQ,lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,SigmaQ,QBar,fSubS) 
     
    6676 
    6777        //Constants 
    68         //Variable del_r = .1 
    6978        Variable vz_1 = 3.956e5         //velocity [cm/s] of 1 A neutron 
    7079        Variable g = 981.0                              //gravity acceleration [cm/s^2] 
     
    7382        results ="Failure" 
    7483 
    75         //rename for working variables,  these must be gotten from global 
    76         //variables 
    77  
    78 //      Variable wLam, wLW, wL1, wL2, wS1, wS2 
    79 //      Variable wBS, wDDet, wApOff 
    80 //      wLam = lambda 
    81 //      wLW = lambdaWidth 
    82 //      wDDet = DDet 
    83 //      wApOff = apOff 
    8484        S1 *= 0.5*0.1                   //convert to radius and [cm] 
    8585        S2 *= 0.5*0.1 
     
    142142 
    143143 
    144 //Utility function that returns the detector resolution (in cm) given information  
    145 //from the file header 
     144//Utility function that returns the detector resolution (in cm) 
    146145//Global values are set in the Initialize procedure 
    147146// 
    148147// 
    149148// - called by CircSectAvg.ipf, RectAnnulAvg.ipf, and ProtocolAsPanel.ipf 
     149// 
     150// fileStr is passed as TextRead[3] 
     151// detStr is passed as TextRead[9] 
    150152// 
    151153Function DetectorPixelResolution(fileStr,detStr) 
     
    187189                default:                                                         
    188190                        //return error? 
    189                         DDet = PixelResDefault  //5mm, typical for new ORNL detectors 
     191                        DDet = PixelResDefault  //0.5 cm, typical for new ORNL detectors 
    190192        endswitch 
    191193         
     
    193195End 
    194196 
    195 //Utility function that returns the detector deadtime (in seconds) given information  
    196 //from the file header 
     197//Utility function that returns the detector deadtime (in seconds) 
    197198//Global values are set in the Initialize procedure 
    198199// 
    199200// - called by WorkFileUtils.ipf 
    200201// 
     202// fileStr is passed as TextRead[3] 
     203// detStr is passed as TextRead[9] 
    201204// 
    202205Function DetectorDeadtime(fileStr,detStr) 
     
    434437End 
    435438 
    436  
    437  
    438439//function to check the header of a raw data file (full path specified by fname) 
    439440//checks the field of the x-position of the beamstop during data collection 
     
    443444// function returns 1 if beamstop is out, 0 if beamstop is in 
    444445// 
     446// tolerance is set as a global value "root:myGlobals:BeamstopXTol" 
    445447// 
    446448// called by Transmission.ipf, CatVSTable.ipf, NSORT.ipf 
    447449// 
    448 Function isTransFile(fName,xTol) 
     450Function isTransFile(fName) 
    449451        String fname 
    450         Variable xTol 
    451452         
    452453        Variable refnum,xpos 
     454        NVAR xTol = root:myGlobals:BeamstopXTol 
     455         
    453456        //pos = 369, read one real value 
    454457         
     
    10461049//NG5 values are taken from the NG7 tables (there is very little difference in the 
    10471050//values, and NG5 attenuators have not been calibrated (as of 8/01) 
    1048 //filestr as passed is textread[3], the default directory 
     1051// 
     1052// filestr is passed from TextRead[3] = the default directory 
     1053// lam is passed from RealsRead[26] 
     1054// AttenNo is passed from ReaslRead[3] 
    10491055// 
    10501056// Attenuation factor as defined here is <= 1 
     1057// 
    10511058// ORNL can pass ("",1,attenuationFactor) and have this function simply 
    10521059// spit back the attenuationFactor (that was read into rw[3]) 
  • sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/NSORT.ipf

    r76 r82  
    15791579        // 0 if the file is a scattering  file, 1 (truth) if the file is a transmission file 
    15801580        InsertPoints lastPoint,1,GIsTrans 
    1581         GIsTrans[lastPoint]  = isTransFile(fname, -5)           //returns one if beamstop is "out" 
     1581        GIsTrans[lastPoint]  = isTransFile(fname)               //returns one if beamstop is "out" 
    15821582         
    15831583        KillWaves/Z w 
  • sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/RectAnnulAvg.ipf

    r76 r82  
    326326        //good values 
    327327 
    328         Variable DDet, apOff=0.0 
     328        Variable DDet 
     329        NVAR apOff = root:myGlobals:apOff               //in cm 
    329330        DDet = DetectorPixelResolution(fileStr,detStr)          //needs detector type and beamline 
    330  
    331331 
    332332        //Width of annulus used for the average is gotten from the  
  • sans/SANSReduction/branches/kline_29MAR07/Put in User Procedures/SANS_Reduction_v5.00/Transmission.ipf

    r75 r82  
    250250        String fname,sname 
    251251         
    252         Variable isTrans, xTol= -5 
    253  
    254 //      String textstr,temp,labelStr,date_time,suffix,assoc 
    255 //      Variable ctime,lambda,sdd,detcnt,cntrate,refNum,trans,thick,xcenter,ycenter,numatten 
    256         Variable lastPoint//, beamstop, Whole 
    257  
    258         isTrans = isTransFile(fname, xTol) 
     252        Variable isTrans 
     253 
     254        Variable lastPoint 
     255 
     256        isTrans = isTransFile(fname) 
    259257        // decalre the correct set of waves 
    260258        // S_Whole is only a place holder so the waves are of equal length 
Note: See TracChangeset for help on using the changeset viewer.