- Timestamp:
- 04/15/10 15:09:34 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/opacity.py
r1689 r1722 6 6 from asap import selector 7 7 from asap import rcParams 8 from asap import xyplotter 8 9 9 10 def _import_data(data): 10 if not hasattr(data, "__len__"):11 if not isinstance(data, (list,tuple)): 11 12 if isinstance(data, scantable): 12 13 return data … … 57 58 plot: Plot each fit (airmass vs. Tsys). Default is 'False' 58 59 """ 60 rcsave = rcParams['verbose'] 61 rcParams['verbose'] = False 59 62 scan = _import_data(data) 60 63 f = fitter() … … 68 71 sel.set_ifs(ino) 69 72 opacity = [] 73 fits = [] 74 airms = [] 75 tsyss = [] 76 77 if plot: 78 xyplotter.cla() 79 xyplotter.ioff() 80 xyplotter.clf() 81 xyplotter.xlabel("Airmass") 82 xyplotter.ylabel(r"$T_{sys}$") 70 83 for pno in pnos: 71 84 sel.set_polarisations(pno) 72 85 scan.set_selection(basesel+sel) 86 freq = scan.get_coordinate(0).get_reference_value()/1e9 87 freqstr = "%0.4f GHz" % freq 73 88 tsys = scan.get_tsys() 74 89 elev = scan.get_elevation() 75 90 airmass = [ 1./math.sin(i) for i in elev ] 91 airms.append(airmass) 92 tsyss.append(tsys) 76 93 f.set_data(airmass, tsys) 77 94 f.fit() 78 if plot: 79 f.plot(residual=True, plotparms=True) 80 raw_input("Hit <return> for next fit...") 95 fits.append(f.get_fit()) 81 96 params = f.get_parameters()["params"] 82 97 opacity.append(params[1]/tsky) … … 85 100 else: 86 101 opacities += opacity 102 if plot: 103 colors = ['b','g','k'] 104 for i in range(len(airms)): 105 xyplotter.plot(airms[i], tsyss[i], 'o', color=colors[i]) 106 xyplotter.plot(airms[i], fits[i], '-', color=colors[i]) 107 xyplotter.figtext(0.7,0.3-(i/30.0), 108 r"$\tau_{fit}=%0.2f$" % opacity[i], 109 color=colors[i]) 110 if averagepol: 111 xyplotter.figtext(0.7,0.3-(len(airms)/30.0), 112 r"$\tau=%0.2f$" % opacities[-1], 113 color='r') 114 xyplotter.title("IF%d : %s" % (ino, freqstr)) 115 116 xyplotter.ion() 117 xyplotter.draw() 118 raw_input("Hit <return> for next fit...") 87 119 sel.reset() 120 88 121 scan.set_selection(basesel) 122 rcParams['verbose'] = rcsave 123 if plot: 124 xyplotter.close() 89 125 return opacities
Note:
See TracChangeset
for help on using the changeset viewer.