Ejemplo n.º 1
0
def ant_ant_stat_frame(title_text, full_pol_array, station_names, output_name=None, dpi=50, **kwargs):
    if output_name is None:
        fig = figure(figsize=(32,30), dpi=dpi)
    else:
        fig=Figure(figsize=(32,30), dpi=dpi)

    if output_name is None:
        fig.suptitle(title_text, fontsize=30)
    else:
        fig.suptitle(title_text+' '+output_name, fontsize=30)
    
    ax1=fig.add_subplot(2,2,1)
    ant_ant_stat_plot(fig, ax1, title_text+' XX', full_pol_array[:,:,0], station_names, **kwargs)
    
    ax2=fig.add_subplot(2,2,2)
    ant_ant_stat_plot(fig, ax2, title_text+' XY', full_pol_array[:,:,1], station_names, **kwargs)
    
    ax3=fig.add_subplot(2,2,3)
    ant_ant_stat_plot(fig, ax3, title_text+' YX', full_pol_array[:,:,2], station_names, **kwargs)
    
    ax4=fig.add_subplot(2,2,4)
    ant_ant_stat_plot(fig, ax4, title_text+' YY', full_pol_array[:,:,3], station_names, **kwargs)

    if output_name is not None:
        canvas = FigureCanvasAgg(fig)
        if output_name[-4:] in ['.jpg', '.JPG']:
            canvas.print_jpg(output_name, dpi=dpi, quality=55)
        else:
            canvas.print_figure(output_name, dpi=dpi)
        pass
    pass
Ejemplo n.º 2
0
def timeseries_station_page(ms, station_name, time_slots, data, fn=abs, output_name=None):
    dpi=50
    if output_name is None:
        fig = figure(figsize=(32,24), dpi=dpi)
    else:
        fig = Figure(figsize=(32,24), dpi=dpi)

    station_name_list = list(ms.tables['antennae']['NAME'])
    station_id        = station_name_list.index(station_name)
    num_ant           = len(ms.tables['antennae'])
    tsn               = time_slots-time_slots[0]
    pol_names         = corr_type(ms.tables['polarization']['CORR_TYPE'][0])
    ref_freq_mhz      = ms.tables['spectral_windows'][0]['REF_FREQUENCY']/1.e6

    fig.suptitle(ms.msname+': '+fn.__name__+'(vis) with '+station_name+' at %3.2f MHz' % (ref_freq_mhz,), fontsize='large')

    median_amp = ma.median(ma.mean(ma.median(fn(data[station_id,:,0::3,:]), axis=-1), axis=-1), axis=-1)
    
    for id2,name in enumerate(station_name_list):
        ax = fig.add_subplot(ceil(num_ant/4.0),4, id2+1)
        ax.plot(tsn, fn(data[station_id,id2,0,:]), c='blue'  , label=pol_names[0])
        ax.plot(tsn, fn(data[station_id,id2,1,:]), c='green' , label=pol_names[1])
        ax.plot(tsn, fn(data[station_id,id2,2,:]), c='purple', label=pol_names[2])
        ax.plot(tsn, fn(data[station_id,id2,3,:]), c='red'   , label=pol_names[3])
        ax.grid()
        ax.set_ylabel(station_name_list[id2], rotation='horizontal')
        ax.set_ylim(0.0, 3*median_amp)
        ax.set_yticklabels([])
        if id2 < len(station_name_list)-4:
            ax.set_xticklabels([])
        else:
            ax.set_xlabel('Time [s]')    
        pass
    fig.subplots_adjust(hspace=0.0, top=0.95, bottom=0.04)
    if output_name is not None:
        canvas = FigureCanvasAgg(fig)
        if output_name[-4:] in ['.jpg', '.JPG']:
            canvas.print_jpg(output_name, dpi=dpi, quality=55)
        else:
            canvas.print_figure(output_name, dpi=dpi)
        pass
    pass