Changeset 886 for sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS
- Timestamp:
- Jan 4, 2013 10:09:48 AM (10 years ago)
- 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 309 309 // Variable ,lambda,sdd,,refNum,trans,thick,xcenter,ycenter,numatten 310 310 // Variable lastPoint, beamstop,dum 311 Variable lastPoint,ctime,detcnt,cntrate ,instrumentNum311 Variable lastPoint,ctime,detcnt,cntrate//,instrumentNum 312 312 313 313 Wave/T GFilenames = $"root:myGlobals:CatVSHeaderInfo:Filenames" … … 445 445 // number of guides and sample position, only for NCNR 446 446 #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] 449 453 450 454 InsertPoints lastPoint,1,GNumGuides -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/CircSectAve.ipf
r779 r886 47 47 WAVE reals = $(destPath + ":RealsRead") 48 48 WAVE/T textread = $(destPath + ":TextRead") 49 String fileStr = textread[3]49 // String fileStr = textread[3] 50 50 51 51 // center of detector, for non-linear corrections -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_DataReadWrite.ipf
r871 r886 2492 2492 // [6] sample label 2493 2493 // [9] det type "ORNL " (6 chars) 2494 2494 2495 SVAR gInstStr = root:Packages:NIST:SAS:gInstStr 2496 2495 2497 tw[1] = Secs2Date(DateTime,-2)+" "+ Secs2Time(DateTime,3) //20 chars, not quite VAX format 2496 2498 tw[2] = "SIM" 2497 tw[3] = "[ NG7SANS99]"2499 tw[3] = "["+gInstStr+"SANS99]" 2498 2500 tw[4] = "C" 2499 2501 tw[5] = "01JAN09 " -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/NCNR_Utils.ipf
r868 r886 32 32 Variable/G root:myGlobals:PixelResNG5_ORNL = 0.5 33 33 Variable/G root:myGlobals:PixelResNG7_ORNL = 0.5 34 // Variable/G root:myGlobals:PixelResNGA_ORNL = 0.5 35 34 36 Variable/G root:myGlobals:PixelResDefault = 0.5 35 37 … … 37 39 Variable/G root:myGlobals:DeadtimeNG5_ILL = 3.0e-6 38 40 Variable/G root:myGlobals:DeadtimeNG7_ILL = 3.0e-6 41 Variable/G root:myGlobals:DeadtimeNGA_ILL = 3.0e-6 // fictional 39 42 Variable/G root:myGlobals:DeadtimeNG3_ORNL_VAX = 3.4e-6 //pre - 23-JUL-2009 used VAX 40 43 Variable/G root:myGlobals:DeadtimeNG3_ORNL_ICE = 1.5e-6 //post - 23-JUL-2009 used ICE … … 42 45 Variable/G root:myGlobals:DeadtimeNG7_ORNL_VAX = 3.4e-6 //pre 25-FEB-2010 used VAX 43 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) 44 48 Variable/G root:myGlobals:DeadtimeDefault = 3.4e-6 45 49 … … 409 413 NVAR PixelResNG5_ILL = root:myGlobals:PixelResNG5_ILL 410 414 NVAR PixelResNG7_ILL = root:myGlobals:PixelResNG7_ILL 415 NVAR PixelResNGA_ILL = root:myGlobals:PixelResNGA_ILL 411 416 NVAR PixelResNG3_ORNL = root:myGlobals:PixelResNG3_ORNL 412 417 NVAR PixelResNG5_ORNL = root:myGlobals:PixelResNG5_ORNL 413 418 NVAR PixelResNG7_ORNL = root:myGlobals:PixelResNG7_ORNL 419 NVAR PixelResNGA_ORNL = root:myGlobals:PixelResNGA_ORNL 414 420 NVAR PixelResDefault = root:myGlobals:PixelResDefault 415 421 … … 436 442 endif 437 443 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 438 451 default: 439 452 //return error? 453 DoAlert 0, "No matching instrument xDetectorPixelResolution-- Using default resolution" 440 454 DDet = PixelResDefault //0.5 cm, typical for new ORNL detectors 441 455 endswitch … … 460 474 // NG3 DECEMBER 2009 1.5 microseconds 461 475 // NG7 APRIL2010 2.3 microseconds 476 // NGA TBD 2013 477 // TODO_10m: measure proper dead time constants 478 // 462 479 // 463 480 // The day of the switch to ICE on NG7 was 25-FEB-2010 (per J. Krzywon) … … 477 494 NVAR DeadtimeNG5_ILL = root:myGlobals:DeadtimeNG5_ILL 478 495 NVAR DeadtimeNG7_ILL = root:myGlobals:DeadtimeNG7_ILL 496 NVAR DeadtimeNGA_ILL = root:myGlobals:DeadtimeNGA_ILL 479 497 NVAR DeadtimeNG3_ORNL_VAX = root:myGlobals:DeadtimeNG3_ORNL_VAX 480 498 NVAR DeadtimeNG3_ORNL_ICE = root:myGlobals:DeadtimeNG3_ORNL_ICE … … 482 500 NVAR DeadtimeNG7_ORNL_VAX = root:myGlobals:DeadtimeNG7_ORNL_VAX 483 501 NVAR DeadtimeNG7_ORNL_ICE = root:myGlobals:DeadtimeNG7_ORNL_ICE 502 NVAR DeadtimeNGA_ORNL_ICE = root:myGlobals:DeadtimeNGA_ORNL_ICE 484 503 NVAR DeadtimeDefault = root:myGlobals:DeadtimeDefault 485 504 … … 525 544 endif 526 545 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 527 554 default: 528 555 //return error? 556 DoAlert 0, "no matching instrument DetectorDeadtime, using default" 529 557 deadtime = DeadtimeDefault //1e-6 seconds, typical for new ORNL detectors 530 558 endswitch … … 1491 1519 End 1492 1520 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:::: 1526 Proc 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 1590 End 1591 1493 1592 //returns the transmission of the attenuator (at NG3) given the attenuator number 1494 1593 //which must be an integer(to select the wave) and given the wavelength. … … 1566 1665 if(!(WaveExists($attStr)) || !(WaveExists($lamStr)) || !(WaveExists($attErrWStr))) 1567 1666 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 1689 End 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 // 1705 Function 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()" 1568 1723 Endif 1569 1724 //just in case creating the tables fails.... … … 1610 1765 attenFactor = LookupAttenNG7(lam,attenNo,atten_err) 1611 1766 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 1612 1771 default: 1613 1772 //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" 1615 1774 attenFactor=1 1616 1775 endswitch … … 1633 1792 // Attenuation factor as defined here is <= 1 1634 1793 // 1635 // ORNLcan pass ("",1,attenuationFactor) and have this function simply1794 // HFIR can pass ("",1,attenuationFactor) and have this function simply 1636 1795 // spit back the attenuationFactor (that was read into rw[3]) 1637 1796 // … … 1658 1817 attenFactor = LookupAttenNG7(lam,attenNo,atten_err) 1659 1818 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 1660 1823 default: 1661 1824 //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" 1663 1826 attenFactor=1 1664 1827 endswitch -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/RectAnnulAvg.ipf
r665 r886 56 56 Wave reals = $(destPath + ":RealsRead") 57 57 WAVE/T textread = $(destPath + ":TextRead") 58 String fileStr = textread[3]58 // String fileStr = textread[3] 59 59 60 60 // center of detector, for non-linear corrections -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/SANS_Utilities.ipf
r872 r886 587 587 return match 588 588 End 589 590 591 // converts a hexadecimal string to a decimal value 592 // crude, no error checking 593 // 594 Function str2hex(str) 595 String str 596 597 Variable hex 598 599 sscanf str,"%x",hex 600 601 return(hex) 602 End -
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/SASCALC.ipf
r875 r886 25 25 // details of the distances, etc, but I'll fill that in as needed 26 26 // -- 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 // 27 31 // 28 32 // calculate what q-values you get based on the instruments settings … … 32 36 // - NOT true intensity, not counts, just a display 33 37 // 34 // TODO :38 // TODO_10m: 35 39 // 36 40 // -- For the 10m SANS... 41 // 37 42 // - how many guides are there 38 43 // - no lenses? focusing pinholes? … … 42 47 // - does this hook into anywhere in the main program? Attenuators, etc. 43 48 // 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 45 54 // 46 55 // Optional: … … 68 77 // 69 78 70 Constant show10mSANS = 079 Constant show10mSANS = 1 71 80 72 81 … … 81 90 Endif 82 91 83 // now a checkbox as needed84 // DoWindow/F MC_SASCALC85 // if(V_flag==0)86 // MC_SASCALC()87 // endif88 92 End 89 93 … … 111 115 112 116 // 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 114 119 Variable/G root:Packages:NIST:SAS:gNg=0 115 120 Variable/G root:Packages:NIST:SAS:gTable=2 //2=chamber, 1=table … … 164 169 Make/O/D/N=5 root:Packages:NIST:SAS:tickSDDNG3,root:Packages:NIST:SAS:tickSDDNG7 165 170 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:tickSDDNG 10167 Make/O/T/N=5 root:Packages:NIST:SAS:lblSDDNG 10171 Make/O/D/N=5 root:Packages:NIST:SAS:tickSDDNGA 172 Make/O/T/N=5 root:Packages:NIST:SAS:lblSDDNGA 168 173 root:Packages:NIST:SAS:tickSDDNG3 = {133,400,700,1000,1317} 169 174 root:Packages:NIST:SAS:lblSDDNG3 = {"133","400","700","1000","1317"} 170 175 root:Packages:NIST:SAS:tickSDDNG7 = {100,450,800,1150,1530} 171 176 root:Packages:NIST:SAS:lblSDDNG7 = {"100","450","800","1150","1530"} 172 root:Packages:NIST:SAS:tickSDDNG 10= {100,200,300,400,500}173 root:Packages:NIST:SAS:lblSDDNG 10= {"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"} 174 179 175 180 //for the fake dependency … … 187 192 188 193 String/G gSelectedInstrument="checkNG3" 189 Variable/G instrument = 3194 String/G gInstStr = "NG3" 190 195 191 196 Variable/G s12 = 54.8 … … 243 248 Variable/G l2diff = 5.0 244 249 // 250 251 252 UpdateSASHeader() 253 245 254 SetDataFolder root: 246 255 end … … 251 260 252 261 String/G gSelectedInstrument="checkNG7" 253 Variable/G instrument = 7262 String/G gInstStr = "NG7" 254 263 255 264 Variable/G s12 = 54.8 … … 307 316 Variable/G l2diff = 5.0 308 317 // 318 319 UpdateSASHeader() 309 320 SetDataFolder root: 310 321 end 311 322 312 323 /// 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 314 326 // which may be simpler here to keep functions from breaking... 315 327 … … 317 329 // most are completey wrong for the 10m SANS 318 330 // 319 Function initNG 10()331 Function initNGA() 320 332 321 333 SetDataFolder root:Packages:NIST:SAS 322 334 323 String/G gSelectedInstrument="checkNG 10"324 Variable/G instrument = 10335 String/G gSelectedInstrument="checkNGA" 336 String/G gInstStr = "NGA" 325 337 326 338 Variable/G s12 = 0 //** no difference between sample and huber position … … 354 366 355 367 //fwhm values (new variables) (+3, 0, -3, calibrated 2009) 356 Variable/G fwhm_narrow = 0.10 9357 Variable/G fwhm_mid = 0. 125358 Variable/G fwhm_wide = 0. 236368 Variable/G fwhm_narrow = 0.10 369 Variable/G fwhm_mid = 0.20 370 Variable/G fwhm_wide = 0.30 359 371 360 372 //source apertures (cm) … … 378 390 Variable/G l2diff = 5.0 379 391 // 392 UpdateSASHeader() 380 393 SetDataFolder root: 381 394 end 382 395 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 399 Function 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 406 End 383 407 384 408 Function S_fillDefaultHeader(iW,rW,tW) … … 387 411 388 412 // 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]" 390 416 391 417 // integer wave … … 492 518 // -- hide/unhide the 10m SANS 493 519 if(show10mSANS) 494 CheckBox checkNG 10,pos={110,19},size={40,14},proc=SelectInstrumentCheckProc,title="NG10"495 CheckBox checkNG 10,value=0,mode=1520 CheckBox checkNGA,pos={110,19},size={40,14},proc=SelectInstrumentCheckProc,title="NGA" 521 CheckBox checkNGA,value=0,mode=1 496 522 endif 497 523 // … … 564 590 //poll the controls on the panel, and change needed values 565 591 Variable isNG3,Ng,mode 566 // ControlInfo/W=SASCALC checkNG3 567 // isNG3=V_value 592 568 593 ControlInfo/W=SASCALC SC_slider 569 594 Ng=V_value 595 NVAR gNg = root:Packages:NIST:SAS:gNg 596 gNg = Ng //update the global from the panel 597 570 598 SVAR A1str= root:Packages:NIST:SAS:gSourceApString// = "1.43 cm;2.54 cm;3.81 cm;" 571 599 SVAR dlStr = root:Packages:NIST:SAS:gDeltaLambdaStr 572 SVAR selInstr = root:Packages:NIST:SAS:g SelectedInstrument600 SVAR selInstr = root:Packages:NIST:SAS:gInstStr 573 601 574 602 strswitch(selInstr) // string switch 575 case " checkNG3": //603 case "NG3": // 576 604 switch(ng) 577 605 case 0: … … 612 640 break 613 641 614 case " checkNG7": //642 case "NG7": // 615 643 switch(ng) 616 644 case 0: … … 636 664 break 637 665 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 639 671 switch(ng) 640 672 case 0: … … 651 683 Slider SC_Slider,limits={0,2,1},ticks=2 //number of guides different on 10m SANS, 3 ticks 652 684 653 Slider SC_Slider_1,win=SASCALC,limits={100,500,1},userTicks={root:Packages:NIST:SAS:tickSDDNG 10,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 } 654 686 655 687 NVAR detDist=root:Packages:NIST:SAS:gDetDist … … 669 701 670 702 default: // optional default expression executed 671 // when no case matches703 DoAlert 0,"No matching instrument! UpdateControls" // when no case matches 672 704 endswitch 673 705 … … 755 787 checkBox checkNG3,win=SASCALC, value=1 756 788 checkBox checkNG7,win=SASCALC, value=0 757 checkBox checkNG 10,win=SASCALC, value=0789 checkBox checkNGA,win=SASCALC, value=0 758 790 initNG3() 759 791 break … … 761 793 checkBox checkNG3,win=SASCALC, value=0 762 794 checkBox checkNG7,win=SASCALC, value=1 763 checkBox checkNG 10,win=SASCALC, value=0795 checkBox checkNGA,win=SASCALC, value=0 764 796 initNG7() 765 797 break 766 case "checkNG 10": // 10m SANS798 case "checkNGA": // 10m SANS 767 799 checkBox checkNG3,win=SASCALC, value=0 768 800 checkBox checkNG7,win=SASCALC, value=0 769 checkBox checkNG 10,win=SASCALC, value=1770 initNG 10()801 checkBox checkNGA,win=SASCALC, value=1 802 initNGA() 771 803 break 772 804 default: // optional default expression executed … … 826 858 NVAR lam = root:Packages:NIST:SAS:gLambda 827 859 NVAR dist = root:Packages:NIST:SAS:gDetDist 828 NVAR instrument = root:Packages:NIST:SAS:instrument860 // NVAR instrument = root:Packages:NIST:SAS:instrument 829 861 Wave rw=root:Packages:NIST:SAS:realsRead 830 862 863 SVAR selInstr = root:Packages:NIST:SAS:gInstStr 864 831 865 // directly uncheck the box, just set the flag and get out 832 866 if(checked == 0) … … 841 875 if(checked == 1) 842 876 lens = checked 843 s witch(instrument) // numericswitch844 case 3:877 strswitch(selInstr) // string switch 878 case "NG3": 845 879 dist = 1317 846 880 DetDistSliderProc("",1317,1) … … 860 894 861 895 break 862 case 7:896 case "NG7": 863 897 dist = 1531 864 898 DetDistSliderProc("",1531,1) … … 877 911 878 912 break 879 case 10:913 case "NGA": 880 914 // 10m SANS - force no lenses for now 881 915 // TODO: -- put in CORRECT VALUES -- THESE ARE FICTIONAL … … 886 920 break 887 921 default: 888 922 DoAlert 0,"No matching instrument! LCP" 889 923 endswitch 890 924 endif … … 894 928 // checkbox value... 895 929 // 930 896 931 // I'll uncheck as needed 897 932 Variable lensNotAllowed=0 … … 906 941 907 942 // instrument specific distance requirements 908 if( instrument == 3&& dist != 1317)943 if(cmpstr(selInstr,"NG3") == 0 && dist != 1317) 909 944 lensNotAllowed=1 910 945 endif 911 946 912 if( instrument == 7&& dist != 1531)947 if(cmpstr(selInstr,"NG7") == 0 && dist != 1531) 913 948 lensNotAllowed=1 914 949 endif 915 950 916 951 // 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) ) 918 953 lensNotAllowed=1 919 954 endif 920 955 921 if( instrument == 7&& lam != 8.09 )956 if(cmpstr(selInstr,"NG7") == 0 && lam != 8.09 ) 922 957 lensNotAllowed=1 923 958 endif 924 959 925 960 // right now, if 10m instrument, no lenses allowed 926 if( instrument == 10)961 if(cmpstr(selInstr,"NGA") == 0) 927 962 lensNotAllowed=1 928 963 endif … … 1825 1860 NVAR wavelength=gLambda 1826 1861 NVAR lambdaWidth=gDeltaLambda 1827 NVAR instrument = instrument1862 // NVAR instrument = instrument 1828 1863 NVAR L2diff = L2diff 1829 1864 NVAR lens = root:Packages:NIST:SAS:gUsingLenses 1830 1865 SVAR/Z aStr = root:Packages:NIST:gAngstStr 1866 SVAR selInstr = root:Packages:NIST:SAS:gInstStr 1867 1831 1868 1832 1869 sprintf temp,"Source Aperture Diameter =\t\t%6.2f cm\r",sourceApertureDiam() … … 1857 1894 // // add text of the user-edited values 1858 1895 // // 1859 sprintf temp,"***************** NG %d *****************\r",instrument1896 sprintf temp,"***************** %s *** %s *****************\r",selInstr,selInstr 1860 1897 str += temp 1861 1898 sprintf temp,"Sample Aperture Diameter =\t\t\t\t%.2f cm\r",sampleApertureDiam() … … 1966 2003 // for the 10m SANS, table position is inline, so S12 = 0 1967 2004 // 1968 // TODO -- for the 10m SANS - all of the numbers here are hard-wired and are WRONG2005 // TODO_10m -- for the 10m SANS - all of the numbers here are hard-wired and are WRONG 1969 2006 // 1970 2007 Function sourceToSampleDist() … … 1974 2011 NVAR L2Diff = root:Packages:NIST:SAS:L2Diff 1975 2012 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": 1981 2019 // NG3 and NG7 are both the same 1982 2020 SSD = 1632 - 155*NG - s12*(2-tableposition()) - L2Diff 1983 2021 break 1984 case 10:2022 case "NGA": 1985 2023 // 10m SANS handled differently 1986 2024 // s12 == 0 by definition 1987 // TODO : -- put in CORRECT VALUES -- THESE ARE FICTIONAL2025 // TODO_10m: -- put in CORRECT VALUES -- THESE ARE FICTIONAL 1988 2026 SSD = 470 - 155*NG - s12*(2-tableposition()) - L2Diff 1989 2027 break 1990 2028 default: 1991 2029 DoAlert 0,"No matching instrument! sourceToSampleDist" 1992 2030 endswitch 1993 1994 2031 1995 2032 … … 2004 2041 // SSD in meters 2005 2042 // 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 // 2007 2047 // 2008 2048 Function numGuides(SSD) … … 2011 2051 Variable Ng 2012 2052 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": 2018 2059 // NG3 and NG7 are both the same 2019 2060 Ng = SSD*100 + 5 - 1632 … … 2021 2062 2022 2063 break 2023 case 10:2064 case "NGA": 2024 2065 // 10m SANS handled differently 2025 // TODO : -- put in CORRECT VALUES -- THESE ARE FICTIONAL2066 // TODO_10m: -- put in CORRECT VALUES -- THESE ARE FICTIONAL 2026 2067 Ng = SSD*100 + 5 - 1632 2027 2068 Ng /= -155
Note: See TracChangeset
for help on using the changeset viewer.