Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
deee7550
Commit
deee7550
authored
Jan 24, 2019
by
Philipp Arras
Browse files
Docs
parent
72f8051b
Changes
1
Hide whitespace changes
Inline
Side-by-side
nifty5/field.py
View file @
deee7550
...
...
@@ -31,13 +31,13 @@ class Field(object):
Parameters
----------
domain : DomainTuple
t
he domain of the new Field
T
he domain of the new Field
.
val : data_object
This object's global shape must match the domain shape
After construction, the object will no longer be writeable!
Note
s
----
-
Note
----
If possible, do not invoke the constructor directly, but use one of the
many convenience functions for instantiation!
"""
...
...
@@ -76,14 +76,14 @@ class Field(object):
Parameters
----------
domain : Domain, tuple of Domain, or DomainTuple
d
omain of the new Field
D
omain of the new Field
.
val : float/complex/int scalar
f
ill value. Data type of the field is inferred from val.
F
ill value. Data type of the field is inferred from val.
Returns
-------
Field
t
he newly created
f
ield
T
he newly created
F
ield
.
"""
if
not
np
.
isscalar
(
val
):
raise
TypeError
(
"val must be a scalar"
)
...
...
@@ -99,7 +99,7 @@ class Field(object):
Parameters
----------
domain : DomainTuple, tuple of Domain, or Domain
t
he domain of the new Field
T
he domain of the new Field
.
arr : numpy.ndarray
The data content to be used for the new Field.
Its shape must match the shape of `domain`.
...
...
@@ -132,8 +132,9 @@ class Field(object):
Returns
-------
numpy.ndarray : array containing all field entries, which can be
modified. Its shape is identical to `self.shape`.
numpy.ndarray
Array containing all field entries, which can be modified. Its
shape is identical to `self.shape`.
"""
return
dobj
.
to_global_data_rw
(
self
.
_val
)
...
...
@@ -171,9 +172,9 @@ class Field(object):
random_type : 'pm1', 'normal', or 'uniform'
The random distribution to use.
domain : DomainTuple
The domain of the output random
f
ield
The domain of the output random
F
ield
.
dtype : type
The datatype of the output random
f
ield
The datatype of the output random
F
ield
.
Returns
-------
...
...
@@ -187,10 +188,10 @@ class Field(object):
@
property
def
val
(
self
):
"""dobj.data_object : the data object storing the field's entries
"""dobj.data_object : the data object storing the field's entries
.
Note
s
----
-
Note
----
This property is intended for low-level, internal use only. Do not use
from outside of NIFTy's core; there should be better alternatives.
"""
...
...
@@ -236,13 +237,13 @@ class Field(object):
Parameters
----------
spaces : int, tuple of int or None
i
ndices of the sub-domains of the field's domain to be considered.
I
ndices of the sub-domains of the field's domain to be considered.
If `None`, the entire domain is used.
Returns
-------
float or None
i
f the requested sub-domain has a uniform volume element, it is
I
f the requested sub-domain has a uniform volume element, it is
returned. Otherwise, `None` is returned.
"""
if
np
.
isscalar
(
spaces
):
...
...
@@ -264,7 +265,7 @@ class Field(object):
Parameters
----------
spaces : int, tuple of int or None
i
ndices of the sub-domains of the field's domain to be considered.
I
ndices of the sub-domains of the field's domain to be considered.
If `None`, the entire domain is used.
Returns
...
...
@@ -331,8 +332,9 @@ class Field(object):
x : Field
Returns
----------
Field, defined on the product space of self.domain and x.domain
-------
Field
Defined on the product space of self.domain and x.domain.
"""
if
not
isinstance
(
x
,
Field
):
raise
TypeError
(
"The multiplier must be an instance of "
+
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment