Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nifty_gridder
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ift
nifty_gridder
Commits
b70bd6d4
Commit
b70bd6d4
authored
5 years ago
by
Landman Bester
Browse files
Options
Downloads
Patches
Plain Diff
Added detapering and explanation in comments
parent
f5c4261f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test_grid_via_dirty.py
+28
-4
28 additions, 4 deletions
test_grid_via_dirty.py
with
28 additions
and
4 deletions
test_grid_via_dirty.py
+
28
−
4
View file @
b70bd6d4
...
@@ -23,16 +23,40 @@ idx = ng.getIndices(baselines, conf, flags)
...
@@ -23,16 +23,40 @@ idx = ng.getIndices(baselines, conf, flags)
data
=
np
.
random
.
randn
(
nrow
,
nchan
)
+
1.0j
*
np
.
random
.
randn
(
nrow
,
nchan
)
data
=
np
.
random
.
randn
(
nrow
,
nchan
)
+
1.0j
*
np
.
random
.
randn
(
nrow
,
nchan
)
# get dirty
# get dirty ID = T.H Z.H F.H G.H V where
# T = taper
# Z = zero padding
# F = FFT
# G = degridding operator
# V = data
dirty
=
ng
.
ms2dirty
(
uvw
=
uvw
,
freq
=
freq
,
ms
=
data
.
copy
(),
npix_x
=
npix
,
npix_y
=
npix
,
dirty
=
ng
.
ms2dirty
(
uvw
=
uvw
,
freq
=
freq
,
ms
=
data
.
copy
(),
npix_x
=
npix
,
npix_y
=
npix
,
pixsize_x
=
pixsize
,
pixsize_y
=
pixsize
,
epsilon
=
eps
,
pixsize_x
=
pixsize
,
pixsize_y
=
pixsize
,
epsilon
=
eps
,
do_wstacking
=
False
,
nthreads
=
1
,
verbosity
=
1
)
do_wstacking
=
False
,
nthreads
=
1
,
verbosity
=
1
)
# convert to gridded data
# we want to convert to gridded data (i.e. G.H V) so we need
grid
=
conf
.
dirty2grid_c
(
dirty
.
astype
(
data
.
dtype
))
# F Z T^{-1} ID
# Since dirty2grid = F Z T we can obtain gridded data as
# G.H V = dirty2grid T^{-2} ID
# check that T^2 is invertible
taper
=
conf
.
apply_taper
(
np
.
ones_like
(
dirty
))
if
(
1.0
/
taper
**
2
).
min
()
<
eps
:
raise
RuntimeError
(
"
Taper not invertible at required precision
"
)
# detaper dirty (same result as dividing by T^2)
dirtyc
=
conf
.
apply_taper
(
dirty
,
divide
=
True
)
dirtycc
=
conf
.
apply_taper
(
dirtyc
,
divide
=
True
)
# get gridded data
grid
=
conf
.
dirty2grid_c
(
dirtycc
.
astype
(
data
.
dtype
))
# get gridded data directly from ms
# get gridded data directly from ms
grid2
=
ng
.
ms2grid_c
(
baselines
=
baselines
,
gconf
=
conf
,
idx
=
idx
,
ms
=
data
)
grid2
=
ng
.
ms2grid_c
(
baselines
=
baselines
,
gconf
=
conf
,
idx
=
idx
,
ms
=
data
)
# normalise in case its a scaling issue
grid
/=
np
.
abs
(
grid
).
max
()
grid2
/=
np
.
abs
(
grid2
).
max
()
# result should match to withon gridding accuracy
# result should match to withon gridding accuracy
np
.
testing
.
assert_array_almost_equal
(
grid
,
grid2
,
decimal
=
6
)
np
.
testing
.
assert_array_almost_equal
(
grid
,
grid2
,
decimal
=
6
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment