 Timestamp:
 Mar 26, 2019 1:58:56 PM (4 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

sans/Dev/trunk/NCNR_User_Procedures/Reduction/VSANS/VC_UtilityProcedures.ipf
r1133 r1134 21 21 22 22 23 // returns the panel separation [cm]23 // returns the panel translation [cm] 24 24 Function VCALC_getPanelTranslation(type) 25 25 String type … … 199 199 200 200 201 201 Function VC_getNumGuides() 202 203 Variable ng 204 ControlInfo/W=VCALC VCALCCtrl_0a 205 ng = V_Value 206 return(ng) 207 End 202 208 ////////////////////////////////// 203 209 // … … 737 743 return(sdd) 738 744 end 739 745 746 747 748 Function V_sampleToGateValve() 749 // VCALCCtrl_1e is Sample Pos to Gate Valve (cm) 750 ControlInfo/W=VCALC VCALCCtrl_1e 751 return(V_Value) 752 end 753 754 755 Function V_sampleApertureToGateValve() 756 // VCALCCtrl_1d is Sample Aperture to Gate Valve (cm) 757 ControlInfo/W=VCALC VCALCCtrl_1d 758 return(V_Value) 759 end 760 761 762 763 // 1=front 764 // 2=middle 765 // 3=back 766 // return value is in cm 767 // gate valve to detector (= nominal distance) is reported 768 // Top/Bottom setback is NOT included 769 Function VC_getGateValveToDetDist(detStr) 770 String detStr 771 772 Variable sdd 773 774 strswitch(detstr) 775 case "B": 776 case "B ": 777 ControlInfo/W=VCALC VCALCCtrl_4b 778 break 779 case "ML": 780 case "MR": 781 case "MT": 782 case "MB": 783 ControlInfo/W=VCALC VCALCCtrl_3d 784 break 785 case "FL": 786 case "FR": 787 case "FT": 788 case "FB": 789 ControlInfo/W=VCALC VCALCCtrl_2d 790 break 791 default: 792 Print "no case matched in VC_getSDD()" 793 endswitch 794 795 // this is gate valve to detector distance 796 sdd = V_Value 797 798 return(sdd) 799 end 740 800 741 801 // TODO … … 1952 2012 end 1953 2013 1954 2014 Function/S V_SetConfigurationText() 2015 2016 String str="",temp 2017 2018 // SetDataFolder root:Packages:NIST:SAS 2019 // 2020 // NVAR numberOfGuides=gNg 2021 // NVAR gTable=gTable //2=chamber, 1=table 2022 // NVAR wavelength=gLambda 2023 // NVAR lambdaWidth=gDeltaLambda 2024 //// NVAR instrument = instrument 2025 // NVAR L2diff = L2diff 2026 // NVAR lens = root:Packages:NIST:SAS:gUsingLenses 2027 // SVAR/Z aStr = root:Packages:NIST:gAngstStr 2028 // SVAR selInstr = root:Packages:NIST:SAS:gInstStr 2029 2030 NVAR min_f = root:Packages:NIST:VSANS:VCALC:gQmin_F 2031 NVAR max_f = root:Packages:NIST:VSANS:VCALC:gQmax_F 2032 NVAR min_m = root:Packages:NIST:VSANS:VCALC:gQmin_M 2033 NVAR max_m = root:Packages:NIST:VSANS:VCALC:gQmax_M 2034 NVAR min_b = root:Packages:NIST:VSANS:VCALC:gQmin_B 2035 NVAR max_b = root:Packages:NIST:VSANS:VCALC:gQmax_B 2036 2037 String aStr = "A" 2038 2039 sprintf temp,"Source Aperture Diameter =\t\t%6.2f cm\r",VC_sourceApertureDiam() 2040 str += temp 2041 sprintf temp,"Source to Sample =\t\t\t\t%6.0f cm\r",VC_calcSSD() 2042 str += temp 2043 // sprintf temp,"Sample Position to Detector =\t%6.0f cm\r",VC_getSDD("ML") 2044 // str += temp 2045 sprintf temp,"Beam diameter (Mid) =\t\t\t%6.2f cm\r",VC_beamDiameter("maximum","ML") 2046 str += temp 2047 sprintf temp,"Beamstop diameter =\t\t\t\t%6.2f inches\r",VC_beamstopDiam("ML")/2.54 2048 str += temp 2049 sprintf temp,"Back: Min > Max Qvalue =\t\t\t%6.4f > %6.4f 1/%s \r",min_b,max_b,aStr 2050 str += temp 2051 sprintf temp,"Middle: Min > Max Qvalue =\t\t%6.4f > %6.4f 1/%s \r",min_m,max_m,aStr 2052 str += temp 2053 sprintf temp,"Front: Min > Max Qvalue =\t\t%6.4f > %6.4f 1/%s \r",min_f,max_f,aStr 2054 str += temp 2055 sprintf temp,"Beam Intensity =\t\t\t\t%.0f counts/s\r",V_beamIntensity() 2056 str += temp 2057 sprintf temp,"Figure of Merit =\t\t\t\t%3.3g %s^2/s\r",VC_figureOfMerit(),aStr 2058 str += temp 2059 // sprintf temp,"Attenuator transmission =\t\t%3.3g = Atten # %d\r"//,attenuatorTransmission(),attenuatorNumber() 2060 // str += temp 2061 //// 2062 // // add text of the useredited values 2063 // // 2064 sprintf temp,"***************** %s *** %s *****************\r","VSANS","VSANS" 2065 str += temp 2066 sprintf temp,"Sample Aperture Diameter =\t\t\t\t%.2f cm\r",VC_sampleApertureDiam() 2067 str += temp 2068 sprintf temp,"Number of Guides =\t\t\t\t\t\t%d \r", VC_getNumGuides() 2069 str += temp 2070 sprintf temp,"Back: Sample Position to Detector =\t\t\t%.1f cm\r", VC_getSDD("B") 2071 str += temp 2072 sprintf temp,"Middle: Sample Position to Detector =\t\t%.1f cm\r", VC_getSDD("ML") 2073 str += temp 2074 sprintf temp,"\tOffsets (L,R) (T,B) = (%.2f, %.2f) (%.2f, %.2f) cm\r", VCALC_getPanelTranslation("ML"),VCALC_getPanelTranslation("MR"),VCALC_getPanelTranslation("MT"),VCALC_getPanelTranslation("MB") 2075 str += temp 2076 sprintf temp,"Front: Sample Position to Detector =\t\t\t%.1f cm\r", VC_getSDD("FL") 2077 str += temp 2078 sprintf temp,"\tOffsets (L,R) (T,B) = (%.2f, %.2f) (%.2f, %.2f) cm\r", VCALC_getPanelTranslation("FL"),VCALC_getPanelTranslation("FR"),VCALC_getPanelTranslation("FT"),VCALC_getPanelTranslation("FB") 2079 str += temp 2080 // if(gTable==1) 2081 // sprintf temp,"Sample Position is \t\t\t\t\t\tHuber\r" 2082 // else 2083 // sprintf temp,"Sample Position is \t\t\t\t\t\tChamber\r" 2084 // endif 2085 // str += temp 2086 // sprintf temp,"Detector Offset =\t\t\t\t\t\t%.1f cm\r", detectorOffset() 2087 // str += temp 2088 sprintf temp,"Neutron Wavelength =\t\t\t\t\t%.2f %s\r", VCALC_getWavelength(),aStr 2089 str += temp 2090 sprintf temp,"Wavelength Spread, FWHM =\t\t\t\t%.3f\r", VCALC_getWavelengthSpread() 2091 str += temp 2092 // sprintf temp,"Sample Aperture to Sample Position =\t%.2f cm\r", L2Diff 2093 // str += temp 2094 // if(lens==1) 2095 // sprintf temp,"Lenses are IN\r" 2096 // else 2097 // sprintf temp,"Lenses are OUT\r" 2098 // endif 2099 // str += temp 2100 2101 setDataFolder root: 2102 return str 2103 End 2104 2105 //Write String representing NICE VSANS configuration 2106 Function/S V_SetNICEConfigText() 2107 2108 string temp_s 2109 2110 String titleStr 2111 String keyStr,keyStrEnd 2112 String valueStr,valueStrEnd 2113 String closingStr 2114 String nameStr,valStr,str 2115 2116 keyStr = " {\r \"key\": {\r \"class\": \"java.lang.String\",\r \"value\": \"" 2117 keyStrEnd = "\"\r },\r" 2118 2119 valueStr = " \"value\": {\r \"class\": \"java.lang.String\",\r \"value\": \"" 2120 valueStrEnd = "\"\r }\r },\r" 2121 2122 closingStr = "\"\r }\r }\r ]\r }\r }\r]\r" 2123 2124 str = "Dummy filler" 2125 2126 titleStr = "VCALC Configuration" 2127 2128 temp_s = "" 2129 2130 temp_s = "[\r {\r \"key\": {\r \"class\": \"java.lang.String\",\r" 2131 temp_s += " \"value\": \""+titleStr+"\"\r },\r" 2132 temp_s += " \"value\": {\r \"class\": \"java.util.HashMap\",\r \"value\": [\r" 2133 2134 //front 2135 nameStr = "frontTrans.primaryNode" 2136 valStr = num2Str(VC_getGateValveToDetDist("FL")) + "cm" //nominal distance, any panel will do 2137 temp_s += keyStr + nameStr + keyStrEnd 2138 temp_s += valueStr + valStr + valueStrEnd 2139 2140 nameStr = "carriage.frontRight" 2141 valStr = num2Str(VCALC_getPanelTranslation("FR")) + "cm" //no space before unit 2142 temp_s += keyStr + nameStr + keyStrEnd 2143 temp_s += valueStr + valStr + valueStrEnd 2144 2145 nameStr = "carriage.frontLeft" 2146 valStr = num2Str(VCALC_getPanelTranslation("FL")) + "cm" //no space before unit 2147 temp_s += keyStr + nameStr + keyStrEnd 2148 temp_s += valueStr + valStr + valueStrEnd 2149 2150 nameStr = "carriage.frontTop" 2151 valStr = num2Str(VCALC_getPanelTranslation("FT")) + "cm" //no space before unit 2152 temp_s += keyStr + nameStr + keyStrEnd 2153 temp_s += valueStr + valStr + valueStrEnd 2154 2155 nameStr = "carriage.frontBottom" 2156 valStr = num2Str(VCALC_getPanelTranslation("FB")) + "cm" //no space before unit 2157 temp_s += keyStr + nameStr + keyStrEnd 2158 temp_s += valueStr + valStr + valueStrEnd 2159 2160 nameStr = "frontRightAreaDetector.beamCenterX" 2161 valStr = num2Str(V_getDet_beam_center_x("VCALC","FR")) + "cm" 2162 temp_s += keyStr + nameStr + keyStrEnd 2163 temp_s += valueStr + valStr + valueStrEnd 2164 2165 nameStr = "frontRightAreaDetector.beamCenterY" 2166 valStr = num2Str(V_getDet_beam_center_y("VCALC","FR")) + "cm" 2167 temp_s += keyStr + nameStr + keyStrEnd 2168 temp_s += valueStr + valStr + valueStrEnd 2169 2170 nameStr = "frontLeftAreaDetector.beamCenterX" 2171 valStr = num2Str(V_getDet_beam_center_x("VCALC","FL")) + "cm" 2172 temp_s += keyStr + nameStr + keyStrEnd 2173 temp_s += valueStr + valStr + valueStrEnd 2174 2175 nameStr = "frontLeftAreaDetector.beamCenterY" 2176 valStr = num2Str(V_getDet_beam_center_y("VCALC","FL")) + "cm" 2177 temp_s += keyStr + nameStr + keyStrEnd 2178 temp_s += valueStr + valStr + valueStrEnd 2179 2180 nameStr = "frontTopAreaDetector.beamCenterX" 2181 valStr = num2Str(V_getDet_beam_center_x("VCALC","FT")) + "cm" 2182 temp_s += keyStr + nameStr + keyStrEnd 2183 temp_s += valueStr + valStr + valueStrEnd 2184 2185 nameStr = "frontTopAreaDetector.beamCenterY" 2186 valStr = num2Str(V_getDet_beam_center_y("VCALC","FT")) + "cm" 2187 temp_s += keyStr + nameStr + keyStrEnd 2188 temp_s += valueStr + valStr + valueStrEnd 2189 2190 nameStr = "frontBottomAreaDetector.beamCenterX" 2191 valStr = num2Str(V_getDet_beam_center_x("VCALC","FB")) + "cm" 2192 temp_s += keyStr + nameStr + keyStrEnd 2193 temp_s += valueStr + valStr + valueStrEnd 2194 2195 nameStr = "frontBottomAreaDetector.beamCenterY" 2196 valStr = num2Str(V_getDet_beam_center_y("VCALC","FB")) + "cm" 2197 temp_s += keyStr + nameStr + keyStrEnd 2198 temp_s += valueStr + valStr + valueStrEnd 2199 2200 2201 2202 // middle 2203 nameStr = "middleTrans.primaryNode" 2204 valStr = num2Str(VC_getGateValveToDetDist("ML")) + "cm" //nominal distance, any panel will do 2205 temp_s += keyStr + nameStr + keyStrEnd 2206 temp_s += valueStr + valStr + valueStrEnd 2207 2208 nameStr = "carriage.middleRight" 2209 valStr = num2Str(VCALC_getPanelTranslation("MR")) + "cm" //no space before unit 2210 temp_s += keyStr + nameStr + keyStrEnd 2211 temp_s += valueStr + valStr + valueStrEnd 2212 2213 nameStr = "carriage.middleLeft" 2214 valStr = num2Str(VCALC_getPanelTranslation("ML")) + "cm" //no space before unit 2215 temp_s += keyStr + nameStr + keyStrEnd 2216 temp_s += valueStr + valStr + valueStrEnd 2217 2218 nameStr = "carriage.middleTop" 2219 valStr = num2Str(VCALC_getPanelTranslation("MT")) + "cm" //no space before unit 2220 temp_s += keyStr + nameStr + keyStrEnd 2221 temp_s += valueStr + valStr + valueStrEnd 2222 2223 nameStr = "carriage.middleBottom" 2224 valStr = num2Str(VCALC_getPanelTranslation("MB")) + "cm" //no space before unit 2225 temp_s += keyStr + nameStr + keyStrEnd 2226 temp_s += valueStr + valStr + valueStrEnd 2227 2228 nameStr = "middleRightAreaDetector.beamCenterX" 2229 valStr = num2Str(V_getDet_beam_center_x("VCALC","MR")) + "cm" 2230 temp_s += keyStr + nameStr + keyStrEnd 2231 temp_s += valueStr + valStr + valueStrEnd 2232 2233 nameStr = "middleRightAreaDetector.beamCenterY" 2234 valStr = num2Str(V_getDet_beam_center_y("VCALC","MR")) + "cm" 2235 temp_s += keyStr + nameStr + keyStrEnd 2236 temp_s += valueStr + valStr + valueStrEnd 2237 2238 nameStr = "middleLeftAreaDetector.beamCenterX" 2239 valStr = num2Str(V_getDet_beam_center_x("VCALC","ML")) + "cm" 2240 temp_s += keyStr + nameStr + keyStrEnd 2241 temp_s += valueStr + valStr + valueStrEnd 2242 2243 nameStr = "middleLeftAreaDetector.beamCenterY" 2244 valStr = num2Str(V_getDet_beam_center_y("VCALC","ML")) + "cm" 2245 temp_s += keyStr + nameStr + keyStrEnd 2246 temp_s += valueStr + valStr + valueStrEnd 2247 2248 nameStr = "middleTopAreaDetector.beamCenterX" 2249 valStr = num2Str(V_getDet_beam_center_x("VCALC","MT")) + "cm" 2250 temp_s += keyStr + nameStr + keyStrEnd 2251 temp_s += valueStr + valStr + valueStrEnd 2252 2253 nameStr = "middleTopAreaDetector.beamCenterY" 2254 valStr = num2Str(V_getDet_beam_center_y("VCALC","MT")) + "cm" 2255 temp_s += keyStr + nameStr + keyStrEnd 2256 temp_s += valueStr + valStr + valueStrEnd 2257 2258 nameStr = "middleBottomAreaDetector.beamCenterX" 2259 valStr = num2Str(V_getDet_beam_center_x("VCALC","MB")) + "cm" 2260 temp_s += keyStr + nameStr + keyStrEnd 2261 temp_s += valueStr + valStr + valueStrEnd 2262 2263 nameStr = "middleBottomAreaDetector.beamCenterY" 2264 valStr = num2Str(V_getDet_beam_center_y("VCALC","MB")) + "cm" 2265 temp_s += keyStr + nameStr + keyStrEnd 2266 temp_s += valueStr + valStr + valueStrEnd 2267 2268 nameStr = "C2BeamStop.beamStop" 2269 valStr = num2Str(1) 2270 temp_s += keyStr + nameStr + keyStrEnd 2271 temp_s += valueStr + valStr + valueStrEnd 2272 2273 nameStr = "C2BeamStopY.softPosition" 2274 valStr = num2Str(0) + "cm" //no space before unit 2275 temp_s += keyStr + nameStr + keyStrEnd 2276 temp_s += valueStr + valStr + valueStrEnd 2277 2278 nameStr = "C2BeamStopX.X" 2279 valStr = num2Str(0) + "cm" //no space before unit 2280 temp_s += keyStr + nameStr + keyStrEnd 2281 temp_s += valueStr + valStr + valueStrEnd 2282 2283 2284 // back 2285 nameStr = "rearTrans.primaryNode" 2286 valStr = num2Str(VC_getGateValveToDetDist("B")) + "cm" //nominal distance, any panel will do 2287 temp_s += keyStr + nameStr + keyStrEnd 2288 temp_s += valueStr + valStr + valueStrEnd 2289 2290 nameStr = "C3DetectorOffset.softPosition" 2291 valStr = num2Str(0) + "cm" //no space before unit 2292 temp_s += keyStr + nameStr + keyStrEnd 2293 temp_s += valueStr + valStr + valueStrEnd 2294 2295 nameStr = "rearAreaDetector.beamCenterX" 2296 valStr = num2Str(V_getDet_beam_center_x_pix("VCALC","B")) 2297 temp_s += keyStr + nameStr + keyStrEnd 2298 temp_s += valueStr + valStr + valueStrEnd 2299 2300 nameStr = "rearAreaDetector.beamCenterY" 2301 valStr = num2Str(V_getDet_beam_center_y_pix("VCALC","B")) 2302 temp_s += keyStr + nameStr + keyStrEnd 2303 temp_s += valueStr + valStr + valueStrEnd 2304 2305 nameStr = "C3BeamStop.beamStop" 2306 valStr = num2Str(0) 2307 temp_s += keyStr + nameStr + keyStrEnd 2308 temp_s += valueStr + valStr + valueStrEnd 2309 2310 nameStr = "C3BeamStopY.softPosition" 2311 valStr = num2Str(0) + "cm" //no space before unit 2312 temp_s += keyStr + nameStr + keyStrEnd 2313 temp_s += valueStr + valStr + valueStrEnd 2314 2315 nameStr = "C3BeamStopX.X" 2316 valStr = num2Str(0) + "cm" //no space before unit 2317 temp_s += keyStr + nameStr + keyStrEnd 2318 temp_s += valueStr + valStr + valueStrEnd 2319 2320 2321 2322 //geometry, guides, beam... 2323 2324 nameStr = "guide.guide" 2325 valStr = num2Str(VC_getNumGuides()) 2326 temp_s += keyStr + nameStr + keyStrEnd 2327 temp_s += valueStr + valStr + valueStrEnd 2328 2329 nameStr = "guide.sampleAperture" 2330 valStr = num2Str(VC_sampleApertureDiam()) + "cm" //no space before unit 2331 temp_s += keyStr + nameStr + keyStrEnd 2332 temp_s += valueStr + valStr + valueStrEnd 2333 2334 nameStr = "guide.sourceAperture" 2335 valStr = num2Str(VC_sourceApertureDiam()) + "cm" //no space before unit 2336 temp_s += keyStr + nameStr + keyStrEnd 2337 temp_s += valueStr + valStr + valueStrEnd 2338 2339 nameStr = "geometry.externalSampleApertureShape" 2340 valStr = "CIRCLE" 2341 temp_s += keyStr + nameStr + keyStrEnd 2342 temp_s += valueStr + valStr + valueStrEnd 2343 2344 nameStr = "geometry.externalSampleAperture" 2345 valStr = num2Str(VC_sampleApertureDiam()) + "cm" //no space before unit 2346 temp_s += keyStr + nameStr + keyStrEnd 2347 temp_s += valueStr + valStr + valueStrEnd 2348 2349 nameStr = "geometry.samplePositionOffset" 2350 valStr = num2Str(V_sampleToGateValve()) + "cm" //no space before unit 2351 temp_s += keyStr + nameStr + keyStrEnd 2352 temp_s += valueStr + valStr + valueStrEnd 2353 2354 nameStr = "geometry.sampleApertureOffset" 2355 valStr = num2Str(V_sampleApertureToGateValve()) + "cm" //no space before unit 2356 temp_s += keyStr + nameStr + keyStrEnd 2357 temp_s += valueStr + valStr + valueStrEnd 2358 2359 nameStr = "attenuator.attenuator" 2360 valStr = num2Str(0) 2361 temp_s += keyStr + nameStr + keyStrEnd 2362 temp_s += valueStr + valStr + valueStrEnd 2363 2364 nameStr = "wavelength.wavelength" 2365 valStr = num2Str(VCALC_getWavelength()) + "A" //no space before unit 2366 temp_s += keyStr + nameStr + keyStrEnd 2367 temp_s += valueStr + valStr + valueStrEnd 2368 2369 nameStr = "wavelengthSpread.wavelengthSpread" 2370 valStr = num2Str(VCALC_getWavelengthSpread()) 2371 // last one has a different ending sequence 2372 temp_s += keyStr + nameStr + keyStrEnd 2373 temp_s += valueStr + valStr + closingStr 2374 2375 return temp_s 2376 end 2377
Note: See TracChangeset
for help on using the changeset viewer.