Changeset 930 for sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS
- Timestamp:
- Jan 21, 2014 6:10:21 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sans/Dev/trunk/NCNR_User_Procedures/Reduction/SANS/SASCALC.ipf
r902 r930 27 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 28 // NGB, so this will have to do. files will be SA4 and SA5 respectively, if the VAX naming continues 29 // 29 // 21 Jan 2014 MJW - Added creation of strings representing NICE configurations and the ability to output these strings to a text document. 30 // Configuration string variables are saved using the Freeze button (2 per configuration, one for scattering 31 // and one for transmission) and deleted using the clear button. 32 // Configurations are outputted to text using command "SaveNICEConfigs()" 30 33 // 31 34 // … … 1294 1297 ModifyGraph msize($("aveint_"+num2str(ct)))=2 1295 1298 ErrorBars/T=0 $("aveint_"+num2str(ct)) Y,wave=($("sigave_"+num2str(ct)),$("sigave_"+num2str(ct))) 1299 NICEConfigText(ct) //create NICE configuration string variables 1300 1296 1301 1297 1302 switch(mod(ct,10)) // 10 different colors - black is the unfrozen color … … 1367 1372 RemoveFromGraph $("aveint_"+num2str(ii)) 1368 1373 Killwaves/Z $("aveint_"+num2str(ii)),$("qval_"+num2str(ii)) 1374 KillStrings/Z $("nice_config_s_"+num2str(ii)),$("nice_config_t_"+num2str(ii)) //Kill NICE configuration string variables 1369 1375 endfor 1370 1376 ct=1 … … 1977 1983 End 1978 1984 1985 1986 //Write String Variables representing NICE SANS configurations. 1987 Function NICEConfigText(ct) 1988 variable ct 1989 1990 string NICENameS = "nice_config_s_"+num2str(ct) 1991 string NICENameT = "nice_config_t_"+num2str(ct) 1992 1993 SetDataFolder root:Packages:NIST:SAS 1994 1995 string temp_s, temp_t 1996 1997 NVAR numberOfGuides=gNg 1998 NVAR wavelength=gLambda 1999 NVAR lambdaWidth=gDeltaLambda 2000 2001 //example from a working NICE trajectory 2002 //"'{1.1m5={attenuator.key=0,wavelength.wavelength=\"5Angstrom\",wavelengthSpread.wavelengthSpread=0.132, guide.guide=0, guide.aperture=\"25.4mm\", beamStop.beamStop=\"2\", beamStopX.X=\"0.1cm\", beamStopY.softPosition=\"6.1cm\",beamStop.beamCenterX= 113.3, beamStop.beamCenterY= 62.5, geometry.sampleToDetectorDistance=\"110cm\", detectorOffset.softPosition=\"25cm\"} 2003 2004 // Make two configurations, one for Scattering and one for Transmission 2005 temp_s = "" 2006 temp_t = "" 2007 //Give random names 2008 //TODO: name the configurations when they are "frozen" 2009 temp_s = "config_"+num2str(ct)+"_s={" 2010 temp_t = "config_"+num2str(ct)+"_t={" 2011 2012 temp_s += "attenuator.key="+"0"+"," 2013 temp_s += "wavelength.wavelength=\\\""+num2str(wavelength)+"Angstrom\\\"," 2014 temp_s += "wavelengthSpread.wavelengthSpread="+num2str(lambdaWidth)+"," 2015 temp_s += "guide.guide="+num2str(numberOfGuides)+"," 2016 temp_s += "guide.aperture=\\\""+num2str(sourceApertureDiam())+"cm\\\"," 2017 temp_s += "beamStop.beamStop=\\\""+num2istr(beamstopDiam()/2.54)+"\\\"," 2018 temp_s += "beamStopX.X=\\\""+"0"+"cm\\\"," 2019 temp_s += "beamStopY.softPosition=\\\""+"0"+"cm\\\"," 2020 temp_s += "beamStop.beamCenterX="+num2str(64+detectorOffset()*2)+"," 2021 temp_s += "beamStop.beamCenterY="+"64"+"," 2022 temp_s += "geometry.sampleToDetectorDistance=\\\""+num2str( chamberToDetectorDist())+"cm\\\"," 2023 temp_s += "detectorOffset.softPosition=\\\""+num2str(detectorOffset())+"cm\\\"" 2024 2025 temp_t += "attenuator.key="+num2str(attenuatorNumber())+"," 2026 temp_t += "wavelength.wavelength=\\\""+num2str(wavelength)+"Anstrom\\\"," 2027 temp_t += "wavelengthSpread.wavelengthSpread="+num2str(lambdaWidth)+"," 2028 temp_t += "guide.guide="+num2str(numberOfGuides)+"," 2029 temp_t += "guide.aperture=\\\""+num2str(sourceApertureDiam())+"cm\\\"," 2030 temp_t += "beamStop.beamStop=\\\""+num2istr(beamstopDiam()/2.54)+"\\\"," 2031 temp_t += "beamStopX.X=\\\""+"0"+"cm\\\"," 2032 temp_t += "beamStopY.softPosition=\\\""+"0"+"cm\\\"," 2033 temp_t += "beamStop.beamCenterX="+num2str(64+detectorOffset()*2)+"," 2034 temp_t += "beamStop.beamCenterY="+"64"+"," 2035 temp_t += "geometry.sampleToDetectorDistance=\\\""+num2str( chamberToDetectorDist())+"cm\\\"," 2036 temp_t += "detectorOffset.softPosition=\\\""+num2str(detectorOffset())+"cm\\\"" 2037 2038 temp_s += "}" 2039 temp_t += "}" 2040 2041 SetDataFolder root:Packages:NIST:SAS 2042 2043 string/g $NICENameS = temp_s 2044 string/g $NICENameT = temp_t 2045 2046 SetDataFolder root:Packages:NIST:SAS 2047 2048 return (0) 2049 end 2050 2051 //Export NICE SANS configurations to a plain text file. 2052 Function SaveNICEConfigs() 2053 2054 String str="" 2055 NVAR ct=root:Packages:NIST:SAS:gFreezeCount 2056 2057 SetDataFolder root:Packages:NIST:SAS 2058 2059 if (ct == 1) 2060 DoAlert 0, "No Configurations are available" 2061 return (0) 2062 endif 2063 2064 str = "{\r" 2065 string tempNameS, tempNameT 2066 2067 variable i = 1 2068 do 2069 tempNameS = "nice_config_s_"+num2str(i) 2070 tempNameT = "nice_config_t_"+num2str(i) 2071 SVAR tempS = $tempNameS 2072 SVAR tempT = $tempNameT 2073 if (i != 1) 2074 str += ",\r" 2075 endif 2076 str += tempS + ",\r" 2077 str += tempT 2078 i +=1 2079 while (i<ct) 2080 2081 str += "\r" 2082 str += "}" 2083 2084 NewNotebook/F=1/N=NICE_Configurations /W=(480,400,880,725) 2085 Notebook NICE_Configurations text=str 2086 SaveNotebook/S=6/I NICE_Configurations as "NICE_Configs.txt" 2087 KillWindow NICE_Configurations 2088 2089 SetDataFolder root: 2090 return (0) 2091 2092 end 2093 1979 2094 Function DisplayConfigurationText() 1980 2095
Note: See TracChangeset
for help on using the changeset viewer.