Commit 914f053a authored by Martin Reinecke's avatar Martin Reinecke

cleanup

parent 46021a81
Pipeline #64987 passed with stages
in 8 minutes and 29 seconds
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright(C) 2013-2019 Max-Planck-Society
#
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
# Data object module that uses simple numpy ndarrays.
import numpy as np
#from numpy import ndarray as data_object
#from numpy import empty, empty_like, ones, zeros, full
#from numpy import absolute, sign, clip, vdot
#from numpy import sin, cos, sinh, cosh, tan, tanh
#from numpy import exp, log, log10, sqrt, sinc, log1p, expm1
from .random import Random
def from_random(random_type, shape, dtype=np.float64, **kwargs):
generator_function = getattr(Random, random_type)
return generator_function(dtype=dtype, shape=shape, **kwargs)
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Copyright(C) 2013-2019 Max-Planck-Society
#
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
from .data_objects.numpy_do import *
......@@ -140,11 +140,11 @@ class Field(object):
Field
The newly created Field.
"""
from . import dobj
from .random import Random
domain = DomainTuple.make(domain)
return Field(domain=domain,
val=dobj.from_random(random_type, dtype=dtype,
shape=domain.shape, **kwargs))
generator_function = getattr(Random, random_type)
arr = generator_function(dtype=dtype, shape=domain.shape, **kwargs)
return Field(domain, arr)
@property
def val(self):
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment