""" Find fields that were observed with the 219 GHz tuning, and find out if they have been re-observed with the 218.9 GHz tuning. This is mostly adequate, though there are unfortunately regions where even the 218.9 GHz tuning will result in some overlap. It is not presently practical to redo those. """ from astropy.table import Table from paths import opath, rpath import pyregion tbl = Table.read(opath('observing_logs.ipac'), format='ipac') co_good = co_ok = tbl['restf'] == 218900 co_bad = tbl['restf'] == 219000 maps_bad = [s.strip() for row in tbl[co_bad] for s in row['sources'].split(", ")] maps_good = [s.strip() for row in tbl[co_good] for s in row['sources'].split(", ")] bad_only = [m for m in maps_bad if m not in maps_good] map_regions = pyregion.open(rpath('target_fields_8x8.reg')) bad_regions = [m for m in map_regions if m.attr[1]['text'].split()[0].upper() in bad_only] not_good_regions = [m for m in map_regions if m.attr[1]['text'].split()[0].upper() in maps_bad] marked_regions = bad_regions + not_good_regions for m in marked_regions: if m in bad_regions: m.attr[1]['color'] = 'red' else: m.attr[1]['color'] = 'green' marked_regions = list(set(marked_regions)) pyregion.ShapeList(marked_regions).write(rpath("co_c18o_overlap.reg"))
""" Find fields that were observed with the 219 GHz tuning, and find out if they have been re-observed with the 218.9 GHz tuning. This is mostly adequate, though there are unfortunately regions where even the 218.9 GHz tuning will result in some overlap. It is not presently practical to redo those. """ from astropy.table import Table from paths import opath, rpath import pyregion tbl = Table.read(opath('observing_logs.ipac'), format='ipac') co_good = co_ok = tbl['restf'] == 218900 co_bad = tbl['restf'] == 219000 maps_bad = [ s.strip() for row in tbl[co_bad] for s in row['sources'].split(", ") ] maps_good = [ s.strip() for row in tbl[co_good] for s in row['sources'].split(", ") ] bad_only = [m for m in maps_bad if m not in maps_good] map_regions = pyregion.open(rpath('target_fields_8x8.reg')) bad_regions = [ m for m in map_regions if m.attr[1]['text'].split()[0].upper() in bad_only ] not_good_regions = [ m for m in map_regions if m.attr[1]['text'].split()[0].upper() in maps_bad ]
nhits[name] = {'mean':nhits_img.data[mask].mean(), 'median':np.median(nhits_img.data[mask]), 'std':nhits_img.data[mask].std()} keys = sorted(nhits.keys()) tbl = table.Table() tbl.add_column(table.Column(data=keys, name='FieldID', dtype=str)) for dt,dtn in zip((noise,nhits), ("noise","nhits")): for ii,coltype in enumerate(('mean','median','std')): col = table.Column(data=[dt[name][coltype] for name in keys], name=dtn+"_"+coltype, dtype='float') tbl.add_column(col) tbl.write(opath('field_noise_stats.ipac'), format='ascii.ipac') tbl.sort('noise_mean') tbl[::-1].write(opath('field_noise_stats_sorted.ipac'), format='ascii.ipac') import pylab as pl pl.figure(1) pl.clf() ax = pl.gca() ax.plot(tbl['nhits_mean'],tbl['noise_mean'], '.', zorder=5, markersize=15, alpha=0.75) exptime = np.arange(*ax.get_xlim()) exptime = np.arange(60,220,dtype='float') # Not clear if 0.75 is physical or a fit or what... #pl.plot(exptime, 0.75/np.sqrt(np.arange(20,220,dtype='float')), # label='$1/\\sqrt{t}$', linewidth=2, alpha=0.5, color='k', zorder=-5) # Apparently each "weight point" is 1/8s; this is empirical though pl.plot(exptime, 2**0.5*155/(0.733e6 * exptime/8.)**0.5,