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
73be0165
Commit
73be0165
authored
3 years ago
by
Alexander Kutkin
Browse files
Options
Downloads
Patches
Plain Diff
better plotting soulutions; some config adjustments
parent
ef7a1a10
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
imcal.py
+43
-34
43 additions, 34 deletions
imcal.py
imcal.yml
+5
-5
5 additions, 5 deletions
imcal.yml
with
48 additions
and
39 deletions
imcal.py
+
43
−
34
View file @
73be0165
...
@@ -241,47 +241,54 @@ def phase_shift(msin, new_center, msout=None):
...
@@ -241,47 +241,54 @@ def phase_shift(msin, new_center, msout=None):
def
view_sols
(
h5param
,
outname
=
None
):
def
view_sols
(
h5param
,
outname
=
None
):
"""
read and plot the gains
"""
"""
read and plot the gains
"""
path
=
os
.
path
.
split
(
os
.
path
.
abspath
(
h5param
))[
0
]
def
plot_sols
(
h5param
,
key
):
def
plot_sols
(
h5param
,
key
):
print
(
'
AAA
'
)
figs
=
[]
axs
=
[]
with
h5py
.
File
(
h5param
,
'
r
'
)
as
f
:
with
h5py
.
File
(
h5param
,
'
r
'
)
as
f
:
grp
=
f
[
'
sol000/{}
'
.
format
(
key
)]
grp
=
f
[
'
sol000/{}
'
.
format
(
key
)]
data
=
grp
[
'
val
'
][()]
data
=
grp
[
'
val
'
][()]
time
=
grp
[
'
time
'
][()]
time
=
grp
[
'
time
'
][()]
print
(
data
.
shape
)
ants
=
[
'
RT2
'
,
'
RT3
'
,
'
RT4
'
,
'
RT5
'
,
'
RT6
'
,
'
RT7
'
,
'
RT8
'
,
'
RT9
'
,
'
RTA
'
,
'
RTB
'
,
'
RTC
'
,
'
RTD
'
]
ants
=
[
'
RT2
'
,
'
RT3
'
,
'
RT4
'
,
'
RT5
'
,
'
RT6
'
,
'
RT7
'
,
'
RT8
'
,
'
RT9
'
,
'
RTA
'
,
'
RTB
'
,
'
RTC
'
,
'
RTD
'
]
for
ipol
,
pol
in
enumerate
([
'
XX
'
,
'
YY
'
]):
fig
=
plt
.
figure
(
figsize
=
[
20
,
15
])
fig
=
plt
.
figure
(
figsize
=
[
20
,
15
])
fig
.
suptitle
(
'
Freq. averaged {} gain solutions
'
.
format
(
key
.
rstrip
(
'
000
'
)))
fig
.
suptitle
(
'
Freq. averaged {} gain solutions ({})
'
.
format
(
key
.
rstrip
(
'
000
'
),
pol
))
print
(
dict
(
f
[
'
sol000/amplitude000/val
'
].
attrs
.
items
()))
# h5 attributes
for
i
,
ant
in
enumerate
(
ants
):
for
i
,
ant
in
enumerate
(
ants
):
ax
=
fig
.
add_subplot
(
4
,
3
,
i
+
1
)
ax
=
fig
.
add_subplot
(
4
,
3
,
i
+
1
)
ax
.
set_title
(
ant
)
ax
.
set_title
(
ant
)
if
len
(
data
.
shape
)
==
5
:
#
se
vera
l directions
gavg
=
np
.
nanmean
(
data
,
axis
=
1
)[...,
ipol
]
#
a
vera
ge by frequency
# a = ax.imshow(data[:,:,i,1,0].T, aspect='auto
')
if
key
.
startswith
(
'
phase
'
)
:
# plt.colorbar(a
)
ax
.
plot
((
time
-
time
[
0
])
/
3600.0
,
gavg
[:,
i
,]
*
180.0
/
np
.
pi
,
alpha
=
0.7
)
gavg
=
np
.
nanmean
(
data
,
axis
=
1
)
ax
.
set_ylim
([
-
180
,
180
]
)
ax
.
plot
((
time
-
time
[
0
])
/
60.0
,
gavg
[:,
i
,
:,
0
],
alpha
=
0.7
)
else
:
elif
len
(
data
.
shape
)
==
4
:
# a single direction
ax
.
plot
((
time
-
time
[
0
])
/
3600.0
,
gavg
[:,
i
,],
alpha
=
0.7
)
ax
.
plot
((
time
-
time
[
0
])
/
3600.0
,
data
[:,
0
,
i
,
0
],
alpha
=
0.7
)
if
key
.
startswith
(
'
amplitude
'
):
ax
.
set_ylim
([
-
0.1
,
2.1
])
if
i
==
0
:
if
i
==
0
:
ax
.
legend
([
'
c{}
'
.
format
(
_
)
for
_
in
range
(
data
.
shape
[
-
2
])])
ax
.
legend
([
'
c{}
'
.
format
(
_
)
for
_
in
range
(
data
.
shape
[
-
2
])])
if
i
==
10
:
if
i
==
10
:
ax
.
set_xlabel
(
'
Time (hrs)
'
)
ax
.
set_xlabel
(
'
Time (hrs)
'
)
return
fig
,
ax
if
outname
is
not
None
:
figs
.
append
(
fig
)
axs
.
append
(
ax
)
return
figs
,
axs
try
:
try
:
fig1
,
ax1
=
plot_sols
(
h5param
,
'
amplitude000
'
)
(
fig1
,
fig2
),
(
ax1
,
ax2
)
=
plot_sols
(
h5param
,
'
amplitude000
'
)
fig1
.
savefig
(
f
'
{
outname
}
_amp.png
'
)
if
outname
is
not
None
:
fig1
.
savefig
(
f
'
{
outname
}
_amp_XX.png
'
)
fig2
.
savefig
(
f
'
{
outname
}
_amp_YY.png
'
)
except
:
except
:
logging
.
error
(
'
No amplitude solutions found
'
)
logging
.
error
(
'
No amplitude solutions found
'
)
try
:
try
:
fig2
,
ax2
=
plot_sols
(
h5param
,
'
phase000
'
)
(
fig1
,
fig2
),
(
ax1
,
ax2
)
=
plot_sols
(
h5param
,
'
phase000
'
)
fig2
.
savefig
(
f
'
{
outname
}
_phase.png
'
)
if
outname
is
not
None
:
fig1
.
savefig
(
f
'
{
outname
}
_phase_XX.png
'
)
fig2
.
savefig
(
f
'
{
outname
}
_phase_YY.png
'
)
except
:
except
:
logging
.
error
(
'
No phase solutions found
'
)
logging
.
error
(
'
No phase solutions found
'
)
# plt.show()
def
remove_model_components_below_level
(
model
,
level
=
0.0
,
out
=
None
):
def
remove_model_components_below_level
(
model
,
level
=
0.0
,
out
=
None
):
"""
"""
...
@@ -359,6 +366,8 @@ def main(msin, outbase=None, cfgfile='imcal.yml'):
...
@@ -359,6 +366,8 @@ def main(msin, outbase=None, cfgfile='imcal.yml'):
if
(
not
os
.
path
.
exists
(
ms_split
))
and
(
cfg
[
'
split1
'
][
'
startchan
'
]
or
cfg
[
'
split1
'
][
'
nchan
'
]):
if
(
not
os
.
path
.
exists
(
ms_split
))
and
(
cfg
[
'
split1
'
][
'
startchan
'
]
or
cfg
[
'
split1
'
][
'
nchan
'
]):
ms_split
=
split_ms
(
msin
,
msout_path
=
ms_split
,
**
cfg
[
'
split1
'
])
ms_split
=
split_ms
(
msin
,
msout_path
=
ms_split
,
**
cfg
[
'
split1
'
])
else
:
ms_split
=
msin
# Clean + DIcal
# Clean + DIcal
...
...
This diff is collapsed.
Click to expand it.
imcal.yml
+
5
−
5
View file @
73be0165
...
@@ -11,7 +11,7 @@
...
@@ -11,7 +11,7 @@
####################### IMAGING #######################
####################### IMAGING #######################
split1
:
split1
:
startchan
:
0
# start channel to split from
startchan
:
4
0
# start channel to split from
nchan
:
0
# 0 means till the end
nchan
:
0
# 0 means till the end
clean0
:
# initial clean
clean0
:
# initial clean
...
@@ -44,7 +44,7 @@ clean2:
...
@@ -44,7 +44,7 @@ clean2:
autothresh
:
5
autothresh
:
5
multiscale
:
True
multiscale
:
True
clip_model_level
:
null
clip_model_level
:
null
kwstring
:
'
-use-wgridder
-parallel-deconvolution
1400
-parallel-gridding
8
-deconvolution-channels
-weight
briggs
0.0'
kwstring
:
'
-use-wgridder
-parallel-deconvolution
1400
-parallel-gridding
8
-deconvolution-channels
3
-weight
briggs
0.0'
dical2
:
dical2
:
solint
:
1
solint
:
1
...
@@ -103,10 +103,10 @@ clean5:
...
@@ -103,10 +103,10 @@ clean5:
imagesize
:
3072
imagesize
:
3072
pixelsize
:
3
pixelsize
:
3
multifreq
:
8
multifreq
:
8
#
automask:
0
automask
:
4
autothresh
:
1.0
autothresh
:
0.5
multiscale
:
True
multiscale
:
True
fitsmask
:
'
mask2.fits'
fitsmask
:
null
clip_model_level
:
null
clip_model_level
:
null
kwstring
:
'
-use-wgridder
-parallel-deconvolution
1400
-parallel-gridding
8
-deconvolution-channels
3
-weight
briggs
-1.5'
kwstring
:
'
-use-wgridder
-parallel-deconvolution
1400
-parallel-gridding
8
-deconvolution-channels
3
-weight
briggs
-1.5'
...
...
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