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
aea10faa
Commit
aea10faa
authored
May 28, 2019
by
Philipp Arras
Browse files
Cleanup
parent
a9b8d316
Pipeline
#50103
failed with stages
in 5 minutes and 12 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
nifty5/library/gridder.py
View file @
aea10faa
...
...
@@ -15,12 +15,9 @@
#
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik.
import
numpy
as
np
from
..domain_tuple
import
DomainTuple
from
..domains.rg_space
import
RGSpace
from
..domains.unstructured_domain
import
UnstructuredDomain
from
..fft
import
hartley
from
..operators.linear_operator
import
LinearOperator
from
..sugar
import
from_global_data
,
makeDomain
...
...
@@ -29,13 +26,12 @@ class GridderMaker(object):
def
__init__
(
self
,
dirty_domain
,
uvw
,
channel_fact
,
eps
=
2e-13
):
import
nifty_gridder
dirty_domain
=
makeDomain
(
dirty_domain
)
if
(
len
(
dirty_domain
)
!=
1
or
not
isinstance
(
dirty_domain
[
0
],
RGSpace
)
or
not
len
(
dirty_domain
.
shape
)
==
2
):
if
(
len
(
dirty_domain
)
!=
1
or
not
isinstance
(
dirty_domain
[
0
],
RGSpace
)
or
not
len
(
dirty_domain
.
shape
)
==
2
):
raise
ValueError
(
"need dirty_domain with exactly one 2D RGSpace"
)
if
channel_fact
.
ndim
!=
1
:
raise
ValueError
(
"channel_fact must be a 1D array"
)
bl
=
nifty_gridder
.
Baselines
(
uvw
,
channel_fact
)
;
bl
=
nifty_gridder
.
Baselines
(
uvw
,
channel_fact
)
nxdirty
,
nydirty
=
dirty_domain
.
shape
gconf
=
nifty_gridder
.
GridderConfig
(
nxdirty
,
nydirty
,
eps
,
1.
,
1.
)
nu
=
gconf
.
Nu
()
...
...
@@ -59,14 +55,12 @@ class GridderMaker(object):
class
_RestOperator
(
LinearOperator
):
def
__init__
(
self
,
dirty_domain
,
grid_domain
,
gconf
):
import
nifty_gridder
self
.
_domain
=
makeDomain
(
grid_domain
)
self
.
_target
=
makeDomain
(
dirty_domain
)
self
.
_gconf
=
gconf
self
.
_capability
=
self
.
TIMES
|
self
.
ADJOINT_TIMES
def
apply
(
self
,
x
,
mode
):
import
nifty_gridder
self
.
_check_input
(
x
,
mode
)
res
=
x
.
to_global_data
()
if
mode
==
self
.
TIMES
:
...
...
@@ -78,8 +72,7 @@ class _RestOperator(LinearOperator):
class
RadioGridder
(
LinearOperator
):
def
__init__
(
self
,
grid_domain
,
bl
,
gconf
,
idx
):
self
.
_domain
=
DomainTuple
.
make
(
UnstructuredDomain
(
(
idx
.
shape
[
0
],)))
self
.
_domain
=
DomainTuple
.
make
(
UnstructuredDomain
((
idx
.
shape
[
0
],)))
self
.
_target
=
DomainTuple
.
make
(
grid_domain
)
self
.
_bl
=
bl
self
.
_gconf
=
gconf
...
...
@@ -90,12 +83,11 @@ class RadioGridder(LinearOperator):
import
nifty_gridder
self
.
_check_input
(
x
,
mode
)
if
mode
==
self
.
TIMES
:
x
=
x
.
to_global_data
().
reshape
((
-
1
,
1
))
x
=
x
.
to_global_data
().
reshape
((
-
1
,
1
))
x
=
self
.
_bl
.
ms2vis
(
x
,
self
.
_idx
)
res
=
nifty_gridder
.
vis2grid
(
self
.
_bl
,
self
.
_gconf
,
self
.
_idx
,
x
)
res
=
nifty_gridder
.
vis2grid
(
self
.
_bl
,
self
.
_gconf
,
self
.
_idx
,
x
)
else
:
res
=
nifty_gridder
.
grid2vis
(
self
.
_bl
,
self
.
_gconf
,
self
.
_idx
,
x
.
to_global_data
())
res
=
nifty_gridder
.
grid2vis
(
self
.
_bl
,
self
.
_gconf
,
self
.
_idx
,
x
.
to_global_data
())
res
=
self
.
_bl
.
vis2ms
(
res
,
self
.
_idx
).
reshape
((
-
1
,))
return
from_global_data
(
self
.
_tgt
(
mode
),
res
)
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