Changeset 605


Ignore:
Timestamp:
Nov 25, 2009 2:40:15 PM (13 years ago)
Author:
srkline
Message:

USANS:

  • added warning for mutliple scattering to the panel (red if trouble)
  • improved handling of .bt5 files if the peak can't be found
  • added a routine to save the fake "cor" file along with the .bt5 files. The cor file is much more useful.

SANS:

  • updated (again) the SASCALC flux numbers. Also made some more of the flux paramters to be instrument specific globals to make future changes easier.
Location:
sans/Dev/trunk
Files:
7 edited

Legend:

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

    r588 r605  
    4747        Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:XCenter" 
    4848        Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:YCenter" 
    49         //Make/O/B/N=0 $"root:myGlobals:CatVSHeaderInfo:NumGuides" 
     49        Make/O/B/N=0 $"root:myGlobals:CatVSHeaderInfo:nGuides" 
    5050        Make/O/B/N=0 $"root:myGlobals:CatVSHeaderInfo:NumAttens" 
    5151        Make/O/D/N=0 $"root:myGlobals:CatVSHeaderInfo:RunNumber" 
     
    7373        WAVE XCenter = $"root:myGlobals:CatVSHeaderInfo:XCenter" 
    7474        WAVE YCenter = $"root:myGlobals:CatVSHeaderInfo:YCenter" 
    75         //WAVE/B NumGuides = $"root:myGlobals:CatVSHeaderInfo:NumGuides" 
     75        WAVE/B NumGuides = $"root:myGlobals:CatVSHeaderInfo:nGuides" 
    7676        WAVE/B NumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" 
    7777        WAVE RunNumber = $"root:myGlobals:CatVSHeaderInfo:RunNumber" 
     
    101101                ModifyTable width(:myGlobals:CatVSHeaderInfo:Reactorpower)=50           //activate for ILL, June 2008 
    102102#endif 
     103 
     104                ModifyTable width(:myGlobals:CatVSHeaderInfo:nGuides)=40 
    103105 
    104106                ModifyTable width(Point)=0              //JUN04, remove point numbers - confuses users since point != run 
     
    190192        Wave GXCenter = $"root:myGlobals:CatVSHeaderInfo:XCenter" 
    191193        Wave GYCenter = $"root:myGlobals:CatVSHeaderInfo:YCenter" 
    192         //Wave/B GNumGuides = $"root:myGlobals:CatVSHeaderInfo:NumGuides" 
     194        Wave/B GNumGuides = $"root:myGlobals:CatVSHeaderInfo:nGuides" 
    193195        Wave/B GNumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" 
    194196        Wave GRunNumber = $"root:myGlobals:CatVSHeaderInfo:RunNumber" 
     
    202204        Sort GSuffix, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens,GRunNumber,GIsTrans,GRot,GTemp,GField,GMCR,GReactPow 
    203205#else 
    204         Sort GSuffix, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens,GRunNumber,GIsTrans,GRot,GTemp,GField,GMCR 
     206//      Sort GSuffix, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens,GRunNumber,GIsTrans,GRot,GTemp,GField,GMCR 
     207        Sort GSuffix, GSuffix, GFilenames, GLabels, GDateTime, GSDD, GLambda, GCntTime, GTotCnts, GCntRate, GTransmission, GThickness, GXCenter, GYCenter, GNumAttens,GRunNumber,GIsTrans,GRot,GTemp,GField,GMCR,gNumGuides 
    205208#endif 
    206209 
     
    223226        Wave XCenter = $"root:myGlobals:CatVSHeaderInfo:XCenter" 
    224227        Wave YCenter = $"root:myGlobals:CatVSHeaderInfo:YCenter" 
    225         //Wave/B NumGuides = $"root:myGlobals:CatVSHeaderInfo:NumGuides" 
     228        Wave/B NumGuides = $"root:myGlobals:CatVSHeaderInfo:nGuides" 
    226229        Wave/B NumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" 
    227230        Wave RotAngle =  $"root:myGlobals:CatVSHeaderInfo:RotAngle" 
     
    235238#else 
    236239// original order, magnetic at the end 
    237         Edit Filenames, Labels, DateAndTime, SDD, Lambda, CntTime, TotCnts, CntRate, Transmission, Thickness, XCenter, YCenter, NumAttens, RotAngle, Temperature, Field, MCR as "Data File Catalog" 
     240//      Edit Filenames, Labels, DateAndTime, SDD, Lambda, CntTime, TotCnts, CntRate, Transmission, Thickness, XCenter, YCenter, NumAttens, RotAngle, Temperature, Field, MCR as "Data File Catalog" 
     241// with numGuides 
     242        Edit Filenames, Labels, DateAndTime, SDD, Lambda, numGuides, CntTime, TotCnts, CntRate, Transmission, Thickness, XCenter, YCenter, NumAttens, RotAngle, Temperature, Field, MCR as "Data File Catalog" 
    238243// alternate ordering, put the magnetic information first 
    239244//      Edit Filenames, Labels, RotAngle, Temperature, Field, DateAndTime, SDD, Lambda, CntTime, TotCnts, CntRate, Transmission, Thickness, XCenter, YCenter, NumAttens as "Data File Catalog" 
     
    270275        Wave GXCenter = $"root:myGlobals:CatVSHeaderInfo:XCenter" 
    271276        Wave GYCenter = $"root:myGlobals:CatVSHeaderInfo:YCenter" 
    272         //Wave/B GNumGuides = $"root:myGlobals:CatVSHeaderInfo:NumGuides" 
     277        Wave/B GNumGuides = $"root:myGlobals:CatVSHeaderInfo:nGuides" 
    273278        Wave/B GNumAttens = $"root:myGlobals:CatVSHeaderInfo:NumAttens" 
    274279        Wave GRunNumber = $"root:myGlobals:CatVSHeaderInfo:RunNumber" 
     
    373378        GReactPow[lastPoint]  = getReactorPower(fname) 
    374379#endif   
     380 
     381// number of guides 
     382        InsertPoints lastPoint,1,GNumGuides 
     383        GNumGuides[lastPoint]  = numGuides(getSourceToSampleDist(fname)) 
    375384 
    376385        return(0) 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/MultScatter_MonteCarlo_2D.ipf

    r598 r605  
    114114        mt = ThreadGroupCreate(nthreads) 
    115115        NVAR gInitTime = root:Packages:NIST:SAS:gRanDateTime            //time that SASCALC was started 
    116         Print "thread group ID = ",mt 
     116//      Print "thread group ID = ",mt 
    117117         
    118118        inputWave[0] = NNeutron/nthreads                //split up the number of neutrons 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/SASCALC.ipf

    r598 r605  
    187187//      Variable/G c = 0.023 
    188188 
    189         //new values, from 2/2009 
    190         Variable/G phi_0 = 3.4e13 
    191         Variable/G b = 0.0185 
    192         Variable/G c = 0.0135 
     189        //new values, from 11/2009 --- BeamFluxReport_2009.ifn 
     190        Variable/G phi_0 = 2.42e13 
     191        Variable/G b = 0.0 
     192        Variable/G c = -0.0243 
     193        Variable/G gGuide_loss = 0.924 
    193194         
    194195        //fwhm values (new variables) (+3, 0, -3, calibrated 2009) 
     
    248249//      Variable/G c = 0.028 
    249250 
    250         //new values, from 6/2009        
    251         Variable/G phi_0 = 3.2e13 
    252         Variable/G b = 0.0448 
    253         Variable/G c = 0.0463 
     251        //new values, from 11/2009       
     252        Variable/G phi_0 = 2.55e13 
     253        Variable/G b = 0.0395 
     254        Variable/G c = 0.0442 
     255        Variable/G gGuide_loss = 0.974 
    254256         
    255257        //fwhm values (new variables) 
     
    20102012 
    20112013    Variable alpha,f,t,t4,t5,t6,as,solid_angle,l1,d2_phi 
    2012     Variable a1,a2,retVal,guide_loss=0.95 
     2014    Variable a1,a2,retVal 
    20132015    SetDataFolder root:Packages:NIST:SAS 
    20142016    NVAR l_gap=l_gap,guide_width =guide_width,ng = gNg 
     
    20162018    NVAR lambda=gLambda,t1=t1,t2=t2,t3=t3,phi_0=phi_0 
    20172019    NVAR lambda_width=gDeltaLambda 
     2020    NVAR guide_loss=gGuide_loss 
    20182021     
    20192022    l1 = sourceToSampleDist() 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/WorkFileUtils.ipf

    r588 r605  
    484484                        //rad is the distance of pixel ij from the sample 
    485485                        //domega is the ratio of the solid angle of pixel ij versus center pixel 
     486                        // product xy = 1 for a detector with a linear spatial response (modern Ordela) 
     487                        // solid angle calculated, dW^3 >=1, so multiply data to raise measured values to correct values. 
    486488                        rad = sqrt(dtdis2 + xd^2 + yd^2) 
    487489                        domega = rad/dtdist 
    488490                        ratio = domega^3 
    489 //                      solidAngle[ii][jj] = ratio              //testing only   
    490491                        xy = xx[ii]*yy[jj] 
    491492                        data[ii][jj] *= xy*ratio 
     493//                      solidAngle[ii][jj] = xy*ratio           //testing only   
     494 
    492495                         
    493                         // multiplicative correction for detector efficiency JBG memo det_eff_cor2.doc 3/20/07 
     496                        // correction factor for detector efficiency JBG memo det_eff_cor2.doc 3/20/07 
    494497                        // correction inserted 11/2007 SRK 
    495                         // large angle detector efficiency correction is >= 1 and will "bump up" the highest angles 
     498                        // large angle detector efficiency is >= 1 and will "bump up" the measured value at the highest angles 
    496499                        // so divide here to get the correct answer (5/22/08 SRK) 
    497500                        if(doEfficiency) 
     
    501504#else 
    502505                                data[ii][jj] /= DetEffCorr(lambda,dtdist,xd,yd) 
    503         //                      solidAngle[ii][jj] = DetEffCorr(lambda,dtdist,xd,yd)            //testing only 
     506//                              solidAngle[ii][jj] /= DetEffCorr(lambda,dtdist,xd,yd)           //testing only 
    504507#endif 
    505508                        endif 
    506509                         
    507                         // large angle transmission correction is <= 1 and will "bump up" the highest angles 
     510                        // large angle transmission calculation is <= 1 and will "bump down" the measured value at the highest angles 
     511                        // so divide here to get the correct answer 
    508512                        if(doTrans) 
    509513                         
     
    520524                                         
    521525                                data[ii][jj] /= LargeAngleTransmissionCorr(trans,dtdist,xd,yd)          //moved from 1D avg SRK 11/2007 
    522                                 solidAngle[ii][jj] = LargeAngleTransmissionCorr(trans,dtdist,xd,yd)             //testing only 
     526//                              solidAngle[ii][jj] /= LargeAngleTransmissionCorr(trans,dtdist,xd,yd)            //testing only 
    523527                        endif 
    524528                         
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/COR_Graph.ipf

    r577 r605  
    488488        Wave/T listW=$(USANSFolder+":Globals:MainPanel:"+type+"Wave") 
    489489        Variable ii,num=numpnts(listW) 
    490         String fname="",fpath="" 
     490        String fname="",fpath="",str="" 
    491491        PathInfo bt5PathName 
    492492        fpath = S_Path 
     
    519519        Variable pkHt=0 
    520520        pkHt = interp(zeroAngle,tmpangle,tmpdetcts) 
    521         String str="" 
     521         
     522        if(numtype(pkHt) != 0)          // bad but it warns, useful if only positive angles are available, use the smallest 
     523                str = "Can't find peak at angle = "+num2str(zeroAngle)+" Using the value at angle = "+num2str(tmpAngle[0]) 
     524                pkHt = tmpDetCts[0] 
     525        endif 
     526 
    522527        str=note(tmpDetCts) 
    523528        str = ReplaceNumberByKey("PEAKANG",str,zeroAngle,":",";") 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/USANS/U_CALC.ipf

    r583 r605  
    121121        String/G gTotTimeStr="" 
    122122        Variable/G gAnalyzerOmega = 7.1e-7              //solid angle of the analyzer, in steradians 
    123         Variable/G gBeamCurrent=25000           //beam current Ed*I     (n/s) for 5/8" diam = 25000 n/s 
     123//      Variable/G gBeamCurrent=25000           // (?? not used) beam current Ed*I      (n/s) for 5/8" diam = 25000 n/s 
    124124        Variable/G gThick=0.1           //sample thickness (cm)  
    125125        Variable/G gSamTrans=0.8 
     
    459459        SetVariable totalTime,pos={left+20,335},size={150,15},title="Count time (h:m)",value= gTotTimeStr 
    460460        SetVariable totalTime,limits={-inf,inf,0},noedit=1 
    461         SetVariable valdisp0_2,pos={left+20,365},size={190,15},title="Multiple Coherent Scattering" 
    462         SetVariable valdisp0_2,limits={-inf,inf,0},noedit=1,value=g_MultScattFraction 
     461        SetVariable valdisp0_2,pos={left+20,365},size={200,15},title="Multiple Coherent Scattering" 
     462        SetVariable valdisp0_2,limits={-inf,inf,0},format="%8f",noedit=1,value=g_MultScattFraction 
    463463//      ValDisplay valdisp0_3,pos={left+20,420},size={220,13},title="Estimated transmission" 
    464464//      ValDisplay valdisp0_3,limits={0,0,0},barmisc={0,1000},value=root:Packages:NIST:USANS:Globals:U_Sim:g_1DEstTrans 
     
    16061606                                endif 
    16071607                        endfor 
    1608                                                                          
     1608                         
     1609                        // no save the fake "COR" file that is the combination and rescaling of the data sets 
     1610                        // - the combination is in root:Sim_USANS: 
     1611                        NVAR g_1D_PlotCR = root:Packages:NIST:USANS:Globals:U_Sim:g_1D_PlotCR 
     1612 
     1613                        if(g_1D_PlotCR) // right now, save COR only if the CR is plotted 
     1614                                SaveFakeCOR(baseName)                    
     1615                        endif 
     1616                         
    16091617                        break 
    16101618        endswitch 
    16111619 
    16121620        return 0 
     1621End 
     1622 
     1623 
     1624Function SaveFakeCOR(nameStr) 
     1625        String nameStr 
     1626         
     1627        NVAR gThick = root:Packages:NIST:USANS:Globals:U_Sim:gThick 
     1628        NVAR gSamTrans = root:Packages:NIST:USANS:Globals:U_Sim:gSamTrans 
     1629        NVAR gAnalyzerOmega = root:Packages:NIST:USANS:Globals:U_Sim:gAnalyzerOmega 
     1630        NVAR g_MultScattFraction = root:Packages:NIST:USANS:Globals:U_Sim:g_MultScattFraction 
     1631        SVAR funcStr = root:Packages:NIST:USANS:Globals:U_Sim:gFuncStr  
     1632         
     1633        String folder = "root:Sim_USANS:",fileStr="" 
     1634        String termStr="\r\n"           //VAX uses only <CR> as terminator, but only CRLF seems to FTP correctly to VAX 
     1635        String destStr="",formatStr = "%15.6g %15.6g %15.6g %15.6g %15.6g %15.6g"+termStr 
     1636 
     1637        Variable refNum,integer,realval 
     1638        //*****these waves MUST EXIST, or IGOR Pro will crash, with a type 2 error**** 
     1639        WAVE qvals =$(folder + "Sim_USANS_q") 
     1640        WAVE inten=$(folder + "Sim_USANS_i") 
     1641        WAVE sig=$(folder + "Sim_USANS_s") 
     1642         
     1643        //check each wave 
     1644        If(!(WaveExists(qvals))) 
     1645                Abort "qvals DNExist in SaveFakeCOR()" 
     1646        Endif 
     1647        If(!(WaveExists(inten))) 
     1648                Abort "inten DNExist in SaveFakeCOR()" 
     1649        Endif 
     1650        If(!(WaveExists(sig))) 
     1651                Abort "sig DNExist in SaveFakeCOR()" 
     1652        Endif 
     1653         
     1654        //dummy wave for the resolution 
     1655        Duplicate/O qvals,dumWave 
     1656        SVAR USANSFolder = root:Packages:NIST:USANS:Globals:gUSANSFolder 
     1657        NVAR DQv=$(USANSFolder+":Globals:MainPanel:gDQv") 
     1658        dumWave = - DQv 
     1659         
     1660        //temp waves for the rescaling 
     1661        Duplicate/O qvals,tq,ti,te 
     1662        ti=inten 
     1663        te=sig 
     1664        tq=qvals 
     1665 
     1666        //rescale 
     1667        ti *= 1.0e6 / GetUSANSBeamIntensity()           //converts to "SAM" scaled data 
     1668        ti *= 1/(gSamTrans*gThick*gAnalyzerOmega*1.0e6)         //converts to "COR" scaling (approx, since I don't know Twide) 
     1669        //rescale error appropriately too 
     1670        te *= 1.0e6 / GetUSANSBeamIntensity()           //converts to "SAM" scaled data 
     1671        te *= 1/(gSamTrans*gThick*gAnalyzerOmega*1.0e6)         //converts to "COR" scaling (approx, since I don't know Twide) 
     1672 
     1673        // add fake error to every few data points to mark it as simulated data 
     1674        te[2,numpnts(te)-1;7] *= 10 
     1675         
     1676        // now trim off the q-values less than 3e-5 
     1677        if(tq[0] < 3e-5) 
     1678                do 
     1679                        DeletePoints 0, 1, ti,tq,te,dumWave 
     1680                while(tq[0] < 3e-5) 
     1681        endif 
     1682         
     1683        String samStr="",empStr="",dateStr="",samLabelStr="",paramStr="",empLevStr="",bkgLevStr="",pkStr="" 
     1684        samStr = "SIM FILES: "+StringByKey("FILE",note(inten),":",";") 
     1685        empStr = "EMP FILES: "+"none" 
     1686        empLevStr = "EMP LEVEL: " + "none" 
     1687        bkgLevStr = "BKG LEVEL: " + "not used" 
     1688        paramStr = "Ds = "+num2str(gthick)+" cm ; " 
     1689        paramStr += "Twide = "+"unknown"+" ; " 
     1690        paramStr += "Trock = "+num2str(gSamTrans)        
     1691        pkStr += "Multiple coherent scattering fraction: "+num2str(g_MultScattFraction) 
     1692         
     1693        //these strings are always the same 
     1694        samLabelStr ="LABEL: "+"Simulated USANS Data from: "+funcStr 
     1695        dateStr = date()+" at  "+time()// + " "+Secs2Time(DateTime,2) 
     1696         
     1697         
     1698        fileStr=nameStr+".cor" 
     1699        //actually open the file 
     1700        Open refNum as fileStr 
     1701         
     1702        fprintf refnum,"%s"+termStr,samStr 
     1703        fprintf refnum,"%s"+termStr,dateStr 
     1704        fprintf refnum,"%s"+termStr,samLabelStr 
     1705        fprintf refnum,"%s"+termStr,empStr 
     1706        fprintf refnum,"%s"+termStr,paramStr 
     1707        fprintf refnum,"%s"+termStr,pkStr 
     1708        fprintf refnum,"%s"+termStr,empLevStr + " ; "+bkglevStr 
     1709         
     1710        // 
     1711        wfprintf refnum, formatStr, tq,ti,te,dumWave,dumWave,dumWave 
     1712         
     1713        Close refnum 
     1714         
     1715        Killwaves/Z dumWave,ti,te,tq 
     1716         
     1717         
     1718         
     1719        return(0) 
    16131720End 
    16141721 
     
    16571764        // set up some of the strings needed 
    16581765        fileStr=nameStr+num2str(num+set)+".bt5" 
    1659         dateStr = date()// + " "+Secs2Time(DateTime,2) 
     1766        dateStr = date() 
    16601767        ctTime = countingTime[first] 
    16611768        numPts = last-first+1 
Note: See TracChangeset for help on using the changeset viewer.