Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
nifty_gridder
Commits
82d33ce9
Commit
82d33ce9
authored
Sep 02, 2019
by
Philipp Arras
Browse files
Add adjointness tests for highlevel functions
parent
15ade055
Changes
1
Hide whitespace changes
Inline
Side-by-side
test.py
View file @
82d33ce9
...
...
@@ -80,6 +80,45 @@ def test_adjointness_wgridding(nxdirty, nydirty, nrow, nchan, epsilon):
rtol
=
epsilon
)
@
pmp
(
"nxdirty"
,
(
128
,
300
))
@
pmp
(
"nydirty"
,
(
128
,
250
))
@
pmp
(
"nrow"
,
(
1
,
10
,
10000
))
@
pmp
(
"nchan"
,
(
1
,
10
,
100
))
@
pmp
(
"epsilon"
,
(
1e-2
,
1e-3
,
1e-5
,
1e-6
,
1e-7
,
2e-13
))
@
pmp
(
"singleprec"
,
(
True
,
False
))
@
pmp
(
"wstacking"
,
(
True
,
False
))
def
test_adjointness_wgridding_highlevel
(
nxdirty
,
nydirty
,
nrow
,
nchan
,
epsilon
,
singleprec
,
wstacking
):
np
.
random
.
seed
(
42
)
pixsizex
=
np
.
pi
/
180
/
60
/
nxdirty
*
0.2398
pixsizey
=
np
.
pi
/
180
/
60
/
nxdirty
speedoflight
,
f0
=
3e8
,
1e9
freq
=
f0
+
np
.
arange
(
nchan
)
*
(
f0
/
nchan
)
uvw
=
(
np
.
random
.
rand
(
nrow
,
3
)
-
0.5
)
/
(
pixsizey
*
f0
/
speedoflight
)
vis
=
np
.
random
.
rand
(
nrow
,
nchan
)
-
0.5
+
1j
*
(
np
.
random
.
rand
(
nrow
,
nchan
)
-
0.5
)
dirty
=
np
.
random
.
rand
(
nxdirty
,
nydirty
)
-
0.5
if
wstacking
:
f1
=
ng
.
full_gridding
f2
=
ng
.
full_degridding
else
:
f1
=
ng
.
gridding
f2
=
ng
.
degridding
if
singleprec
:
vis
=
vis
.
astype
(
"c8"
)
uvw
=
uvw
.
astype
(
"f4"
)
dirty
=
dirty
.
astype
(
"f4"
)
freq
=
freq
.
astype
(
"f4"
)
if
wstacking
:
f1
=
ng
.
full_gridding_f
f2
=
ng
.
full_degridding_f
else
:
f1
=
ng
.
gridding_f
f2
=
ng
.
degridding_f
dirty2
=
f1
(
uvw
,
freq
,
vis
,
None
,
nxdirty
,
nydirty
,
pixsizex
,
pixsizey
,
epsilon
,
1
,
0
)
vis2
=
f2
(
uvw
,
freq
,
dirty
,
None
,
pixsizex
,
pixsizey
,
epsilon
,
1
,
0
)
assert_allclose
(
np
.
vdot
(
vis
,
vis2
).
real
,
np
.
vdot
(
dirty2
,
dirty
),
rtol
=
epsilon
)
@
pmp
(
"nxdirty"
,
(
128
,))
@
pmp
(
"nydirty"
,
(
128
,))
@
pmp
(
"nrow"
,
(
10000
,))
...
...
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