Changeset 1782 for branches/alma
- Timestamp:
- 07/30/10 14:46:03 (14 years ago)
- Location:
- branches/alma
- Files:
-
- 8 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/alma/external/atnf/pks/pks_maths.cc
-
Property svn:mergeinfo
set to
/branches/asap-3.x/external/atnf/pks/pks_maths.cc merged eligible /trunk/external/atnf/pks/pks_maths.cc merged eligible
r1757 r1782 321 321 322 322 // Azimuth and elevation (rad). 323 az = atan2(cos(dec)*sin(ha), 324 cos(dec)*sin(lat)*cos(ha) - sin(dec)*cos(lat)); 323 az = atan2(-cos(dec)*sin(ha), 324 sin(dec)*cos(lat) - cos(dec)*sin(lat)*cos(ha)); 325 el = asin(sin(dec)*sin(lat) + cos(dec)*cos(lat)*cos(ha)); 326 325 327 if (az < 0.0) az += C::_2pi; 326 el = asin(sin(dec)*sin(lat) + cos(dec)*cos(lat)*cos(ha));327 328 328 } 329 329 -
Property svn:mergeinfo
set to
-
branches/alma/python/asapfitter.py
r1757 r1782 127 127 return 128 128 129 #@print_log_dec129 @print_log_dec 130 130 def fit(self, row=0, estimate=False): 131 131 """ … … 222 222 self.data._addfit(fit,self._fittedrow) 223 223 224 #@print_log_dec224 @print_log_dec 225 225 def set_parameters(self,*args,**kwargs): 226 226 """ … … 544 544 return self.fitter.getfit() 545 545 546 #@print_log_dec546 @print_log_dec 547 547 def commit(self): 548 548 """ … … 573 573 return scan 574 574 575 #@print_log_dec575 @print_log_dec 576 576 def plot(self, residual=False, components=None, plotparms=False, 577 577 filename=None): … … 674 674 print_log() 675 675 676 #@print_log_dec676 @print_log_dec 677 677 def auto_fit(self, insitu=None, plot=False): 678 678 """ -
branches/alma/python/asaplotbase.py
r1766 r1782 282 282 283 283 284 #def get_region(self):285 #pos = []286 #print "Please select the bottom/left point"287 #pos.append(self.figure.ginput(n=1, show_clicks=False)[0])288 #print "Please select the top/right point"289 #pos.append(self.figure.ginput(n=1, show_clicks=False)[0])290 #return pos291 292 #def get_point(self):293 #print "Please select the point"294 #pt = self.figure.ginput(n=1, show_clicks=False)295 #if pt:296 #return pt[0]297 #else:298 #return None284 def get_region(self): 285 pos = [] 286 print "Please select the bottom/left point" 287 pos.append(self.figure.ginput(n=1, show_clicks=False)[0]) 288 print "Please select the top/right point" 289 pos.append(self.figure.ginput(n=1, show_clicks=False)[0]) 290 return pos 291 292 def get_point(self): 293 print "Please select the point" 294 pt = self.figure.ginput(n=1, show_clicks=False) 295 if pt: 296 return pt[0] 297 else: 298 return None 299 299 300 300 def region(self): -
branches/alma/python/asapmath.py
r1757 r1782 6 6 from asap import asaplotgui 7 7 8 #@print_log_dec8 @print_log_dec 9 9 def average_time(*args, **kwargs): 10 10 """ … … 123 123 return s 124 124 125 #@print_log_dec125 @print_log_dec 126 126 def dototalpower(calon, caloff, tcalval=0.0): 127 127 """ … … 142 142 return s 143 143 144 #@print_log_dec144 @print_log_dec 145 145 def dosigref(sig, ref, smooth, tsysval=0.0, tauval=0.0): 146 146 """ … … 163 163 return s 164 164 165 #@print_log_dec165 @print_log_dec 166 166 def calps(scantab, scannos, smooth=1, tsysval=0.0, tauval=0.0, tcalval=0.0, verify=False): 167 167 """ … … 446 446 return ress 447 447 448 #@print_log_dec448 @print_log_dec 449 449 def calnod(scantab, scannos=[], smooth=1, tsysval=0.0, tauval=0.0, tcalval=0.0, verify=False): 450 450 """ … … 687 687 return resspec 688 688 689 #@print_log_dec689 @print_log_dec 690 690 def calfs(scantab, scannos=[], smooth=1, tsysval=0.0, tauval=0.0, tcalval=0.0, verify=False): 691 691 """ … … 895 895 return resspec 896 896 897 #@print_log_dec897 @print_log_dec 898 898 def merge(*args): 899 899 """ -
branches/alma/python/asapplotter.py
r1765 r1782 77 77 else: return None 78 78 79 #@print_log_dec79 @print_log_dec 80 80 def plot(self, scan=None): 81 81 """ … … 180 180 def text(self, *args, **kwargs): 181 181 if kwargs.has_key("interactive"): 182 #if kwargs.pop("interactive"): 183 # pos = self._plotter.get_point() 184 # args = tuple(pos)+args 185 kwargs.pop("interactive") 182 if kwargs.pop("interactive"): 183 pos = self._plotter.get_point() 184 args = tuple(pos)+args 186 185 self._axes_callback("text", *args, **kwargs) 187 186 … … 190 189 def arrow(self, *args, **kwargs): 191 190 if kwargs.has_key("interactive"): 192 #if kwargs.pop("interactive"): 193 # pos = self._plotter.get_region() 194 # dpos = (pos[0][0], pos[0][1], 195 # pos[1][0]-pos[0][0], 196 # pos[1][1] - pos[0][1]) 197 # args = dpos + args 198 kwargs.pop("interactive") 191 if kwargs.pop("interactive"): 192 pos = self._plotter.get_region() 193 dpos = (pos[0][0], pos[0][1], 194 pos[1][0]-pos[0][0], 195 pos[1][1] - pos[0][1]) 196 args = dpos + args 199 197 self._axes_callback("arrow", *args, **kwargs) 200 198 … … 203 201 def annotate(self, text, xy=None, xytext=None, **kwargs): 204 202 if kwargs.has_key("interactive"): 205 #if kwargs.pop("interactive"): 206 # xy = self._plotter.get_point() 207 # xytext = self._plotter.get_point() 208 kwargs.pop("interactive") 203 if kwargs.pop("interactive"): 204 xy = self._plotter.get_point() 205 xytext = self._plotter.get_point() 209 206 if not kwargs.has_key("arrowprops"): 210 207 kwargs["arrowprops"] = dict(arrowstyle="->") … … 215 212 def axvline(self, *args, **kwargs): 216 213 if kwargs.has_key("interactive"): 217 #if kwargs.pop("interactive"): 218 # pos = self._plotter.get_point() 219 # args = (pos[0],)+args 220 kwargs.pop("interactive") 214 if kwargs.pop("interactive"): 215 pos = self._plotter.get_point() 216 args = (pos[0],)+args 221 217 self._axes_callback("axvline", *args, **kwargs) 222 218 … … 225 221 def axhline(self, *args, **kwargs): 226 222 if kwargs.has_key("interactive"): 227 #if kwargs.pop("interactive"): 228 # pos = self._plotter.get_point() 229 # args = (pos[1],)+args 230 kwargs.pop("interactive") 223 if kwargs.pop("interactive"): 224 pos = self._plotter.get_point() 225 args = (pos[1],)+args 231 226 self._axes_callback("axhline", *args, **kwargs) 232 227 … … 235 230 def axvspan(self, *args, **kwargs): 236 231 if kwargs.has_key("interactive"): 237 #if kwargs.pop("interactive"): 238 # pos = self._plotter.get_region() 239 # dpos = (pos[0][0], pos[1][0]) 240 # args = dpos + args 241 kwargs.pop("interactive") 232 if kwargs.pop("interactive"): 233 pos = self._plotter.get_region() 234 dpos = (pos[0][0], pos[1][0]) 235 args = dpos + args 242 236 self._axes_callback("axvspan", *args, **kwargs) 243 237 # hack to preventy mpl from redrawing the patch … … 250 244 def axhspan(self, *args, **kwargs): 251 245 if kwargs.has_key("interactive"): 252 #if kwargs.pop("interactive"): 253 # pos = self._plotter.get_region() 254 # dpos = (pos[0][1], pos[1][1]) 255 # args = dpos + args 256 kwargs.pop("interactive") 246 if kwargs.pop("interactive"): 247 pos = self._plotter.get_region() 248 dpos = (pos[0][1], pos[1][1]) 249 args = dpos + args 257 250 self._axes_callback("axhspan", *args, **kwargs) 258 251 # hack to preventy mpl from redrawing the patch … … 1220 1213 private method for plotting total power data 1221 1214 """ 1222 from matplotlib.numeriximport ma, array, arange, logical_not1215 from numpy import ma, array, arange, logical_not 1223 1216 r=0 1224 1217 nr = scan.nrow() -
branches/alma/python/asapreader.py
r1757 r1782 25 25 rpfits ONLY. 26 26 """ 27 #@print_log_dec27 @print_log_dec 28 28 def __init__(self, filename, unit=None, theif=None, thebeam=None): 29 29 self.unit = unit … … 48 48 print_log() 49 49 50 #@print_log_dec50 @print_log_dec 51 51 def read(self): 52 52 """ -
branches/alma/python/scantable.py
r1781 r1782 36 36 """ 37 37 38 #@print_log_dec38 @print_log_dec 39 39 def __init__(self, filename, average=None, unit=None, getpt=None, antenna=None, parallactify=None): 40 40 """ … … 128 128 print_log() 129 129 130 #@print_log_dec130 @print_log_dec 131 131 def save(self, name=None, format=None, overwrite=False): 132 132 """ … … 752 752 return self._get_column(self._getdirectionvec, row) 753 753 754 #@print_log_dec754 @print_log_dec 755 755 def set_unit(self, unit='channel'): 756 756 """ … … 768 768 self._add_history("set_unit", varlist) 769 769 770 #@print_log_dec770 @print_log_dec 771 771 def set_instrument(self, instr): 772 772 """ … … 780 780 print_log() 781 781 782 #@print_log_dec782 @print_log_dec 783 783 def set_feedtype(self, feedtype): 784 784 """ … … 791 791 print_log() 792 792 793 #@print_log_dec793 @print_log_dec 794 794 def set_doppler(self, doppler='RADIO'): 795 795 """ … … 805 805 print_log() 806 806 807 #@print_log_dec807 @print_log_dec 808 808 def set_freqframe(self, frame=None): 809 809 """ … … 950 950 self._add_history("clip", varlist) 951 951 952 #@print_log_dec952 @print_log_dec 953 953 def lag_flag(self, start, end, unit="MHz", insitu=None): 954 954 #def lag_flag(self, frequency, width=0.0, unit="GHz", insitu=None): … … 994 994 return s 995 995 996 #@print_log_dec996 @print_log_dec 997 997 def create_mask(self, *args, **kwargs): 998 998 """ … … 1323 1323 # Maths business 1324 1324 # 1325 #@print_log_dec1325 @print_log_dec 1326 1326 def average_time(self, mask=None, scanav=False, weight='tint', align=False): 1327 1327 """ … … 1375 1375 return s 1376 1376 1377 #@print_log_dec1377 @print_log_dec 1378 1378 def convert_flux(self, jyperk=None, eta=None, d=None, insitu=None): 1379 1379 """ … … 1404 1404 else: return s 1405 1405 1406 #@print_log_dec1406 @print_log_dec 1407 1407 def gain_el(self, poly=None, filename="", method="linear", insitu=None): 1408 1408 """ … … 1459 1459 return s 1460 1460 1461 #@print_log_dec1461 @print_log_dec 1462 1462 def freq_align(self, reftime=None, method='cubic', insitu=None): 1463 1463 """ … … 1485 1485 else: return s 1486 1486 1487 #@print_log_dec1487 @print_log_dec 1488 1488 def opacity(self, tau=None, insitu=None): 1489 1489 """ … … 1514 1514 else: return s 1515 1515 1516 #@print_log_dec1516 @print_log_dec 1517 1517 def bin(self, width=5, insitu=None): 1518 1518 """ … … 1535 1535 return s 1536 1536 1537 #@print_log_dec1537 @print_log_dec 1538 1538 def resample(self, width=5, method='cubic', insitu=None): 1539 1539 """ … … 1558 1558 else: return s 1559 1559 1560 #@print_log_dec1560 @print_log_dec 1561 1561 def average_pol(self, mask=None, weight='none'): 1562 1562 """ … … 1576 1576 return s 1577 1577 1578 #@print_log_dec1578 @print_log_dec 1579 1579 def average_beam(self, mask=None, weight='none'): 1580 1580 """ … … 1606 1606 self._add_history("parallactify", varlist) 1607 1607 1608 #@print_log_dec1608 @print_log_dec 1609 1609 def convert_pol(self, poltype=None): 1610 1610 """ … … 1631 1631 return s 1632 1632 1633 #@print_log_dec1633 @print_log_dec 1634 1634 def smooth(self, kernel="hanning", width=5.0, order=2, plot=False, insitu=None): 1635 1635 """ … … 1705 1705 else: return s 1706 1706 1707 #@print_log_dec1707 @print_log_dec 1708 1708 def poly_baseline(self, mask=None, order=0, plot=False, uselin=False, 1709 1709 insitu=None): … … 1938 1938 return workscan 1939 1939 1940 #@print_log_dec1940 @print_log_dec 1941 1941 def rotate_linpolphase(self, angle): 1942 1942 """ … … 1955 1955 return 1956 1956 1957 #@print_log_dec1957 @print_log_dec 1958 1958 def rotate_xyphase(self, angle): 1959 1959 """ … … 1972 1972 return 1973 1973 1974 #@print_log_dec1974 @print_log_dec 1975 1975 def swap_linears(self): 1976 1976 """ … … 1984 1984 return 1985 1985 1986 #@print_log_dec1986 @print_log_dec 1987 1987 def invert_phase(self): 1988 1988 """ … … 1995 1995 return 1996 1996 1997 #@print_log_dec1997 @print_log_dec 1998 1998 def add(self, offset, insitu=None): 1999 1999 """ … … 2016 2016 return s 2017 2017 2018 #@print_log_dec2018 @print_log_dec 2019 2019 def scale(self, factor, tsys=True, insitu=None): 2020 2020 """ … … 2084 2084 self._add_history("set_sourcetype", varlist) 2085 2085 2086 #@print_log_dec2086 @print_log_dec 2087 2087 def auto_quotient(self, preserve=True, mode='paired', verify=False): 2088 2088 """ … … 2128 2128 return s 2129 2129 2130 #@print_log_dec2130 @print_log_dec 2131 2131 def mx_quotient(self, mask = None, weight='median', preserve=True): 2132 2132 """ … … 2151 2151 return q 2152 2152 2153 #@print_log_dec2153 @print_log_dec 2154 2154 def freq_switch(self, insitu=None): 2155 2155 """ … … 2171 2171 else: return s 2172 2172 2173 #@print_log_dec2173 @print_log_dec 2174 2174 def recalc_azel(self): 2175 2175 """ … … 2185 2185 return 2186 2186 2187 #@print_log_dec2187 @print_log_dec 2188 2188 def __add__(self, other): 2189 varlist = vars() 2190 s = None 2191 if isinstance(other, scantable): 2192 s = scantable(self._math._binaryop(self, other, "ADD")) 2193 elif isinstance(other, float): 2194 s = scantable(self._math._unaryop(self, other, "ADD", False)) 2195 else: 2196 raise TypeError("Other input is not a scantable or float value") 2197 s._add_history("operator +", varlist) 2198 return s 2199 2200 @print_log_dec 2201 def __sub__(self, other): 2189 2202 """ 2190 2203 implicit on all axes and on Tsys 2191 2204 """ 2192 return self._operation( other, "ADD" ) 2193 2194 #@print_log_dec 2195 def __sub__(self, other): 2205 varlist = vars() 2206 s = None 2207 if isinstance(other, scantable): 2208 s = scantable(self._math._binaryop(self, other, "SUB")) 2209 elif isinstance(other, float): 2210 s = scantable(self._math._unaryop(self, other, "SUB", False)) 2211 else: 2212 raise TypeError("Other input is not a scantable or float value") 2213 s._add_history("operator -", varlist) 2214 return s 2215 2216 @print_log_dec 2217 def __mul__(self, other): 2196 2218 """ 2197 2219 implicit on all axes and on Tsys 2198 2220 """ 2199 return self._operation( other, 'SUB' ) 2200 2201 #@print_log_dec 2202 def __mul__(self, other): 2221 varlist = vars() 2222 s = None 2223 if isinstance(other, scantable): 2224 s = scantable(self._math._binaryop(self, other, "MUL")) 2225 elif isinstance(other, float): 2226 s = scantable(self._math._unaryop(self, other, "MUL", False)) 2227 else: 2228 raise TypeError("Other input is not a scantable or float value") 2229 s._add_history("operator *", varlist) 2230 return s 2231 2232 2233 @print_log_dec 2234 def __div__(self, other): 2203 2235 """ 2204 2236 implicit on all axes and on Tsys 2205 2237 """ 2206 return self._operation( other, 'MUL' ) 2207 2208 #@print_log_dec 2209 def __div__(self, other): 2210 """ 2211 implicit on all axes and on Tsys 2212 """ 2213 return self._operation( other, 'DIV' ) 2238 varlist = vars() 2239 s = None 2240 if isinstance(other, scantable): 2241 s = scantable(self._math._binaryop(self, other, "DIV")) 2242 elif isinstance(other, float): 2243 if other == 0.0: 2244 raise ZeroDivisionError("Dividing by zero is not recommended") 2245 s = scantable(self._math._unaryop(self, other, "DIV", False)) 2246 else: 2247 raise TypeError("Other input is not a scantable or float value") 2248 s._add_history("operator /", varlist) 2249 return s 2214 2250 2215 2251 def get_fit(self, row=0): … … 2388 2424 for i in range(len(self)): 2389 2425 yield self[i] 2390 2391 def _operation(self, other, opmode):2392 varlist = vars()2393 s = None2394 import numpy2395 if isinstance(other, scantable):2396 s = scantable(self._math._binaryop(self.copy(), other, opmode))2397 elif isinstance(other, float) or isinstance(other, int):2398 if opmode == 'DIV' and float(other) == 0.0:2399 raise ZeroDivisionError("Dividing by zero is not recommended")2400 s = scantable(self._math._unaryop(self.copy(), other, opmode, False))2401 elif isinstance(other, list) or isinstance(other, numpy.ndarray):2402 if isinstance(other[0], list) or isinstance(other[0], numpy.ndarray):2403 from asapmath import _array2dOp2404 s = _array2dOp( self.copy(), other, opmode, False )2405 else:2406 s = scantable(self._math._arrayop(self.copy(), other, opmode, False))2407 else:2408 raise TypeError("Other input is not a scantable or float value or float list")2409 opdic = {}2410 opdic['ADD'] = '+'2411 opdic['SUB'] = '-'2412 opdic['MUL'] = '*'2413 opdic['DIV'] = '/'2414 s._add_history("operator %s" % opdic[opmode], varlist)2415 print_log()2416 return s -
branches/alma/src/SConscript
-
Property svn:mergeinfo
set to
/branches/asap-3.x/src/SConscript merged eligible /trunk/src/SConscript merged eligible
r1328 r1782 3 3 # import root environment 4 4 Import( "env") 5 myenv = env.C opy()5 myenv = env.Clone() 6 6 7 7 # gather cpp files -
Property svn:mergeinfo
set to
Note:
See TracChangeset
for help on using the changeset viewer.