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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ift
resolve
Commits
73084759
Commit
73084759
authored
4 years ago
by
Philipp Arras
Browse files
Options
Downloads
Patches
Plain Diff
Add script for initial calibration
parent
2e36cd9d
No related branches found
No related tags found
1 merge request
!2
Add antenna-based calibration
Pipeline
#84095
passed
4 years ago
Stage: build_docker
Stage: testing
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
demo/calibration_and_imaging.py
+80
-0
80 additions, 0 deletions
demo/calibration_and_imaging.py
with
80 additions
and
0 deletions
demo/calibration_and_imaging.py
0 → 100644
+
80
−
0
View file @
73084759
# SPDX-License-Identifier: GPL-3.0-or-later
# Copyright(C) 2019-2020 Max-Planck-Society
# Author: Philipp Arras
import
numpy
as
np
from
ducc0.fft
import
good_size
import
nifty7
as
ift
import
resolve
as
rve
def
main
():
rve
.
set_nthreads
(
8
)
rve
.
set_wstacking
(
False
)
obs
=
rve
.
ms2observations
(
'
/data/AM754_A030124_flagged.ms
'
,
'
DATA
'
,
0
)
obs
=
[
oo
.
restrict_to_stokes_i
()
for
oo
in
obs
]
t0
,
_
=
rve
.
tmin_tmax
(
*
obs
)
obs
=
[
oo
.
move_time
(
-
t0
)
for
oo
in
obs
]
ocalib1
,
ocalib2
,
oscience
=
obs
rve
.
set_epsilon
(
min
(
1
/
10
/
oo
.
max_snr
()
for
oo
in
obs
))
uantennas
=
rve
.
unique_antennas
(
*
obs
)
utimes
=
rve
.
unique_times
(
*
obs
)
antenna_dct
=
{
aa
:
ii
for
ii
,
aa
in
enumerate
(
uantennas
)}
npol
,
nfreq
=
obs
[
0
].
npol
,
obs
[
0
].
nfreq
total_N
=
npol
*
len
(
uantennas
)
*
nfreq
tmin
,
tmax
=
rve
.
tmin_tmax
(
*
obs
)
solution_interval
=
20
# s
time_domain
=
ift
.
RGSpace
(
good_size
(
int
(
2
*
(
tmax
-
tmin
)
/
solution_interval
)),
solution_interval
)
print
(
f
'
Npix in time domain
{
time_domain
.
shape
[
0
]
}
'
)
reshaper
=
rve
.
Reshaper
([
ift
.
UnstructuredDomain
(
total_N
),
time_domain
],
[
ift
.
UnstructuredDomain
(
npol
),
ift
.
UnstructuredDomain
(
len
(
uantennas
)),
time_domain
,
ift
.
UnstructuredDomain
(
nfreq
)])
dct
=
{
'
offset_mean
'
:
0
,
'
offset_std
'
:
(
1
,
0.5
),
'
prefix
'
:
'
calibration_phases
'
}
dct1
=
{
'
fluctuations
'
:
(
2.
,
1.
),
'
loglogavgslope
'
:
(
-
4.
,
1
),
'
flexibility
'
:
(
5
,
2.
),
'
asperity
'
:
None
}
cfmph
=
ift
.
CorrelatedFieldMaker
.
make
(
**
dct
,
total_N
=
total_N
)
cfmph
.
add_fluctuations
(
time_domain
,
**
dct1
)
phase
=
reshaper
@
cfmph
.
finalize
(
0
)
dct
=
{
'
offset_mean
'
:
0
,
'
offset_std
'
:
(
1e-3
,
1e-6
),
'
prefix
'
:
'
calibration_logamplitudes
'
}
dct1
=
{
'
fluctuations
'
:
(
2.
,
1.
),
'
loglogavgslope
'
:
(
-
4.
,
1
),
'
flexibility
'
:
(
5
,
2.
),
'
asperity
'
:
None
}
cfmampl
=
ift
.
CorrelatedFieldMaker
.
make
(
**
dct
,
total_N
=
total_N
)
cfmampl
.
add_fluctuations
(
time_domain
,
**
dct1
)
logampl
=
reshaper
@
cfmampl
.
finalize
(
0
)
abc
=
rve
.
calibration_distribution
(
ocalib2
,
phase
,
logampl
,
antenna_dct
,
None
)
plotter
=
rve
.
Plotter
(
'
png
'
,
'
plots
'
)
plotter
.
add_calibration_solution
(
'
calibration_logamplitude
'
,
logampl
)
plotter
.
add_calibration_solution
(
'
calibration_phase
'
,
phase
)
lh0
=
rve
.
CalibrationLikelihood
(
ocalib2
,
abc
,
ift
.
full
(
ocalib2
.
vis
.
domain
,
1.
+
0.j
))
ham
=
ift
.
StandardHamiltonian
(
lh0
)
pos
=
0.1
*
ift
.
from_random
(
ham
.
domain
)
state
=
rve
.
MinimizationState
(
pos
,
[])
minimizer
=
ift
.
NewtonCG
(
ift
.
GradientNormController
(
name
=
'
newton
'
,
iteration_limit
=
10
))
for
ii
in
range
(
10
):
state
=
rve
.
simple_minimize
(
ham
,
state
.
mean
,
0
,
minimizer
)
plotter
.
plot
(
f
'
{
ii
}
'
,
state
)
state
.
save
(
f
'
{
ii
}
'
)
if
__name__
==
'
__main__
'
:
main
()
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