Changeset 206


Ignore:
Timestamp:
Nov 18, 2007 4:15:52 PM (15 years ago)
Author:
srkline
Message:

Three changes:

(1) in WorkfileUtils? - DetCorr?() now includes the correction to the detector efficiency at large angles as was described in John's memo of 3/20/2007. A small correction, increasing the measured intensity by at most a few percent at the largest scattering angles.

(2) Tweaks to the ascii output for Grasp, still untested.

(3) Changed beamstop x-tolerance to -8 cm to account for the 3" BS malfunction on NG3. Only affected recognition of transmission files, and easily worked around by resetting the BS position (NG1 Files to Trans function)

Location:
sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/NCNR_Utils.ipf

    r143 r206  
    4141         
    4242        //new 11APR07 
    43         Variable/G root:myGlobals:BeamstopXTol = -5                     // (cm) is BS Xpos is -5 cm or less, it's a trans measurement 
     43        Variable/G root:myGlobals:BeamstopXTol = -8                     // (cm) is BS Xpos is -5 cm or less, it's a trans measurement 
    4444        // sample aperture offset is NOT stored in the VAX header, but it should be 
    4545        // - when it is, remove the global and write an accessor AND make a place for  
  • sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/WorkFileUtils.ipf

    r116 r206  
    367367        Variable ii,jj,dtdist,dtdis2 
    368368        Variable xi,xd,yd,rad,ratio,domega,xy 
     369        Variable lambda 
    369370         
    370371//      Print "...doing jacobian and non-linear corrections" 
     372        NVAR pixelsX = root:myGlobals:gNPixelsX 
     373        NVAR pixelsY = root:myGlobals:gNPixelsY 
    371374         
    372375        //set up values to send to auxiliary trig functions 
    373         xcenter = 64.5 
    374         ycenter = 64.5 
     376        xcenter = pixelsX/2 + 0.5               // == 64.5 for 128x128 Ordela 
     377        ycenter = pixelsY/2 + 0.5               // == 64.5 for 128x128 Ordela 
     378 
    375379        x0 = realsread[16] 
    376380        y0 = realsread[17] 
     
    383387        dtdis2 = dtdist^2 
    384388         
     389        lambda = realsRead[26] 
     390         
    385391        xx0 = dc_fx(x0,sx,sx3,xcenter) 
    386392        yy0 = dc_fy(y0,sy,sy3,ycenter) 
    387393         
    388         NVAR pixelsX = root:myGlobals:gNPixelsX 
    389 //      NVAR pixelsY = root:myGlobals:gNPixelsY 
     394 
    390395        //waves to contain repeated function calls 
    391         Make/O/N=(pixelsX) fyy,xx,yy            //Assumes square detector 
     396        Make/O/N=(pixelsX) fyy,xx,yy            //Assumes square detector !!! 
    392397        ii=0 
    393398        do 
     
    399404        while(ii<pixelsX) 
    400405         
    401 //      Make/O/N=(pixelsX,pixelsX) SolidAngle 
     406//      Make/O/N=(pixelsX,pixelsX) SolidAngle           // testing only 
    402407         
    403408        ii=0 
     
    413418                        domega = rad/dtdist 
    414419                        ratio = domega^3 
    415 //                      solidAngle[ii][jj] = ratio                       
     420//                      solidAngle[ii][jj] = ratio              //testing only   
    416421                        xy = xx[ii]*yy[jj] 
    417422                        data[ii][jj] *= xy*ratio 
     423                         
     424                        // multiplicative correction for detector efficiency JBG memo det_eff_cor2.doc 3/20/07 
     425                        // correction inserted 11/2007 SRK 
     426                         
     427                        data[ii][jj] *= DetEffCorr(lambda,dtdist,xd,yd) 
     428                         
     429//                      solidAngle[ii][jj] = DetEffCorr(lambda,dtdist,xd,yd)            //testing only 
     430                         
    418431                        jj+=1 
    419432                while(jj<pixelsX) 
     
    422435         
    423436        //clean up waves 
    424         Killwaves/Z fyy,xx,yy 
     437//      Killwaves/Z fyy,xx,yy 
    425438         
    426439        Return(0) 
     
    467480End 
    468481 
     482//distances passed in are in mm 
     483// dtdist is SDD 
     484// xd and yd are distances from the beam center to the current pixel 
     485// 
     486Function DetEffCorr(lambda,dtdist,xd,yd) 
     487        Variable lambda,dtdist,xd,yd 
     488         
     489        Variable theta,cosT,ff,stAl,stHe 
     490         
     491        theta = atan( (sqrt(xd^2 + yd^2))/dtdist ) 
     492        cosT = cos(theta) 
     493         
     494        stAl = 0.00967*lambda*0.8               //dimensionless, constants from JGB memo 
     495        stHe = 0.146*lambda*2.5 
     496         
     497        ff = exp(-stAl/cosT)*(1-exp(-stHe/cosT)) / ( exp(-stAl)*(1-exp(-stHe)) ) 
     498                 
     499        return(ff) 
     500End 
    469501//****************** 
    470502//direct port of the FORTRAN code for calculating the weighted 
  • sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/WriteQIS.ipf

    r201 r206  
    335335        String type,fullpath 
    336336        Variable dialog         //=1 will present dialog for name 
    337          
    338         Variable enter=StopMSTimer(-2) 
    339          
     337                 
    340338        String destStr="",ave="C",typeStr="" 
    341339        Variable step=1,refnum 
     
    396394        Endif 
    397395         
    398         Print "Before fill = ",(StopMSTimer(-2) - enter)/1e6 
    399396///////// 
    400397        Variable numTextLines=18 
     
    434431//              termStr = "\r\n" 
    435432//      Endif 
    436  
    437         Print "After fill = ",(StopMSTimer(-2) - enter)/1e6 
    438433         
    439434        Duplicate/O data,spWave          
    440435        Redimension/S/N=(pixelsX*pixelsY) spWave                //single precision (/S) 
    441436         
    442         Print "Before save = ",(StopMSTimer(-2) - enter)/1e6 
    443437        //not demo- compatible, but approx 100x faster!! 
    444438         
     
    457451        Print "2D ASCII File written: ", GetFileNameFromPathNoSemi(fullPath) 
    458452         
    459         Print "Before exit = ",(StopMSTimer(-2) - enter)/1e6 
    460453        return(0) 
    461454End 
    462455 
    463456 
    464 //// ASCII EXPORT in detector coordinates - mimicking the VAX ASCII/128 command 
     457//// ASCII EXPORT in detector coordinates - mimicking the VAX CONVERT command 
    465458// this is done simply to be able to produce converted raw data files that can be  
    466459// read in with Grasp. A rather awkward structure, definitely not the preferred export format 
     
    471464        String type,fullpath 
    472465        Variable dialog         //=1 will present dialog for name 
    473          
    474         Variable enter=StopMSTimer(-2) 
    475          
     466                 
    476467        String destStr="" 
    477468        String typeStr="" 
     
    522513        Endif 
    523514         
    524         Print "Before fill = ",(StopMSTimer(-2) - enter)/1e6 
    525515///////// 
    526516        String tmpStr="" 
     
    531521        labelWave[0] = tmpStr 
    532522        labelWave[1] = textw[6]         //label 
    533         sprintf tmpStr," %d   %g   %g   %g",intw[2],rw[0],rw[39],rw[2] 
     523         
     524        sprintf tmpStr," %d  %g  %g  %g",intw[2],rw[0],rw[39],rw[2] 
    534525        labelWave[2] = tmpStr 
    535526        labelWave[3] = " Cnt.Time(sec.)    Mon. Cnt.      Trans. Det. Cnt.  Tot. Det. Cnt." 
    536         sprintf tmpStr," %g   %g   %g   %g   %d   %d   %g",rw[4],rw[5],rw[8],rw[9],intw[4],intw[5],rw[6] 
     527         
     528        sprintf tmpStr," %g  %g  %g '%s' %g '%s' %d  %d  %g",rw[4],rw[5],rw[8],textw[7],rw[9],textw[8],intw[4],intw[5],rw[6] 
    537529        labelWave[4] = tmpStr 
    538530        labelWave[5] = " Trans.      Thckns       Temp.           H Field         Table  Holder  Pos" 
    539         sprintf tmpStr," %g   %g   %d   '%s'   %g",rw[26],rw[27],intw[9],textw[9],rw[7] 
     531         
     532        sprintf tmpStr," %g  %g  %d  '%s'  %g",rw[26],rw[27],intw[9],textw[9],rw[7] 
    540533        labelWave[6] = tmpStr 
    541534        labelWave[7] = " Wavelength &  Spread(FWHM)    Det.#  Type      Sample Rotation Angle" 
    542         sprintf tmpStr," %g   %g   %g   %g   %g   %g",rw[18],rw[19],rw[16],rw[17],rw[21],rw[3] 
     535         
     536        sprintf tmpStr," %g  %g  %g  %g  %g  %g",rw[18],rw[19],rw[16],rw[17],rw[21],rw[3] 
    543537        labelWave[8] = tmpStr 
    544538        labelWave[9] = " Sam-Det Dis.(m)   Det.Ang.(cm.)   Beam Center(x,y)  Beam Stop(mm)  Atten.No." 
    545         sprintf tmpStr," %g   %g   %g   %g   %g   %g",rw[10],rw[11],rw[12],rw[13],rw[14],rw[15] 
     539         
     540        sprintf tmpStr," %g  %g  %g  %g  %g  %g",rw[10],rw[11],rw[12],rw[13],rw[14],rw[15] 
    546541        labelWave[10] = tmpStr 
    547542        labelWave[11] = "        Det. Calib Consts. (x)           Det. Calib Consts. (y)" 
    548         sprintf tmpStr," %g  %g  %g  '%s'   %g   %g",rw[23],rw[24],rw[25],"    F",rw[32],rw[32] 
     543         
     544        sprintf tmpStr," %g  %g  %g  '%s'  %g  %g",rw[23],rw[24],rw[25],"    F",rw[45],rw[46] 
    549545        labelWave[12] = tmpStr 
    550546        labelWave[13] = " Aperture (A1,A2) Sizes(mm)    Sep.(m)    Flip ON   Horiz. and Vert. Cur.(amps)" 
     547         
    551548        sprintf tmpStr," %d  %d  %d  %d  %g  %g  %g",intw[19],intw[20],intw[21],intw[22],rw[47],rw[48],rw[49] 
    552549        labelWave[14] = tmpStr 
    553550        labelWave[15] = "      Rows        Cols       Factor   Qmin      Qmax" 
     551         
    554552        labelWave[16] = " Packed Counts by Rows (L -> R) and Top -> Bot" 
    555553          
     
    559557                labelWave[ii] = (labelWave[ii])[0,240] 
    560558        endfor 
    561  
    562         Print "After fill = ",(StopMSTimer(-2) - enter)/1e6 
    563559         
    564560        Duplicate/O data,spWave          
     
    581577                sPt=ePt 
    582578        while(ePt<len-1) 
    583          
    584         Print "Before save = ",(StopMSTimer(-2) - enter)/1e6 
    585          
     579                 
    586580        Open refNum as fullpath 
    587581        wfprintf refNum,"%s\r",labelWave                        //VAX uses just \r 
     
    593587        Print "2D ASCII File written for Grasp: ", GetFileNameFromPathNoSemi(fullPath) 
    594588         
    595         Print "Before exit = ",(StopMSTimer(-2) - enter)/1e6 
    596589        return(0) 
    597590End 
Note: See TracChangeset for help on using the changeset viewer.