Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LOFAR
Manage
Activity
Members
Labels
Plan
Issues
Wiki
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Insights
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
RadioObservatory
LOFAR
Commits
4e945cdd
Commit
4e945cdd
authored
6 years ago
by
Mattia Mancini
Browse files
Options
Downloads
Patches
Plain Diff
SSB-47
: redefinition of l, m and the scale of immage in the station plane, minor look and feel
parent
05b974a2
No related branches found
No related tags found
1 merge request
!44
Merge back holography to master
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
CAL/CalibrationProcessing/lib/processing/inspect.py
+24
-16
24 additions, 16 deletions
CAL/CalibrationProcessing/lib/processing/inspect.py
with
24 additions
and
16 deletions
CAL/CalibrationProcessing/lib/processing/inspect.py
+
24
−
16
View file @
4e945cdd
...
@@ -7,9 +7,10 @@ from matplotlib import cm
...
@@ -7,9 +7,10 @@ from matplotlib import cm
from
matplotlib.figure
import
Figure
from
matplotlib.figure
import
Figure
from
numpy
import
mgrid
from
numpy
import
mgrid
from
scipy.constants
import
c
as
light_speed
from
scipy.constants
import
c
as
light_speed
from
sci
py.fft
pack
import
fft2
,
fftshift
from
num
py.fft
import
fft2
,
fftshift
from
scipy.interpolate
import
griddata
from
scipy.interpolate
import
griddata
__LIST_OR_NPARRAY
=
typing
.
Union
[
typing
.
List
[
float
],
numpy
.
ndarray
]
__LIST_OR_NPARRAY
=
typing
.
Union
[
typing
.
List
[
float
],
numpy
.
ndarray
]
__DATATABLE_TYPE
=
typing
.
Dict
[
__DATATABLE_TYPE
=
typing
.
Dict
[
str
,
typing
.
Dict
[
str
,
typing
.
Dict
[
str
,
typing
.
Dict
[
str
,
numpy
.
ndarray
]]]]
str
,
typing
.
Dict
[
str
,
typing
.
Dict
[
str
,
typing
.
Dict
[
str
,
numpy
.
ndarray
]]]]
...
@@ -36,7 +37,7 @@ def complex_value_to_color(complex_array: numpy.ndarray, abs_max=None, abs_min=N
...
@@ -36,7 +37,7 @@ def complex_value_to_color(complex_array: numpy.ndarray, abs_max=None, abs_min=N
norm_abs_array
=
(
abs_array
-
abs_min
)
/
normalization
norm_abs_array
=
(
abs_array
-
abs_min
)
/
normalization
phase_array
=
(
numpy
.
angle
(
linearized_complex_array
)
+
numpy
.
pi
)
/
2
/
numpy
.
pi
phase_array
=
(
numpy
.
angle
(
linearized_complex_array
)
+
numpy
.
pi
)
/
2
/
numpy
.
pi
color_map
=
cm
.
get_cmap
(
'
autumn
'
)
color_map
=
cm
.
get_cmap
(
'
hsv
'
)
colors
=
color_map
(
phase_array
)
colors
=
color_map
(
phase_array
)
colors
[:,
0
]
*=
norm_abs_array
colors
[:,
0
]
*=
norm_abs_array
...
@@ -66,11 +67,12 @@ def _grid_visibilities_lm_plane(l, m, v, sampling):
...
@@ -66,11 +67,12 @@ def _grid_visibilities_lm_plane(l, m, v, sampling):
points
=
numpy
.
stack
((
l
,
m
),
axis
=
1
)
points
=
numpy
.
stack
((
l
,
m
),
axis
=
1
)
grid_x
,
grid_y
=
mgrid
[
-
1
:
1
:
sampling
*
1.j
,
-
1
:
1
:
sampling
*
1.j
]
grid_x
,
grid_y
=
mgrid
[
-
1
:
1
:
sampling
*
1.j
,
-
1
:
1
:
sampling
*
1.j
]
from
scipy.ndimage.filters
import
gaussian_filter
#from scipy.ndimage.filters import gaussian_filter
vis
=
griddata
(
points
,
v
,
(
grid_x
,
grid_y
),
fill_value
=
0.
,
method
=
'
cubic
'
)
vis
=
griddata
(
points
,
v
,
(
grid_x
,
grid_y
),
fill_value
=
0.
,
method
=
'
linear
'
)
sigma
=
[
2
,
2
]
#sigma = [2, 2]
vis
.
real
=
gaussian_filter
(
vis
.
real
,
sigma
)
#vis.real = gaussian_filter(vis.real, sigma)
vis
.
imag
=
gaussian_filter
(
vis
.
imag
,
sigma
)
#vis.imag = gaussian_filter(vis.imag, sigma)
return
vis
return
vis
...
@@ -82,7 +84,7 @@ def _fft_visibilities_lm_plane(l, m, v, sampling):
...
@@ -82,7 +84,7 @@ def _fft_visibilities_lm_plane(l, m, v, sampling):
def
_plot_station_averaged_visibilities_lm_plane_single_frequency
(
figure
:
Figure
,
l_m_v
,
def
_plot_station_averaged_visibilities_lm_plane_single_frequency
(
figure
:
Figure
,
l_m_v
,
sampling
=
250
):
sampling
=
512
):
l
,
m
,
v
,
flagged
=
list
(
zip
(
*
l_m_v
))
l
,
m
,
v
,
flagged
=
list
(
zip
(
*
l_m_v
))
for
index
,
polarization
in
enumerate
((
'
XX
'
,
'
XY
'
,
'
YX
'
,
'
YY
'
)):
for
index
,
polarization
in
enumerate
((
'
XX
'
,
'
XY
'
,
'
YX
'
,
'
YY
'
)):
...
@@ -95,7 +97,7 @@ def _plot_station_averaged_visibilities_lm_plane_single_frequency(figure: Figure
...
@@ -95,7 +97,7 @@ def _plot_station_averaged_visibilities_lm_plane_single_frequency(figure: Figure
canvas
.
set_ylim
(
-
1
,
1
)
canvas
.
set_ylim
(
-
1
,
1
)
vis
=
_grid_visibilities_lm_plane
(
l
,
m
,
v_pol
,
sampling
)
vis
=
_grid_visibilities_lm_plane
(
l
,
m
,
v_pol
,
sampling
)
color_mapped_vis
=
complex_value_to_color
(
vis
,
log
=
Fals
e
)
color_mapped_vis
=
complex_value_to_color
(
vis
,
log
=
Tru
e
)
canvas
.
imshow
(
color_mapped_vis
,
extent
=
[
-
1
,
1
,
-
1
,
1
],
origin
=
'
lower
'
,
resample
=
True
)
canvas
.
imshow
(
color_mapped_vis
,
extent
=
[
-
1
,
1
,
-
1
,
1
],
origin
=
'
lower
'
,
resample
=
True
)
...
@@ -110,13 +112,13 @@ def _plot_station_averaged_visibilities_station_plane_single_frequency(figure: F
...
@@ -110,13 +112,13 @@ def _plot_station_averaged_visibilities_station_plane_single_frequency(figure: F
fft_vis
=
_fft_visibilities_lm_plane
(
l
,
m
,
v_pol
,
sampling
)
fft_vis
=
_fft_visibilities_lm_plane
(
l
,
m
,
v_pol
,
sampling
)
canvas
=
figure
.
add_subplot
(
2
,
2
,
index
+
1
)
canvas
=
figure
.
add_subplot
(
2
,
2
,
index
+
1
)
canvas
.
set_xlim
(
-
6
0
,
6
0
)
canvas
.
set_xlim
(
-
3
0
,
3
0
)
canvas
.
set_ylim
(
-
6
0
,
6
0
)
canvas
.
set_ylim
(
-
3
0
,
3
0
)
canvas
.
set_xlabel
(
'
x [m]
'
)
canvas
.
set_xlabel
(
'
x [m]
'
)
canvas
.
set_ylabel
(
'
y [m]
'
)
canvas
.
set_ylabel
(
'
y [m]
'
)
antenna_array_length
=
light_speed
/
frequency
*
sampling
antenna_array_length
=
light_speed
/
frequency
*
sampling
/
2.
/
2.
color_mapped_fft
=
complex_value_to_color
(
fft_vis
,
log
=
False
)
color_mapped_fft
=
complex_value_to_color
(
fft_vis
,
log
=
False
)
canvas
.
imshow
(
color_mapped_fft
[:,
::
-
1
],
origin
=
'
lower
'
,
extent
=
[
-
1
*
antenna_array_length
,
canvas
.
imshow
(
color_mapped_fft
[:,
::
-
1
],
origin
=
'
lower
'
,
extent
=
[
-
1
*
antenna_array_length
,
...
@@ -127,11 +129,15 @@ def _plot_station_averaged_visibilities_station_plane_single_frequency(figure: F
...
@@ -127,11 +129,15 @@ def _plot_station_averaged_visibilities_station_plane_single_frequency(figure: F
canvas
.
set_title
(
polarization
)
canvas
.
set_title
(
polarization
)
def
_plot_station_averaged_visibilities_lm_plane_datatable
(
data_table
:
__DATATABLE_TYPE
):
def
_plot_station_averaged_visibilities_lm_plane_datatable
(
data_table
:
__DATATABLE_TYPE
,
central_beamlets
):
for
station
,
data_per_station
in
data_table
.
items
():
for
station
,
data_per_station
in
data_table
.
items
():
for
frequency_str
,
data_per_frequency
in
data_per_station
.
items
():
for
frequency_str
,
data_per_frequency
in
data_per_station
.
items
():
l_m_v
=
[(
data_per_beam
[
'
mean
'
][
'
l
'
][
0
],
data_per_beam
[
'
mean
'
][
'
m
'
][
0
],
central_beam
=
data_per_frequency
[
central_beamlets
[
frequency_str
]][
'
mean
'
]
l_m_v
=
[(
data_per_beam
[
'
mean
'
][
'
l
'
][
0
]
-
central_beam
[
'
l
'
][
0
],
data_per_beam
[
'
mean
'
][
'
m
'
][
0
]
-
central_beam
[
'
m
'
][
0
],
dict
(
XX
=
data_per_beam
[
'
mean
'
][
'
XX
'
][
0
],
XY
=
data_per_beam
[
'
mean
'
][
'
XY
'
][
0
],
dict
(
XX
=
data_per_beam
[
'
mean
'
][
'
XX
'
][
0
],
XY
=
data_per_beam
[
'
mean
'
][
'
XY
'
][
0
],
YX
=
data_per_beam
[
'
mean
'
][
'
YX
'
][
0
],
YY
=
data_per_beam
[
'
mean
'
][
'
YY
'
][
0
]),
YX
=
data_per_beam
[
'
mean
'
][
'
YX
'
][
0
],
YY
=
data_per_beam
[
'
mean
'
][
'
YY
'
][
0
]),
data_per_beam
[
'
mean
'
][
'
flag
'
][
0
])
data_per_beam
[
'
mean
'
][
'
flag
'
][
0
])
...
@@ -171,6 +177,7 @@ def _plot_gains_as_frequency(data_table: __DATATABLE_TYPE, target_station):
...
@@ -171,6 +177,7 @@ def _plot_gains_as_frequency(data_table: __DATATABLE_TYPE, target_station):
canvas
=
figure
.
add_subplot
(
2
,
2
,
polarization_index
+
1
)
canvas
=
figure
.
add_subplot
(
2
,
2
,
polarization_index
+
1
)
canvas
.
set_title
(
polarization
)
canvas
.
set_title
(
polarization
)
canvas
.
set_ylim
(
-
numpy
.
pi
,
numpy
.
pi
)
canvas
.
plot
(
frequencies
/
__MHZ_IN_HZ
,
numpy
.
angle
(
gains_per_antenna
),
'
+-
'
)
canvas
.
plot
(
frequencies
/
__MHZ_IN_HZ
,
numpy
.
angle
(
gains_per_antenna
),
'
+-
'
)
plt
.
tight_layout
()
plt
.
tight_layout
()
...
@@ -187,7 +194,8 @@ def plot_station_averaged_visibilities_lm_plane(dset: HolographyDataset,
...
@@ -187,7 +194,8 @@ def plot_station_averaged_visibilities_lm_plane(dset: HolographyDataset,
derived_datatable_name
=
'
STATION_AVERAGED
'
):
derived_datatable_name
=
'
STATION_AVERAGED
'
):
__apply_to_datatable
(
dset
,
__apply_to_datatable
(
dset
,
derived_datatable_name
,
derived_datatable_name
,
_plot_station_averaged_visibilities_lm_plane_datatable
)
_plot_station_averaged_visibilities_lm_plane_datatable
,
dset
.
central_beamlets
)
def
plot_gains_per_antenna
(
dset
:
HolographyDataset
,
derived_datatable_name
=
'
GAINS
'
):
def
plot_gains_per_antenna
(
dset
:
HolographyDataset
,
derived_datatable_name
=
'
GAINS
'
):
...
...
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