Ignore:
Timestamp:
May 18, 2009 5:15:08 PM (14 years ago)
Author:
srkline
Message:

(1) fix in ProtocolAsPanel? that correctly calculates Kappa for data taken with the Cerca detectors. In the Kappa calculation, the data is manually scaled, bypassing the normal "ADD" step where the 4x detector data is correctly renormalized. Added a flag to divide by 4 if ILL detector type found.

(2) lots of bits to try to accomodate 2D resolution smearing. Changes to the QxQy? output to have everything needed: Qz, sigX, sigY, and shadowing. So presumably, all of the information is in the reduced data, where it should be.

  • added a 2D resolution calculation based on David Mildner's notes.
  • added 2D quadrature calculation for smearing, and new structure definitions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/WriteQIS.ipf

    r474 r509  
    630630 
    631631 
    632 //ASCII export of data as 3-columns qx-qy-Intensity 
     632// NEW additions - May 2009 
     633//ASCII export of data as 7-columns qx-qy-Intensity-qz-sigmaQx-sigmaQy-fShad 
    633634//limited header information? 
    634635// 
     
    718719        labelWave[13] = "" 
    719720        labelWave[14] = "*** Data written from "+type+" folder and may not be a fully corrected data file ***" 
    720         labelWave[15] = "Data columns are Qx - Qy - I(Qx,Qy)" 
     721        labelWave[15] = "Data columns are Qx - Qy - I(Qx,Qy) - Qz - SigmaQx - SigmaQy - fSubS(beam stop shadow)" 
    721722        labelWave[16] = "" 
    722723        labelWave[17] = "ASCII data created " +date()+" "+time() 
     
    736737//      Endif 
    737738         
    738         Duplicate/O data,qx_val,qy_val,z_val,qval,qz_val 
     739        Duplicate/O data,qx_val,qy_val,z_val,qval,qz_val,phi,r_dist 
    739740         
    740741//      Redimension/N=(pixelsX*pixelsY) qx_val,qy_val,z_val 
    741742//      MyMat2XYZ(data,qx_val,qy_val,z_val)             //x and y are [p][q] indexes, not q-vals yet 
    742743         
     744        Variable xctr,yctr,sdd,lambda,pixSize 
     745        xctr = rw[16] 
     746        yctr = rw[17] 
     747        sdd = rw[18] 
     748        lambda = rw[26] 
     749        pixSize = rw[13]/10             //convert mm to cm (x and y are the same size pixels) 
     750         
    743751        qx_val = CalcQx(p+1,q+1,rw[16],rw[17],rw[18],rw[26],rw[13]/10)          //+1 converts to detector coordinate system 
    744752        qy_val = CalcQy(p+1,q+1,rw[16],rw[17],rw[18],rw[26],rw[13]/10) 
    745753         
    746754        Redimension/N=(pixelsX*pixelsY) qx_val,qy_val,z_val 
    747          
     755 
     756///************ 
     757// do everything to write out the resolution too 
    748758        // un-comment these if you want to write out qz_val and qval too, then use the proper save command 
    749 //      qval = CalcQval(p+1,q+1,rw[16],rw[17],rw[18],rw[26],rw[13]/10) 
    750 //      qz_val = CalcQz(p+1,q+1,rw[16],rw[17],rw[18],rw[26],rw[13]/10) 
    751 //      Redimension/N=(pixelsX*pixelsY) qz_val,qval 
     759        qval = CalcQval(p+1,q+1,rw[16],rw[17],rw[18],rw[26],rw[13]/10) 
     760        qz_val = CalcQz(p+1,q+1,rw[16],rw[17],rw[18],rw[26],rw[13]/10) 
     761        phi = FindPhi( pixSize*((p+1)-xctr) , pixSize*((q+1)-yctr))             //(dx,dy) 
     762        r_dist = sqrt(  (pixSize*((p+1)-xctr))^2 +  (pixSize*((q+1)-yctr))^2 )          //radial distance from ctr to pt 
     763        Redimension/N=(pixelsX*pixelsY) qz_val,qval,phi,r_dist 
     764        //everything in 1D now 
     765        Duplicate/O qval SigmaQX,SigmaQY,fsubS 
     766 
     767        Variable L2 = rw[18] 
     768        Variable BS = rw[21] 
     769        Variable S1 = rw[23] 
     770        Variable S2 = rw[24] 
     771        Variable L1 = rw[25] 
     772        Variable lambdaWidth = rw[27]    
     773        Variable usingLenses = rw[28]           //new 2007 
     774 
     775        //Two parameters DDET and APOFF are instrument dependent.  Determine 
     776        //these from the instrument name in the header. 
     777        //From conversation with JB on 01.06.99 these are the current good values 
     778        Variable DDet 
     779        NVAR apOff = root:myGlobals:apOff               //in cm 
     780        DDet = rw[10]/10                        // header value (X) is in mm, want cm here 
     781 
     782        Variable ret1,ret2,ret3,nq 
     783        nq = pixelsX*pixelsY 
     784        ii=0 
     785         
     786        do 
     787                get2DResolution(qval[ii],phi[ii],lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,pixSize,usingLenses,r_dist[ii],ret1,ret2,ret3) 
     788                SigmaQX[ii] = ret1       
     789                SigmaQY[ii] = ret2       
     790                fsubs[ii] = ret3         
     791                ii+=1 
     792        while(ii<nq)     
     793 
     794//********************* 
    752795 
    753796        //not demo-compatible, but approx 8x faster!!    
    754797#if(cmpstr(stringbykey("IGORKIND",IgorInfo(0),":",";"),"pro") == 0)      
    755         Save/G/M="\r\n" labelWave,qx_val,qy_val,z_val as fullpath       // /M=termStr specifies terminator       
    756 //      Save/G/M="\r\n" labelWave,qx_val,qy_val,qz_val,qval,z_val as fullpath   // for debugging, write out everything 
     798//      Save/G/M="\r\n" labelWave,qx_val,qy_val,z_val as fullpath       // /M=termStr specifies terminator       
     799        Save/G/M="\r\n" labelWave,qx_val,qy_val,z_val,qz_val,SigmaQx,SigmaQy,fSubS as fullpath  // for debugging, write out everything 
    757800#else 
    758801        Open refNum as fullpath 
     
    763806#endif 
    764807         
    765         Killwaves/Z spWave,labelWave,qx_val,qy_val,z_val,qval,qz_val 
     808        Killwaves/Z spWave,labelWave,qx_val,qy_val,z_val,qval,qz_val,sigmaQx,SigmaQy,fSubS,phi,r_dist 
    766809         
    767810        Print "QxQy_Export File written: ", GetFileNameFromPathNoSemi(fullPath) 
     
    812855        return(0) 
    813856End 
    814  
Note: See TracChangeset for help on using the changeset viewer.