missing_obs = util.make_obslist( '/Users/mike_e_dubs/MWA/INS/Long_Run/Original_Jackknife_Revamp_Complete/missing_obs.txt' ) maxlist = [] quadlist = np.zeros([1, 336]) linlist = np.zeros([1, 336]) for obs in obslist: if obs not in missing_obs: pow = np.load('%s/cfg-%s.npy' % (args.ppd_dir, obs)) pow_max = np.amax(pow) if not os.path.exists('%s/%s_ms_poly_coeff_order_2_XX.npy' % (args.outdir, obs)): read_paths = util.read_paths_construct(args.ins_dir, 'original', obs, 'INS') ins = INS(read_paths=read_paths, order=2, coeff_write=True, outpath=args.outdir, obs=obs) coeff = np.load('%s/%s_ms_poly_coeff_order_2_XX.npy' % (args.outdir, obs)) med = np.absolute(coeff[:-1]) maxlist.append(pow_max) quadlist = np.vstack([quadlist, med[:1]]) linlist = np.vstack([linlist, med[1:2]]) print('The minimum peak is %f' % min(maxlist)) print('The maximum peak is %f' % max(maxlist))
from SSINS import INS, plot_lib, util import numpy as np import matplotlib.pyplot as plt inpath = '/Users/mike_e_dubs/General/1061318984' outpath = '%s/figs' % inpath obs = '1061318984' read_paths = util.read_paths_construct(inpath, None, obs, 'INS') ins = INS(read_paths=read_paths, obs=obs, outpath=outpath) vmax = [None, 150] fig, ax = plt.subplots(figsize=(14, 8), nrows=2) fig.suptitle('Narrowband SSINS') for i in range(2): plot_lib.image_plot(fig, ax[i], ins.data[:, 0, :, 0], cbar_label='Amplitude (UNCALIB)', freq_array=ins.freq_array[0], vmax=vmax[i]) fig.savefig('%s/1061318984_None_INS_data_XX.png' % outpath)
from SSINS import util, INS, INS_helpers, plot_lib, MF from SSINS import Catalog_Plot as cp from matplotlib import cm import matplotlib.pyplot as plt import numpy as np basedir = '/Users/jonj/Test_folder/lwa' obs = [ 'LWA_50to51', 'LWA_51to52', 'LWA_52to53', 'LWA_53to54', 'LWA_54to55', 'LWA_55to56', 'LWA_56to57', 'LWA_57to58', 'LWA_58to59', 'LWA_59to60' ] outpath = '%s/test_combines' % basedir insarray = [] for x in obs: read_paths = util.read_paths_construct(basedir, 'None', x, 'INS') insarray.append( INS(obs=x, outpath=outpath, read_paths=read_paths, flag_choice='orginal')) inscombined = INS_helpers.INS_concat(insarray, axis=0) inscombined.obs = 'LWA_50to60' inscombined.outpath = outpath inscombined.vis_units = insarray[0].vis_units inscombined.pols = insarray[0].pols inscombined.save() cp.INS_plot(inscombined, vmax=.05, ms_vmax=5, ms_vmin=-5) shape_dict = {'44MHZ': [44e6, 45e6], '40.6MHZ': [40.4e6, 40.7e6]} sig_thresh = 4.35
'TV7': [1.81e8, 1.88e8], 'TV8': [1.88e8, 1.95e8], 'broad6': [1.72e8, 1.83e8], 'broad7': [1.79e8, 1.9e8], 'broad8': [1.86e8, 1.97e8] } shapes = [ 'TV6', 'TV7', 'TV8', 'broad6', 'broad7', 'broad8', 'streak', 'point', 'total' ] occ_dict = {sig: {shape: {} for shape in shapes} for sig in sig_list} for obs in obslist: flist = glob.glob('%s/metadata/%s*' % (basedir, obs)) if len(flist): read_paths = util.read_paths_construct(basedir, 'original', obs, 'INS') for sig_thresh in sig_list: ins = INS(read_paths=read_paths, obs=obs, outpath=outdir, flag_choice='original') mf = MF(ins, sig_thresh=sig_thresh, N_thresh=15, shape_dict=shape_dict) mf.apply_match_test(apply_N_thresh=True) occ_dict[sig_thresh]['total'][obs] = np.mean(ins.data.mask[:, 0, :, 0], axis=0) if len(ins.match_events): event_frac = util.event_fraction(ins.match_events,
from __future__ import division from SSINS import INS, plot_lib, util, MF from matplotlib import cm import matplotlib.pyplot as plt import numpy as np obs = 'zen.2458098.37904.xx.HH' indir = '/Users/mike_e_dubs/HERA/INS/IDR2_Prelim_Nocut/HERA_IDR2_Prelim_Set_nocut' outpath = '/Users/mike_e_dubs/General/%s' % obs read_paths = util.read_paths_construct(indir, None, obs, 'INS') indir2 = '/Users/mike_e_dubs/HERA/INS/IDR2_OR/HERA_IDR2_Prelim_Set_OR_original' read_paths_orig = util.read_paths_construct(indir2, 'original', obs, 'INS') ins2 = INS(read_paths=read_paths_orig, obs=obs, flag_choice='original', outpath=outpath) ins = INS(read_paths=read_paths, obs=obs, outpath=outpath) aspect = ins.data.shape[2] / ins.data.shape[0] fig, ax = plt.subplots(figsize=(16, 9), ncols=2) #plot_lib.image_plot(fig, ax[0], ins.data[:, 0, :, 0], freq_array=ins.freq_array[0], #cbar_label='Amplitude (UNCALIB)', aspect=aspect, vmax=0.03, #ylabel='Time (10 s)') plot_lib.image_plot(fig, ax[0], ins.data_ms[:, 0, :, 0], freq_array=ins.freq_array[0],
inpath = '/Users/mike_e_dubs/MWA/Data/uvfits/1061313128.uvfits' inpath2 = '/Users/mike_e_dubs/MWA/Data/uvfits/1061313128_noflag.uvfits' outpath = '/Users/mike_e_dubs/General/1061313128' if not os.path.exists('%s/arrs/%s_original_INS_data.npym' % (outpath, obs)): ss = SS(obs=obs, inpath=inpath, bad_time_indices=[0, -1, -2, -3], read_kwargs={'ant_str': 'cross'}, flag_choice='original', outpath=outpath) ss.INS_prepare() ss.INS.save() ins = ss.INS else: read_paths = util.read_paths_construct(outpath, 'original', obs, 'INS') ins = INS(read_paths=read_paths, outpath=outpath, obs=obs, flag_choice='original') fig, ax = plt.subplots(figsize=(8, 9)) plot_lib.image_plot(fig, ax, ins.data_ms[:, 0, :, 0], cmap=cm.coolwarm, cbar_label='Deviation ($\hat{\sigma}$)', aspect=ins.data.shape[2] / ins.data.shape[0], freq_array=ins.freq_array[0], mask_color='black') fig.savefig('%s/1061313128_AOFlagger_INS_ms.png' % outpath)
help='The output directory', required=True) args = parser.parse_args() if args.shape_dict is not None: with open(args.shape_dict, 'rb') as file: shape_dict = pickle.load(file) else: shape_dict = {} obslist = util.make_obslist(args.obsfile) bright_dict = {args.sig: {shape: {} for shape in args.shapes}} for obs in obslist: read_paths = util.read_paths_construct(args.indir, args.flag_choice, obs, 'INS') ins = INS(obs=obs, outpath=args.outdir, read_paths=read_paths, flag_choice=args.flag_choice) mf = MF(ins, sig_thresh=args.sig, N_thresh=args.N, shape_dict=shape_dict, streak=args.streak, point=args.point) mf.apply_match_test(apply_N_thresh=True) ins.match_events = util.red_event_sort(ins.match_events, [('TV6', 'broad6'), ('TV7', 'broad7'), ('TV8', 'broad8')],
os.makedirs(figpath) shape_dict = { 'TV4': [1.74e8, 1.82e8], 'TV5': [1.82e8, 1.9e8], 'TV6': [1.9e8, 1.98e8], 'dig1': [1.125e8, 1.15625e8], 'dig2': [1.375e8, 1.40625e8], 'dig3': [1.625e8, 1.65625e8], 'dig4': [1.875e8, 1.90625e8] } obslist = util.make_obslist(obslist_path) for obs in obslist: raw_reads = util.read_paths_construct(rawpath, 'None', obs, 'INS') OR_reads = util.read_paths_construct(ORpath, 'original', obs, 'INS') raw_ins = INS(obs=obs, flag_choice=None, read_paths=raw_reads, order=0, outpath=outpath) OR_ins = INS(obs=obs, flag_choice='original', read_paths=OR_reads) fig, ax = plt.subplots(nrows=3, ncols=2, figsize=(14, 8)) fig.suptitle('%s Incoherent Noise Spectrum Comparison' % obs) attr = ['data', 'data_ms'] cbar_label = ['UNCALIB', 'Deviation ($\hat{\sigma}$)'] kwargs = [{ 'cmap': cm.viridis, 'vmax': 0.1
from SSINS import util from SSINS import MF from SSINS import plot_lib as pl import matplotlib.pyplot as plt from matplotlib import cm import numpy as np import os # 'TV7_ext': [1.845e8 - 5.15e6, 1.845e8 + 5.15e6] basedir = '/Users/mike_e_dubs/MWA/INS/Long_Run/All' obs = '1066742016' outpath = '/Users/mike_e_dubs/General/Movie' if not os.path.exists(outpath): os.makedirs(outpath) flag_choice = 'None' read_paths = util.read_paths_construct(basedir, flag_choice, obs, 'INS') shape_dict = { 'TV6': [1.74e8, 1.81e8], 'TV7': [1.81e8, 1.88e8], 'TV8': [1.88e8, 1.95e8] } order = 0 ins = INS(obs=obs, read_paths=read_paths, outpath=outpath, order=order) mf = MF(ins, shape_dict=shape_dict, sig_thresh=5) mf.apply_match_test(order=order) ins.data.mask = False ins.data_ms = ins.mean_subtract(order=order) ins.outpath = '%s_0' % outpath labels = ['', '_ms'] titles = ['', ' (Mean-Subtracted)'] cbar_labels = [ins.vis_units, 'Deviation ($\hat{\sigma}$)']