Skip to content
Snippets Groups Projects
Select Git revision
  • 0bb0898768e5323e2d529f5d572c9081aa6cb94e
  • master default
  • dobj_experiments
  • nifty2go
  • nightly
  • critical_nightly
  • theo_master
  • field_testing
  • issue173_wienerFilterDemos
  • wiener_filter_easy
  • RXTE_compatible
  • plotting
  • NIFTy_2
  • NIFTy_1
  • 1.0.8
  • 1.0.7
  • 1.0.6
  • 0.9.0
  • 0.8.4
  • 0.8.0
  • 0.7.0
  • 0.6.0
  • 0.4.2
  • 0.4.0
  • 0.3.0
  • 0.2.0
26 results

numpy_do.py

Blame
  • 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)