예제 #1
0
def plot_init_map(ax, d_v, inps, metadata):

    # prepare data
    if inps.wrap:
        if inps.disp_unit_v == 'radian':
            d_v *= inps.range2phase
        d_v = ut.wrap(d_v, wrap_range=inps.wrap_range)

    # Title and Axis Label
    disp_date = inps.dates[inps.init_idx].strftime('%Y-%m-%d')
    inps.fig_title = 'N = {}, Time = {}'.format(inps.init_idx, disp_date)

    # Initial Pixel
    if inps.yx and inps.yx != inps.ref_yx:
        inps.pts_yx = np.array(inps.yx).reshape(-1, 2)
        if inps.lalo:
            inps.pts_lalo = np.array(inps.lalo).reshape(-1, 2)
        else:
            inps.pts_lalo = None
        inps.pts_marker = 'ro'

    # call view.py to plot
    ax, inps, im, cbar = view.plot_slice(ax, d_v, metadata, inps)

    return ax, im
예제 #2
0
def main(iargs=None):
    inps = cmd_line_parse(iargs)
    if not inps.disp_fig:
        plt.switch_backend('Agg')

    # read network info
    inps = read_network_info(inps)

    # Figure 1 - map
    fig1, ax1 = plt.subplots(num=inps.map_file)
    cmd = inps.map_plot_cmd.format(inps.map_file)
    data1, atr, inps1 = view.prep_slice(cmd)
    ax1 = view.plot_slice(ax1, data1, atr, inps1)[0]

    # Figure 2 - coherence matrix
    fig2, ax2 = plt.subplots(num='Coherence Matrix')
    if inps.yx:
        plot_coherence_matrix4one_pixel(inps.yx, fig2, ax2, inps)

    def plot_event(event):
        if event.inaxes == ax1:
            yx = (int(event.ydata + 0.5), int(event.xdata + 0.5))
            plot_coherence_matrix4one_pixel(yx, fig2, ax2, inps)

    if inps.save_fig:
        plt.savefig('coh_mat_{}'.format())

    # Final linking of the canvas to the plots.
    cid = fig1.canvas.mpl_connect('button_press_event', plot_event)
    if inps.disp_fig:
        plt.show()
    fig1.canvas.mpl_disconnect(cid)
    return
예제 #3
0
    def plot(self):
        # Figure 1
        self.fig = plt.figure(self.figname, figsize=self.fig_size)
        # Axes 1 - Image
        self.ax_img = self.fig.add_axes([0.05, 0.1, 0.4, 0.8])
        view_cmd = self.view_cmd.format(self.img_file)
        d_img, atr, inps_img = view.prep_slice(view_cmd)
        if self.yx:
            inps_img.pts_yx = np.array(self.yx).reshape(-1, 2)
            inps_img.pts_marker = 'r^'
        inps_img.print_msg = self.print_msg
        self.ax_img = view.plot_slice(self.ax_img, d_img, atr, inps_img)[0]

        # coordinate info
        self.coord = ut.coordinate(atr)
        self.fig_coord = inps_img.fig_coord

        # Axes 2 - coherence matrix
        self.ax_mat = self.fig.add_axes([0.55, 0.125, 0.40, 0.75])
        if self.yx:
            self.plot_coherence_matrix4pixel(self.yx)

        # Link the canvas to the plots.
        self.cid = self.fig.canvas.mpl_connect('button_press_event', self.update_coherence_matrix)
        if self.disp_fig:
            plt.show()
        return
예제 #4
0
파일: tsview.py 프로젝트: xuubing/PySAR
    def plot_init_image(self, img_data):
        # prepare data
        if self.wrap:
            if self.disp_unit_img == 'radian':
                img_data *= self.range2phase
            img_data = ut.wrap(img_data, wrap_range=self.wrap_range)

        # Title and Axis Label
        disp_date = self.dates[self.init_idx].strftime('%Y-%m-%d')
        self.fig_title = 'N = {}, Time = {}'.format(self.init_idx, disp_date)

        # Initial Pixel
        if self.yx and self.yx != self.ref_yx:
            self.pts_yx = np.array(self.yx).reshape(-1, 2)
            if self.lalo:
                self.pts_lalo = np.array(self.lalo).reshape(-1, 2)
            else:
                self.pts_lalo = None

        # call view.py to plot
        self.img, self.cbar_img = view.plot_slice(self.ax_img, img_data, self.atr, self)[2:4]
        return self.img, self.cbar_img