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_gridder
Commits
16135c1e
Commit
16135c1e
authored
Jul 09, 2019
by
Simon Perkins
Browse files
Test weight gridding
parent
da0b9004
Changes
1
Hide whitespace changes
Inline
Side-by-side
test.py
View file @
16135c1e
...
...
@@ -57,6 +57,7 @@ def test_hoisted_grid_allocation(nxdirty, nydirty, nrow, nchan, epsilon):
pixsize_y
=
pixsize
)
flags
=
np
.
zeros
((
nrow
,
nchan
),
dtype
=
np
.
bool
)
weights
=
np
.
random
.
rand
(
nrow
,
nchan
)
idx
=
ng
.
getIndices
(
baselines
,
gconf
,
flags
)
ms
=
np
.
random
.
rand
(
nrow
,
nchan
)
-
0.5
+
1j
*
(
np
.
random
.
rand
(
nrow
,
nchan
)
-
0.5
)
vis
=
baselines
.
ms2vis
(
ms
,
idx
)
...
...
@@ -72,6 +73,16 @@ def test_hoisted_grid_allocation(nxdirty, nydirty, nrow, nchan, epsilon):
assert
grid
.
dtype
==
real_grid
.
dtype
==
grid2
.
dtype
assert
id
(
grid2
)
==
id
(
real_grid
)
# Same grid object
real_grid
=
np
.
zeros
((
gconf
.
Nu
(),
gconf
.
Nv
()),
dtype
=
np
.
float64
)
grid
=
ng
.
ms2grid_wgt
(
baselines
,
gconf
,
idx
,
ms
,
weights
,
grid_in
=
None
)
grid2
=
ng
.
ms2grid_wgt
(
baselines
,
gconf
,
idx
,
ms
,
weights
,
grid_in
=
real_grid
)
assert_array_almost_equal
(
grid
,
grid2
)
assert
grid
.
dtype
==
real_grid
.
dtype
==
grid2
.
dtype
assert
id
(
grid2
)
==
id
(
real_grid
)
# Same grid object
# ------------------------------
# Test real grid case (vis2grid)
# ------------------------------
...
...
@@ -96,6 +107,17 @@ def test_hoisted_grid_allocation(nxdirty, nydirty, nrow, nchan, epsilon):
assert
grid
.
dtype
==
cplx_grid
.
dtype
==
grid2
.
dtype
assert
id
(
grid2
)
==
id
(
cplx_grid
)
# Same grid object
cplx_grid
=
np
.
zeros
((
gconf
.
Nu
(),
gconf
.
Nv
()),
dtype
=
np
.
complex128
)
grid
=
ng
.
ms2grid_c_wgt
(
baselines
,
gconf
,
idx
,
ms
,
weights
,
grid_in
=
None
)
grid2
=
ng
.
ms2grid_c_wgt
(
baselines
,
gconf
,
idx
,
ms
,
weights
,
grid_in
=
cplx_grid
)
# Almost same result
assert_array_almost_equal
(
grid
,
grid2
)
assert
grid
.
dtype
==
cplx_grid
.
dtype
==
grid2
.
dtype
assert
id
(
grid2
)
==
id
(
cplx_grid
)
# Same grid object
# ----------------------------------
# Test complex grid case (vis2grid_c)
# ----------------------------------
...
...
Write
Preview
Supports
Markdown
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