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
de7c2aba
Commit
de7c2aba
authored
Jan 16, 2018
by
Martin Reinecke
Browse files
nastier tests
parent
c15eb016
Pipeline
#23740
failed with stage
in 4 minutes and 5 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
test/test_operators/test_adjoint.py
View file @
de7c2aba
...
...
@@ -9,8 +9,17 @@ from numpy.testing import assert_allclose
def
_check_adjointness
(
op
,
dtype
=
np
.
float64
):
f1
=
ift
.
Field
.
from_random
(
"normal"
,
domain
=
op
.
domain
,
dtype
=
dtype
)
f2
=
ift
.
Field
.
from_random
(
"normal"
,
domain
=
op
.
target
,
dtype
=
dtype
)
assert_allclose
(
f1
.
vdot
(
op
.
adjoint_times
(
f2
)),
op
.
times
(
f1
).
vdot
(
f2
),
rtol
=
1e-8
)
cap
=
op
.
capability
if
((
cap
&
ift
.
LinearOperator
.
TIMES
)
and
(
cap
&
ift
.
LinearOperator
.
ADJOINT_TIMES
)):
assert_allclose
(
f1
.
vdot
(
op
.
adjoint_times
(
f2
)),
op
.
times
(
f1
).
vdot
(
f2
),
rtol
=
1e-8
)
if
((
cap
&
ift
.
LinearOperator
.
INVERSE_TIMES
)
and
(
cap
&
ift
.
LinearOperator
.
INVERSE_ADJOINT_TIMES
)):
assert_allclose
(
f1
.
vdot
(
op
.
inverse_times
(
f2
)),
op
.
inverse_adjoint_times
(
f1
).
vdot
(
f2
),
rtol
=
1e-8
)
_harmonic_spaces
=
[
ift
.
RGSpace
(
7
,
distances
=
0.2
,
harmonic
=
True
),
ift
.
RGSpace
((
12
,
46
),
distances
=
(
0.2
,
0.3
),
harmonic
=
True
),
...
...
@@ -41,3 +50,5 @@ class Adjointness_Tests(unittest.TestCase):
def
testFFT
(
self
,
sp
,
dtype
):
op
=
ift
.
FFTOperator
(
sp
)
_check_adjointness
(
op
,
dtype
)
op
=
ift
.
FFTOperator
(
sp
.
get_default_codomain
())
_check_adjointness
(
op
,
dtype
)
test/test_operators/test_fft_operator.py
View file @
de7c2aba
...
...
@@ -39,9 +39,18 @@ class FFTOperatorTests(unittest.TestCase):
tol
=
_get_rtol
(
itp
)
a
=
ift
.
RGSpace
(
dim1
,
distances
=
d
)
b
=
ift
.
RGSpace
(
dim1
,
distances
=
1.
/
(
dim1
*
d
),
harmonic
=
True
)
np
.
random
.
seed
(
16
)
fft
=
ift
.
FFTOperator
(
domain
=
a
,
target
=
b
)
inp
=
ift
.
Field
.
from_random
(
domain
=
a
,
random_type
=
'normal'
,
std
=
7
,
mean
=
3
,
dtype
=
itp
)
out
=
fft
.
inverse_times
(
fft
.
times
(
inp
))
assert_allclose
(
ift
.
dobj
.
to_global_data
(
inp
.
val
),
ift
.
dobj
.
to_global_data
(
out
.
val
),
rtol
=
tol
,
atol
=
tol
)
np
.
random
.
seed
(
16
)
a
,
b
=
b
,
a
fft
=
ift
.
FFTOperator
(
domain
=
a
,
target
=
b
)
inp
=
ift
.
Field
.
from_random
(
domain
=
a
,
random_type
=
'normal'
,
std
=
7
,
mean
=
3
,
dtype
=
itp
)
out
=
fft
.
inverse_times
(
fft
.
times
(
inp
))
...
...
@@ -56,8 +65,18 @@ class FFTOperatorTests(unittest.TestCase):
a
=
ift
.
RGSpace
([
dim1
,
dim2
],
distances
=
[
d1
,
d2
])
b
=
ift
.
RGSpace
([
dim1
,
dim2
],
distances
=
[
1.
/
(
dim1
*
d1
),
1.
/
(
dim2
*
d2
)],
harmonic
=
True
)
fft
=
ift
.
FFTOperator
(
domain
=
a
,
target
=
b
)
inp
=
ift
.
Field
.
from_random
(
domain
=
a
,
random_type
=
'normal'
,
std
=
7
,
mean
=
3
,
dtype
=
itp
)
out
=
fft
.
inverse_times
(
fft
.
times
(
inp
))
assert_allclose
(
ift
.
dobj
.
to_global_data
(
inp
.
val
),
ift
.
dobj
.
to_global_data
(
out
.
val
),
rtol
=
tol
,
atol
=
tol
)
fft
=
ift
.
FFTOperator
(
domain
=
a
,
target
=
b
)
a
,
b
=
b
,
a
fft
=
ift
.
FFTOperator
(
domain
=
a
,
target
=
b
)
inp
=
ift
.
Field
.
from_random
(
domain
=
a
,
random_type
=
'normal'
,
std
=
7
,
mean
=
3
,
dtype
=
itp
)
out
=
fft
.
inverse_times
(
fft
.
times
(
inp
))
...
...
@@ -132,6 +151,7 @@ class FFTOperatorTests(unittest.TestCase):
assert_allclose
(
v1
,
v2
,
rtol
=
tol
,
atol
=
tol
)
@
expand
(
product
([
ift
.
RGSpace
(
128
,
distances
=
3.76
,
harmonic
=
True
),
ift
.
RGSpace
(
73
,
distances
=
0.5643
),
ift
.
LMSpace
(
lmax
=
30
,
mmax
=
25
)],
[
np
.
float64
,
np
.
float32
,
np
.
complex64
,
np
.
complex128
]))
def
test_normalisation
(
self
,
space
,
tp
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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