Skip to content
GitLab
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
1d9d8541
Commit
1d9d8541
authored
Apr 08, 2020
by
Martin Reinecke
Browse files
more renamings
parent
97974970
Pipeline
#72567
failed with stages
in 19 minutes and 58 seconds
Changes
59
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
demos/bench_gridder.py
View file @
1d9d8541
...
...
@@ -19,7 +19,7 @@ for ii in range(10, 26):
uvspace
=
ift
.
RGSpace
((
nu
,
nv
))
visspace
=
ift
.
Unstructured
Domain
(
N
)
visspace
=
ift
.
Unstructured
Space
(
N
)
img
=
rng
.
standard_normal
((
nu
,
nv
))
img
=
ift
.
makeField
(
uvspace
,
img
)
...
...
demos/getting_started_2.py
View file @
1d9d8541
...
...
@@ -68,7 +68,7 @@ if __name__ == '__main__':
HT
=
ift
.
HarmonicTransformOperator
(
harmonic_space
,
position_space
)
# Domain on which the field's degrees of freedom are defined
domain
=
ift
.
Domain
Tuple
.
make
(
harmonic_space
)
domain
=
ift
.
Space
Tuple
.
make
(
harmonic_space
)
# Define amplitude (square root of power spectrum)
def
sqrtpspec
(
k
):
...
...
demos/polynomial_fit.py
View file @
1d9d8541
...
...
@@ -48,19 +48,19 @@ class PolynomialResponse(ift.LinearOperator):
Parameters
----------
domain: Unstructured
Domain
domain: Unstructured
Space
The domain on which the coefficients of the polynomial are defined.
sampling_points: Numpy array
x-values of the sampling points.
"""
def
__init__
(
self
,
domain
,
sampling_points
):
if
not
(
isinstance
(
domain
,
ift
.
Unstructured
Domain
)
if
not
(
isinstance
(
domain
,
ift
.
Unstructured
Space
)
and
isinstance
(
x
,
np
.
ndarray
)):
raise
TypeError
self
.
_domain
=
ift
.
Domain
Tuple
.
make
(
domain
)
tgt
=
ift
.
Unstructured
Domain
(
sampling_points
.
shape
)
self
.
_target
=
ift
.
Domain
Tuple
.
make
(
tgt
)
self
.
_domain
=
ift
.
Space
Tuple
.
make
(
domain
)
tgt
=
ift
.
Unstructured
Space
(
sampling_points
.
shape
)
self
.
_target
=
ift
.
Space
Tuple
.
make
(
tgt
)
self
.
_capability
=
self
.
TIMES
|
self
.
ADJOINT_TIMES
sh
=
(
self
.
target
.
size
,
domain
.
size
)
...
...
@@ -93,7 +93,7 @@ if __name__ == '__main__':
y
[
5
]
-=
0
# Set up minimization problem
p_space
=
ift
.
Unstructured
Domain
(
N_params
)
p_space
=
ift
.
Unstructured
Space
(
N_params
)
params
=
ift
.
full
(
p_space
,
0.
)
R
=
PolynomialResponse
(
p_space
,
x
)
ift
.
extra
.
consistency_check
(
R
)
...
...
nifty6/__init__.py
View file @
1d9d8541
...
...
@@ -3,8 +3,8 @@ from .version import __version__
from
.
import
random
from
.domains.domain
import
Domain
from
.domains.structured_domain
import
Structured
Domain
from
.domains.unstructured_domain
import
Unstructured
Domain
from
.domains.structured_domain
import
Structured
Space
from
.domains.unstructured_domain
import
Unstructured
Space
from
.domains.rg_space
import
RGSpace
from
.domains.lm_space
import
LMSpace
from
.domains.gl_space
import
GLSpace
...
...
@@ -12,8 +12,8 @@ from .domains.hp_space import HPSpace
from
.domains.power_space
import
PowerSpace
from
.domains.dof_space
import
DOFSpace
from
.domain_tuple
import
Domain
Tuple
from
.multi_domain
import
MultiDomain
from
.domain_tuple
import
Space
Tuple
from
.multi_domain
import
SpaceTupleDict
from
.field
import
Field
from
.multi_field
import
MultiField
...
...
@@ -24,7 +24,7 @@ from .operators.linear_operator import LinearOperator
from
.operators.adder
import
Adder
from
.operators.diagonal_operator
import
DiagonalOperator
from
.operators.distributors
import
DOFDistributor
,
PowerDistributor
from
.operators.domain_tuple_field_inserter
import
Domain
TupleFieldInserter
from
.operators.domain_tuple_field_inserter
import
Space
TupleFieldInserter
from
.operators.contraction_operator
import
ContractionOperator
from
.operators.linear_interpolation
import
LinearInterpolator
from
.operators.endomorphic_operator
import
EndomorphicOperator
...
...
nifty6/domain_tuple.py
View file @
1d9d8541
...
...
@@ -22,7 +22,7 @@ from .domains.domain import Domain
import
numpy
as
np
class
Domain
Tuple
(
object
):
class
Space
Tuple
(
object
):
"""Ordered sequence of Domain objects.
This class holds a tuple of :class:`Domain` objects, which together form
...
...
@@ -33,7 +33,7 @@ class DomainTuple(object):
Notes
-----
Domain
Tuples should never be created using the constructor, but rather
Space
Tuples should never be created using the constructor, but rather
via the factory function :attr:`make`!
"""
_tupleCache
=
{}
...
...
@@ -59,26 +59,26 @@ class DomainTuple(object):
@
staticmethod
def
make
(
domain
):
"""Returns a
Domain
Tuple matching `domain`.
"""Returns a
Space
Tuple matching `domain`.
This function checks whether a matching
Domain
Tuple already exists.
If yes, this object is returned, otherwise a new
Domain
Tuple object
This function checks whether a matching
Space
Tuple already exists.
If yes, this object is returned, otherwise a new
Space
Tuple object
is created and returned.
Parameters
----------
domain : Domain or tuple of Domain or
Domain
Tuple
The geometrical structure for which the
Domain
Tuple shall be
domain : Domain or tuple of Domain or
Space
Tuple
The geometrical structure for which the
Space
Tuple shall be
obtained.
"""
if
isinstance
(
domain
,
Domain
Tuple
):
if
isinstance
(
domain
,
Space
Tuple
):
return
domain
domain
=
Domain
Tuple
.
_parse_domain
(
domain
)
obj
=
Domain
Tuple
.
_tupleCache
.
get
(
domain
)
domain
=
Space
Tuple
.
_parse_domain
(
domain
)
obj
=
Space
Tuple
.
_tupleCache
.
get
(
domain
)
if
obj
is
not
None
:
return
obj
obj
=
Domain
Tuple
(
domain
,
_callingfrommake
=
True
)
Domain
Tuple
.
_tupleCache
[
domain
]
=
obj
obj
=
Space
Tuple
(
domain
,
_callingfrommake
=
True
)
Space
Tuple
.
_tupleCache
[
domain
]
=
obj
return
obj
@
staticmethod
...
...
@@ -105,7 +105,7 @@ class DomainTuple(object):
"""tuple of int: number of pixels along each axis
The shape of the array-like object required to store information
defined on the
Domain
Tuple.
defined on the
Space
Tuple.
"""
return
self
.
_shape
...
...
@@ -187,22 +187,22 @@ class DomainTuple(object):
return
not
self
.
__eq__
(
x
)
def
__str__
(
self
):
return
(
"
Domain
Tuple, len: {}
\n
"
.
format
(
len
(
self
))
+
return
(
"
Space
Tuple, len: {}
\n
"
.
format
(
len
(
self
))
+
"
\n
"
.
join
(
str
(
i
)
for
i
in
self
))
def
__reduce__
(
self
):
return
(
_unpickle
Domain
Tuple
,
(
self
.
_dom
,))
return
(
_unpickle
Space
Tuple
,
(
self
.
_dom
,))
@
staticmethod
def
scalar_domain
():
if
Domain
Tuple
.
_scalarDomain
is
None
:
Domain
Tuple
.
_scalarDomain
=
Domain
Tuple
.
make
(())
return
Domain
Tuple
.
_scalarDomain
if
Space
Tuple
.
_scalarDomain
is
None
:
Space
Tuple
.
_scalarDomain
=
Space
Tuple
.
make
(())
return
Space
Tuple
.
_scalarDomain
def
__repr__
(
self
):
subs
=
"
\n
"
.
join
(
sub
.
__repr__
()
for
sub
in
self
.
_dom
)
return
"
Domain
Tuple:
\n
"
+
utilities
.
indent
(
subs
)
return
"
Space
Tuple:
\n
"
+
utilities
.
indent
(
subs
)
def
_unpickle
Domain
Tuple
(
*
args
):
return
Domain
Tuple
.
make
(
*
args
)
def
_unpickle
Space
Tuple
(
*
args
):
return
Space
Tuple
.
make
(
*
args
)
nifty6/domains/dof_space.py
View file @
1d9d8541
...
...
@@ -17,10 +17,10 @@
import
numpy
as
np
from
.structured_domain
import
Structured
Domain
from
.structured_domain
import
Structured
Space
class
DOFSpace
(
Structured
Domain
):
class
DOFSpace
(
Structured
Space
):
"""Generic degree-of-freedom space. It is defined as the domain of some
DOFDistributor.
Its entries represent the underlying degrees of freedom of some other
...
...
nifty6/domains/gl_space.py
View file @
1d9d8541
...
...
@@ -17,10 +17,10 @@
import
numpy
as
np
from
.structured_domain
import
Structured
Domain
from
.structured_domain
import
Structured
Space
class
GLSpace
(
Structured
Domain
):
class
GLSpace
(
Structured
Space
):
"""Represents a 2-sphere with Gauss-Legendre pixelization.
Its harmonic partner domain is the
...
...
nifty6/domains/hp_space.py
View file @
1d9d8541
...
...
@@ -17,10 +17,10 @@
import
numpy
as
np
from
.structured_domain
import
Structured
Domain
from
.structured_domain
import
Structured
Space
class
HPSpace
(
Structured
Domain
):
class
HPSpace
(
Structured
Space
):
"""Represents 2-sphere with HEALPix discretization.
Its harmonic partner domain is the
...
...
nifty6/domains/lm_space.py
View file @
1d9d8541
...
...
@@ -18,10 +18,10 @@
import
numpy
as
np
from
..field
import
Field
from
.structured_domain
import
Structured
Domain
from
.structured_domain
import
Structured
Space
class
LMSpace
(
Structured
Domain
):
class
LMSpace
(
Structured
Space
):
"""Represents a set of spherical harmonic coefficients.
Its harmonic partner spaces are :class:`~nifty6.domains.hp_space.HPSpace`
...
...
nifty6/domains/power_space.py
View file @
1d9d8541
...
...
@@ -17,10 +17,10 @@
import
numpy
as
np
from
.structured_domain
import
Structured
Domain
from
.structured_domain
import
Structured
Space
class
PowerSpace
(
Structured
Domain
):
class
PowerSpace
(
Structured
Space
):
"""Represents non-equidistantly binned spaces for power spectra.
A power space is the result of a projection of a harmonic domain where
...
...
@@ -28,7 +28,7 @@ class PowerSpace(StructuredDomain):
Parameters
----------
harmonic_partner : Structured
Domain
harmonic_partner : Structured
Space
The harmonic domain of which this is the power space.
binbounds : None, or tuple of float
By default (binbounds=None):
...
...
@@ -107,7 +107,7 @@ class PowerSpace(StructuredDomain):
Parameters
----------
space : Structured
Domain
space : Structured
Space
the domain for which the binbounds will be computed.
logarithmic : bool
If True bins will have equal size in linear space; otherwise they
...
...
@@ -124,7 +124,7 @@ class PowerSpace(StructuredDomain):
empty bins, if `nbin` is not supplied.
The first and last bin boundary are inferred from `space`.
"""
if
not
(
isinstance
(
space
,
Structured
Domain
)
and
space
.
harmonic
):
if
not
(
isinstance
(
space
,
Structured
Space
)
and
space
.
harmonic
):
raise
ValueError
(
"first argument must be a harmonic space."
)
if
logarithmic
is
None
and
nbin
is
None
:
return
None
...
...
@@ -153,7 +153,7 @@ class PowerSpace(StructuredDomain):
return
PowerSpace
.
linear_binbounds
(
nbin
,
lbound
,
rbound
)
def
__init__
(
self
,
harmonic_partner
,
binbounds
=
None
):
if
not
(
isinstance
(
harmonic_partner
,
Structured
Domain
)
and
if
not
(
isinstance
(
harmonic_partner
,
Structured
Space
)
and
harmonic_partner
.
harmonic
):
raise
ValueError
(
"harmonic_partner must be a harmonic space."
)
if
harmonic_partner
.
scalar_dvol
is
None
:
...
...
@@ -224,7 +224,7 @@ class PowerSpace(StructuredDomain):
@
property
def
harmonic_partner
(
self
):
"""Structured
Domain
: the harmonic domain associated with `self`."""
"""Structured
Space
: the harmonic domain associated with `self`."""
return
self
.
_harmonic_partner
@
property
...
...
nifty6/domains/rg_space.py
View file @
1d9d8541
...
...
@@ -19,10 +19,10 @@ from functools import reduce
import
numpy
as
np
from
..field
import
Field
from
.structured_domain
import
Structured
Domain
from
.structured_domain
import
Structured
Space
class
RGSpace
(
Structured
Domain
):
class
RGSpace
(
Structured
Space
):
"""Represents a regular Cartesian grid.
Parameters
...
...
nifty6/domains/structured_domain.py
View file @
1d9d8541
...
...
@@ -20,7 +20,7 @@ import numpy as np
from
.domain
import
Domain
class
Structured
Domain
(
Domain
):
class
Structured
Space
(
Domain
):
"""The abstract base class for all structured domains.
An instance of a space contains information about the manifold's
...
...
nifty6/domains/unstructured_domain.py
View file @
1d9d8541
...
...
@@ -19,7 +19,7 @@ from functools import reduce
from
.domain
import
Domain
class
Unstructured
Domain
(
Domain
):
class
Unstructured
Space
(
Domain
):
"""A :class:`~nifty6.domains.domain.Domain` subclass for spaces with no
associated geometry.
...
...
@@ -41,7 +41,7 @@ class UnstructuredDomain(Domain):
self
.
_shape
=
(
int
(
shape
),
)
def
__repr__
(
self
):
return
"Unstructured
Domain
(shape={})"
.
format
(
self
.
shape
)
return
"Unstructured
Space
(shape={})"
.
format
(
self
.
shape
)
@
property
def
shape
(
self
):
...
...
nifty6/extra.py
View file @
1d9d8541
...
...
@@ -18,10 +18,10 @@
import
numpy
as
np
from
numpy.testing
import
assert_
from
.domain_tuple
import
Domain
Tuple
from
.domain_tuple
import
Space
Tuple
from
.field
import
Field
from
.linearization
import
Linearization
from
.multi_domain
import
MultiDomain
from
.multi_domain
import
SpaceTupleDict
from
.multi_field
import
MultiField
from
.operators.linear_operator
import
LinearOperator
from
.sugar
import
from_random
...
...
@@ -121,10 +121,10 @@ def _actual_domain_check_nonlinear(op, loc):
def
_domain_check
(
op
):
for
dd
in
[
op
.
domain
,
op
.
target
]:
if
not
isinstance
(
dd
,
(
Domain
Tuple
,
MultiDomain
)):
if
not
isinstance
(
dd
,
(
Space
Tuple
,
SpaceTupleDict
)):
raise
TypeError
(
'The domain and the target of an operator need to '
'be instances of either
Domain
Tuple or
MultiDomain
.'
)
'be instances of either
Space
Tuple or
SpaceTupleDict
.'
)
def
_performance_check
(
op
,
pos
,
raise_on_fail
):
...
...
nifty6/field.py
View file @
1d9d8541
...
...
@@ -19,7 +19,7 @@ from functools import reduce
import
numpy
as
np
from
.
import
utilities
from
.domain_tuple
import
Domain
Tuple
from
.domain_tuple
import
Space
Tuple
from
.operand
import
Operand
...
...
@@ -31,7 +31,7 @@ class Field(Operand):
Parameters
----------
target :
Domain
Tuple
target :
Space
Tuple
The target of the new Field.
val : numpy.ndarray
This object's shape must match the target shape
...
...
@@ -43,11 +43,11 @@ class Field(Operand):
many convenience functions for instantiation!
"""
_scalar_dom
=
Domain
Tuple
.
scalar_domain
()
_scalar_dom
=
Space
Tuple
.
scalar_domain
()
def
__init__
(
self
,
target
,
val
):
if
not
isinstance
(
target
,
Domain
Tuple
):
raise
TypeError
(
"target must be of type
Domain
Tuple"
)
if
not
isinstance
(
target
,
Space
Tuple
):
raise
TypeError
(
"target must be of type
Space
Tuple"
)
if
not
isinstance
(
val
,
np
.
ndarray
):
if
np
.
isscalar
(
val
):
val
=
np
.
full
(
target
.
shape
,
val
)
...
...
@@ -76,7 +76,7 @@ class Field(Operand):
Parameters
----------
target : Domain, tuple of Domain, or
Domain
Tuple
target : Domain, tuple of Domain, or
Space
Tuple
Domain of the new Field.
val : float/complex/int scalar
Fill value. Data type of the field is inferred from val.
...
...
@@ -90,7 +90,7 @@ class Field(Operand):
raise
TypeError
(
"val must be a scalar"
)
if
not
(
np
.
isreal
(
val
)
or
np
.
iscomplex
(
val
)):
raise
TypeError
(
"need arithmetic scalar"
)
target
=
Domain
Tuple
.
make
(
target
)
target
=
Space
Tuple
.
make
(
target
)
return
Field
(
target
,
val
)
@
staticmethod
...
...
@@ -99,20 +99,20 @@ class Field(Operand):
Parameters
----------
target :
Domain
Tuple, tuple of Domain, or Domain
target :
Space
Tuple, tuple of Domain, or Domain
The target of the new Field.
arr : numpy.ndarray
The data content to be used for the new Field.
Its shape must match the shape of `target`.
"""
return
Field
(
Domain
Tuple
.
make
(
target
),
arr
)
return
Field
(
Space
Tuple
.
make
(
target
),
arr
)
def
cast_target
(
self
,
new_target
):
"""Returns a field with the same data, but a different target
Parameters
----------
new_target : Domain, tuple of Domain, or
Domain
Tuple
new_target : Domain, tuple of Domain, or
Space
Tuple
The target for the returned field. Must be shape-compatible to
`self`.
...
...
@@ -121,7 +121,7 @@ class Field(Operand):
Field
Field defined on `new_target`, but with the same data as `self`.
"""
return
Field
(
Domain
Tuple
.
make
(
new_target
),
self
.
_val
)
return
Field
(
Space
Tuple
.
make
(
new_target
),
self
.
_val
)
@
staticmethod
def
from_random
(
random_type
,
target
,
dtype
=
np
.
float64
,
**
kwargs
):
...
...
@@ -131,7 +131,7 @@ class Field(Operand):
----------
random_type : 'pm1', 'normal', or 'uniform'
The random distribution to use.
target :
Domain
Tuple
target :
Space
Tuple
The target of the output random Field.
dtype : type
The datatype of the output random Field.
...
...
@@ -142,7 +142,7 @@ class Field(Operand):
The newly created Field.
"""
from
.random
import
Random
target
=
Domain
Tuple
.
make
(
target
)
target
=
Space
Tuple
.
make
(
target
)
generator_function
=
getattr
(
Random
,
random_type
)
arr
=
generator_function
(
dtype
=
dtype
,
shape
=
target
.
shape
,
**
kwargs
)
return
Field
(
target
,
arr
)
...
...
@@ -173,7 +173,7 @@ class Field(Operand):
@
property
def
target
(
self
):
"""
Domain
Tuple : the field's target"""
"""
Space
Tuple : the field's target"""
return
self
.
_target
@
property
...
...
@@ -404,7 +404,7 @@ class Field(Operand):
for
i
,
dom
in
enumerate
(
self
.
_target
)
if
i
not
in
spaces
)
return
Field
(
Domain
Tuple
.
make
(
return_target
),
data
)
return
Field
(
Space
Tuple
.
make
(
return_target
),
data
)
def
sum
(
self
,
spaces
=
None
):
"""Sums up over the sub-domains given by `spaces`.
...
...
nifty6/library/correlated_fields.py
View file @
1d9d8541
...
...
@@ -21,9 +21,9 @@ from operator import mul
import
numpy
as
np
from
..domain_tuple
import
Domain
Tuple
from
..domain_tuple
import
Space
Tuple
from
..domains.power_space
import
PowerSpace
from
..domains.unstructured_domain
import
Unstructured
Domain
from
..domains.unstructured_domain
import
Unstructured
Space
from
..field
import
Field
from
..linearization
import
Linearization
from
..logger
import
logger
...
...
@@ -68,12 +68,12 @@ def _lognormal_moments(mean, sig, N=0):
def
_normal
(
mean
,
sig
,
key
,
N
=
0
):
if
N
==
0
:
domain
=
Domain
Tuple
.
scalar_domain
()
domain
=
Space
Tuple
.
scalar_domain
()
mean
,
sig
=
np
.
asfarray
(
mean
),
np
.
asfarray
(
sig
)
return
Adder
(
makeField
(
domain
,
mean
))
@
(
sig
*
ducktape
(
domain
,
None
,
key
))
domain
=
Unstructured
Domain
(
N
)
domain
=
Unstructured
Space
(
N
)
mean
,
sig
=
(
_reshaper
(
param
,
N
)
for
param
in
(
mean
,
sig
))
return
Adder
(
makeField
(
domain
,
mean
))
@
(
DiagonalOperator
(
makeField
(
domain
,
sig
))
@
ducktape
(
domain
,
None
,
key
))
...
...
@@ -87,7 +87,7 @@ def _log_k_lengths(pspace):
def
_relative_log_k_lengths
(
power_space
):
"""Log-distance to first bin
logkl.shape==power_space.shape, logkl[0]=logkl[1]=0"""
power_space
=
Domain
Tuple
.
make
(
power_space
)
power_space
=
Space
Tuple
.
make
(
power_space
)
assert
isinstance
(
power_space
[
0
],
PowerSpace
)
assert
len
(
power_space
)
==
1
logkl
=
_log_k_lengths
(
power_space
[
0
])
...
...
@@ -104,7 +104,7 @@ def _log_vol(power_space):
def
_structured_spaces
(
domain
):
if
isinstance
(
domain
[
0
],
Unstructured
Domain
):
if
isinstance
(
domain
[
0
],
Unstructured
Space
):
return
np
.
arange
(
1
,
len
(
domain
))
return
np
.
arange
(
len
(
domain
))
...
...
@@ -169,7 +169,7 @@ class _TwoLogIntegrations(LinearOperator):
self
.
_target
=
makeDomain
(
target
)
assert
isinstance
(
self
.
target
[
space
],
PowerSpace
)
dom
=
list
(
self
.
_target
)
dom
[
space
]
=
Unstructured
Domain
((
2
,
self
.
target
[
space
].
shape
[
0
]
-
2
))
dom
[
space
]
=
Unstructured
Space
((
2
,
self
.
target
[
space
].
shape
[
0
]
-
2
))
self
.
_domain
=
makeDomain
(
dom
)
self
.
_space
=
space
self
.
_log_vol
=
_log_vol
(
self
.
_target
[
space
])
...
...
@@ -208,7 +208,7 @@ class _TwoLogIntegrations(LinearOperator):
class
_Normalization
(
Operator
):
def
__init__
(
self
,
domain
,
space
=
0
):
self
.
_domain
=
self
.
_target
=
Domain
Tuple
.
make
(
domain
)
self
.
_domain
=
self
.
_target
=
Space
Tuple
.
make
(
domain
)
assert
isinstance
(
self
.
_domain
[
space
],
PowerSpace
)
hspace
=
list
(
self
.
_domain
)
hspace
[
space
]
=
hspace
[
space
].
harmonic_partner
...
...
@@ -279,9 +279,9 @@ class _Amplitude(Operator):
if
len
(
dofdex
)
>
0
:
N_copies
=
max
(
dofdex
)
+
1
space
=
1
distributed_tgt
=
makeDomain
((
Unstructured
Domain
(
len
(
dofdex
)),
distributed_tgt
=
makeDomain
((
Unstructured
Space
(
len
(
dofdex
)),
target
))
target
=
makeDomain
((
Unstructured
Domain
(
N_copies
),
target
))
target
=
makeDomain
((
Unstructured
Space
(
N_copies
),
target
))
Distributor
=
_Distributor
(
dofdex
,
target
,
distributed_tgt
,
0
)
else
:
N_copies
=
0
...
...
@@ -397,7 +397,7 @@ class CorrelatedFieldMaker:
prefix
+
'zeromode'
,
N
)
if
total_N
>
0
:
zm
=
_Distributor
(
dofdex
,
zm
.
target
,
Unstructured
Domain
(
total_N
))
@
zm
zm
=
_Distributor
(
dofdex
,
zm
.
target
,
Unstructured
Space
(
total_N
))
@
zm
return
CorrelatedFieldMaker
(
offset_mean
,
zm
,
prefix
,
total_N
)
def
add_fluctuations
(
self
,
...
...
@@ -427,7 +427,7 @@ class CorrelatedFieldMaker:
if
self
.
_total_N
>
0
:
N
=
max
(
dofdex
)
+
1
position_space
=
makeDomain
((
Unstructured
Domain
(
N
),
position_space
))
position_space
=
makeDomain
((
Unstructured
Space
(
N
),
position_space
))
else
:
N
=
0
position_space
=
makeDomain
(
position_space
)
...
...
@@ -460,7 +460,7 @@ class CorrelatedFieldMaker:
n_amplitudes
=
len
(
self
.
_a
)
if
self
.
_total_N
>
0
:
hspace
=
makeDomain
(
[
Unstructured
Domain
(
self
.
_total_N
)]
+
[
Unstructured
Space
(
self
.
_total_N
)]
+
[
dd
.
target
[
-
1
].
harmonic_partner
for
dd
in
self
.
_a
])
spaces
=
tuple
(
range
(
1
,
n_amplitudes
+
1
))
amp_space
=
1
...
...
nifty6/library/dynamic_operator.py
View file @
1d9d8541
...
...
@@ -17,9 +17,9 @@
import
numpy
as
np
from
..domain_tuple
import
Domain
Tuple
from
..domain_tuple
import
Space
Tuple
from
..domains.rg_space
import
RGSpace
from
..domains.unstructured_domain
import
Unstructured
Domain
from
..domains.unstructured_domain
import
Unstructured
Space
from
..field
import
Field
from
..operators.diagonal_operator
import
DiagonalOperator
from
..operators.field_zero_padder
import
FieldZeroPadder
...
...
@@ -58,7 +58,7 @@ def _make_dynamic_operator(target, harmonic_padding, sm_s0, sm_x0, cone, keys, c
if
codomain
is
None
:
codomain
=
target
.
get_default_codomain
()
dom
=
Domain
Tuple
.
make
(
codomain
)
dom
=
Space
Tuple
.
make
(
codomain
)
ops
=
{}
FFT
=
FFTOperator
(
dom
)
Real
=
Realizer
(
dom
)
...
...
@@ -111,7 +111,7 @@ def _make_dynamic_operator(target, harmonic_padding, sm_s0, sm_x0, cone, keys, c
sigc
=
list
((
sigc
,)
*
(
len
(
m
.
target
.
shape
)
-
1
))
elif
len
(
sigc
)
!=
len
(
m
.
target
.
shape
)
-
1
:
raise
(
ValueError
,
"Shape mismatch!"
)
c
=
FieldAdapter
(
Unstructured
Domain
(
len
(
sigc
)),
keys
[
1
])
c
=
FieldAdapter
(
Unstructured
Space
(
len
(
sigc
)),
keys
[
1
])
c
=
makeOp
(
Field
(
c
.
target
,
np
.
array
(
sigc
)))(
c
)
lightspeed
=
ScalingOperator
(
c
.
target
,
-
0.5
)(
c
).
ptw
(
"exp"
)
...
...
nifty6/library/gridder.py
View file @
1d9d8541
...
...
@@ -17,9 +17,9 @@
import
numpy
as
np
from
..domain_tuple
import
Domain
Tuple
from
..domain_tuple
import
Space
Tuple
from
..domains.rg_space
import
RGSpace
from
..domains.unstructured_domain
import
Unstructured
Domain
from
..domains.unstructured_domain
import
Unstructured
Space
from
..operators.linear_operator
import
LinearOperator
from
..sugar
import
makeField
,
makeDomain
...
...
@@ -90,9 +90,9 @@ class _RestOperator(LinearOperator):
class
RadioGridder
(
LinearOperator
):
def
__init__
(
self
,
grid_domain
,
bl
,
gconf
,
idx
):
self
.
_domain
=
Domain
Tuple
.
make
(