Changeset 143


Ignore:
Timestamp:
Aug 10, 2007 3:08:57 PM (15 years ago)
Author:
srkline
Message:

RT 809 fix to correct resolution calculation

  • gravity term
  • lens resolution

-- this also led to changes in the two averaging routines to pick up this flag and pass it to getResolution()
-- then two SANSBeta menu items added to crudely change the header flag (0|1) on a run-by-run basis
!! NOTE that the VAX header has not been updated to put this information in at the time of data collection!!

other minor changes...
Some changes to beta procedures for combining files (I don't think anyone uses these but me) - these changes are in NSORT.ipf.

Some changes to the MainPanel? to remove the RealTime? button (which somehow came back)

SRK 10AUG07

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

Legend:

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

    r116 r143  
    320320        Variable lambdaWidth = reals[27] 
    321321        String detStr=textRead[9] 
     322         
     323        Variable usingLenses = reals[28]                //new 2007 
    322324 
    323325        //Two parameters DDET and APOFF are instrument dependent.  Determine 
     
    341343        Variable ret1,ret2,ret3 
    342344        do 
    343                 getResolution(qval[ii],lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,ddr,ret1,ret2,ret3) 
     345                getResolution(qval[ii],lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,ddr,usingLenses,ret1,ret2,ret3) 
    344346                sigmaq[ii] = ret1        
    345347                qbar[ii] = ret2  
  • sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/Includes_v500.ipf

    r116 r143  
    7777////    "Set3NSORTFiles" 
    7878        "CreateTableToCombine" 
    79 ////    "DoCombineFiles" 
     79        "DoCombineFiles" 
     80        "-" 
     81        "Convert To Lens" 
     82        "Convert To Pinhole" 
    8083        "-" 
    8184        "AddALLToLayout" 
     85         
    8286End 
  • sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/MainPanel.ipf

    r116 r143  
    241241        TabControl MainTab,tabLabel(1)="Reduction",tabLabel(2)="1-D Ops",tabLabel(3)="2-D Ops",tabLabel(4)="Misc Ops" 
    242242        TabControl MainTab,value=0 
     243        // 
     244        TabControl MainTab labelBack=(65535,58981,27524) 
    243245         
    244246//on tab(0) - Raw Data - initially visible 
     
    249251        Button MainButton_0c,pos={15,150},size={110,20},proc=TransMainButtonProc,title="Transmission" 
    250252        Button MainButton_0c,help={"Shows the \"Patch\" panel which allows calculation of sample transmissions and entering these values into raw data headers"} 
    251         Button MainButton_0d,pos={15,180},size={130,20},proc=RealTime_MainButtonProc,title="RealTime Display" 
    252         Button MainButton_0d,help={"Shows the panel for control of the RealTime data display. Only used during data collection"} 
     253//      Button MainButton_0d,pos={15,180},size={130,20},proc=RealTime_MainButtonProc,title="RealTime Display" 
     254//      Button MainButton_0d,help={"Shows the panel for control of the RealTime data display. Only used during data collection"} 
    253255 
    254256//on tab(1) - Reduction 
  • sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/NCNR_DataReadWrite.ipf

    r116 r143  
    16001600        return(0) 
    16011601end 
     1602 
     1603//******************* 
     1604//************ 
     1605// simple command - line utilities to convert/unconvert the header value 
     1606// that flags files as using lenses 
     1607// 
     1608// stored in reals[28], header byte start @ 300 
     1609// 
     1610// currently, two values (0 | 1) = (no lens | yes lens) 
     1611// 
     1612// this is used in getResolution (reads the reals[]) and switches the calculation 
     1613//************ 
     1614 
     1615Proc ConvertToLens(RunNumber) 
     1616        Variable RunNumber 
     1617        HeaderToLensResolution(RunNumber)  
     1618End 
     1619 
     1620Proc ConvertToPinhole(RunNumber) 
     1621        Variable RunNumber 
     1622        HeaderToPinholeResolution(RunNumber) 
     1623End 
     1624 
     1625// sets the flag to zero in the file (= 0) 
     1626Function HeaderToPinholeResolution(num)  
     1627        Variable num     
     1628         
     1629        //Print "UnConvert" 
     1630        String fullname="" 
     1631         
     1632        fullname = FindFileFromRunNumber(num) 
     1633        Print fullname 
     1634        //report error or change the file 
     1635        if(cmpstr(fullname,"")==0) 
     1636                Print "HeaderToPinhole - file not found" 
     1637        else 
     1638                //Print "Unconvert",fullname 
     1639                WriteVAXReal(fullname,0,300) 
     1640        Endif 
     1641        return(0) 
     1642End 
     1643 
     1644// sets the flag to zero in the file (= 1) 
     1645Function HeaderToLensResolution(num)  
     1646        Variable num     
     1647         
     1648        //Print "UnConvert" 
     1649        String fullname="" 
     1650         
     1651        fullname = FindFileFromRunNumber(num) 
     1652        Print fullname 
     1653        //report error or change the file 
     1654        if(cmpstr(fullname,"")==0) 
     1655                Print "HeaderToPinhole - file not found" 
     1656        else 
     1657                //Print "Unconvert",fullname 
     1658                WriteVAXReal(fullname,1,300) 
     1659        Endif 
     1660        return(0) 
     1661End 
  • sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/NCNR_Utils.ipf

    r121 r143  
    6262//          raw data header to indicate the presence of lenses. 
    6363// 
     64// - Aug 07 - added input to switch calculation based on lenses (==1 if in) 
     65// 
    6466// - called by CircSectAvg.ipf and RectAnnulAvg.ipf 
    6567// 
     
    6769// except DDet and apOff, which are set from globals before passing 
    6870// 
    69 Function/S getResolution(inQ,lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,SigmaQ,QBar,fSubS) 
    70         Variable inQ, lambda, lambdaWidth, DDet, apOff, S1, S2, L1, L2, BS, del_r 
     71// 
     72Function/S getResolution(inQ,lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,usingLenses,SigmaQ,QBar,fSubS) 
     73        Variable inQ, lambda, lambdaWidth, DDet, apOff, S1, S2, L1, L2, BS, del_r,usingLenses 
    7174        Variable &fSubS, &QBar, &SigmaQ         //these are the output quantities at the input Q value 
    7275         
     
    104107 
    105108        v_lambda = lambdaWidth^2/6.0 
    106         v_b = 0.25*(S1*L2/L1)^2 +0.25*(S2*L2/lp)^2 
     109         
     110        if(usingLenses==1)                      //SRK 2007 
     111                v_b = 0.25*(S1*L2/L1)^2 +0.25*(2/3)*(lambdaWidth/lambda)^2*(S2*L2/lp)^2         //correction to 2nd term 
     112        else 
     113                v_b = 0.25*(S1*L2/L1)^2 +0.25*(S2*L2/lp)^2              //original form 
     114        endif 
     115         
    107116        v_d = (DDet/2.3548)^2 + del_r^2/12.0 
    108117        vz = vz_1 / lambda 
    109118        yg = 0.5*g*L2*(L1+L2)/vz^2 
    110         v_g = 2.0*yg^2*v_lambda 
     119        v_g = 2.0*(2.0*yg^2*v_lambda)                                   //factor of 2 correction, B. Hammouda, 2007 
    111120 
    112121        r0 = L2*tan(2.0*asin(lambda*inQ/(4.0*Pi) )) 
  • sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/NSORT.ipf

    r116 r143  
    15171517         
    15181518        ///// 
    1519         SetWindow kwTopWin hook=CombineTableHook, hookevents=1  // mouse down events 
     1519//      SetWindow kwTopWin hook=CombineTableHook, hookevents=1  // mouse down events 
    15201520         
    15211521end 
     
    15311531//      Edit Filenames, Labels, DateAndTime, SDD, Lambda, CntTime, TotCnts, CntRate, Transmission, Thickness, XCenter, YCenter, NumAttens as "Files to Combine" 
    15321532        Edit Labels, SDD, runNum as "Files to Combine" 
    1533 //      SetWindow kwTopWin hook=CombineTableHook, hookevents=1  // mouse down events 
     1533        SetWindow kwTopWin hook=CombineTableHook, hookevents=1  // mouse down events 
    15341534 
    15351535        String name="CombineTable" 
     
    16231623// 
    16241624Proc  DoCombineFiles() 
    1625  
    1626 //      Wave lowWave = $"root:myGlobals:CombineTable:Low" 
    1627 //      Wave mediumWave = $"root:myGlobals:CombineTable:Medium" 
    1628 //      Wave highWave = $"root:myGlobals:CombineTable:High" 
    1629 //      Wave/T prefixWave = $"root:myGlobals:CombineTable:Prefix" 
    1630 //      Wave/T saveNameWave = $"root:myGlobals:CombineTable:SaveName" 
     1625         
     1626        // pop all of the menus to make sure that they are properly populated 
     1627        LowQPopMenuProc("",1,"") 
     1628        MedQPopMenuProc("",1,"") 
     1629        HighQPopMenuProc("",1,"") 
    16311630         
    16321631        String savedDataFolder = GetDataFolder(1)               // save 
     
    16771676                        Variable ypix= NumberByKey("MOUSEY",infoStr) 
    16781677                        Variable modif= NumberByKey("MODIFIERS",infoStr) 
    1679                         if(modif == 2)          //bit 1 set, shift key is down 
     1678                        //print modif 
     1679                        if(modif & 2^1)         //bit 1 set, shift key is down 
    16801680                                PopupContextualMenu/C=(xpix, ypix) "combine;" 
    16811681                                strswitch(S_selection) 
     
    16991699Function SendSelectionToTable() 
    17001700 
    1701         DoWindow/F ToCombine 
     1701        DoWindow/F CombineTable 
    17021702        if(V_flag==0) 
    17031703//              Make/O/N=0 $"root:myGlobals:CombineTable:Low" 
     
    17121712                 
    17131713        else 
    1714                 Wave low = $"root:myGlobals:CombineTable:Low" 
    1715                 Wave medium = $"root:myGlobals:CombineTable:Medium" 
    1716                 Wave high = $"root:myGlobals:CombineTable:High" 
     1714                Wave low = $"root:myGlobals:CombineTable:LowRun" 
     1715                Wave medium = $"root:myGlobals:CombineTable:MediumRun" 
     1716                Wave high = $"root:myGlobals:CombineTable:HighRun" 
    17171717                Wave/T prefix = $"root:myGlobals:CombineTable:Prefix" 
    17181718                Wave/T saveName = $"root:myGlobals:CombineTable:SaveName" 
     
    17211721                Wave gSDD = $"root:myGlobals:CombineTable:SDD" 
    17221722                Wave gRunNumber = $"root:myGlobals:CombineTable:RunNumber" 
     1723                Wave/T filenames = $"root:myGlobals:CombineTable:FileNames" 
    17231724        endif 
    17241725         
     
    17401741         
    17411742        num=numpnts(low) 
    1742         InsertPoints num, 1, low,medium,high 
     1743        InsertPoints num, 1, low,medium,high,prefix,SaveName 
    17431744        low[num] = tmpRun[2] 
    17441745        medium[num] = tmpRun[1] 
    17451746        high[num] = tmpRun[0] 
     1747        prefix[num] = GetPrefixStrFromFile(filenames[ii]) 
     1748         
     1749        //prompt for combined name 
     1750        String saveStr="" 
     1751        Prompt saveStr,"saved file name" 
     1752        DoPrompt "Enter the combined file name",saveStr 
     1753        saveName[num] = saveStr 
    17461754         
    17471755        return(0) 
    17481756end 
     1757 
     1758//given a filename of a SANS data filename of the form 
     1759//TTTTTnnn.SAn_TTT_Txxx 
     1760//returns the prefix "TTTTT" as some number of characters 
     1761//returns "" as an invalid file prefix 
     1762// 
     1763// NCNR-specifc, does not really belong here - but it's a beta procedure anyhow... 
     1764// 
     1765Function/S GetPrefixStrFromFile(item) 
     1766        String item 
     1767        String invalid = ""     //"" is not a valid run prefix, since it's text 
     1768        Variable num=-1 
     1769         
     1770        //find the "dot" 
     1771        String runStr="" 
     1772        Variable pos = strsearch(item,".",0) 
     1773        if(pos == -1) 
     1774                //"dot" not found 
     1775                return (invalid) 
     1776        else 
     1777                //found, skip the three characters preceeding it 
     1778                if (pos <=3) 
     1779                        //not enough characters 
     1780                        return (invalid) 
     1781                else 
     1782                        runStr = item[0,pos-4] 
     1783                        return (runStr) 
     1784                Endif 
     1785        Endif 
     1786End 
  • sans/SANSReduction/trunk/Put in User Procedures/SANS_Reduction_v5.00/RectAnnulAvg.ipf

    r116 r143  
    320320        Variable lambdaWidth = reals[27] 
    321321        String detStr=textRead[9] 
     322         
     323        Variable usingLenses = reals[28]                //new 2007 
    322324 
    323325        //Two parameters DDET and APOFF are instrument dependent.  Determine 
     
    341343        Variable ret1,ret2,ret3 
    342344        do 
    343                 getResolution(qval[ii],lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,ddr,ret1,ret2,ret3) 
     345                getResolution(qval[ii],lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,ddr,usingLenses,ret1,ret2,ret3) 
    344346                sigmaq[ii] = ret1 
    345347                qbar[ii] = ret2  
Note: See TracChangeset for help on using the changeset viewer.