Changeset 887 for sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS
- Timestamp:
- Jan 16, 2013 3:44:53 PM (10 years ago)
- 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 1124 1124 RenameWindow #,T_results 1125 1125 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(),";") 1126 1129 EndMacro 1127 1130 … … 1543 1546 1544 1547 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 1545 1552 endif 1546 1553 … … 1703 1710 root:Packages:NIST:SAS:gDoMonteCarlo = 0 // == 1 if 2D MonteCarlo set by hidden flag 1704 1711 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 1706 1715 EndMacro 1707 1716 … … 1791 1800 1792 1801 // 1793 // 1802 // set up a fake protocol with the simulation results, then call one of the 1803 // standard writing routines 1794 1804 // 1795 1805 Function Save_1DSimData(ctrlName) : ButtonControl … … 1798 1808 String type="SAS",fullpath="" 1799 1809 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 1824 End 1825 1826 // type is the folder type 1827 // 1828 // Protocol is SIMProtocol, and overwrites every time 1829 // 1830 Function FillFake_SIMProtocol(type) 1831 String type 1800 1832 1801 1833 String destStr="" … … 1808 1840 1809 1841 If(1) 1810 //setup a "fake protocol" wave, si ce I have no idea of the current state of the data1842 //setup a "fake protocol" wave, since I have no idea of the current state of the data 1811 1843 Make/O/T/N=8 root:myGlobals:Protocols:SIMProtocol 1812 1844 Wave/T SIMProtocol = $"root:myGlobals:Protocols:SIMProtocol" … … 1833 1865 Endif 1834 1866 1835 1836 NVAR useXMLOutput = root:Packages:NIST:gXML_Write1837 1838 if (useXMLOutput == 1)1839 WriteXMLWaves_W_Protocol(type,"",1)1840 else1841 WriteWaves_W_Protocol(type,"",1) //"" is an empty path, 1 will force a dialog1842 endif1843 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:gProtoStr1857 // Wave/T proto=$("root:myGlobals:Protocols:"+gProtoStr)1858 //1859 // //check each wave1860 // If(!(WaveExists(intw)))1861 // Abort "intw DNExist Save_1DSimData()"1862 // Endif1863 // If(!(WaveExists(rw)))1864 // Abort "rw DNExist Save_1DSimData()"1865 // Endif1866 // If(!(WaveExists(textw)))1867 // Abort "textw DNExist Save_1DSimData()"1868 // Endif1869 // If(!(WaveExists(qvals)))1870 // Abort "qvals DNExist Save_1DSimData()"1871 // Endif1872 // If(!(WaveExists(inten)))1873 // Abort "inten DNExist Save_1DSimData()"1874 // Endif1875 // If(!(WaveExists(sig)))1876 // Abort "sig DNExist Save_1DSimData()"1877 // Endif1878 // If(!(WaveExists(qbar)))1879 // Abort "qbar DNExist Save_1DSimData()"1880 // Endif1881 // If(!(WaveExists(sigmaq)))1882 // Abort "sigmaq DNExist Save_1DSimData()"1883 // Endif1884 // If(!(WaveExists(fsubs)))1885 // Abort "fsubs DNExist Save_1DSimData()"1886 // Endif1887 // If(!(WaveExists(proto)))1888 // Abort "current protocol wave DNExist Save_1DSimData()"1889 // Endif1890 //1891 // //strings can be too long to print-- must trim to 255 chars1892 // Variable ii,num=81893 // Make/O/T/N=(num) tempShortProto1894 // for(ii=0;ii<num;ii+=1)1895 // tempShortProto[ii] = (proto[ii])[0,240]1896 // endfor1897 //1898 // if(dialog)1899 // PathInfo/S catPathName1900 // fullPath = DoSaveFileDialog("Save data as")1901 // If(cmpstr(fullPath,"")==0)1902 // //user cancel, don't write out a file1903 // Close/A1904 // Abort "no data file was written"1905 // Endif1906 // //Print "dialog fullpath = ",fullpath1907 // Endif1908 //1909 // NVAR monCt = root:Packages:NIST:SAS:gImon1910 // NVAR thick = root:Packages:NIST:SAS:gThick1911 // NVAR trans = root:Packages:NIST:SAS:gSamTrans //for 1D, default value1912 //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 here1922 // Open refNum as fullpath1923 //1924 // //write out the standard header information1925 // 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,hdrStr11929 // fprintf refnum,"BCENT(X,Y) A1(mm) A2(mm) A1A2DIST(m) DL/L BSTOP(mm) DET_TYP \r\n"1930 // fprintf refnum,hdrStr21931 //// fprintf refnum,headerFormat,rw[0],rw[26],rw[19],rw[18],rw[4],rw[5],ave,step1932 //1933 // //insert protocol information here1934 // //-1 list of sample files1935 // //0 - bkg1936 // //1 - emp1937 // //2 - div1938 // //3 - mask1939 // //4 - abs params c2-c51940 // //5 - average params1941 // 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 columns1950 // 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,fsubs1952 //1953 // Close refnum1954 //1955 // SetDataFolder root: //(redundant)1956 //1957 // //write confirmation of write operation to history area1958 // Print "Averaged File written: ", GetFileNameFromPathNoSemi(fullPath)1959 // KillWaves/Z tempShortProto1960 //1961 // //clear the stuff that was created for case of saving files1962 // If(1)1963 // Killwaves/Z root:myGlobals:Protocols:SIMProtocol1964 // String/G root:myGlobals:Protocols:gProtoStr = ""1965 // Endif1966 //1967 1968 1867 return(0) 1969 1970 End 1868 End 1869 1971 1870 1972 1871 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_Utils.ipf
r886 r887 39 39 Variable/G root:myGlobals:DeadtimeNG5_ILL = 3.0e-6 40 40 Variable/G root:myGlobals:DeadtimeNG7_ILL = 3.0e-6 41 Variable/G root:myGlobals:DeadtimeNGA_ILL = 3.0e-6 // fictional41 Variable/G root:myGlobals:DeadtimeNGA_ILL = 4.0e-6 // fictional 42 42 Variable/G root:myGlobals:DeadtimeNG3_ORNL_VAX = 3.4e-6 //pre - 23-JUL-2009 used VAX 43 43 Variable/G root:myGlobals:DeadtimeNG3_ORNL_ICE = 1.5e-6 //post - 23-JUL-2009 used ICE … … 45 45 Variable/G root:myGlobals:DeadtimeNG7_ORNL_VAX = 3.4e-6 //pre 25-FEB-2010 used VAX 46 46 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 48 48 Variable/G root:myGlobals:DeadtimeDefault = 3.4e-6 49 49 … … 1523 1523 // are measured 1524 1524 // 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 // 1525 1530 // TODO_10m:::: 1526 1531 Proc MakeNGAAttenTable() … … 1691 1696 //returns the transmission of the attenuator (at NGA) given the attenuator number 1692 1697 //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 interpolated1698 //the wavelength may be any value between 3 and 30 (A), and is interpolated 1694 1699 //between calibrated wavelengths for a given attenuator 1695 1700 // … … 1699 1704 // 1700 1705 // 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 1702 1707 // 1703 1708 // TODO_10m:::: 1704 //1705 1709 Function LookupAttenNGA(lambda,attenNo,atten_err) 1706 1710 Variable lambda, attenNo, &atten_err … … 1715 1719 endif 1716 1720 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" 1719 1723 Endif 1720 1724 … … 1767 1771 case "NGA": 1768 1772 Print "Using the NG7 table for NGA *** this needs to be updated ***" 1769 attenFactor = LookupAttenNG 7(lam,attenNo,atten_err)1773 attenFactor = LookupAttenNGA(lam,attenNo,atten_err) 1770 1774 break 1771 1775 default: … … 1819 1823 case "NGA": 1820 1824 Print "Using the NG7 table for NGA *** this needs to be updated ***" 1821 attenFactor = LookupAttenNG 7(lam,attenNo,atten_err)1825 attenFactor = LookupAttenNGA(lam,attenNo,atten_err) 1822 1826 break 1823 1827 default: -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/SASCALC.ipf
r886 r887 51 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 52 // 53 // use str2hex(str) (my function) to conver "A" to 1053 // use str2hex(str) (my function) to convert "A" to 10 54 54 // 55 55 // Optional: … … 105 105 root:Packages:NIST:SAS:data = 1 106 106 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 109 108 110 109 // other variables … … 156 155 Variable/G root:Packages:NIST:SAS:g_1DEstDetCR = 0 // estimated detector count rate 157 156 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) 159 158 Variable/G root:Packages:NIST:SAS:g_1D_DoABS = 1 160 159 Variable/G root:Packages:NIST:SAS:g_1D_AddNoise = 1 … … 175 174 root:Packages:NIST:SAS:tickSDDNG7 = {100,450,800,1150,1530} 176 175 root:Packages:NIST:SAS:lblSDDNG7 = {"100","450","800","1150","1530"} 177 root:Packages:NIST:SAS:tickSDDNGA = {10 0,200,300,400,500}178 root:Packages:NIST:SAS:lblSDDNGA = {"10 0","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"} 179 178 180 179 //for the fake dependency … … 185 184 Variable/G root:Packages:NIST:SAS:gDoTraceOffset=0 // (1==Yes, offset 2^n), 0==turn off the offset 186 185 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 187 190 End 188 191 … … 195 198 196 199 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 199 202 Variable/G del_r = 0.5 200 203 Variable/G det_width = 64.0 … … 223 226 Variable/G gGuide_loss = 0.924 224 227 225 //fwhm values (new variables) (+3, 0, -3, calibrated 2009)226 Variable/G fwhm_narrow = 0.109227 Variable/G fwhm_mid = 0.125228 Variable/G fwhm_wide = 0.236229 230 //source apertures (cm)231 Variable/G a1_0_0 = 1.43232 Variable/G a1_0_1 = 2.54233 Variable/G a1_0_2 = 3.81234 Variable/G a1_7_0 = 2.5 // after the polarizer235 Variable/G a1_7_1 = 5.0236 Variable/G a1_7_1 = 0.95 // new Mar 2012 9.5 mm diameter source aperture237 Variable/G a1_def = 5.00228 // //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 238 241 239 242 //default configuration values … … 263 266 264 267 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 267 270 Variable/G del_r = 0.5 268 271 Variable/G det_width = 64.0 … … 292 295 Variable/G gGuide_loss = 0.974 293 296 294 //fwhm values (new variables)295 Variable/G fwhm_narrow = 0.09296 Variable/G fwhm_mid = 0.115 //2009297 Variable/G fwhm_wide = 0.22298 299 //source apertures (cm)300 Variable/G a1_0_0 = 1.43301 Variable/G a1_0_1 = 2.22302 Variable/G a1_0_2 = 3.81303 Variable/G a1_7_0 = 5.0 // don't apply to NG7304 Variable/G a1_7_1 = 5.0305 Variable/G a1_def = 5.00297 // //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 306 309 307 310 //default configuration values … … 329 332 // most are completey wrong for the 10m SANS 330 333 // 334 // TODO_10m: 331 335 Function initNGA() 332 336 … … 337 341 338 342 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 341 345 Variable/G del_r = 0.5 342 346 Variable/G det_width = 64.0 343 347 Variable/G lambda_t = 5.50 344 Variable/G l2r_lower = 10 0345 Variable/G l2r_upper = 5 00346 Variable/G lambda_lower = 2.5347 Variable/G lambda_upper = 20.0348 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 348 352 Variable/G d_upper = 25.0 //** 349 353 Variable/G bs_factor = 1.05 //** … … 353 357 Variable/G l_gap = 100.0 //** 354 358 Variable/G guide_width = 6.0 //** 355 Variable/G idmax = 100.0 //** 359 Variable/G idmax = 100.0 //** max count rate per pixel 356 360 // //old values, from 3/2002 357 361 // Variable/G phi_0 = 2.95e13 … … 365 369 Variable/G gGuide_loss = 0.924 366 370 367 //fwhm values (new variables) (+3, 0, -3, calibrated 2009)368 Variable/G fwhm_narrow = 0.10369 Variable/G fwhm_mid = 0.20370 Variable/G fwhm_wide = 0.30371 372 //source apertures (cm)373 Variable/G a1_0_0 = 1.43374 Variable/G a1_0_1 = 2.54375 Variable/G a1_0_2 = 3.81376 Variable/G a1_7_0 = 2.5 // after the polarizer377 Variable/G a1_7_1 = 5.0378 Variable/G a1_7_1 = 0.95 // new Mar 2012 9.5 mm diameter source aperture379 Variable/G a1_def = 5.00380 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 // 381 385 //default configuration values 382 386 // ng = 0 … … 445 449 End 446 450 447 451 // TODO_10m: verify that controls have the proper limits for 10m SANS (see UpdateControls()) 448 452 Window SASCALC_Panel() 449 453 … … 587 591 // set the wavelength spread popup 588 592 // 593 // TODO_10m: 589 594 Function UpdateControls() 590 595 //poll the controls on the panel, and change needed values … … 599 604 SVAR dlStr = root:Packages:NIST:SAS:gDeltaLambdaStr 600 605 SVAR selInstr = root:Packages:NIST:SAS:gInstStr 606 NVAR lambda = root:Packages:NIST:SAS:gLambda 601 607 602 608 strswitch(selInstr) // string switch … … 622 628 //wavelength spread 623 629 dlStr = "0.109;0.125;0.236;" //updated calibration 2009 624 Slider SC_Slider ,limits={0,8,1},ticks=1630 Slider SC_Slider win=SASCALC,limits={0,8,1},ticks=1 625 631 //detector limits 632 Slider SC_Slider_1,win=SASCALC,limits={133,1317,1},userTicks={root:Packages:NIST:SAS:tickSDDNG3,root:Packages:NIST:SAS:lblSDDNG3 } 626 633 SetVariable setvar0,win=SASCALC,limits={133,1317,1} 627 634 NVAR detDist=root:Packages:NIST:SAS:gDetDist … … 631 638 detDist = 1317 632 639 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 635 649 636 650 // un-disable the sample table position … … 653 667 654 668 dlStr = "0.09;0.115;0.22;" 655 Slider SC_Slider ,limits={0,8,1},ticks=1669 Slider SC_Slider win=SASCALC,limits={0,8,1},ticks=1 656 670 Slider SC_Slider_1,win=SASCALC,limits={100,1531,1},userTicks={root:Packages:NIST:SAS:tickSDDNG7,root:Packages:NIST:SAS:lblSDDNG7 } 657 671 SetVariable setvar0,win=SASCALC,limits={100,1531,1} 658 Slider SC_Slider_1,win=SASCALC,variable=root:Packages:NIST:SAS:gDetDist //forces update659 672 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 660 687 // un-disable the sample table position 661 688 CheckBox checkChamber,win=SASCALC,disable=0 … … 664 691 break 665 692 666 case "NGA": // 10m SANS 693 case "NGA": // 10m SANS // TODO_10m: update values in this section 667 694 if(ng>2) 668 695 ng=2 … … 673 700 ControlInfo/W=SASCALC popup0 674 701 mode=V_value 675 A1str="1. 43 cm;2.22 cm;3.81cm;"702 A1str="1.3 cm;2.5 cm;3.8 cm;" 676 703 break 677 704 default: 678 A1str = "5.0 8cm;"705 A1str = "5.0 cm;" 679 706 mode=1 680 707 endswitch 681 708 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 684 720 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 692 725 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 696 730 // disable the sample table position, as long as the sample positions are identical for the 10 m 697 731 CheckBox checkChamber,win=SASCALC,disable=2 … … 704 738 endswitch 705 739 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 706 745 707 746 ControlUpdate popup0 … … 732 771 sourceToSampleDist() //updates the SSD global and wave 733 772 //change the sourceAp popup, SDD range, etc 734 UpdateControls() 773 UpdateControls() // the Ng global is actually set inside this function 735 774 ReCalculateInten(recalc) 736 775 endif … … 847 886 // currently, the 17.2 A for lens/prism @ ng3 must be typed in 848 887 // 888 // TODO_10m: verify operation, no lenses @ 10m 849 889 Function LensCheckProc(ctrlName,checked) : CheckBoxControl 850 890 String ctrlName … … 884 924 885 925 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 888 929 PopupMenu popup0,win=SASCALC,mode=1,popvalue="1.43 cm" //first item in source aperture menu 889 930 … … 902 943 903 944 ng=0 945 Slider SC_Slider,win=SASCALC,variable=root:Packages:NIST:SAS:gNg 904 946 GuideSliderProc("",0,1) 947 905 948 PopupMenu popup0,win=SASCALC,mode=1,popvalue="1.43 cm" //first item 906 949 … … 978 1021 End 979 1022 1023 // 980 1024 //simulation controls as a control bar that toggles on/off to the right 981 1025 // … … 1028 1072 End 1029 1073 1074 // 1030 1075 // change the source aperture 1031 1076 // … … 1180 1225 if(doMonteCarlo == 1) 1181 1226 //2D simulation (in MultiScatter_MonteCarlo_2D.ipf) 1182 1183 // may want to take this back out--- 20 JUN 2011 SRK1184 // 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 the1186 // wrong values...1187 1188 detectorOffset()1189 1227 1190 1228 Simulate_2D_MC(funcStr,aveint,qval,sigave,sigmaq,qbar,fsubs) … … 1702 1740 // Incorporates eqn. 3-15 from J. Appl. Cryst. (1995) v. 28 p105-114 1703 1741 // 1742 // TODO_10m: verify, and does this match the "main" getResolution function? gravity? 1704 1743 Function/S S_getResolution(inQ,lambda,lambdaWidth,DDet,apOff,S1,S2,L1,L2,BS,del_r,SigmaQ,QBar,fSubS) 1705 1744 Variable inQ, lambda, lambdaWidth, DDet, apOff, S1, S2, L1, L2, BS, del_r … … 1940 1979 //parses the control for A1 diam 1941 1980 // updates the wave 1981 // TODO_10m: verify that this reads correctly (after I know the values) 1942 1982 Function sourceApertureDiam() 1943 1983 ControlInfo/W=SASCALC popup0 … … 2003 2043 // for the 10m SANS, table position is inline, so S12 = 0 2004 2044 // 2005 // TODO_10m -- for the 10m SANS - all of the numbers here are hard-wired and are WRONG2006 2045 // 2007 2046 Function sourceToSampleDist() … … 2014 2053 SVAR selInstr = root:Packages:NIST:SAS:gInstStr 2015 2054 2055 Variable NGA_gap = 61.9 // extra distance between a1 and beginning of guide 1 on NGA 2056 2016 2057 strswitch(selInstr) // string switch 2017 2058 case "NG3": … … 2023 2064 // 10m SANS handled differently 2024 2065 // 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 2027 2072 break 2028 2073 default: 2029 2074 DoAlert 0,"No matching instrument! sourceToSampleDist" 2030 2075 endswitch 2031 2076 2032 2077 2033 2078 WAVE rw=root:Packages:NIST:SAS:realsRead … … 2046 2091 // 2047 2092 // 2093 // TODO_10m: correct values, verify 2048 2094 Function numGuides(SSD) 2049 2095 variable SSD … … 2053 2099 //NVAR instrument = root:Packages:NIST:SAS:instrument 2054 2100 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 2055 2103 2056 2104 strswitch(selInstr) // string switch … … 2064 2112 case "NGA": 2065 2113 // 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 2070 2122 break 2071 2123 default: 2072 2124 2073 2125 endswitch 2074 2075 2076 Ng = round(Ng)2126 Print "Ng = ",Ng 2127 2128 Ng = abs(round(Ng)) 2077 2129 return(Ng) 2078 2130 End … … 2105 2157 // relative to the chamber) 2106 2158 // updates the wave 2159 // TODO_10m: verify 2107 2160 Function sampleToDetectorDist() 2108 2161 … … 2168 2221 // 2169 2222 // - in an approximate way, account for lenses 2223 // TODO_10m: verify 2170 2224 Function beamstopDiam() 2171 2225 … … 2307 2361 // 2308 2362 // 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 2311 2364 Function beamIntensity() 2312 2365 … … 2353 2406 2354 2407 //estimate the number of pixels in the beam, and enforce the maximum countrate per pixel (idmax) 2408 // TODO_10m: verify 2355 2409 Function attenuatorTransmission() 2356 2410 … … 2371 2425 End 2372 2426 2427 // TODO_10m: is this going to be close enough? Are the steps the same? 2373 2428 Function attenuatorNumber() 2374 2429 -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/Transmission.ipf
r794 r887 286 286 Wave GTransmission = $"root:myGlobals:TransHeaderInfo:S_Transmission" 287 287 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" 294 289 Endif 295 290 … … 333 328 GLambda[lastPoint]=getWavelength(fname) 334 329 330 if(isTrans==0) 331 //Transmission error 332 InsertPoints lastPoint,1,S_GTrans_err 333 S_GTrans_err[lastPoint] = getSampleTransError(fname) 334 Endif 335 335 336 return(0) 336 337 End
Note: See TracChangeset
for help on using the changeset viewer.