Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
resolve
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
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
resolve
Merge requests
!7
Mosaicing
Code
Review changes
Check out branch
Download
Patches
Plain diff
Closed
Mosaicing
parras/resolve:mosaicing
into
master
Overview
0
Commits
45
Pipelines
0
Changes
17
Closed
Philipp Arras
requested to merge
parras/resolve:mosaicing
into
master
4 years ago
Overview
0
Commits
45
Pipelines
0
Changes
17
Expand
0
0
Merge request reports
Compare
master
version 37
9d720b09
4 years ago
version 36
9d720b09
4 years ago
version 35
90bcfe9e
4 years ago
version 34
5e7fb8b0
4 years ago
version 33
b1623ad4
4 years ago
version 32
9a8ff2b1
4 years ago
version 31
efa229ed
4 years ago
version 30
01cbe7e9
4 years ago
version 29
27ea01c3
4 years ago
version 28
36421944
4 years ago
version 27
6ad78de3
4 years ago
version 26
8c1c9a1c
4 years ago
version 25
f55e0f6b
4 years ago
version 24
2d716780
4 years ago
version 23
719b339d
4 years ago
version 22
dfc60905
4 years ago
version 21
d04ec889
4 years ago
version 20
93c4a371
4 years ago
version 19
c322fd83
4 years ago
version 18
7090704e
4 years ago
version 17
6ef70053
4 years ago
version 16
11e966c8
4 years ago
version 15
e8e7440a
4 years ago
version 14
cd1091d9
4 years ago
version 13
a1435a66
4 years ago
version 12
28c728ba
4 years ago
version 11
46401739
4 years ago
version 10
78d0b001
4 years ago
version 9
df9933cc
4 years ago
version 8
e1f30848
4 years ago
version 7
f14ce8af
4 years ago
version 6
f80666e4
4 years ago
version 5
55a12c28
4 years ago
version 4
2f39257a
4 years ago
version 3
d32ba0ba
4 years ago
version 2
2200c860
4 years ago
version 1
91809e29
4 years ago
master (base)
and
version 29
latest version
7a369ff4
45 commits,
4 years ago
version 37
9d720b09
43 commits,
4 years ago
version 36
9d720b09
43 commits,
4 years ago
version 35
90bcfe9e
42 commits,
4 years ago
version 34
5e7fb8b0
41 commits,
4 years ago
version 33
b1623ad4
40 commits,
4 years ago
version 32
9a8ff2b1
38 commits,
4 years ago
version 31
efa229ed
37 commits,
4 years ago
version 30
01cbe7e9
36 commits,
4 years ago
version 29
27ea01c3
35 commits,
4 years ago
version 28
36421944
34 commits,
4 years ago
version 27
6ad78de3
33 commits,
4 years ago
version 26
8c1c9a1c
31 commits,
4 years ago
version 25
f55e0f6b
29 commits,
4 years ago
version 24
2d716780
28 commits,
4 years ago
version 23
719b339d
27 commits,
4 years ago
version 22
dfc60905
26 commits,
4 years ago
version 21
d04ec889
24 commits,
4 years ago
version 20
93c4a371
23 commits,
4 years ago
version 19
c322fd83
22 commits,
4 years ago
version 18
7090704e
21 commits,
4 years ago
version 17
6ef70053
20 commits,
4 years ago
version 16
11e966c8
19 commits,
4 years ago
version 15
e8e7440a
18 commits,
4 years ago
version 14
cd1091d9
16 commits,
4 years ago
version 13
a1435a66
15 commits,
4 years ago
version 12
28c728ba
14 commits,
4 years ago
version 11
46401739
13 commits,
4 years ago
version 10
78d0b001
12 commits,
4 years ago
version 9
df9933cc
12 commits,
4 years ago
version 8
e1f30848
11 commits,
4 years ago
version 7
f14ce8af
10 commits,
4 years ago
version 6
f80666e4
9 commits,
4 years ago
version 5
55a12c28
8 commits,
4 years ago
version 4
2f39257a
7 commits,
4 years ago
version 3
d32ba0ba
6 commits,
4 years ago
version 2
2200c860
5 commits,
4 years ago
version 1
91809e29
4 commits,
4 years ago
17 files
+
1080
−
71
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
17
Search (e.g. *.vue) (Ctrl+P)
demo/cfg_mosaicing.py
0 → 100644
+
129
−
0
Options
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright(C) 2019-2021 Max-Planck-Society
# Author: Philipp Arras
import
numpy
as
np
from
functools
import
reduce
from
operator
import
add
import
nifty7
as
ift
import
resolve
as
rve
diffusefluxlevel
=
29
npix
=
np
.
array
([
1800
,
1800
])
rve
.
set_nthreads
(
2
)
rve
.
set_wgridding
(
False
)
interobs_extended
=
{
f
"
extended
{
ii
}
"
:
rve
.
Observation
.
load
(
f
"
/data/mosaicing/extended_field
{
ii
}
.npz
"
)
# for ii in range(5, 135)
for
ii
in
range
(
5
,
7
)
}
interobs_compact
=
{
f
"
compact
{
ii
}
"
:
rve
.
Observation
.
load
(
f
"
/data/mosaicing/compact_field
{
ii
}
.npz
"
)
# for ii in range(5, 153)
for
ii
in
range
(
5
,
7
)
}
interobs
=
{
**
interobs_compact
,
**
interobs_extended
}
sdobs
=
{
"
sd0
"
:
rve
.
SingleDishObservation
.
load
(
"
/data/mosaicing/totalpower.npz
"
)}
assert
len
(
set
(
sdobs
.
keys
())
&
set
(
interobs
.
keys
()))
==
0
rve
.
set_epsilon
(
1
/
10
/
max
(
o
.
max_snr
()
for
o
in
interobs
.
values
()))
# Compute phase center and define domain
# Convention: The phase center is the coordinate of the [nx/2, ny/2] pixel
xs
,
ys
=
[],
[]
for
vv
in
interobs
.
values
():
xs
.
append
(
vv
.
direction
.
phase_center
[
0
])
ys
.
append
(
vv
.
direction
.
phase_center
[
1
])
for
vv
in
sdobs
.
values
():
foo
,
bar
=
vv
.
pointings
.
phase_centers
.
T
xs
.
extend
(
foo
)
ys
.
extend
(
bar
)
xs
,
ys
=
np
.
array
(
xs
),
np
.
array
(
ys
)
global_phase_center_casa
=
-
2.7180339078174175
,
-
0.5210930907116116
global_phase_center
=
(
max
(
xs
)
+
min
(
xs
))
/
2
,
(
max
(
ys
)
+
min
(
ys
))
/
2
margin
=
1
*
rve
.
ARCMIN2RAD
xfov
=
2
*
max
(
abs
(
xs
-
global_phase_center
[
0
]))
+
2
*
margin
yfov
=
2
*
max
(
abs
(
ys
-
global_phase_center
[
1
]))
+
2
*
margin
fov
=
np
.
array
([
xfov
,
yfov
])
dom
=
ift
.
RGSpace
(
npix
,
fov
/
npix
)
# End compute phase center and define domain
# Sky model
logsky
=
ift
.
SimpleCorrelatedField
(
dom
,
diffusefluxlevel
,
(
1
,
1
),
(
1.5
,
1
),
(
1.2
,
0.4
),
(
0.2
,
0.2
),
(
-
1.5
,
0.5
)
)
sky
=
logsky
.
exp
()
# End sky model
# Single dish likelihood
responsesd
=
[]
for
kk
,
oo
in
sdobs
.
items
():
# Single dish response does not support multifrequency
assert
np
.
min
(
oo
.
freq
)
/
np
.
max
(
oo
.
freq
)
>
0.99
R
=
rve
.
SingleDishResponse
(
oo
,
dom
,
lambda
x
:
rve
.
alma_beam_func
(
10.7
,
0.75
,
np
.
mean
(
oo
.
freq
),
x
),
global_phase_center
,
)
responsesd
.
append
(
R
.
ducktape_left
(
kk
))
responsesd
=
reduce
(
add
,
responsesd
)
dsd
=
ift
.
MultiField
.
from_dict
({
kk
:
o
.
vis
for
kk
,
o
in
sdobs
.
items
()})
invcovsd
=
ift
.
makeOp
(
ift
.
MultiField
.
from_dict
({
kk
:
o
.
weight
for
kk
,
o
in
sdobs
.
items
()})
)
lhsd
=
ift
.
GaussianEnergy
(
dsd
,
invcovsd
)
@
responsesd
if
True
:
# Learn one number per observation
foo
=
[]
for
kk
in
dsd
.
keys
():
foo
.
append
(
ift
.
ContractionOperator
(
invcovsd
.
domain
[
kk
],
(
0
,
1
,
2
))
.
adjoint
.
ducktape
(
kk
+
"
invcovinp
"
)
.
ducktape_left
(
kk
)
)
invcovsdop
=
invcovsd
@
reduce
(
add
,
foo
).
exp
()
else
:
# Learn one number per data point
invcovsdop
=
invcovsd
@
rve
.
KeyPrefixer
(
dsd
.
domain
,
"
invcov_inp
"
).
adjoint
.
exp
()
lhsd_varcov
=
rve
.
MultiDomainVariableCovarianceGaussianEnergy
(
dsd
,
responsesd
.
ducktape
(
"
sky
"
),
invcovsdop
)
# End single dish likelihood
# Consistency checks
ift
.
extra
.
assert_allclose
(
invcovsdop
(
ift
.
full
(
invcovsdop
.
domain
,
0.0
)),
invcovsd
(
ift
.
full
(
invcovsd
.
domain
,
1.0
)),
)
_
,
lhsd1
=
lhsd_varcov
.
simplify_for_constant_input
(
ift
.
full
(
invcovsdop
.
domain
,
0.0
))
foo
=
ift
.
from_random
(
lhsd1
.
domain
)
# FIXME Inaccuracy probably due to tr-log term in VariableCovGaussianEnergy
ift
.
extra
.
assert_allclose
(
lhsd
(
foo
[
"
sky
"
]),
lhsd1
(
foo
),
rtol
=
1e-2
)
del
lhsd1
,
foo
# End consistency check
# Interferometer likelihood
def
get_beamdirections
(
obs
):
beam_directions
=
{}
for
kk
,
oo
in
obs
.
items
():
assert
np
.
min
(
oo
.
freq
)
/
np
.
max
(
oo
.
freq
)
>
0.99
beam_directions
[
kk
]
=
rve
.
BeamDirection
(
oo
.
direction
.
phase_center
[
0
]
-
global_phase_center
[
0
],
oo
.
direction
.
phase_center
[
1
]
-
global_phase_center
[
1
],
lambda
x
:
rve
.
alma_beam_func
(
10.7
,
0.75
,
np
.
mean
(
oo
.
freq
),
x
),
0.1
,
)
return
beam_directions
skyslicer_compact
=
rve
.
SkySlicer
(
logsky
.
target
,
get_beamdirections
(
interobs_compact
))
skyslicer_extended
=
rve
.
SkySlicer
(
logsky
.
target
,
get_beamdirections
(
interobs_extended
))
ift
.
extra
.
check_linear_operator
(
skyslicer_compact
)
lh_compact
=
rve
.
ImagingLikelihood
(
interobs_compact
,
skyslicer_compact
)
lh_extended
=
rve
.
ImagingLikelihood
(
interobs_extended
,
skyslicer_extended
)
# End interferometer likelihood
Loading