Esempio n. 1
0
    def plot_profile(cv, x, y, width, height, bestprof_inst, *args, **kwargs):
        psr_name = kwargs.get('psr_name', '')
        data_set = kwargs.get('data_set', '')
        beam_ra = kwargs.get('beam_ra', None)
        beam_dec = kwargs.get('beam_dec', None)

        if beam_ra != None and beam_dec != None:
            if isintance(beam_ra, BaseString):
                pass
            elif isinstance(beam_ra, RightAscension):
                pass

        # Some futzing with the position and size because the axes are not
        # drawn, normally they get 50 px.
        pc = PlotContainer(x - 50,
                           y - 50,
                           width + 100,
                           height + 100,
                           data_padding=0)
        pc.hide_axes()

        bpf = bestprof_inst

        pp = LinePlotter(bpf.profile, use_markers=False)
        pc.add_plotter(pp)
        TEXTSIZE = 10
        cv.add_plot_container(pc)
        if psr_name:
            cv.add_plot_container(
                TextFragment(x + 0,
                             y + height + TEXTSIZE,
                             'PSR ' + psr_name,
                             font_size=TEXTSIZE))
        elif bpf.psr_name:
            cv.add_plot_container(
                TextFragment(x + 0,
                             y + height + TEXTSIZE,
                             bpf.psr_name,
                             font_size=TEXTSIZE))
        else:
            cv.add_plot_container(
                TextFragment(x + 0,
                             y + height + TEXTSIZE,
                             'PSR UNKNOWN',
                             font_size=TEXTSIZE))
        cv.add_plot_container(
            TextFragment(x + 0,
                         y + height + 2 * TEXTSIZE,
                         '%.2f ms' % bpf.header.p_bary[0],
                         alignment='start',
                         font_size=TEXTSIZE))
        cv.add_plot_container(
            TextFragment(x + width,
                         y + height + 2 * TEXTSIZE,
                         '%.3f pc cm^-3' % bpf.header.best_dm,
                         alignment='end',
                         font_size=TEXTSIZE))