Select Git revision
numpy_do.py
Forked from
ift / NIFTy
Source project has a limited visibility.
numpy_do.py 611 B
# Data object module for NIFTy that uses simple numpy ndarrays.
import numpy as np
from numpy import ndarray as data_object
from numpy import full, empty, sqrt, ones, zeros, vdot, abs, bincount, exp, log
from .random import Random
def from_object(object, dtype=None, copy=True):
return np.array(object, dtype=dtype, copy=copy)
def from_random(random_type, shape, dtype=np.float64, **kwargs):
generator_function = getattr(Random, random_type)
return generator_function(dtype=dtype, shape=shape, **kwargs)
def to_ndarray(arr):
return arr
def from_ndarray(arr):
return np.asarray(arr)