示例#1
0
文件: tasks.py 项目: flomertens/wise
    def do_plot(fig, scale):
        link_builder = link_builders.get_scale(scale)

        links = list(link_builder.get_links(feature_filter=feature_filter, 
                        min_link_size=min_link_size))
        ax = fig.subplots(nrows=1 + int(pa or snr), reshape=False, sharex=True)

        if fit_fct:
            plotutils.checkargs(kwargs, 'ls', '--')
        wiseutils.plot_links_dfc(ax[0], projection, links, num=num, **kwargs)
        if fit_fct:
            fit_result = wiseutils.plot_links_dfc_fit(ax[0], projection, links, fit_fct, lw=2)
            fit_results.update(fit_result)

        if title:
            ax[0].set_title("Separation from core at scale %s" % projection.get_sky(scale))

        ax[-1].set_xlabel("Epoch (years)")
        ax[0].set_ylabel("Distance from core (mas)")

        if pa:
            wiseutils.plot_links_pa(ax[1], projection, links, **kwargs)
            ax[-1].set_xlabel("Separation PA (deg)")
        elif snr:
            wiseutils.plot_links_snr(ax[1], projection, links, **kwargs)
            ax[1].set_ylabel("Wavelet Coef SNR")
示例#2
0
def plot_displacement_vector(ax, delta_info, mode='com', color_fct=None, 
                             flag=wfeatures.DeltaInformation.DELTA_MATCH, **kwargs):
    """Display displacements vectors represented as arrows.
    
    Parameters
    ----------
    ax : :class:`matplotlib.axes.Axes`
    delta_info : :class:`wise.features.DeltaInformation`
        An object containing the displacements to display.
    mode : str, optional
        Coord mode for the location of the features: 'lm', 'com' or 'cos'.
    color_fct : TYPE, optional
        If set, it should be a function that take a feature as argument and return a color.
    flag : Attribute, optional
        Default is DeltaInformation.DELTA_MATCH.
    **kwargs: 
        Additional arguments to be passed to :func:`matplotlib.pyltot.Arrow`.

    
    .. _tags: plt_matching
    """
    features = delta_info.get_features(flag=flag)
    for i, feature in enumerate(features):
        coord = feature.get_coord(mode=mode)
        delta = delta_info.get_delta(feature)
        if color_fct is not None:
            kwargs['fc'] = color_fct(feature)
        plotutils.checkargs(kwargs, 'zorder', 3)
        plotutils.checkargs(kwargs, 'width', 3.5)
        patch = plt.Arrow(coord[1], coord[0], delta[1], delta[0], **kwargs)
        ax.add_patch(patch)
示例#3
0
def plot_velocity_vector(ax, delta_info, projection, ang_vel_unit, pix_per_unit, 
                         mode='com', color_fct=None, 
                         flag=wfeatures.DeltaInformation.DELTA_MATCH, **kwargs):
    features = delta_info.get_features(flag=flag)
    for i, feature in enumerate(features):
        coord = feature.get_coord(mode=mode)
        delta = delta_info.get_delta(feature)
        ang_vel = delta_info.get_full_delta(feature).get_angular_velocity(projection)
        ang_vel_pix = ang_vel.to(ang_vel_unit).value * pix_per_unit
        ang_vel_vect_pix = ang_vel_pix * delta / nputils.l2norm(delta)
        if color_fct is not None:
            kwargs['fc'] = color_fct(feature)
        plotutils.checkargs(kwargs, 'zorder', 3)
        plotutils.checkargs(kwargs, 'width', 3.5)
        patch = plt.Arrow(coord[1], coord[0], ang_vel_vect_pix[1], ang_vel_vect_pix[0], **kwargs)
        ax.add_patch(patch)