__init__.py 文件源码

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

项目:SDF-Python 作者: ScientificDataFormat 项目源码 文件源码
def _validate_dataset(ds):
    if not type(ds.data) is np.ndarray:
        return ['Dataset.data must be a numpy.ndarray']

    elif np.alen(ds.data) < 1:
        return ['Dataset.data must not be empty']

    elif not np.issubdtype(ds.data.dtype, np.float64):
        return ['Dataset.data.dtype must be numpy.float64']

    if ds.is_scale:
        if len(ds.data.shape) != 1:
            return ['Scales must be one-dimensional']
        if np.any(np.diff(ds.data) <= 0):
            return ['Scales must be strictly monotonic increasing']
    else:
        if (len(ds.data.shape) >= 1) and (ds.data.shape[0] > 0) and not (len(ds.data.shape) == len(ds.scales)):
            return ['The number of scales does not match the number of dimensions']

    return []
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号