Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
A
apipeline
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
Alexander Kutkin
apipeline
Commits
964f5c64
Commit
964f5c64
authored
Aug 5, 2021
by
Alexander Kutkin
Browse files
Options
Downloads
Patches
Plain Diff
added ddcal step
parent
3a98e336
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
cluster.py
+2
-1
2 additions, 1 deletion
cluster.py
imcal.py
+32
-1
32 additions, 1 deletion
imcal.py
imcal.yml
+31
-20
31 additions, 20 deletions
imcal.yml
with
65 additions
and
22 deletions
cluster.py
+
2
−
1
View file @
964f5c64
...
@@ -456,7 +456,7 @@ def main(img, resid, model, auto=True, add_manual=False, nclusters=5, boxsize=25
...
@@ -456,7 +456,7 @@ def main(img, resid, model, auto=True, add_manual=False, nclusters=5, boxsize=25
nbright
=
80
,
cluster_radius
=
5
,
cluster_overlap
=
1.6
):
nbright
=
80
,
cluster_radius
=
5
,
cluster_overlap
=
1.6
):
path
=
os
.
path
.
split
(
os
.
path
.
abspath
(
img
))[
0
]
path
=
os
.
path
.
split
(
os
.
path
.
abspath
(
img
))[
0
]
output
=
os
.
path
.
join
(
path
,
'
clustered.txt
'
)
output
=
os
.
path
.
spitext
(
img
)[
0
]
+
'
-
clustered.txt
'
df
=
pd
.
read_csv
(
model
,
skipinitialspace
=
True
)
df
=
pd
.
read_csv
(
model
,
skipinitialspace
=
True
)
df
[
'
ra
'
]
=
df
.
Ra
.
apply
(
ra2deg
)
df
[
'
ra
'
]
=
df
.
Ra
.
apply
(
ra2deg
)
...
@@ -492,6 +492,7 @@ def main(img, resid, model, auto=True, add_manual=False, nclusters=5, boxsize=25
...
@@ -492,6 +492,7 @@ def main(img, resid, model, auto=True, add_manual=False, nclusters=5, boxsize=25
write_df
(
df
,
clusters
,
output
=
output
)
write_df
(
df
,
clusters
,
output
=
output
)
fig
.
tight_layout
()
fig
.
tight_layout
()
fig
.
savefig
(
path
+
'
/clustering.png
'
)
fig
.
savefig
(
path
+
'
/clustering.png
'
)
return
output
### if __name__ == "__main__":
### if __name__ == "__main__":
...
...
This diff is collapsed.
Click to expand it.
imcal.py
+
32
−
1
View file @
964f5c64
...
@@ -26,6 +26,8 @@ from astropy.time import Time
...
@@ -26,6 +26,8 @@ from astropy.time import Time
import
astropy.units
as
u
import
astropy.units
as
u
from
astropy.io
import
fits
from
astropy.io
import
fits
from
cluster
import
main
as
cluster
_POOL_TIME
=
300
# SECONDS
_POOL_TIME
=
300
# SECONDS
_MAX_TIME
=
1
*
3600
# SECONDS
_MAX_TIME
=
1
*
3600
# SECONDS
...
@@ -325,6 +327,8 @@ def main(msin, outbase=None, cfgfile='imcal.yml'):
...
@@ -325,6 +327,8 @@ def main(msin, outbase=None, cfgfile='imcal.yml'):
img2
=
outbase
+
'
_2
'
img2
=
outbase
+
'
_2
'
img3
=
outbase
+
'
_3
'
img3
=
outbase
+
'
_3
'
img_final
=
outbase
img_final
=
outbase
img_ddsub
=
outbase
+
'
-ddsub
'
img_ddcal
=
outbase
+
'
-ddcal
'
mask0
=
'
mask0.fits
'
mask0
=
'
mask0.fits
'
mask1
=
'
mask1.fits
'
mask1
=
'
mask1.fits
'
...
@@ -337,13 +341,15 @@ def main(msin, outbase=None, cfgfile='imcal.yml'):
...
@@ -337,13 +341,15 @@ def main(msin, outbase=None, cfgfile='imcal.yml'):
dical1
=
outbase
+
'
_dical1.MS
'
dical1
=
outbase
+
'
_dical1.MS
'
dical2
=
outbase
+
'
_dical2.MS
'
dical2
=
outbase
+
'
_dical2.MS
'
dical3
=
outbase
+
'
_dical3.MS
'
dical3
=
outbase
+
'
_dical3.MS
'
ddsub
=
outbase
+
'
_ddsub.MS
'
h5_1
=
outbase
+
'
_dical1.h5
'
h5_1
=
outbase
+
'
_dical1.h5
'
h5_2
=
outbase
+
'
_dical2.h5
'
h5_2
=
outbase
+
'
_dical2.h5
'
h5_3
=
outbase
+
'
_dical3.h5
'
h5_3
=
outbase
+
'
_dical3.h5
'
h5_dd
=
outbase
+
'
_dd.h5
'
if
os
.
path
.
exists
(
img_
fin
al
+
'
-image.fits
'
):
if
os
.
path
.
exists
(
img_
ddc
al
+
'
-image.fits
'
):
logging
.
info
(
'
The final image exists. Exiting...
'
)
logging
.
info
(
'
The final image exists. Exiting...
'
)
return
0
return
0
...
@@ -398,6 +404,31 @@ def main(msin, outbase=None, cfgfile='imcal.yml'):
...
@@ -398,6 +404,31 @@ def main(msin, outbase=None, cfgfile='imcal.yml'):
if
(
not
os
.
path
.
exists
(
img_final
+
'
-image.fits
'
))
and
(
not
os
.
path
.
exists
(
img_final
+
'
-MFS-image.fits
'
)):
if
(
not
os
.
path
.
exists
(
img_final
+
'
-image.fits
'
))
and
(
not
os
.
path
.
exists
(
img_final
+
'
-MFS-image.fits
'
)):
wsclean
(
dical3
,
outname
=
img_final
,
**
cfg
[
'
clean4
'
])
wsclean
(
dical3
,
outname
=
img_final
,
**
cfg
[
'
clean4
'
])
# Cluster
if
(
not
os
.
path
.
exists
(
img_final
+
'
-clustered.txt
'
)):
clustered_model
=
cluster
(
img_final
+
'
-image.fits
'
,
img_final
+
'
-residual.fits
'
,
img_final
+
'
-sources.txt
'
,
**
cfg
[
'
cluster
'
])
# Makesourcedb
clustered_sdb
=
makesourcedb
(
clustered_model
,
img_final
+
'
-clustered.sourcedb
'
)
# DDE calibration + peeling everything
if
(
not
os
.
path
.
exists
(
ddsub
)):
ddsub
,
h5out
=
ddecal
(
dical3
,
clustered_sdb
,
msout
=
ddsub
,
h5out
=
h5_dd
,
solint
=
120
,
mode
=
'
diagonal
'
)
# view the solutions and save figure
view_sols
(
h5_dd
)
if
(
not
os
.
path
.
exists
(
img_ddsub
+
'
-image.fits
'
)):
wsclean
(
ddsub
,
outname
=
img_ddsub
,
**
cfg
[
'
clean4
'
])
aomodel
=
bbs2model
(
img_final
+
'
-sources.txt
'
,
img_final
+
'
-model.ao
'
)
render
(
img_ddsub
+
'
-image.fits
'
,
aomodel
,
out
=
img_ddcal
+
'
-image.fits
'
)
return
0
return
0
...
...
This diff is collapsed.
Click to expand it.
imcal.yml
+
31
−
20
View file @
964f5c64
...
@@ -64,7 +64,7 @@ dical3:
...
@@ -64,7 +64,7 @@ dical3:
solint
:
800
solint
:
800
mode
:
'
diagonal'
mode
:
'
diagonal'
uvlambdamin
:
500
# Ignore baselines / channels with UV < uvlambdamin wavelengths.
uvlambdamin
:
500
# Ignore baselines / channels with UV < uvlambdamin wavelengths.
cal_nchan
:
3
0
# number of chans with the same solutions
cal_nchan
:
3
1
# number of chans with the same solutions
clean4
:
clean4
:
imagesize
:
3072
imagesize
:
3072
...
@@ -76,27 +76,38 @@ clean4:
...
@@ -76,27 +76,38 @@ clean4:
fitsmask
:
'
mask2.fits'
fitsmask
:
'
mask2.fits'
kwstring
:
'
-use-wgridder
-parallel-deconvolution
1400
-parallel-gridding
8
-deconvolution-channels
3
-weight
briggs
0.0'
kwstring
:
'
-use-wgridder
-parallel-deconvolution
1400
-parallel-gridding
8
-deconvolution-channels
3
-weight
briggs
0.0'
### END
####################### CLUSTERING #######################
####################### CLUSTERING #######################
#
cluster:
cluster
:
#
nbright: 80 # number of brightest clean components (CC) to check for artefacts
nbright
:
80
# number of brightest clean components (CC) to check for artefacts
#
boxsize: 250 # the boxsize around CC in pixels where to check for artefacts
boxsize
:
250
# the boxsize around CC in pixels where to check for artefacts
#
nclusters: 10 # number of clusters ('auto' -- to set automatically)
nclusters
:
10
# number of clusters ('auto' -- to set automatically)
#
cluster_radius: 5 # arcmin
cluster_radius
:
5
# arcmin
#
cluster_overlap: 1.6 # if lower than 2 clusters can intersect
cluster_overlap
:
1.6
# if lower than 2 clusters can intersect
#
auto: True
auto
:
True
#
add_manual: False
add_manual
:
False
#
######################## DD CALIBRATION #######################
######################## DD CALIBRATION #######################
#ddcal: # see DPPP/DDECal documentation
ddcal
:
# see DPPP/DDECal documentation
# solint: 120 # Solution interval in timesteps (1 ~ 30sec for Apertif).
solint
:
120
# Solution interval in timesteps (1 ~ 30sec for Apertif).
# mode: 'diagonal' # Type of constraint to apply.
mode
:
'
diagonal'
# Type of constraint to apply.
# nchan: 15 # Number of channels in each channel block, for which the solution is assumed to be constant.
nfreq
:
15
# Number of channels in each channel block, for which the solution is assumed to be constant.
# startchan: 0
startchan
:
0
# nchan: 192
nchan
:
0
# uvlambdamin: 500 # Ignore baselines / channels with UV < uvlambdamin wavelengths.
uvlambdamin
:
500
# Ignore baselines / channels with UV < uvlambdamin wavelengths.
#
clean5
:
imagesize
:
3072
pixelsize
:
3
multifreq
:
8
automask
:
4.5
autothresh
:
0.5
multiscale
:
True
fitsmask
:
'
mask2.fits'
kwstring
:
'
-use-wgridder
-parallel-deconvolution
1400
-parallel-gridding
8
-deconvolution-channels
3
-weight
briggs
0.0'
### END
## TODO:
## TODO:
#plotsols:
#plotsols:
#
#
...
...
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