示例#1
0
    read_paths = {
        'data':
        arr,
        'Nbls':
        '%s/arrs/%s_%s_INS_Nbls.npym' % (args.inpath, obs, args.flag_choice),
        'freq_array':
        '%s/metadata/%s_freq_array.npy' % (args.inpath, obs),
        'pols':
        '%s/metadata/%s_pols.npy' % (args.inpath, obs),
        'vis_units':
        '%s/metadata/%s_vis_units.npy' % (args.inpath, obs)
    }
    ins = INS(obs=obs,
              outpath=args.outpath,
              flag_choice=args.flag_choice,
              read_paths=read_paths)
    # ins.data[:, :, :82] = np.ma.masked
    # ins.data[:, :, -21:] = np.ma.masked
    ins.data_ms = ins.mean_subtract()
    ins.counts, ins.bins, ins.sig_thresh = ins.hist_make()
    cp.INS_plot(ins, **ms_plot_kwargs)
    mf = MF(ins,
            shape_dict=shape_dict,
            point=args.point,
            streak=args.streak,
            **mf_kwargs)
    for test in args.tests:
        getattr(mf, 'apply_%s_test' % test)(args.order)
    ins.save()
    cp.MF_plot(mf, **ms_plot_kwargs)
                    ylabel='Time (10 s)')
plot_lib.image_plot(fig_mf,
                    ax[1],
                    ins.data_ms[:, 0, :, 0],
                    freq_array=ins.freq_array[0],
                    cbar_label='Deviation ($\hat{\sigma}$)',
                    aspect=aspect,
                    vmin=-5,
                    vmax=5,
                    cmap=cm.coolwarm,
                    mask_color='black',
                    ylabel='Time (10 s)')
fig_mf.savefig('%s/%s_INS_MF.png' % (outpath, obs))
fig.savefig('%s/%s_INS.png' % (outpath, obs))

ins.counts, ins.bins = np.histogram(ins.data_ms[np.logical_not(ins.data.mask)],
                                    bins='auto')
ins2.counts, ins2.bins = np.histogram(ins2.data_ms[np.logical_not(
    ins2.data.mask)],
                                      bins='auto')
exp, var = util.hist_fit(ins2.counts, ins2.bins)
N1 = np.sum(ins.counts)
N2 = np.sum(ins2.counts)
Nexp = np.sum(exp)

pdf1 = ins.counts / (N1 * np.diff(ins.bins))
pdf2 = ins2.counts / (N2 * np.diff(ins2.bins))
pdf_exp = exp / (Nexp * np.diff(ins2.bins))

print(np.sum(pdf1 * np.diff(ins.bins)))
print(np.sum(pdf2 * np.diff(ins2.bins)))
print(np.sum(pdf_exp * np.diff(ins2.bins)))