Ignore:
Timestamp:
Jan 4, 2013 10:09:48 AM (10 years ago)
Author:
srkline
Message:

Changes to SASCALC and other locations in the code that identify the instrument from the account name that is stored in the file header. New designation of NGA for the 10-m SANS, and NGB is reserved for the NG3 30-m SANS when it is moved into the new guide hall. Changes to incorporate the 10m SANS are functional, but INCOMPLETE since many of the instrument details have not been filled in yet (they haven't been measured yet).

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

Legend:

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

    r871 r886  
    309309//      Variable ,lambda,sdd,,refNum,trans,thick,xcenter,ycenter,numatten 
    310310//      Variable lastPoint, beamstop,dum 
    311         Variable lastPoint,ctime,detcnt,cntrate,instrumentNum 
     311        Variable lastPoint,ctime,detcnt,cntrate//,instrumentNum 
    312312 
    313313        Wave/T GFilenames = $"root:myGlobals:CatVSHeaderInfo:Filenames" 
     
    445445// number of guides and sample position, only for NCNR 
    446446#if (exists("NCNR")==6) 
    447         instrumentNum = str2num(getAcctName(fname)[3])          // "[NGxSANSxx]" -- [3] should be then instrument number 
    448         Variable/G root:Packages:NIST:SAS:instrument = instrumentNum            //so that Ng can be correctly calculated 
     447//      instrumentNum = str2num(getAcctName(fname)[3])          // "[NGxSANSxx]" -- [3] should be then instrument number 
     448//      Variable/G root:Packages:NIST:SAS:instrument = instrumentNum            //so that Ng can be correctly calculated 
     449 
     450        // acct name is "[NGxSANSxx]" -- [1,3] is the instrument "name" "NGx" 
     451        //so that Ng can be correctly calculated 
     452        String/G root:Packages:NIST:SAS:gInstStr = getAcctName(fname)[1,3]  
    449453         
    450454        InsertPoints lastPoint,1,GNumGuides 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/CircSectAve.ipf

    r779 r886  
    4747        WAVE reals = $(destPath + ":RealsRead") 
    4848        WAVE/T textread = $(destPath + ":TextRead") 
    49         String fileStr = textread[3] 
     49//      String fileStr = textread[3] 
    5050         
    5151        // center of detector, for non-linear corrections 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_DataReadWrite.ipf

    r871 r886  
    24922492        // [6] sample label 
    24932493        // [9] det type "ORNL  " (6 chars) 
    2494          
     2494 
     2495        SVAR gInstStr = root:Packages:NIST:SAS:gInstStr 
     2496                 
    24952497        tw[1] = Secs2Date(DateTime,-2)+"  "+ Secs2Time(DateTime,3)              //20 chars, not quite VAX format 
    24962498        tw[2] = "SIM" 
    2497         tw[3] = "[NG7SANS99]" 
     2499        tw[3] = "["+gInstStr+"SANS99]" 
    24982500        tw[4] = "C" 
    24992501        tw[5] = "01JAN09 " 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_Utils.ipf

    r868 r886  
    3232        Variable/G root:myGlobals:PixelResNG5_ORNL = 0.5 
    3333        Variable/G root:myGlobals:PixelResNG7_ORNL = 0.5 
     34//      Variable/G root:myGlobals:PixelResNGA_ORNL = 0.5 
     35 
    3436        Variable/G root:myGlobals:PixelResDefault = 0.5 
    3537         
     
    3739        Variable/G root:myGlobals:DeadtimeNG5_ILL = 3.0e-6 
    3840        Variable/G root:myGlobals:DeadtimeNG7_ILL = 3.0e-6 
     41        Variable/G root:myGlobals:DeadtimeNGA_ILL = 3.0e-6              // fictional 
    3942        Variable/G root:myGlobals:DeadtimeNG3_ORNL_VAX = 3.4e-6         //pre - 23-JUL-2009 used VAX 
    4043        Variable/G root:myGlobals:DeadtimeNG3_ORNL_ICE = 1.5e-6         //post - 23-JUL-2009 used ICE 
     
    4245        Variable/G root:myGlobals:DeadtimeNG7_ORNL_VAX = 3.4e-6         //pre 25-FEB-2010 used VAX 
    4346        Variable/G root:myGlobals:DeadtimeNG7_ORNL_ICE = 2.3e-6         //post 25-FEB-2010 used ICE 
     47//      Variable/G root:myGlobals:DeadtimeNGA_ORNL_ICE = 1.0e-6         //not yet measured for NGA (10m) 
    4448        Variable/G root:myGlobals:DeadtimeDefault = 3.4e-6 
    4549         
     
    409413        NVAR PixelResNG5_ILL = root:myGlobals:PixelResNG5_ILL 
    410414        NVAR PixelResNG7_ILL = root:myGlobals:PixelResNG7_ILL 
     415        NVAR PixelResNGA_ILL = root:myGlobals:PixelResNGA_ILL 
    411416        NVAR PixelResNG3_ORNL = root:myGlobals:PixelResNG3_ORNL 
    412417        NVAR PixelResNG5_ORNL = root:myGlobals:PixelResNG5_ORNL 
    413418        NVAR PixelResNG7_ORNL = root:myGlobals:PixelResNG7_ORNL 
     419        NVAR PixelResNGA_ORNL = root:myGlobals:PixelResNGA_ORNL 
    414420        NVAR PixelResDefault = root:myGlobals:PixelResDefault 
    415421         
     
    436442                        endif 
    437443                        break 
     444                case "NGA": 
     445                        if(cmpstr(detStr, "ILL   ") == 0 ) 
     446                                DDet= PixelResNGA_ILL 
     447                        else 
     448                                DDet = PixelResNGA_ORNL //detector is ordella-type 
     449                        endif 
     450                        break 
    438451                default:                                                         
    439452                        //return error? 
     453                        DoAlert 0, "No matching instrument xDetectorPixelResolution-- Using default resolution" 
    440454                        DDet = PixelResDefault  //0.5 cm, typical for new ORNL detectors 
    441455        endswitch 
     
    460474//      NG3                                                     DECEMBER 2009                           1.5 microseconds 
    461475//      NG7                                                     APRIL2010                                       2.3 microseconds 
     476//      NGA                                                     TBD 2013 
     477// TODO_10m: measure proper dead time constants 
     478// 
    462479// 
    463480// The day of the switch to ICE on NG7 was 25-FEB-2010 (per J. Krzywon)  
     
    477494        NVAR DeadtimeNG5_ILL = root:myGlobals:DeadtimeNG5_ILL 
    478495        NVAR DeadtimeNG7_ILL = root:myGlobals:DeadtimeNG7_ILL 
     496        NVAR DeadtimeNGA_ILL = root:myGlobals:DeadtimeNGA_ILL 
    479497        NVAR DeadtimeNG3_ORNL_VAX = root:myGlobals:DeadtimeNG3_ORNL_VAX 
    480498        NVAR DeadtimeNG3_ORNL_ICE = root:myGlobals:DeadtimeNG3_ORNL_ICE 
     
    482500        NVAR DeadtimeNG7_ORNL_VAX = root:myGlobals:DeadtimeNG7_ORNL_VAX 
    483501        NVAR DeadtimeNG7_ORNL_ICE = root:myGlobals:DeadtimeNG7_ORNL_ICE 
     502        NVAR DeadtimeNGA_ORNL_ICE = root:myGlobals:DeadtimeNGA_ORNL_ICE 
    484503        NVAR DeadtimeDefault = root:myGlobals:DeadtimeDefault 
    485504         
     
    525544                        endif 
    526545                        break 
     546                case "NGA": 
     547                        if(cmpstr(detStr, "ILL   ") == 0 ) 
     548                                deadtime= DeadtimeNGA_ILL 
     549                        else 
     550                                deadtime = DeadtimeNGA_ORNL_ICE //detector is ordella-type, using ICE hardware 
     551                        endif 
     552                        Print "Using fictional values for NGA dead time" 
     553                        break 
    527554                default:                                                         
    528555                        //return error? 
     556                        DoAlert 0, "no matching instrument DetectorDeadtime, using default" 
    529557                        deadtime = DeadtimeDefault      //1e-6 seconds, typical for new ORNL detectors 
    530558        endswitch 
     
    14911519End 
    14921520 
     1521 
     1522// JAN 2013 -- a duplication of the NG7 table, needs to be updated after the attenuation factors 
     1523// are measured 
     1524// 
     1525// TODO_10m:::: 
     1526Proc MakeNGAAttenTable() 
     1527 
     1528        NewDataFolder/O root:myGlobals:Attenuators 
     1529         
     1530        Variable num=10         //10 needed for tables after June 2007 
     1531         
     1532        Make/O/N=(num) root:myGlobals:Attenuators:ngAatt0 
     1533        Make/O/N=(num) root:myGlobals:Attenuators:ngAatt1 
     1534        Make/O/N=(num) root:myGlobals:Attenuators:ngAatt2 
     1535        Make/O/N=(num) root:myGlobals:Attenuators:ngAatt3 
     1536        Make/O/N=(num) root:myGlobals:Attenuators:ngAatt4 
     1537        Make/O/N=(num) root:myGlobals:Attenuators:ngAatt5 
     1538        Make/O/N=(num) root:myGlobals:Attenuators:ngAatt6 
     1539        Make/O/N=(num) root:myGlobals:Attenuators:ngAatt7 
     1540        Make/O/N=(num) root:myGlobals:Attenuators:ngAatt8 
     1541        Make/O/N=(num) root:myGlobals:Attenuators:ngAatt9 
     1542        Make/O/N=(num) root:myGlobals:Attenuators:ngAatt10 
     1543         
     1544        // and a wave for the errors at each attenuation factor 
     1545        Make/O/N=(num) root:myGlobals:Attenuators:ngAatt0_err 
     1546        Make/O/N=(num) root:myGlobals:Attenuators:ngAatt1_err 
     1547        Make/O/N=(num) root:myGlobals:Attenuators:ngAatt2_err 
     1548        Make/O/N=(num) root:myGlobals:Attenuators:ngAatt3_err 
     1549        Make/O/N=(num) root:myGlobals:Attenuators:ngAatt4_err 
     1550        Make/O/N=(num) root:myGlobals:Attenuators:ngAatt5_err 
     1551        Make/O/N=(num) root:myGlobals:Attenuators:ngAatt6_err 
     1552        Make/O/N=(num) root:myGlobals:Attenuators:ngAatt7_err 
     1553        Make/O/N=(num) root:myGlobals:Attenuators:ngAatt8_err 
     1554        Make/O/N=(num) root:myGlobals:Attenuators:ngAatt9_err 
     1555        Make/O/N=(num) root:myGlobals:Attenuators:ngAatt10_err   
     1556         
     1557        //NGA wave has 10 elements, the transmission of att# at the wavelengths  
     1558        //lambda =4, 5,6,7,8,10,12,14,17,20 
     1559        // note that some of the higher attenuations and ALL of the 4 A and 20A data is interpolated 
     1560        // none of these values are expected to be used in reality since the flux would be too low in practice 
     1561        Make/O/N=(num) root:myGlobals:Attenuators:ngAlambda={4,5,6,7,8,10,12,14,17,20} 
     1562 
     1563// New calibration, June 2007, John Barker 
     1564        root:myGlobals:Attenuators:ngAatt0 = {1, 1, 1, 1, 1, 1, 1, 1 ,1,1}       
     1565        root:myGlobals:Attenuators:ngAatt1 = {0.448656,0.4192,0.3925,0.3661,0.3458,0.3098,0.2922,0.2738,0.2544,0.251352} 
     1566        root:myGlobals:Attenuators:ngAatt2 = {0.217193,0.1898,0.1682,0.148,0.1321,0.1076,0.0957,0.08485,0.07479,0.0735965} 
     1567        root:myGlobals:Attenuators:ngAatt3 = {0.098019,0.07877,0.06611,0.05429,0.04548,0.03318,0.02798,0.0234,0.02004,0.0202492} 
     1568        root:myGlobals:Attenuators:ngAatt4 = {0.0426904,0.03302,0.02617,0.02026,0.0158,0.01052,0.008327,0.006665,0.005745,0.00524807} 
     1569        root:myGlobals:Attenuators:ngAatt5 = {0.0194353,0.01398,0.01037,0.0075496,0.005542,0.003339,0.002505,0.001936,0.001765,0.00165959} 
     1570        root:myGlobals:Attenuators:ngAatt6 = {0.00971666,0.005979,0.004136,0.002848,0.001946,0.001079,0.0007717,0.000588,0.000487337,0.000447713} 
     1571        root:myGlobals:Attenuators:ngAatt7 = {0.00207332,0.001054,0.0006462,0.0003957,0.0002368,0.0001111,7.642e-05,4.83076e-05,3.99401e-05,3.54814e-05} 
     1572        root:myGlobals:Attenuators:ngAatt8 = {0.000397173,0.0001911,0.0001044,5.844e-05,3.236e-05,1.471e-05,6.88523e-06,4.06541e-06,3.27333e-06,2.81838e-06} 
     1573        root:myGlobals:Attenuators:ngAatt9 = {9.43625e-05,3.557e-05,1.833e-05,1.014e-05,6.153e-06,1.64816e-06,6.42353e-07,3.42132e-07,2.68269e-07,2.2182e-07} 
     1574        root:myGlobals:Attenuators:ngAatt10 = {2.1607e-05,7.521e-06,2.91221e-06,1.45252e-06,7.93451e-07,1.92309e-07,5.99279e-08,2.87928e-08,2.19862e-08,1.7559e-08} 
     1575 
     1576  // percent errors as measured, May 2007 values 
     1577  // zero error for zero attenuators, appropriate average values put in for unknown values 
     1578        root:myGlobals:Attenuators:ngAatt0_err = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } 
     1579        root:myGlobals:Attenuators:ngAatt1_err = {0.2,0.169,0.1932,0.253,0.298,0.4871,0.238,0.245,0.332,0.3} 
     1580        root:myGlobals:Attenuators:ngAatt2_err = {0.3,0.305,0.3551,0.306,0.37,0.6113,0.368,0.413,0.45,0.4} 
     1581        root:myGlobals:Attenuators:ngAatt3_err = {0.4,0.355,0.4158,0.36,0.4461,0.7643,0.532,0.514,0.535,0.5} 
     1582        root:myGlobals:Attenuators:ngAatt4_err = {0.45,0.402,0.4767,0.415,0.5292,0.9304,0.635,0.588,0.623,0.6} 
     1583        root:myGlobals:Attenuators:ngAatt5_err = {0.5,0.447,0.5376,0.487,0.6391,1.169,0.708,0.665,0.851,0.8} 
     1584        root:myGlobals:Attenuators:ngAatt6_err = {0.6,0.501,0.6136,0.528,0.8796,1.708,0.782,0.874,1,1} 
     1585        root:myGlobals:Attenuators:ngAatt7_err = {0.8,0.697,0.9149,0.583,1.173,2.427,1.242,2,2,2} 
     1586        root:myGlobals:Attenuators:ngAatt8_err = {1,0.898,1.24,0.696,1.577,3.412,3,3,3,3} 
     1587        root:myGlobals:Attenuators:ngAatt9_err = {1.5,1.113,1.599,1.154,2.324,4.721,5,5,5,5} 
     1588        root:myGlobals:Attenuators:ngAatt10_err = {1.5,1.493,5,5,5,5,5,5,5,5}   
     1589   
     1590End 
     1591 
    14931592//returns the transmission of the attenuator (at NG3) given the attenuator number 
    14941593//which must be an integer(to select the wave) and given the wavelength. 
     
    15661665        if(!(WaveExists($attStr)) || !(WaveExists($lamStr)) || !(WaveExists($attErrWStr))) 
    15671666                Execute "MakeNG7AttenTable()" 
     1667        Endif 
     1668        //just in case creating the tables fails.... 
     1669        if(!(WaveExists($attStr)) || !(WaveExists($lamStr)) ) 
     1670                Abort "Attenuator lookup waves could not be found. You must manually enter the absolute parameters" 
     1671        Endif 
     1672         
     1673        //lookup the value by interpolating the wavelength 
     1674        //the attenuator must always be an integer 
     1675        Wave att = $attStr 
     1676        Wave attErrW = $attErrWStr 
     1677        Wave lam = $lamstr 
     1678        trans = interp(lambda,lam,att) 
     1679        atten_err = interp(lambda,lam,attErrW) 
     1680 
     1681// the error in the tables is % error. return the standard deviation instead 
     1682        atten_err = trans*atten_err/100 
     1683         
     1684//      Print "trans = ",trans 
     1685//      Print "trans err = ",atten_err 
     1686         
     1687        return trans 
     1688 
     1689End 
     1690 
     1691//returns the transmission of the attenuator (at NGA) given the attenuator number 
     1692//which must be an integer(to select the wave) and given the wavelength. 
     1693//the wavelength may be any value between 4 and 20 (A), and is interpolated 
     1694//between calibrated wavelengths for a given attenuator 
     1695// 
     1696// local function 
     1697// 
     1698// Mar 2010 - abs() added to attStr to account for ICE reporting -0.0001 as an attenuator position, which truncates to "-0" 
     1699// 
     1700// JAN 2013 -- a duplication of the NG7 table, needs to be updated after the attenuation factors 
     1701// are measured 
     1702// 
     1703// TODO_10m:::: 
     1704// 
     1705Function LookupAttenNGA(lambda,attenNo,atten_err) 
     1706        Variable lambda, attenNo, &atten_err 
     1707         
     1708        Variable trans 
     1709        String attStr="root:myGlobals:Attenuators:ngAatt"+num2str(trunc(abs(attenNo))) 
     1710        String attErrWStr="root:myGlobals:Attenuators:ngAatt"+num2str(trunc(abs(attenNo)))+"_err" 
     1711        String lamStr = "root:myGlobals:Attenuators:ngAlambda" 
     1712         
     1713        if(attenNo == 0) 
     1714                return (1)              //no attenuation, return trans == 1 
     1715        endif 
     1716         
     1717        if( (lambda < 4) || (lambda > 20 ) ) 
     1718                Abort "Wavelength out of calibration range (4,20). You must manually enter the absolute parameters" 
     1719        Endif 
     1720         
     1721        if(!(WaveExists($attStr)) || !(WaveExists($lamStr)) || !(WaveExists($attErrWStr))) 
     1722                Execute "MakeNGAAttenTable()" 
    15681723        Endif 
    15691724        //just in case creating the tables fails.... 
     
    16101765                        attenFactor = LookupAttenNG7(lam,attenNo,atten_err) 
    16111766                        break 
     1767                case "NGA": 
     1768                        Print "Using the NG7 table for NGA *** this needs to be updated ***" 
     1769                        attenFactor = LookupAttenNG7(lam,attenNo,atten_err) 
     1770                        break 
    16121771                default:                                                         
    16131772                        //return error? 
    1614                         Print "if you're using the 10m SANS, this needs to be fixed, atten = 1" 
     1773                        DoAlert 0, "No matching instrument -- PrintAttenuation" 
    16151774                        attenFactor=1 
    16161775        endswitch 
     
    16331792// Attenuation factor as defined here is <= 1 
    16341793// 
    1635 // ORNL can pass ("",1,attenuationFactor) and have this function simply 
     1794// HFIR can pass ("",1,attenuationFactor) and have this function simply 
    16361795// spit back the attenuationFactor (that was read into rw[3]) 
    16371796// 
     
    16581817                        attenFactor = LookupAttenNG7(lam,attenNo,atten_err) 
    16591818                        break 
     1819                case "NGA": 
     1820                        Print "Using the NG7 table for NGA *** this needs to be updated ***" 
     1821                        attenFactor = LookupAttenNG7(lam,attenNo,atten_err) 
     1822                        break 
    16601823                default:                                                         
    16611824                        //return error? 
    1662                         Print "if you're using the 10m SANS, this needs to be fixed, atten = 1" 
     1825                        DoAlert 0, "No matching instrument -- PrintAttenuation" 
    16631826                        attenFactor=1 
    16641827        endswitch 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/RectAnnulAvg.ipf

    r665 r886  
    5656        Wave reals = $(destPath + ":RealsRead") 
    5757        WAVE/T textread = $(destPath + ":TextRead") 
    58         String fileStr = textread[3] 
     58//      String fileStr = textread[3] 
    5959         
    6060        // center of detector, for non-linear corrections 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/SANS_Utilities.ipf

    r872 r886  
    587587        return match 
    588588End 
     589 
     590 
     591// converts a hexadecimal string to a decimal value 
     592// crude, no error checking 
     593// 
     594Function str2hex(str) 
     595        String str 
     596         
     597        Variable hex 
     598         
     599        sscanf str,"%x",hex 
     600         
     601        return(hex) 
     602End 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/SASCALC.ipf

    r875 r886  
    2525//                                                      details of the distances, etc, but I'll fill that in as needed 
    2626//                                              -- to "un-hide" the 10m SANS, uncomment the CheckBox control in the panel (see the constant declared below) 
     27// 03 JAN 2013 SRK -- settled on "A" for new 10m SANS and "B" for the NG3 when it's relocated. Both instruments share 
     28//                                                      NGB, so this will have to do. files will be SA4 and SA5 respectively, if the VAX naming continues 
     29// 
     30// 
    2731// 
    2832// calculate what q-values you get based on the instruments settings 
     
    3236// - NOT true intensity, not counts, just a display 
    3337// 
    34 // TODO: 
     38// TODO_10m: 
    3539// 
    3640// -- For the 10m SANS... 
     41// 
    3742//              - how many guides are there 
    3843//              - no lenses? focusing pinholes? 
     
    4247//              - does this hook into anywhere in the main program? Attenuators, etc. 
    4348//                      where knowledge of the 10m SANS is necessary?? 
    44 // 
     49//              - setting the instrument "number" is done here as "10". This will have a trickle-down effect for the places that use 
     50//              the global -- root:Packages:NIST:SAS:instrument (search for it everywhere...) 
     51//              - repair the naming/numbering scheme to look for the string "NGx" and switch on that, not a number, which is unreliable and confusing. 
     52// 
     53// use str2hex(str) (my function) to conver "A" to 10 
    4554// 
    4655// Optional: 
     
    6877// 
    6978 
    70 Constant show10mSANS = 0 
     79Constant show10mSANS = 1 
    7180 
    7281 
     
    8190        Endif 
    8291 
    83 // now a checkbox as needed 
    84 //      DoWindow/F MC_SASCALC 
    85 //      if(V_flag==0) 
    86 //              MC_SASCALC() 
    87 //      endif 
    8892End 
    8993 
     
    111115         
    112116        // for the panel 
    113         Variable/G root:Packages:NIST:SAS:gInst=3               //or 7 for NG7 
     117//      Variable/G root:Packages:NIST:SAS:gInst=3               //or 7 for NG7 
     118        String/G root:Packages:NIST:SAS:gInstStr="NG3"          //or "NG7" or "NGA"=10m or "NGB"=NG3 moved 
    114119        Variable/G root:Packages:NIST:SAS:gNg=0 
    115120        Variable/G root:Packages:NIST:SAS:gTable=2              //2=chamber, 1=table 
     
    164169        Make/O/D/N=5 root:Packages:NIST:SAS:tickSDDNG3,root:Packages:NIST:SAS:tickSDDNG7 
    165170        Make/O/T/N=5 root:Packages:NIST:SAS:lblSDDNG3,root:Packages:NIST:SAS:lblSDDNG7 
    166         Make/O/D/N=5 root:Packages:NIST:SAS:tickSDDNG10 
    167         Make/O/T/N=5 root:Packages:NIST:SAS:lblSDDNG10 
     171        Make/O/D/N=5 root:Packages:NIST:SAS:tickSDDNGA 
     172        Make/O/T/N=5 root:Packages:NIST:SAS:lblSDDNGA 
    168173        root:Packages:NIST:SAS:tickSDDNG3 = {133,400,700,1000,1317} 
    169174        root:Packages:NIST:SAS:lblSDDNG3 = {"133","400","700","1000","1317"} 
    170175        root:Packages:NIST:SAS:tickSDDNG7 = {100,450,800,1150,1530} 
    171176        root:Packages:NIST:SAS:lblSDDNG7 = {"100","450","800","1150","1530"} 
    172         root:Packages:NIST:SAS:tickSDDNG10 = {100,200,300,400,500} 
    173         root:Packages:NIST:SAS:lblSDDNG10 = {"100","200","300","400","500"} 
     177        root:Packages:NIST:SAS:tickSDDNGA = {100,200,300,400,500} 
     178        root:Packages:NIST:SAS:lblSDDNGA = {"100","200","300","400","500"} 
    174179                 
    175180        //for the fake dependency 
     
    187192         
    188193        String/G gSelectedInstrument="checkNG3" 
    189         Variable/G instrument = 3 
     194        String/G gInstStr = "NG3" 
    190195         
    191196        Variable/G s12 = 54.8 
     
    243248        Variable/G      l2diff = 5.0 
    244249//       
     250 
     251 
     252        UpdateSASHeader() 
     253         
    245254        SetDataFolder root: 
    246255end 
     
    251260 
    252261        String/G gSelectedInstrument="checkNG7" 
    253         Variable/G instrument = 7 
     262        String/G gInstStr = "NG7" 
    254263         
    255264        Variable/G s12 = 54.8 
     
    307316        Variable/G      l2diff = 5.0 
    308317//       
     318 
     319        UpdateSASHeader() 
    309320        SetDataFolder root: 
    310321end 
    311322 
    312323/// this is the (incomplete) definition of the 10m SANS instrument 
    313 // on NG-B, which may be referred to as NG10 here to keep the NG(number) notation 
     324// on NG-B, which will be referred to as NGA here to keep the NG(number) notation 
     325// reserving NGB for the moved NG3 instrument 
    314326// which may be simpler here to keep functions from breaking... 
    315327 
     
    317329// most are completey wrong for the 10m SANS 
    318330// 
    319 Function initNG10() 
     331Function initNGA() 
    320332 
    321333        SetDataFolder root:Packages:NIST:SAS 
    322334 
    323         String/G gSelectedInstrument="checkNG10"         
    324         Variable/G instrument = 10 
     335        String/G gSelectedInstrument="checkNGA"  
     336        String/G gInstStr = "NGA" 
    325337 
    326338        Variable/G s12 = 0                      //**            no difference between sample and huber position 
     
    354366         
    355367        //fwhm values (new variables) (+3, 0, -3, calibrated 2009) 
    356         Variable/G fwhm_narrow = 0.109 
    357         Variable/G fwhm_mid = 0.125 
    358         Variable/G fwhm_wide = 0.236 
     368        Variable/G fwhm_narrow = 0.10 
     369        Variable/G fwhm_mid = 0.20 
     370        Variable/G fwhm_wide = 0.30 
    359371         
    360372        //source apertures (cm) 
     
    378390        Variable/G      l2diff = 5.0 
    379391//       
     392        UpdateSASHeader() 
    380393        SetDataFolder root: 
    381394end 
    382395 
     396// as the instrument changes, fill in appropriate values into the header waves of the SAS folder 
     397// so that any simulation data (2D VAX) that is written out will be as correct as possible 
     398// -- this should be taken care of in SimulationVAXHeader(), so this is really redundant 
     399Function UpdateSASHeader() 
     400 
     401        Wave/T tw=root:Packages:NIST:SAS:textRead 
     402        // fill in the instrument 
     403        SVAR gInstStr = root:Packages:NIST:SAS:gInstStr 
     404        tw[3] = "["+gInstStr+"SANS99]" 
     405 
     406End 
    383407 
    384408Function S_fillDefaultHeader(iW,rW,tW) 
     
    387411 
    388412        // text wave 
    389         // don't need anything 
     413        // fill in the instrument 
     414        SVAR gInstStr = root:Packages:NIST:SAS:gInstStr 
     415        tw[3] = "["+gInstStr+"SANS99]" 
    390416         
    391417        // integer wave 
     
    492518//      -- hide/unhide the 10m SANS 
    493519        if(show10mSANS) 
    494                 CheckBox checkNG10,pos={110,19},size={40,14},proc=SelectInstrumentCheckProc,title="NG10" 
    495                 CheckBox checkNG10,value=0,mode=1 
     520                CheckBox checkNGA,pos={110,19},size={40,14},proc=SelectInstrumentCheckProc,title="NGA" 
     521                CheckBox checkNGA,value=0,mode=1 
    496522        endif 
    497523//               
     
    564590        //poll the controls on the panel, and change needed values 
    565591        Variable isNG3,Ng,mode 
    566 //      ControlInfo/W=SASCALC checkNG3 
    567 //      isNG3=V_value 
     592 
    568593        ControlInfo/W=SASCALC SC_slider 
    569594        Ng=V_value 
     595        NVAR gNg = root:Packages:NIST:SAS:gNg 
     596        gNg = Ng                //update the global from the panel 
     597         
    570598        SVAR A1str= root:Packages:NIST:SAS:gSourceApString// = "1.43 cm;2.54 cm;3.81 cm;" 
    571599        SVAR dlStr = root:Packages:NIST:SAS:gDeltaLambdaStr 
    572         SVAR selInstr = root:Packages:NIST:SAS:gSelectedInstrument 
     600        SVAR selInstr = root:Packages:NIST:SAS:gInstStr 
    573601 
    574602        strswitch(selInstr)     // string switch 
    575                 case "checkNG3":                        //  
     603                case "NG3":                     //  
    576604                        switch(ng)       
    577605                                case 0: 
     
    612640                        break 
    613641                                                                 
    614                 case "checkNG7":                        //  
     642                case "NG7":                     //  
    615643                        switch(ng)       
    616644                                case 0: 
     
    636664                        break 
    637665                         
    638                 case "checkNG10":               // 10m SANS 
     666                case "NGA":             // 10m SANS 
     667                        if(ng>2) 
     668                                ng=2 
     669                                gNg = Ng                //update the global 
     670                        endif 
    639671                        switch(ng)       
    640672                                case 0: 
     
    651683                        Slider SC_Slider,limits={0,2,1},ticks=2                 //number of guides different on 10m SANS, 3 ticks 
    652684                         
    653                         Slider SC_Slider_1,win=SASCALC,limits={100,500,1},userTicks={root:Packages:NIST:SAS:tickSDDNG10,root:Packages:NIST:SAS:lblSDDNG10 } 
     685                        Slider SC_Slider_1,win=SASCALC,limits={100,500,1},userTicks={root:Packages:NIST:SAS:tickSDDNGA,root:Packages:NIST:SAS:lblSDDNGA } 
    654686                         
    655687                        NVAR detDist=root:Packages:NIST:SAS:gDetDist 
     
    669701                         
    670702                default:                                                        // optional default expression executed 
    671                                                                         // when no case matches 
     703                                DoAlert 0,"No matching instrument!  UpdateControls"                                     // when no case matches 
    672704        endswitch 
    673705         
     
    755787                        checkBox checkNG3,win=SASCALC, value=1 
    756788                        checkBox checkNG7,win=SASCALC, value=0 
    757                         checkBox checkNG10,win=SASCALC, value=0 
     789                        checkBox checkNGA,win=SASCALC, value=0 
    758790                        initNG3() 
    759791                        break                                            
     
    761793                        checkBox checkNG3,win=SASCALC, value=0 
    762794                        checkBox checkNG7,win=SASCALC, value=1 
    763                         checkBox checkNG10,win=SASCALC, value=0  
     795                        checkBox checkNGA,win=SASCALC, value=0  
    764796                        initNG7() 
    765797                        break 
    766                 case "checkNG10":               // 10m SANS 
     798                case "checkNGA":                // 10m SANS 
    767799                        checkBox checkNG3,win=SASCALC, value=0 
    768800                        checkBox checkNG7,win=SASCALC, value=0  
    769                         checkBox checkNG10,win=SASCALC, value=1 
    770                         initNG10() 
     801                        checkBox checkNGA,win=SASCALC, value=1 
     802                        initNGA() 
    771803                        break 
    772804                default:                                                        // optional default expression executed 
     
    826858        NVAR lam = root:Packages:NIST:SAS:gLambda 
    827859        NVAR dist = root:Packages:NIST:SAS:gDetDist 
    828         NVAR instrument = root:Packages:NIST:SAS:instrument 
     860//      NVAR instrument = root:Packages:NIST:SAS:instrument 
    829861        Wave rw=root:Packages:NIST:SAS:realsRead 
    830862         
     863        SVAR selInstr = root:Packages:NIST:SAS:gInstStr 
     864                 
    831865        // directly uncheck the box, just set the flag and get out 
    832866        if(checked == 0) 
     
    841875        if(checked == 1) 
    842876                lens = checked   
    843                 switch(instrument)      // numeric switch 
    844                         case 3: 
     877                strswitch(selInstr)     // string switch 
     878                        case "NG3": 
    845879                                dist = 1317 
    846880                                DetDistSliderProc("",1317,1) 
     
    860894                 
    861895                                break 
    862                         case 7: 
     896                        case "NG7": 
    863897                                dist = 1531 
    864898                                DetDistSliderProc("",1531,1) 
     
    877911                                 
    878912                                break 
    879                         case 10: 
     913                        case "NGA": 
    880914                                // 10m SANS - force no lenses for now 
    881915                                // TODO:  -- put in CORRECT VALUES -- THESE ARE FICTIONAL 
     
    886920                                break 
    887921                        default: 
    888                                  
     922                                DoAlert 0,"No matching instrument! LCP" 
    889923                endswitch 
    890924        endif 
     
    894928        // checkbox value... 
    895929        // 
     930         
    896931        // I'll uncheck as needed 
    897932        Variable lensNotAllowed=0 
     
    906941         
    907942                // instrument specific distance requirements 
    908                 if(instrument == 3 && dist != 1317) 
     943                if(cmpstr(selInstr,"NG3") == 0 && dist != 1317) 
    909944                        lensNotAllowed=1 
    910945                endif 
    911946         
    912                 if(instrument == 7 && dist != 1531) 
     947                if(cmpstr(selInstr,"NG7") == 0 && dist != 1531) 
    913948                        lensNotAllowed=1 
    914949                endif 
    915950                 
    916951                // instrument specific wavelength requirements 
    917                 if(instrument == 3 && !(lam == 8.4 || lam == 17.2) ) 
     952                if(cmpstr(selInstr,"NG3") == 0 && !(lam == 8.4 || lam == 17.2) ) 
    918953                        lensNotAllowed=1 
    919954                endif 
    920955                 
    921                 if(instrument == 7 && lam != 8.09 ) 
     956                if(cmpstr(selInstr,"NG7") == 0 && lam != 8.09 ) 
    922957                        lensNotAllowed=1 
    923958                endif 
    924959 
    925960        // right now, if 10m instrument, no lenses allowed               
    926                 if(instrument == 10 ) 
     961                if(cmpstr(selInstr,"NGA") == 0) 
    927962                        lensNotAllowed=1 
    928963                endif 
     
    18251860        NVAR wavelength=gLambda 
    18261861        NVAR lambdaWidth=gDeltaLambda 
    1827         NVAR instrument = instrument 
     1862//      NVAR instrument = instrument 
    18281863        NVAR L2diff = L2diff 
    18291864   NVAR lens = root:Packages:NIST:SAS:gUsingLenses 
    18301865        SVAR/Z aStr = root:Packages:NIST:gAngstStr 
     1866        SVAR selInstr = root:Packages:NIST:SAS:gInstStr 
     1867 
    18311868         
    18321869        sprintf temp,"Source Aperture Diameter =\t\t%6.2f cm\r",sourceApertureDiam() 
     
    18571894//      // add text of the user-edited values 
    18581895//      // 
    1859         sprintf temp,"***************** NG %d *****************\r",instrument 
     1896        sprintf temp,"***************** %s *** %s *****************\r",selInstr,selInstr 
    18601897        str += temp 
    18611898        sprintf temp,"Sample Aperture Diameter =\t\t\t\t%.2f cm\r",sampleApertureDiam() 
     
    19662003// for the 10m SANS, table position is inline, so S12 = 0 
    19672004// 
    1968 // TODO -- for the 10m SANS - all of the numbers here are hard-wired and are WRONG 
     2005// TODO_10m -- for the 10m SANS - all of the numbers here are hard-wired and are WRONG 
    19692006// 
    19702007Function sourceToSampleDist() 
     
    19742011        NVAR L2Diff = root:Packages:NIST:SAS:L2Diff 
    19752012        NVAR SSD = root:Packages:NIST:SAS:gSSD 
    1976         NVAR instrument = root:Packages:NIST:SAS:instrument 
    1977          
    1978         switch(instrument)      // numeric switch 
    1979                 case 3: 
    1980                 case 7: 
     2013//      NVAR instrument = root:Packages:NIST:SAS:instrument 
     2014        SVAR selInstr = root:Packages:NIST:SAS:gInstStr 
     2015 
     2016        strswitch(selInstr)     // string switch 
     2017                case "NG3": 
     2018                case "NG7": 
    19812019                        // NG3 and NG7 are both the same 
    19822020                        SSD = 1632 - 155*NG - s12*(2-tableposition()) - L2Diff 
    19832021                        break 
    1984                 case 10: 
     2022                case "NGA": 
    19852023                        // 10m SANS handled differently 
    19862024                        // s12 == 0 by definition 
    1987                         // TODO:  -- put in CORRECT VALUES -- THESE ARE FICTIONAL 
     2025                        // TODO_10m:  -- put in CORRECT VALUES -- THESE ARE FICTIONAL 
    19882026                        SSD = 470 - 155*NG - s12*(2-tableposition()) - L2Diff 
    19892027                        break 
    19902028                default: 
    1991                          
     2029                        DoAlert 0,"No matching instrument! sourceToSampleDist" 
    19922030        endswitch 
    1993          
    19942031         
    19952032         
     
    20042041// SSD in meters 
    20052042// 
    2006 // TODO -- for the 10m SANS - all of the numbers here are hard-wired and are WRONG 
     2043// TODO_10m -- for the 10m SANS - all of the numbers here are hard-wired and are WRONG 
     2044// -- need to re-write this to take a second parameter, a string with the instrument, or something 
     2045// else needs to be changed in GetHeaderInfoToWave() which calls this function 
     2046// 
    20072047// 
    20082048Function numGuides(SSD) 
     
    20112051        Variable Ng 
    20122052         
    2013         NVAR instrument = root:Packages:NIST:SAS:instrument 
    2014          
    2015         switch(instrument)      // numeric switch 
    2016                 case 3: 
    2017                 case 7: 
     2053        //NVAR instrument = root:Packages:NIST:SAS:instrument 
     2054        SVAR selInstr = root:Packages:NIST:SAS:gInstStr 
     2055 
     2056        strswitch(selInstr)     // string switch 
     2057                case "NG3": 
     2058                case "NG7": 
    20182059                        // NG3 and NG7 are both the same 
    20192060                        Ng = SSD*100 + 5 - 1632 
     
    20212062         
    20222063                        break 
    2023                 case 10: 
     2064                case "NGA": 
    20242065                        // 10m SANS handled differently 
    2025                         // TODO:  -- put in CORRECT VALUES -- THESE ARE FICTIONAL 
     2066                        // TODO_10m:  -- put in CORRECT VALUES -- THESE ARE FICTIONAL 
    20262067                        Ng = SSD*100 + 5 - 1632 
    20272068                        Ng /= -155 
Note: See TracChangeset for help on using the changeset viewer.