示例#1
0
def test_VDH_plot():

    matplotlib = pytest.importorskip("matplotlib")

    obs = '1061313128_99bl_1pol_half_time'
    testfile = os.path.join(DATA_PATH, '%s.uvfits' % obs)
    outdir = os.path.join(DATA_PATH, 'test_plots')

    prefix = '%s/%s' % (outdir, obs)
    outfile = '%s_VDH.pdf' % prefix

    dens_prefix = '%s/%s_dens' % (outdir, obs)
    dens_outfile = '%s_VDH.pdf' % dens_prefix

    ss = SS()
    ss.read(testfile, flag_choice='original', diff=True)

    cp.VDH_plot(ss, prefix, backend='Agg')
    # Test with density prefix and error bars
    cp.VDH_plot(ss,
                dens_prefix,
                density=True,
                error_sig=1,
                ylim=[1e-5, 1e5],
                pre_model_label='model label')

    assert os.path.exists(outfile), "The first plot was not made"
    assert os.path.exists(dens_outfile), "The second plot was not made"

    os.remove(outfile)
    os.remove(dens_outfile)
    os.rmdir(outdir)
示例#2
0
def test_VDH_no_model():
    obs = '1061313128_99bl_1pol_half_time'
    testfile = os.path.join(DATA_PATH, '%s.uvfits' % obs)
    outdir = os.path.join(DATA_PATH, 'test_plots')
    prefix = '%s/%s' % (outdir, obs)
    outfile = '%s_VDH.pdf' % prefix

    ss = SS()
    ss.read(testfile, flag_choice=None)

    cp.VDH_plot(ss, prefix, pre_model=False, post_model=False)

    assert os.path.exists(outfile), "The plot was not made"

    os.remove(outfile)
    os.rmdir(outdir)
示例#3
0
def test_VDH_no_model():
    obs = '1061313128_99bl_1pol_half_time'
    testfile = os.path.join(DATA_PATH, '%s.uvfits' % obs)
    outdir = os.path.join(DATA_PATH, 'test_plots')
    prefix = '%s/%s' % (outdir, obs)
    outfile = '%s_VDH.pdf' % prefix

    ss = SS()
    ss.read(testfile, flag_choice=None, diff=True)

    with pytest.warns(
            UserWarning,
            match=
            "Asking to plot post-flagging data, but SS.flag_choice is None. This is identical to plotting pre-flagging data"
    ):
        cp.VDH_plot(ss, prefix, pre_model=False, post_model=False)

    assert os.path.exists(outfile), "The plot was not made"

    os.remove(outfile)
    os.rmdir(outdir)
示例#4
0
def test_VDH_no_model():

    matplotlib = pytest.importorskip("matplotlib")

    obs = '1061313128_99bl_1pol_half_time'
    testfile = os.path.join(DATA_PATH, f'{obs}.uvfits')
    outdir = os.path.join(DATA_PATH, 'test_plots')
    prefix = f'{outdir}/{obs}'
    outfile = f'{prefix}_VDH.pdf'

    ss = SS()
    ss.read(testfile, flag_choice=None, diff=True)

    with pytest.warns(
            UserWarning,
            match=
            "Asking to plot post-flagging data, but SS.flag_choice is None. This is identical to plotting pre-flagging data"
    ):
        cp.VDH_plot(ss, prefix, pre_model=False, post_model=False)

    assert os.path.exists(outfile), "The plot was not made"

    os.remove(outfile)
    os.rmdir(outdir)
示例#5
0
# set a file prefix for plot
prefix = 'tutorial_outputs/IW_plot_1.1_' + uvfits_filename

# Pre-flagged and Post-flagged
cp.VDH_plot(ss,
            prefix,
            file_ext='pdf',
            xlabel='Visibility Differences',
            xscale='log',
            yscale='log',
            legend=True,
            ylim=None,
            density=False,
            pre_flag=True,
            post_flag=True,
            pre_model=True,
            post_model=True,
            pre_label='Pre flagging',
            post_label='Post flagging',
            pre_model_label='Pre Model',
            post_model_label='Post Model',
            pre_model_color='green',
            post_model_color='yellow',
            pre_color='red',
            post_color='blue',
            font_size='medium')

# Create an INS object and use uvfits file
ins = INS(ss)

# Make a INS plot
示例#6
0
from SSINS import SS
from SSINS import Catalog_Plot as cp
import numpy as np

inpath = '/Volumes/Faramir/uvfits'
obslist = ['1061313128', '1061312640', '1066742016']
outpath = '/Users/mikewilensky/General/Hist_Compare_Big_Legend'
read_kwargs = {'ant_str': 'cross'}

for obs in obslist:
    ss = SS(inpath='%s/%s.uvfits' % (inpath, obs),
            obs=obs,
            outpath=outpath,
            read_kwargs=read_kwargs,
            bad_time_indices=[0, -1, -2, -3])
    ss.VDH_prepare(fit_hist=True, bins='auto')
    ss.VDH.errors[0] *= 4
    cp.VDH_plot(ss.VDH,
                leg_size='xx-large',
                xscale='linear',
                ylim=[0.1, 10 * np.amax(ss.VDH.counts[0])])
    del ss
示例#7
0
UV6.phase(5.03706309897,.598912483314)

for x in inpath5:
    	UVtemp.read(x, ant_str = 'cross')
    	UVtemp.object_name = 'same'
    	if not UVtemp.phase_center_dec == .598912483314 or not UVtemp.phase_center_ra == 5.03706309897:
        	UVtemp.unphase_to_drift()
        	UVtemp.phase(5.03706309897,.598912483314)
    	UV6 = UV6 + UVtemp

UV = UV2 + UV3 + UV4 + UV5 + UV6

print UV.Nbls
print UV.Ntimes
print UV.Nblts
print 'the buck stop here'

ss = SS(obs=obs, outpath=outpath, UV = UV, diff= True)

ss.INS_prepare()
print 'Marker 1'
ss.VDH_prepare()
print 'Marker 2'
ss.INS.save()
ss.VDH.save()

cp.INS_plot(ss.INS, ms_vmax=5, ms_vmin=-5)
print 'Marker 3'
cp.VDH_plot(ss.VDH, xscale = 'linear')