Ignore:
Timestamp:
Feb 22, 2013 3:21:48 PM (10 years ago)
Author:
srkline
Message:

10m SANS is now "on-center", so the tolerance for the center in ProDiv? has been re-instated

All waves in the CatTable? are now double precision so that the floating point details can be seen, like when the attenuator number = 2.997, rather than 3.

NCNR_utils - now rounds the attenuator number to get an integer. 2.9999 was being truncated to 2, not the "real" value of 3.

Some unfinished changes to the non-XOP 2D simulation, testing the pixel assignment.

Location:
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS
Files:
6 edited

Legend:

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

    r898 r901  
    4949        Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:XCenter" 
    5050        Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:YCenter" 
    51         Make/O/B/N=0 $"root:myGlobals:CatVSHeaderInfo:nGuides" 
    52         Make/O/B/N=0 $"root:myGlobals:CatVSHeaderInfo:NumAttens" 
     51//      Make/O/B/N=0 $"root:myGlobals:CatVSHeaderInfo:nGuides" 
     52//      Make/O/B/N=0 $"root:myGlobals:CatVSHeaderInfo:NumAttens" 
     53        Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:nGuides" 
     54        Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:NumAttens" 
    5355        Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:RunNumber" 
    5456        Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:IsTrans" 
     
    7880        WAVE XCenter = $"root:myGlobals:CatVSHeaderInfo:XCenter" 
    7981        WAVE YCenter = $"root:myGlobals:CatVSHeaderInfo:YCenter" 
    80         WAVE/B nGuides = $"root:myGlobals:CatVSHeaderInfo:nGuides" 
    81         WAVE/B NumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" 
     82//      WAVE/B nGuides = $"root:myGlobals:CatVSHeaderInfo:nGuides" 
     83//      WAVE/B NumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" 
     84        WAVE nGuides = $"root:myGlobals:CatVSHeaderInfo:nGuides" 
     85        WAVE NumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" 
    8286        WAVE RunNumber = $"root:myGlobals:CatVSHeaderInfo:RunNumber" 
    8387        WAVE IsTrans = $"root:myGlobals:CatVSHeaderInfo:IsTrans" 
     
    220224        Wave GXCenter = $"root:myGlobals:CatVSHeaderInfo:XCenter" 
    221225        Wave GYCenter = $"root:myGlobals:CatVSHeaderInfo:YCenter" 
    222         Wave/B GNumGuides = $"root:myGlobals:CatVSHeaderInfo:nGuides" 
    223         Wave/B GNumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" 
     226//      Wave/B GNumGuides = $"root:myGlobals:CatVSHeaderInfo:nGuides" 
     227//      Wave/B GNumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" 
     228        Wave GNumGuides = $"root:myGlobals:CatVSHeaderInfo:nGuides" 
     229        Wave GNumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" 
    224230        Wave GRunNumber = $"root:myGlobals:CatVSHeaderInfo:RunNumber" 
    225231        Wave GIsTrans = $"root:myGlobals:CatVSHeaderInfo:IsTrans" 
     
    266272        Wave XCenter = $"root:myGlobals:CatVSHeaderInfo:XCenter" 
    267273        Wave YCenter = $"root:myGlobals:CatVSHeaderInfo:YCenter" 
    268         Wave/B NumGuides = $"root:myGlobals:CatVSHeaderInfo:nGuides" 
    269         Wave/B NumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" 
     274//      Wave/B NumGuides = $"root:myGlobals:CatVSHeaderInfo:nGuides" 
     275//      Wave/B NumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" 
     276        Wave NumGuides = $"root:myGlobals:CatVSHeaderInfo:nGuides" 
     277        Wave NumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" 
    270278        Wave RotAngle =  $"root:myGlobals:CatVSHeaderInfo:RotAngle" 
    271279        Wave Temperature = $"root:myGlobals:CatVSHeaderInfo:Temperature" 
     
    328336        Wave GXCenter = $"root:myGlobals:CatVSHeaderInfo:XCenter" 
    329337        Wave GYCenter = $"root:myGlobals:CatVSHeaderInfo:YCenter" 
    330         Wave/B GNumGuides = $"root:myGlobals:CatVSHeaderInfo:nGuides" 
    331         Wave/B GNumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" 
     338//      Wave/B GNumGuides = $"root:myGlobals:CatVSHeaderInfo:nGuides" 
     339//      Wave/B GNumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" 
     340        Wave GNumGuides = $"root:myGlobals:CatVSHeaderInfo:nGuides" 
     341        Wave GNumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" 
    332342        Wave GRunNumber = $"root:myGlobals:CatVSHeaderInfo:RunNumber" 
    333343        Wave GIsTrans = $"root:myGlobals:CatVSHeaderInfo:IsTrans" 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/MC_SimulationScripting.ipf

    r899 r901  
    105105// -- scattering from an empty cell is NOT provided in 2D 
    106106 
    107 xMenu "Macros" 
     107Menu "Macros" 
    108108        Submenu "Simulation Scripting - Beta" 
    109109                "Save Configuration",Sim_saveConfProc() 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/MultScatter_MonteCarlo_2D.ipf

    r898 r901  
    406406        xCtr = inputWave[3] 
    407407        yCtr = inputWave[4] 
     408//      xCtr += 1 
     409//      yCtr += 1 
    408410        sdd = inputWave[5] 
    409411        pixSize = inputWave[6] 
     
    587589                                                // so get it from the wave scaling instead 
    588590                                                Q0 =left + binarysearchinterp(ran_dev,abs(enoise(1)))*delta 
    589                                                 theta = Q0/2/Pi*currWavelength          //SAS approximation. 1% error at theta=30 deg (theta/2=15deg) 
     591//                                              theta = Q0/2/Pi*currWavelength          //SAS approximation. 1% error at theta=30 deg (theta/2=15deg) 
     592                                                theta = 2*asin(Q0*currWavelength/4/pi)          //exact 
    590593                                                 
    591594                                                //Print "q0, theta = ",q0,theta 
     
    651654                                        if(xPixel != -1 && yPixel != -1) 
    652655                                                //if(index==1)  // only the single scattering events 
    653                                                         if( xPixel > 127 || yPixel > 127) 
     656                                                        if( xPixel > 127 || yPixel > 127 || xPixel < 0 || yPixel < 0) 
    654657                                                                print "error XY=",xPixel,yPixel 
    655658                                                        endif 
     
    891894 
    892895 
    893 // xCtr and yCtr here are the "optical" center of the detector ~(65,65) and the full fall due to  
     896// xCtr and yCtr here are the "optical" center of the detector ~(64,64) and the full fall due to  
    894897// gravity is calculated from this horizontal axis 
     898// 
     899// -- be sure to subtract 1 from xCtr and yCtr here to convert to array (pixel) units. As  
     900//    passed in, xCtr and yCtr are in detector coordinates 
    895901// 
    896902ThreadSafe Function FindPixel(testQ,testPhi,lam,yg_d,sdd,pixSize,xCtr,yCtr,xPixel,yPixel) 
    897903        Variable testQ,testPhi,lam,yg_d,sdd,pixSize,xCtr,yCtr,&xPixel,&yPixel 
    898904 
    899         Variable theta,dy,dx,qx,qy 
     905        Variable theta,dy,dx,qx,qy,qz 
     906         
     907        theta = 2*asin(testQ*lam/4/pi) 
     908         
    900909        //decompose to qx,qy 
    901         qx = testQ*cos(testPhi) 
    902         qy = testQ*sin(testPhi) 
    903  
     910        qx = testQ*cos(theta/2)*cos(testPhi) 
     911        qy = testQ*cos(theta/2)*sin(testPhi) 
     912        qz = testQ*sin(theta/2) 
     913         
    904914// correct qy for gravity 
    905915// qy = 4*pi/lam * (theta/2) 
     
    910920        theta = 2*asin(qy*lam/4/pi) 
    911921        dy = sdd*tan(theta) 
     922//      dy +=  
    912923        yPixel = round(yCtr + dy/pixSize) 
    913924         
     
    919930        NVAR pixelsY = root:myGlobals:gNPixelsY 
    920931         
     932        xPixel -= 1 
     933        yPixel -= 1 
     934         
     935         
    921936        //if on detector, return xPix and yPix values, otherwise -1 
    922937        if(yPixel >= pixelsY || yPixel < 0) 
     
    929944        return(0) 
    930945End 
     946 
     947//// xCtr and yCtr here are the "optical" center of the detector ~(64,64) and the full fall due to  
     948//// gravity is calculated from this horizontal axis 
     949//// 
     950//// -- be sure to subtract 1 from xCtr and yCtr here to convert to array (pixel) units. As  
     951////    passed in, xCtr and yCtr are in detector coordinates 
     952//// 
     953//ThreadSafe Function FindPixel(testQ,testPhi,lam,yg_d,sdd,pixSize,xCtr,yCtr,xPixel,yPixel) 
     954//      Variable testQ,testPhi,lam,yg_d,sdd,pixSize,xCtr,yCtr,&xPixel,&yPixel 
     955// 
     956//      Variable theta,dy,dx,qx,qy 
     957//       
     958////    theta = 2*asin(testQ*lam/4/pi) 
     959//       
     960//      //decompose to qx,qy 
     961//      qx = testQ*cos(testPhi) 
     962//      qy = testQ*sin(testPhi) 
     963// 
     964//// correct qy for gravity 
     965//// qy = 4*pi/lam * (theta/2) 
     966//      qy += 4*pi/lam*(yg_d/sdd/2) 
     967//       
     968//       
     969//      //convert qx,qy to pixel locations relative to # of pixels x, y from center 
     970//      theta = 2*asin(qy*lam/4/pi) 
     971//      dy = sdd*tan(theta) 
     972//      yPixel = round(yCtr + dy/pixSize) 
     973//       
     974//      theta = 2*asin(qx*lam/4/pi) 
     975//      dx = sdd*tan(theta) 
     976//      xPixel = round(xCtr + dx/pixSize) 
     977// 
     978//      NVAR pixelsX = root:myGlobals:gNPixelsX 
     979//      NVAR pixelsY = root:myGlobals:gNPixelsY 
     980//       
     981//      xPixel -= 1 
     982//      yPixel -= 1 
     983//       
     984//       
     985//      //if on detector, return xPix and yPix values, otherwise -1 
     986//      if(yPixel >= pixelsY || yPixel < 0) 
     987//              yPixel = -1 
     988//      endif 
     989//      if(xPixel >= pixelsX || xPixel < 0) 
     990//              xPixel = -1 
     991//      endif 
     992//       
     993//      return(0) 
     994//End 
    931995 
    932996Function MC_CheckFunctionAndCoef(funcStr,coefStr) 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_Utils.ipf

    r899 r901  
    17611761        Variable atten_err, attenFactor 
    17621762         
     1763        // 22 FEB 2013 - not sure what changed with the writeout of ICE data files... but .... 
     1764        // to account for ICE occasionally writing out "3" as 2.9998, make sure I can construct 
     1765        // a single digit -> string "3" to identify the proper wave in the lookup table 
     1766         
     1767        attenNo = round(attenNo) 
     1768         
    17631769        strswitch(instr) 
    17641770                case "CGB": 
     
    18131819        Variable attenFactor=1,loc 
    18141820        String instr=fileStr[1,3]       //filestr is "[NGnSANSn] " or "[NGnSANSnn]" (11 characters total) 
    1815          
     1821 
     1822 
     1823        // 22 FEB 2013 - not sure what changed with the writeout of ICE data files... but .... 
     1824        // to account for ICE occasionally writing out "3" as 2.9998, make sure I can construct 
     1825        // a single digit -> string "3" to identify the proper wave in the lookup table 
     1826         
     1827        attenNo = round(attenNo) 
     1828         
     1829                 
    18161830        strswitch(instr) 
    18171831                case "CGB": 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/ProDiv.ipf

    r899 r901  
    371371                         
    372372                         
    373                 // reduce the off-center, keep in STO 
     373                // reduce the off-center, keep in COR 
    374374                        //patch trans 
    375375                        num = ItemsInList(gPlex_off, ",") 
     
    393393                        if(strlen(str) > 0) 
    394394                                proto[1] = str 
    395                                 err = CheckDIVBeamCenter(str,105,65) 
     395                                err = CheckDIVBeamCenter(str,110,65) 
    396396                                if(err) 
    397397                                        Abort "Off-center EMP files do not have correct beam center" 
     
    402402                        str = ParseRunNumberList(gPlex_off) 
    403403                        if(strlen(str) > 0) 
    404                                 err = CheckDIVBeamCenter(str,105,65) 
     404                                err = CheckDIVBeamCenter(str,110,65) 
    405405                                if(err) 
    406                                         Abort "On-center EMP files do not have correct beam center" 
     406                                        Abort "Off-center PLEX files do not have correct beam center" 
    407407                                endif 
    408408                                ExecuteProtocol("root:myGlobals:Protocols:DIV_Protocol",str) 
     
    580580        Variable xc,yc 
    581581         
    582         Variable err,ii,num,tmpX,tmpY,badCtr,tol=5 
     582        Variable err,ii,num,tmpX,tmpY,badCtr,tol=10 
    583583        String fileStr,pathStr,acct 
    584584         
     
    592592        // get the account, to identify the instrument 
    593593        fileStr = pathStr + StringFromList(ii, str,",") 
    594         acct = getAcctName(fileStr) 
    595         String instr=acct[1,3]  //filestr is "[NGnSANSn] " or "[NGnSANSnn]" (11 characters total)        
    596         if(cmpstr(instr,"NGA")==0 || cmpstr(instr,"NGB")==0 ) 
    597                 tol=20          //if the 10m SANS, give an extra-wide tolerance, and show an alert 
    598                 DoAlert 0,"NGB SANS instrument. Be sure that the correct beam centers are entered for all of the plex files." 
    599         endif 
     594//      acct = getAcctName(fileStr) 
     595//      String instr=acct[1,3]  //filestr is "[NGnSANSn] " or "[NGnSANSnn]" (11 characters total)        
     596//      if(cmpstr(instr,"NGA")==0 || cmpstr(instr,"NGB")==0 ) 
     597//              tol=20          //if the 10m SANS, give an extra-wide tolerance, and show an alert 
     598//              DoAlert 0,"NGB SANS instrument. Be sure that the correct beam centers are entered for all of the plex files." 
     599//      endif 
    600600         
    601601        do 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/SASCALC.ipf

    r899 r901  
    21452145        rw[19] = val            // already in cm 
    21462146        //move the beamcenter, make it an integer value for the MC simulation 
    2147         rw[16] = 64  + round(2*rw[19]) + 0.5            //approximate beam X is 64 w/no offset, 114 w/25 cm offset  
    2148         rw[17] = 64     + 0.5 //typical value 
     2147        rw[16] = 64  + round(2*rw[19]) //+ 0.5          //approximate beam X is 64 w/no offset, 114 w/25 cm offset  
     2148        rw[17] = 64     //+ 0.5 //typical value 
    21492149 
    21502150        return(val) 
Note: See TracChangeset for help on using the changeset viewer.