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
119da1a5
Commit
119da1a5
authored
Dec 08, 2017
by
Martin Reinecke
Browse files
simplifications
parent
a2d0f803
Pipeline
#22720
passed with stage
in 4 minutes and 49 seconds
Changes
6
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty/domain_tuple.py
View file @
119da1a5
...
...
@@ -75,10 +75,6 @@ class DomainTuple(object):
def
__getitem__
(
self
,
i
):
return
self
.
_dom
[
i
]
@
property
def
domains
(
self
):
return
self
.
_dom
@
property
def
shape
(
self
):
return
self
.
_shape
...
...
@@ -108,7 +104,7 @@ class DomainTuple(object):
return
not
self
.
__eq__
(
x
)
def
__str__
(
self
):
res
=
"DomainTuple, len: "
+
str
(
len
(
self
.
domains
))
for
i
in
self
.
domains
:
res
=
"DomainTuple, len: "
+
str
(
len
(
self
))
for
i
in
self
:
res
+=
"
\n
"
+
str
(
i
)
return
res
nifty/operators/diagonal_operator.py
View file @
119da1a5
...
...
@@ -81,9 +81,9 @@ class DiagonalOperator(EndomorphicOperator):
else
:
self
.
_spaces
=
cast_iseq_to_tuple
(
spaces
)
nspc
=
len
(
self
.
_spaces
)
if
nspc
!=
len
(
diagonal
.
domain
.
domains
):
if
nspc
!=
len
(
diagonal
.
domain
):
raise
ValueError
(
"spaces and domain must have the same length"
)
if
nspc
>
len
(
self
.
_domain
.
domains
):
if
nspc
>
len
(
self
.
_domain
):
raise
ValueError
(
"too many spaces"
)
if
nspc
>
len
(
set
(
self
.
_spaces
)):
raise
ValueError
(
"non-unique space indices"
)
...
...
@@ -92,7 +92,7 @@ class DiagonalOperator(EndomorphicOperator):
for
i
,
j
in
enumerate
(
self
.
_spaces
):
if
diagonal
.
domain
[
i
]
!=
self
.
_domain
[
j
]:
raise
ValueError
(
"domain mismatch"
)
if
self
.
_spaces
==
tuple
(
range
(
len
(
self
.
_domain
.
domains
))):
if
self
.
_spaces
==
tuple
(
range
(
len
(
self
.
_domain
))):
self
.
_spaces
=
None
# shortcut
self
.
_diagonal
=
diagonal
.
copy
()
...
...
nifty/operators/fft_operator.py
View file @
119da1a5
...
...
@@ -79,11 +79,11 @@ class FFTOperator(LinearOperator):
# Initialize domain and target
self
.
_domain
=
DomainTuple
.
make
(
domain
)
if
space
is
None
:
if
len
(
self
.
_domain
.
domains
)
!=
1
:
if
len
(
self
.
_domain
)
!=
1
:
raise
ValueError
(
"need a Field with exactly one domain"
)
space
=
0
space
=
int
(
space
)
if
space
<
0
or
space
>=
len
(
self
.
_domain
.
domains
):
if
space
<
0
or
space
>=
len
(
self
.
_domain
):
raise
ValueError
(
"space index out of range"
)
self
.
_space
=
space
...
...
nifty/operators/fft_smoothing_operator.py
View file @
119da1a5
...
...
@@ -11,11 +11,11 @@ class FFTSmoothingOperator(EndomorphicOperator):
dom
=
DomainTuple
.
make
(
domain
)
self
.
_sigma
=
float
(
sigma
)
if
space
is
None
:
if
len
(
dom
.
domains
)
!=
1
:
if
len
(
dom
)
!=
1
:
raise
ValueError
(
"need a Field with exactly one domain"
)
space
=
0
space
=
int
(
space
)
if
space
<
0
or
space
>=
len
(
dom
.
domains
):
if
space
<
0
or
space
>=
len
(
dom
):
raise
ValueError
(
"space index out of range"
)
self
.
_space
=
space
...
...
nifty/operators/laplace_operator.py
View file @
119da1a5
...
...
@@ -45,11 +45,11 @@ class LaplaceOperator(EndomorphicOperator):
super
(
LaplaceOperator
,
self
).
__init__
()
self
.
_domain
=
DomainTuple
.
make
(
domain
)
if
space
is
None
:
if
len
(
self
.
_domain
.
domains
)
!=
1
:
if
len
(
self
.
_domain
)
!=
1
:
raise
ValueError
(
"need a Field with exactly one domain"
)
space
=
0
space
=
int
(
space
)
if
space
<
0
or
space
>=
len
(
self
.
_domain
.
domains
):
if
space
<
0
or
space
>=
len
(
self
.
_domain
):
raise
ValueError
(
"space index out of range"
)
self
.
_space
=
space
...
...
nifty/sugar.py
View file @
119da1a5
...
...
@@ -261,7 +261,7 @@ def create_composed_fft_operator(domain, codomain=None, all_to='other'):
if
codomain
is
None
:
codomain
=
[
None
]
*
len
(
domain
)
interdomain
=
list
(
domain
.
domains
)
interdomain
=
list
(
domain
)
for
i
,
space
in
enumerate
(
domain
):
if
not
isinstance
(
space
,
Space
):
continue
...
...
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