Ignore:
Timestamp:
Jan 16, 2013 3:44:53 PM (10 years ago)
Author:
srkline
Message:

Changes include:

updates to the simulation through SASCALC to allow easier "scripting" of SASCALC for simulation of "experiments"

updated some of the calibration values for the 10m SANS @ NGA

fixed bug in how the transmission error were being displayed in the TransFile? table (bad sort). Data was not affected, only the display.

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

Legend:

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

    r816 r887  
    11241124        RenameWindow #,T_results 
    11251125        SetActiveSubwindow ## 
     1126         
     1127        // set the global for the popup function menu so the shown item is global 
     1128        root:Packages:NIST:SAS:gFuncStr = StringFromList(0, MC_FunctionPopupList(),";") 
    11261129EndMacro 
    11271130 
     
    15431546                 
    15441547                linear_data *= tmp_mask 
     1548                 
     1549                rw[37] = 0              // make sure BS X = 0 if BS is in 
     1550        else 
     1551                rw[37] = -10                    // fake BS out as X = -10 cm 
    15451552        endif 
    15461553         
     
    17031710        root:Packages:NIST:SAS:gDoMonteCarlo     = 0  // == 1 if 2D MonteCarlo set by hidden flag 
    17041711 
    1705          
     1712        // set the global for the popup function menu so the shown item is global 
     1713        root:Packages:NIST:SAS:gFuncStr = StringFromList(0, MC_FunctionPopupList(),";") 
     1714 
    17061715EndMacro 
    17071716 
     
    17911800 
    17921801// 
    1793 // 
     1802// set up a fake protocol with the simulation results, then call one of the  
     1803// standard writing routines 
    17941804// 
    17951805Function Save_1DSimData(ctrlName) : ButtonControl 
     
    17981808        String type="SAS",fullpath="" 
    17991809        Variable dialog=1               //=1 will present dialog for name 
     1810         
     1811        // fill a fake protocol to pass information to the data writer about the simulation 
     1812        FillFake_SIMProtocol(type) 
     1813 
     1814        NVAR useXMLOutput = root:Packages:NIST:gXML_Write 
     1815         
     1816        if (useXMLOutput == 1) 
     1817                WriteXMLWaves_W_Protocol(type,"",1) 
     1818        else 
     1819                WriteWaves_W_Protocol(type,"",1)                //"" is an empty path, 1 will force a dialog 
     1820        endif 
     1821         
     1822        return(0) 
     1823         
     1824End 
     1825 
     1826// type is the folder type 
     1827//  
     1828// Protocol is SIMProtocol, and overwrites every time 
     1829// 
     1830Function FillFake_SIMProtocol(type) 
     1831        String type 
    18001832         
    18011833        String destStr="" 
     
    18081840         
    18091841        If(1) 
    1810                 //setup a "fake protocol" wave, sice I have no idea of the current state of the data 
     1842                //setup a "fake protocol" wave, since I have no idea of the current state of the data 
    18111843                Make/O/T/N=8 root:myGlobals:Protocols:SIMProtocol 
    18121844                Wave/T SIMProtocol = $"root:myGlobals:Protocols:SIMProtocol" 
     
    18331865        Endif 
    18341866         
    1835          
    1836         NVAR useXMLOutput = root:Packages:NIST:gXML_Write 
    1837          
    1838         if (useXMLOutput == 1) 
    1839                 WriteXMLWaves_W_Protocol(type,"",1) 
    1840         else 
    1841                 WriteWaves_W_Protocol(type,"",1)                //"" is an empty path, 1 will force a dialog 
    1842         endif 
    1843          
    1844 //       
    1845 //      //*****these waves MUST EXIST, or IGOR Pro will crash, with a type 2 error**** 
    1846 //      WAVE intw=$(destStr + ":integersRead") 
    1847 //      WAVE rw=$(destStr + ":realsRead") 
    1848 //      WAVE/T textw=$(destStr + ":textRead") 
    1849 //      WAVE qvals =$(destStr + ":qval") 
    1850 //      WAVE inten=$(destStr + ":aveint") 
    1851 //      WAVE sig=$(destStr + ":sigave") 
    1852 //      WAVE qbar = $(destStr + ":QBar") 
    1853 //      WAVE sigmaq = $(destStr + ":SigmaQ") 
    1854 //      WAVE fsubs = $(destStr + ":fSubS") 
    1855 // 
    1856 //      SVAR gProtoStr = root:myGlobals:Protocols:gProtoStr 
    1857 //      Wave/T proto=$("root:myGlobals:Protocols:"+gProtoStr) 
    1858 //       
    1859 //      //check each wave 
    1860 //      If(!(WaveExists(intw))) 
    1861 //              Abort "intw DNExist Save_1DSimData()" 
    1862 //      Endif 
    1863 //      If(!(WaveExists(rw))) 
    1864 //              Abort "rw DNExist Save_1DSimData()" 
    1865 //      Endif 
    1866 //      If(!(WaveExists(textw))) 
    1867 //              Abort "textw DNExist Save_1DSimData()" 
    1868 //      Endif 
    1869 //      If(!(WaveExists(qvals))) 
    1870 //              Abort "qvals DNExist Save_1DSimData()" 
    1871 //      Endif 
    1872 //      If(!(WaveExists(inten))) 
    1873 //              Abort "inten DNExist Save_1DSimData()" 
    1874 //      Endif 
    1875 //      If(!(WaveExists(sig))) 
    1876 //              Abort "sig DNExist Save_1DSimData()" 
    1877 //      Endif 
    1878 //      If(!(WaveExists(qbar))) 
    1879 //              Abort "qbar DNExist Save_1DSimData()" 
    1880 //      Endif 
    1881 //      If(!(WaveExists(sigmaq))) 
    1882 //              Abort "sigmaq DNExist Save_1DSimData()" 
    1883 //      Endif 
    1884 //      If(!(WaveExists(fsubs))) 
    1885 //              Abort "fsubs DNExist Save_1DSimData()" 
    1886 //      Endif 
    1887 //      If(!(WaveExists(proto))) 
    1888 //              Abort "current protocol wave DNExist Save_1DSimData()" 
    1889 //      Endif 
    1890 // 
    1891 //      //strings can be too long to print-- must trim to 255 chars 
    1892 //      Variable ii,num=8 
    1893 //      Make/O/T/N=(num) tempShortProto 
    1894 //      for(ii=0;ii<num;ii+=1) 
    1895 //              tempShortProto[ii] = (proto[ii])[0,240] 
    1896 //      endfor 
    1897 //       
    1898 //      if(dialog) 
    1899 //              PathInfo/S catPathName 
    1900 //              fullPath = DoSaveFileDialog("Save data as") 
    1901 //              If(cmpstr(fullPath,"")==0) 
    1902 //                      //user cancel, don't write out a file 
    1903 //                      Close/A 
    1904 //                      Abort "no data file was written" 
    1905 //              Endif 
    1906 //              //Print "dialog fullpath = ",fullpath 
    1907 //      Endif 
    1908 //       
    1909 //      NVAR monCt = root:Packages:NIST:SAS:gImon 
    1910 //      NVAR thick = root:Packages:NIST:SAS:gThick 
    1911 //      NVAR trans = root:Packages:NIST:SAS:gSamTrans                   //for 1D, default value 
    1912 //       
    1913 // 
    1914 //       
    1915 //      hdrStr1 = num2str(monCt)+"  "+num2str(rw[26])+"       "+num2str(rw[19])+"     "+num2str(rw[18]) 
    1916 //      hdrStr1 += "     "+num2str(trans)+"     "+num2str(thick) + ave +"   "+num2str(step) + "\r\n" 
    1917 // 
    1918 //      hdrStr2 = num2str(rw[16])+"  "+num2str(rw[17])+"  "+num2str(rw[23])+"    "+num2str(rw[24])+"    " 
    1919 //      hdrStr2 += num2str(rw[25])+"    "+num2str(rw[27])+"    "+num2str(rw[21])+"    "+"ORNL  " + "\r\n" 
    1920 //       
    1921 //      //actually open the file here 
    1922 //      Open refNum as fullpath 
    1923 //       
    1924 //      //write out the standard header information 
    1925 //      fprintf refnum,"FILE: %s\t\t CREATED: %s\r\n","SIMULATED DATA",(date() +"  "+ time()) 
    1926 //      fprintf refnum,"LABEL: %s\r\n","SIMULATED DATA" 
    1927 //      fprintf refnum,"MON CNT   LAMBDA   DET ANG   DET DIST   TRANS   THICK   AVE   STEP\r\n" 
    1928 //      fprintf refnum,hdrStr1 
    1929 //      fprintf refnum,"BCENT(X,Y)   A1(mm)   A2(mm)   A1A2DIST(m)   DL/L   BSTOP(mm)   DET_TYP \r\n" 
    1930 //      fprintf refnum,hdrStr2 
    1931 ////    fprintf refnum,headerFormat,rw[0],rw[26],rw[19],rw[18],rw[4],rw[5],ave,step 
    1932 // 
    1933 //      //insert protocol information here 
    1934 //      //-1 list of sample files 
    1935 //      //0 - bkg 
    1936 //      //1 - emp 
    1937 //      //2 - div 
    1938 //      //3 - mask 
    1939 //      //4 - abs params c2-c5 
    1940 //      //5 - average params 
    1941 //      fprintf refnum, "SAM: %s\r\n",tempShortProto[0] 
    1942 //      fprintf refnum, "BGD: %s\r\n",tempShortProto[1] 
    1943 //      fprintf refnum, "EMP: %s\r\n",tempShortProto[2] 
    1944 //      fprintf refnum, "DIV: %s\r\n",tempShortProto[3] 
    1945 //      fprintf refnum, "MASK: %s\r\n",tempShortProto[4] 
    1946 //      fprintf refnum, "ABS: %s\r\n",tempShortProto[5] 
    1947 //      fprintf refnum, "Average Choices: %s\r\n",tempShortProto[6] 
    1948 //       
    1949 //      //write out the data columns 
    1950 //      fprintf refnum,"The 6 columns are | Q (1/A) | I(Q) (1/cm) | std. dev. I(Q) (1/cm) | sigmaQ | meanQ | ShadowFactor|\r\n" 
    1951 //      wfprintf refnum, formatStr, qvals,inten,sig,sigmaq,qbar,fsubs 
    1952 //       
    1953 //      Close refnum 
    1954 //       
    1955 //      SetDataFolder root:             //(redundant) 
    1956 //       
    1957 //      //write confirmation of write operation to history area 
    1958 //      Print "Averaged File written: ", GetFileNameFromPathNoSemi(fullPath) 
    1959 //      KillWaves/Z tempShortProto 
    1960 // 
    1961 //      //clear the stuff that was created for case of saving files 
    1962 //      If(1) 
    1963 //              Killwaves/Z root:myGlobals:Protocols:SIMProtocol 
    1964 //              String/G root:myGlobals:Protocols:gProtoStr = "" 
    1965 //      Endif 
    1966 //       
    1967          
    19681867        return(0) 
    1969          
    1970 End 
     1868End 
     1869 
    19711870 
    19721871 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_Utils.ipf

    r886 r887  
    3939        Variable/G root:myGlobals:DeadtimeNG5_ILL = 3.0e-6 
    4040        Variable/G root:myGlobals:DeadtimeNG7_ILL = 3.0e-6 
    41         Variable/G root:myGlobals:DeadtimeNGA_ILL = 3.0e-6              // fictional 
     41        Variable/G root:myGlobals:DeadtimeNGA_ILL = 4.0e-6              // fictional 
    4242        Variable/G root:myGlobals:DeadtimeNG3_ORNL_VAX = 3.4e-6         //pre - 23-JUL-2009 used VAX 
    4343        Variable/G root:myGlobals:DeadtimeNG3_ORNL_ICE = 1.5e-6         //post - 23-JUL-2009 used ICE 
     
    4545        Variable/G root:myGlobals:DeadtimeNG7_ORNL_VAX = 3.4e-6         //pre 25-FEB-2010 used VAX 
    4646        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) 
     47        Variable/G root:myGlobals:DeadtimeNGA_ORNL_ICE = 4.0e-6         //per JGB 16-JAN-23013 
    4848        Variable/G root:myGlobals:DeadtimeDefault = 3.4e-6 
    4949         
     
    15231523// are measured 
    15241524// 
     1525// 1) change num to be the number of discrete wavelengths 
     1526// 2) set these in ngALambda = 
     1527//      3) do I have (11) slots for atten 0-10? 
     1528//      4) fill in the tables of factors and errors 
     1529// 
    15251530// TODO_10m:::: 
    15261531Proc MakeNGAAttenTable() 
     
    16911696//returns the transmission of the attenuator (at NGA) given the attenuator number 
    16921697//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 
     1698//the wavelength may be any value between 3 and 30 (A), and is interpolated 
    16941699//between calibrated wavelengths for a given attenuator 
    16951700// 
     
    16991704// 
    17001705// JAN 2013 -- a duplication of the NG7 table, needs to be updated after the attenuation factors 
    1701 // are measured 
     1706// are measured - Note that the wavelength range is larger here than for the 30m instruments 
    17021707// 
    17031708// TODO_10m:::: 
    1704 // 
    17051709Function LookupAttenNGA(lambda,attenNo,atten_err) 
    17061710        Variable lambda, attenNo, &atten_err 
     
    17151719        endif 
    17161720         
    1717         if( (lambda < 4) || (lambda > 20 ) ) 
    1718                 Abort "Wavelength out of calibration range (4,20). You must manually enter the absolute parameters" 
     1721        if( (lambda < 3) || (lambda > 30 ) ) 
     1722                Abort "Wavelength out of calibration range (3,30). You must manually enter the absolute parameters" 
    17191723        Endif 
    17201724         
     
    17671771                case "NGA": 
    17681772                        Print "Using the NG7 table for NGA *** this needs to be updated ***" 
    1769                         attenFactor = LookupAttenNG7(lam,attenNo,atten_err) 
     1773                        attenFactor = LookupAttenNGA(lam,attenNo,atten_err) 
    17701774                        break 
    17711775                default:                                                         
     
    18191823                case "NGA": 
    18201824                        Print "Using the NG7 table for NGA *** this needs to be updated ***" 
    1821                         attenFactor = LookupAttenNG7(lam,attenNo,atten_err) 
     1825                        attenFactor = LookupAttenNGA(lam,attenNo,atten_err) 
    18221826                        break 
    18231827                default:                                                         
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/SASCALC.ipf

    r886 r887  
    5151//              - repair the naming/numbering scheme to look for the string "NGx" and switch on that, not a number, which is unreliable and confusing. 
    5252// 
    53 // use str2hex(str) (my function) to conver "A" to 10 
     53// use str2hex(str) (my function) to convert "A" to 10 
    5454// 
    5555// Optional: 
     
    105105        root:Packages:NIST:SAS:data = 1 
    106106        root:Packages:NIST:SAS:linear_data = 1 
    107         // fill w/default values 
    108         S_fillDefaultHeader(root:Packages:NIST:SAS:integersRead,root:Packages:NIST:SAS:realsRead,root:Packages:NIST:SAS:textRead) 
     107 
    109108         
    110109        // other variables 
     
    156155        Variable/G root:Packages:NIST:SAS:g_1DEstDetCR = 0              // estimated detector count rate 
    157156        Variable/G root:Packages:NIST:SAS:g_1DFracScatt = 0             // fraction of beam captured on detector 
    158         Variable/G root:Packages:NIST:SAS:g_1DEstTrans = 0              // estimated transmission of sample 
     157        Variable/G root:Packages:NIST:SAS:g_1DEstTrans = 0              // estimated transmission of sample (OUTPUT) 
    159158        Variable/G root:Packages:NIST:SAS:g_1D_DoABS = 1 
    160159        Variable/G root:Packages:NIST:SAS:g_1D_AddNoise = 1 
     
    175174        root:Packages:NIST:SAS:tickSDDNG7 = {100,450,800,1150,1530} 
    176175        root:Packages:NIST:SAS:lblSDDNG7 = {"100","450","800","1150","1530"} 
    177         root:Packages:NIST:SAS:tickSDDNGA = {100,200,300,400,500} 
    178         root:Packages:NIST:SAS:lblSDDNGA = {"100","200","300","400","500"} 
     176        root:Packages:NIST:SAS:tickSDDNGA = {106,200,300,400,525} 
     177        root:Packages:NIST:SAS:lblSDDNGA = {"106","200","300","400","525"} 
    179178                 
    180179        //for the fake dependency 
     
    185184        Variable/G root:Packages:NIST:SAS:gDoTraceOffset=0              // (1==Yes, offset 2^n), 0==turn off the offset 
    186185         
     186        // fill a fake data header 
     187        // fill w/default values 
     188        S_fillDefaultHeader(root:Packages:NIST:SAS:integersRead,root:Packages:NIST:SAS:realsRead,root:Packages:NIST:SAS:textRead) 
     189         
    187190End 
    188191 
     
    195198         
    196199        Variable/G s12 = 54.8 
    197         Variable/G d_det = 0.5 
    198         Variable/G a_pixel = 0.5 
     200        Variable/G d_det = 0.508 
     201        Variable/G a_pixel = 0.508 
    199202        Variable/G del_r = 0.5 
    200203        Variable/G det_width = 64.0 
     
    223226        Variable/G gGuide_loss = 0.924 
    224227         
    225         //fwhm values (new variables) (+3, 0, -3, calibrated 2009) 
    226         Variable/G fwhm_narrow = 0.109 
    227         Variable/G fwhm_mid = 0.125 
    228         Variable/G fwhm_wide = 0.236 
    229          
    230         //source apertures (cm) 
    231         Variable/G a1_0_0 = 1.43 
    232         Variable/G a1_0_1 = 2.54 
    233         Variable/G a1_0_2 = 3.81 
    234         Variable/G a1_7_0 = 2.5 // after the polarizer           
    235         Variable/G a1_7_1 = 5.0 
    236         Variable/G a1_7_1 = 0.95                // new Mar 2012 9.5 mm diameter source aperture 
    237         Variable/G a1_def = 5.00 
     228//      //fwhm values (new variables) (+3, 0, -3, calibrated 2009) 
     229//      Variable/G fwhm_narrow = 0.109 
     230//      Variable/G fwhm_mid = 0.125 
     231//      Variable/G fwhm_wide = 0.236 
     232//       
     233//      //source apertures (cm) 
     234//      Variable/G a1_0_0 = 1.43 
     235//      Variable/G a1_0_1 = 2.54 
     236//      Variable/G a1_0_2 = 3.81 
     237//      Variable/G a1_7_0 = 2.5 // after the polarizer           
     238//      Variable/G a1_7_1 = 5.0 
     239//      Variable/G a1_7_1 = 0.95                // new Mar 2012 9.5 mm diameter source aperture 
     240//      Variable/G a1_def = 5.00 
    238241         
    239242        //default configuration values 
     
    263266         
    264267        Variable/G s12 = 54.8 
    265         Variable/G d_det = 0.5 
    266         Variable/G a_pixel = 0.5 
     268        Variable/G d_det = 0.508 
     269        Variable/G a_pixel = 0.508 
    267270        Variable/G del_r = 0.5 
    268271        Variable/G det_width = 64.0 
     
    292295        Variable/G gGuide_loss = 0.974 
    293296         
    294         //fwhm values (new variables) 
    295         Variable/G fwhm_narrow = 0.09 
    296         Variable/G fwhm_mid = 0.115             //2009 
    297         Variable/G fwhm_wide = 0.22 
    298          
    299         //source apertures (cm) 
    300         Variable/G a1_0_0 = 1.43 
    301         Variable/G a1_0_1 = 2.22 
    302         Variable/G a1_0_2 = 3.81 
    303         Variable/G a1_7_0 = 5.0         // don't apply to NG7 
    304         Variable/G a1_7_1 = 5.0 
    305         Variable/G a1_def = 5.00 
     297//      //fwhm values (new variables) 
     298//      Variable/G fwhm_narrow = 0.09 
     299//      Variable/G fwhm_mid = 0.115             //2009 
     300//      Variable/G fwhm_wide = 0.22 
     301//       
     302//      //source apertures (cm) 
     303//      Variable/G a1_0_0 = 1.43 
     304//      Variable/G a1_0_1 = 2.22 
     305//      Variable/G a1_0_2 = 3.81 
     306//      Variable/G a1_7_0 = 5.0         // don't apply to NG7 
     307//      Variable/G a1_7_1 = 5.0 
     308//      Variable/G a1_def = 5.00 
    306309         
    307310        //default configuration values 
     
    329332// most are completey wrong for the 10m SANS 
    330333// 
     334// TODO_10m: 
    331335Function initNGA() 
    332336 
     
    337341 
    338342        Variable/G s12 = 0                      //**            no difference between sample and huber position 
    339         Variable/G d_det = 0.5 
    340         Variable/G a_pixel = 0.5 
     343        Variable/G d_det = 0.508 
     344        Variable/G a_pixel = 0.508 
    341345        Variable/G del_r = 0.5 
    342346        Variable/G det_width = 64.0 
    343347        Variable/G lambda_t = 5.50 
    344         Variable/G l2r_lower = 100 
    345         Variable/G l2r_upper =  500 
    346         Variable/G lambda_lower = 2.5 
    347         Variable/G lambda_upper = 20.0 
     348        Variable/G l2r_lower = 106 
     349        Variable/G l2r_upper =  525 
     350        Variable/G lambda_lower = 3.0 
     351        Variable/G lambda_upper = 30.0 
    348352        Variable/G d_upper = 25.0                       //** 
    349353        Variable/G bs_factor = 1.05             //** 
     
    353357        Variable/G l_gap = 100.0                        //** 
    354358        Variable/G guide_width = 6.0            //** 
    355         Variable/G idmax = 100.0                        //** 
     359        Variable/G idmax = 100.0                        //** max count rate per pixel 
    356360//      //old values, from 3/2002 
    357361//      Variable/G phi_0 = 2.95e13 
     
    365369        Variable/G gGuide_loss = 0.924 
    366370         
    367         //fwhm values (new variables) (+3, 0, -3, calibrated 2009) 
    368         Variable/G fwhm_narrow = 0.10 
    369         Variable/G fwhm_mid = 0.20 
    370         Variable/G fwhm_wide = 0.30 
    371          
    372         //source apertures (cm) 
    373         Variable/G a1_0_0 = 1.43 
    374         Variable/G a1_0_1 = 2.54 
    375         Variable/G a1_0_2 = 3.81 
    376         Variable/G a1_7_0 = 2.5 // after the polarizer           
    377         Variable/G a1_7_1 = 5.0 
    378         Variable/G a1_7_1 = 0.95                // new Mar 2012 9.5 mm diameter source aperture 
    379         Variable/G a1_def = 5.00 
    380          
     371//      //fwhm values (new variables) (+3, 0, -3, calibrated 2009) 
     372//      Variable/G fwhm_narrow = 0.10 
     373//      Variable/G fwhm_mid = 0.20 
     374//      Variable/G fwhm_wide = 0.30 
     375//       
     376//      //source apertures (cm) 
     377//      Variable/G a1_0_0 = 1.43 
     378//      Variable/G a1_0_1 = 2.54 
     379//      Variable/G a1_0_2 = 3.81 
     380//      Variable/G a1_7_0 = 2.5 // after the polarizer           
     381//      Variable/G a1_7_1 = 5.0 
     382//      Variable/G a1_7_1 = 0.95                // new Mar 2012 9.5 mm diameter source aperture 
     383//      Variable/G a1_def = 5.00 
     384//       
    381385        //default configuration values 
    382386//      ng = 0 
     
    445449End 
    446450 
    447  
     451// TODO_10m: verify that controls have the proper limits for 10m SANS (see UpdateControls()) 
    448452Window SASCALC_Panel() 
    449453 
     
    587591// set the wavelength spread popup 
    588592// 
     593// TODO_10m: 
    589594Function UpdateControls() 
    590595        //poll the controls on the panel, and change needed values 
     
    599604        SVAR dlStr = root:Packages:NIST:SAS:gDeltaLambdaStr 
    600605        SVAR selInstr = root:Packages:NIST:SAS:gInstStr 
     606        NVAR lambda = root:Packages:NIST:SAS:gLambda 
    601607 
    602608        strswitch(selInstr)     // string switch 
     
    622628                        //wavelength spread 
    623629                        dlStr = "0.109;0.125;0.236;"            //updated calibration 2009 
    624                         Slider SC_Slider,limits={0,8,1},ticks=1 
     630                        Slider SC_Slider win=SASCALC,limits={0,8,1},ticks=1 
    625631                        //detector limits 
     632                        Slider SC_Slider_1,win=SASCALC,limits={133,1317,1},userTicks={root:Packages:NIST:SAS:tickSDDNG3,root:Packages:NIST:SAS:lblSDDNG3 } 
    626633                        SetVariable setvar0,win=SASCALC,limits={133,1317,1} 
    627634                        NVAR detDist=root:Packages:NIST:SAS:gDetDist 
     
    631638                                detDist = 1317 
    632639                        endif 
    633                         Slider SC_Slider_1,win=SASCALC,limits={133,1317,1},userTicks={root:Packages:NIST:SAS:tickSDDNG3,root:Packages:NIST:SAS:lblSDDNG3 } 
    634                         Slider SC_Slider_1,win=SASCALC,variable=root:Packages:NIST:SAS:gDetDist         //forces update 
     640 
     641                        // wavelength limits 
     642                        SetVariable setvar0_2 win=SASCALC,limits={4,20,0.1} 
     643                        if(lambda < 4) 
     644                                lambda = 4 
     645                        endif 
     646                        if(lambda > 20) 
     647                                lambda = 20 
     648                        endif 
    635649 
    636650                        // un-disable the sample table position 
     
    653667                         
    654668                        dlStr = "0.09;0.115;0.22;" 
    655                         Slider SC_Slider,limits={0,8,1},ticks=1 
     669                        Slider SC_Slider win=SASCALC,limits={0,8,1},ticks=1 
    656670                        Slider SC_Slider_1,win=SASCALC,limits={100,1531,1},userTicks={root:Packages:NIST:SAS:tickSDDNG7,root:Packages:NIST:SAS:lblSDDNG7 } 
    657671                        SetVariable setvar0,win=SASCALC,limits={100,1531,1} 
    658                         Slider SC_Slider_1,win=SASCALC,variable=root:Packages:NIST:SAS:gDetDist         //forces update 
    659672                         
     673                        if(detDist < 100 ) 
     674                                detDist = 100 
     675                        elseif (detDist > 1531 ) 
     676                                detDist = 1531 
     677                        endif 
     678                        // wavelength limits 
     679                        SetVariable setvar0_2 win=SASCALC,limits={4,20,0.1} 
     680                        if(lambda < 4) 
     681                                lambda = 4 
     682                        endif 
     683                        if(lambda > 20) 
     684                                lambda = 20 
     685                        endif 
     686                                                 
    660687                        // un-disable the sample table position 
    661688                        CheckBox checkChamber,win=SASCALC,disable=0 
     
    664691                        break 
    665692                         
    666                 case "NGA":             // 10m SANS 
     693                case "NGA":             // 10m SANS // TODO_10m: update values in this section 
    667694                        if(ng>2) 
    668695                                ng=2 
     
    673700                                        ControlInfo/W=SASCALC popup0 
    674701                                        mode=V_value 
    675                                         A1str="1.43 cm;2.22 cm;3.81 cm;" 
     702                                        A1str="1.3 cm;2.5 cm;3.8 cm;" 
    676703                                        break 
    677704                                default: 
    678                                         A1str = "5.08 cm;" 
     705                                        A1str = "5.0 cm;" 
    679706                                        mode=1 
    680707                        endswitch 
    681708                         
    682                         dlStr = "0.10;0.20;0.30;" 
    683                         Slider SC_Slider,limits={0,2,1},ticks=2                 //number of guides different on 10m SANS, 3 ticks 
     709                        dlStr = "0.10;0.132;0.154;0.25;" 
     710                        Slider SC_Slider win=SASCALC,limits={0,2,1},ticks=2                     //number of guides different on 10m SANS, 3 ticks 
     711                        Slider SC_Slider_1,win=SASCALC,limits={106,525,1},userTicks={root:Packages:NIST:SAS:tickSDDNGA,root:Packages:NIST:SAS:lblSDDNGA } 
     712                        SetVariable setvar0,win=SASCALC,limits={106,525,1} 
     713 
     714                        NVAR detDist=root:Packages:NIST:SAS:gDetDist 
     715                        if(detDist < 106 ) 
     716                                detDist = 106 
     717                        elseif (detDist > 525 ) 
     718                                detDist = 525 
     719                        endif 
    684720                         
    685                         Slider SC_Slider_1,win=SASCALC,limits={100,500,1},userTicks={root:Packages:NIST:SAS:tickSDDNGA,root:Packages:NIST:SAS:lblSDDNGA } 
    686                          
    687                         NVAR detDist=root:Packages:NIST:SAS:gDetDist 
    688                         if(detDist < 100 ) 
    689                                 detDist = 100 
    690                         elseif (detDist > 500 ) 
    691                                 detDist = 500 
     721                        // wavelength limits 
     722                        SetVariable setvar0_2 win=SASCALC,limits={3,30,0.1} 
     723                        if(lambda < 3) 
     724                                lambda = 3 
    692725                        endif 
    693                         SetVariable setvar0,win=SASCALC,limits={100,500,1} 
    694                         Slider SC_Slider_1,win=SASCALC,variable=root:Packages:NIST:SAS:gDetDist         //forces update 
    695  
     726                        if(lambda > 30) 
     727                                lambda = 30 
     728                        endif 
     729                                         
    696730                        // disable the sample table position, as long as the sample positions are identical for the 10 m 
    697731                        CheckBox checkChamber,win=SASCALC,disable=2 
     
    704738        endswitch 
    705739         
     740        // force update of the sliders 
     741        Slider SC_Slider,win=SASCALC,variable=root:Packages:NIST:SAS:gNg                                //guides 
     742        Slider SC_Slider_1,win=SASCALC,variable=root:Packages:NIST:SAS:gDetDist         //detector distance 
     743        Slider SC_Slider_2,win=SASCALC,variable=root:Packages:NIST:SAS:gOffset          //detector offset 
     744 
    706745 
    707746        ControlUpdate popup0 
     
    732771                sourceToSampleDist()            //updates the SSD global and wave 
    733772                //change the sourceAp popup, SDD range, etc 
    734                 UpdateControls() 
     773                UpdateControls()                                // the Ng global is actually set inside this function 
    735774                ReCalculateInten(recalc) 
    736775        endif 
     
    847886// currently, the 17.2 A for lens/prism @ ng3 must be typed in 
    848887// 
     888// TODO_10m: verify operation, no lenses @ 10m 
    849889Function LensCheckProc(ctrlName,checked) : CheckBoxControl 
    850890        String ctrlName 
     
    884924         
    885925                                ng=0 
    886                                 GuideSliderProc("",0,1)         //this updates the controls to the new # of guides 
    887                                  
     926                                Slider SC_Slider,win=SASCALC,variable=root:Packages:NIST:SAS:gNg 
     927                                GuideSliderProc("",0,1) 
     928 
    888929                                PopupMenu popup0,win=SASCALC,mode=1,popvalue="1.43 cm"          //first item in source aperture menu 
    889930                                 
     
    902943                                 
    903944                                ng=0 
     945                                Slider SC_Slider,win=SASCALC,variable=root:Packages:NIST:SAS:gNg 
    904946                                GuideSliderProc("",0,1) 
     947                                 
    905948                                PopupMenu popup0,win=SASCALC,mode=1,popvalue="1.43 cm"          //first item 
    906949                                 
     
    9781021End 
    9791022 
     1023// 
    9801024//simulation controls as a control bar that toggles on/off to the right 
    9811025// 
     
    10281072End 
    10291073 
     1074// 
    10301075// change the source aperture 
    10311076//  
     
    11801225                if(doMonteCarlo == 1) 
    11811226                        //2D simulation (in MultiScatter_MonteCarlo_2D.ipf) 
    1182                          
    1183                         // may want to take this back out--- 20 JUN 2011 SRK 
    1184                         // this call to detectorOffset() sets the (xCtr,yCtr) in RealsRead to default values of (64.5,64.5) 
    1185                         // -- if user changes the values in RealsRead to be able to do a proper average, the next sim starts wtih the 
    1186                         // wrong values... 
    1187                          
    1188                         detectorOffset() 
    11891227                         
    11901228                        Simulate_2D_MC(funcStr,aveint,qval,sigave,sigmaq,qbar,fsubs) 
     
    17021740// Incorporates eqn. 3-15 from J. Appl. Cryst. (1995) v. 28 p105-114 
    17031741// 
     1742// TODO_10m: verify, and does this match the "main" getResolution function? gravity? 
    17041743Function/S S_getResolution(inQ,lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,SigmaQ,QBar,fSubS) 
    17051744        Variable inQ, lambda, lambdaWidth, DDet, apOff, S1, S2, L1, L2, BS, del_r 
     
    19401979//parses the control for A1 diam 
    19411980// updates the wave 
     1981// TODO_10m: verify that this reads correctly (after I know the values) 
    19421982Function sourceApertureDiam() 
    19431983        ControlInfo/W=SASCALC popup0 
     
    20032043// for the 10m SANS, table position is inline, so S12 = 0 
    20042044// 
    2005 // TODO_10m -- for the 10m SANS - all of the numbers here are hard-wired and are WRONG 
    20062045// 
    20072046Function sourceToSampleDist() 
     
    20142053        SVAR selInstr = root:Packages:NIST:SAS:gInstStr 
    20152054 
     2055        Variable NGA_gap = 61.9         // extra distance between a1 and beginning of guide 1 on NGA 
     2056         
    20162057        strswitch(selInstr)     // string switch 
    20172058                case "NG3": 
     
    20232064                        // 10m SANS handled differently 
    20242065                        // s12 == 0 by definition 
    2025                         // TODO_10m:  -- put in CORRECT VALUES -- THESE ARE FICTIONAL 
    2026                         SSD = 470 - 155*NG - s12*(2-tableposition()) - L2Diff 
     2066                        // TODO_10m:  -- 16JAN13 - these are now correct values 
     2067                        if(ng==0) 
     2068                                SSD = 513 - L2diff 
     2069                        else                     
     2070                                SSD = 513 - NGA_gap - 150*NG - s12*(2-tableposition()) - L2Diff 
     2071                        endif 
    20272072                        break 
    20282073                default: 
    20292074                        DoAlert 0,"No matching instrument! sourceToSampleDist" 
    20302075        endswitch 
    2031          
     2076 
    20322077         
    20332078        WAVE rw=root:Packages:NIST:SAS:realsRead 
     
    20462091// 
    20472092// 
     2093// TODO_10m: correct values, verify 
    20482094Function numGuides(SSD) 
    20492095        variable SSD 
     
    20532099        //NVAR instrument = root:Packages:NIST:SAS:instrument 
    20542100        SVAR selInstr = root:Packages:NIST:SAS:gInstStr 
     2101 
     2102        Variable NGA_gap = 61.9         // extra distance between a1 and beginning of guide 1 on NGA 
    20552103 
    20562104        strswitch(selInstr)     // string switch 
     
    20642112                case "NGA": 
    20652113                        // 10m SANS handled differently 
    2066                         // TODO_10m:  -- put in CORRECT VALUES -- THESE ARE FICTIONAL 
    2067                         Ng = SSD*100 + 5 - 1632 
    2068                         Ng /= -155 
    2069          
     2114                        // TODO_10m:  -- 16JAN13 - these are now correct values 
     2115                        Ng = 513 - NGA_gap - SSD*100 -5 
     2116                        Ng /= 150 
     2117         
     2118                        if(ng < 0) 
     2119                                ng=0 
     2120                        endif 
     2121                         
    20702122                        break 
    20712123                default: 
    20722124                         
    20732125        endswitch 
    2074          
    2075  
    2076         Ng = round(Ng) 
     2126        Print "Ng = ",Ng 
     2127 
     2128        Ng = abs(round(Ng)) 
    20772129        return(Ng) 
    20782130End 
     
    21052157//  relative to the chamber) 
    21062158// updates the wave 
     2159// TODO_10m: verify 
    21072160Function sampleToDetectorDist() 
    21082161 
     
    21682221// 
    21692222// - in an approximate way, account for lenses 
     2223// TODO_10m: verify 
    21702224Function beamstopDiam() 
    21712225 
     
    23072361// 
    23082362// 
    2309 // TODO -- for the 10m SANS - all of the numbers need to be updated in the initialization 
    2310 // 
     2363// TODO_10m -- for the 10m SANS - all of the numbers need to be updated in the initialization 
    23112364Function beamIntensity() 
    23122365 
     
    23532406 
    23542407//estimate the number of pixels in the beam, and enforce the maximum countrate per pixel (idmax) 
     2408// TODO_10m: verify 
    23552409Function attenuatorTransmission() 
    23562410 
     
    23712425End 
    23722426 
     2427// TODO_10m: is this going to be close enough? Are the steps the same? 
    23732428Function attenuatorNumber() 
    23742429 
  • sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/Transmission.ipf

    r794 r887  
    286286                Wave GTransmission = $"root:myGlobals:TransHeaderInfo:S_Transmission" 
    287287                Wave S_GTrans_err =  $"root:myGlobals:TransHeaderInfo:S_Trans_Error" 
    288                 Wave GWhole = $"root:myGlobals:TransHeaderInfo:S_Whole" 
    289                  
    290                         //Transmission error 
    291                         InsertPoints lastPoint,1,S_GTrans_err 
    292                         S_GTrans_err[lastPoint] = getSampleTransError(fname) 
    293                          
     288                Wave GWhole = $"root:myGlobals:TransHeaderInfo:S_Whole"          
    294289        Endif 
    295290 
     
    333328        GLambda[lastPoint]=getWavelength(fname) 
    334329         
     330        if(isTrans==0)   
     331                //Transmission error 
     332                InsertPoints lastPoint,1,S_GTrans_err 
     333                S_GTrans_err[lastPoint] = getSampleTransError(fname) 
     334        Endif                    
     335                         
    335336        return(0) 
    336337End 
Note: See TracChangeset for help on using the changeset viewer.