base_plots.py 文件源码

python
阅读 31 收藏 0 点赞 0 评论 0

项目:seqhawkes 作者: mlukasik 项目源码 文件源码
def x_frame1D(X, plot_limits=None, resolution=None):
    """
    Internal helper function for making plots, returns a set of input values to plot as well as lower and upper limits
    """

    assert X.shape[1] == 1, \
        'x_frame1D is defined for one-dimensional inputs'
    if plot_limits is None:
        (xmin, xmax) = (X.min(0), X.max(0))
        (xmin, xmax) = (xmin - 0.2 * (xmax - xmin), xmax + 0.2 * (xmax
                        - xmin))
    elif len(plot_limits) == 2:
        (xmin, xmax) = plot_limits
    else:
        raise ValueError, 'Bad limits for plotting'

    Xnew = np.linspace(xmin, xmax, resolution or 200)[:, None]
    return (Xnew, xmin, xmax)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号