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
27a021dc
Commit
27a021dc
authored
5 years ago
by
Mattia Mancini
Browse files
Options
Downloads
Patches
Plain Diff
SSB-44
: using enums to specify indexes
parent
c0ecd8d7
No related branches found
No related tags found
1 merge request
!44
Merge back holography to master
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
CAL/CalibrationCommon/lib/datacontainers/holography_measurementset.py
+18
-15
18 additions, 15 deletions
...ionCommon/lib/datacontainers/holography_measurementset.py
with
18 additions
and
15 deletions
CAL/CalibrationCommon/lib/datacontainers/holography_measurementset.py
+
18
−
15
View file @
27a021dc
import
os
import
re
from
enum
import
Enum
import
numpy
from
astropy.time
import
Time
from
casacore.tables
import
table
as
MS_Table
from
lofar.calibration.common.coordinates
import
pqr_from_icrs
from
.holography_dataset_definitions
import
*
class
CASA_POLARIZATION_INDEX
(
Enum
):
XX
=
0
XY
=
1
YX
=
2
YY
=
3
X
=
0
Y
=
0
class
HolographyMeasurementSet
(
object
):
ms_name_pattern
=
r
'
L(?P<sas_id>\d{6})_SB(?P<sub_band_id>\d{3})_uv\.MS
'
CASA_XX_INDEX
=
0
CASA_XY_INDEX
=
1
CASA_YX_INDEX
=
2
CASA_YY_INDEX
=
3
CASA_X_INDEX
=
0
CASA_Y_INDEX
=
1
def
__init__
(
self
,
ms_name
,
ms_path
):
self
.
path
=
os
.
path
.
join
(
ms_path
,
ms_name
)
...
...
@@ -87,8 +90,8 @@ class HolographyMeasurementSet(object):
tile_offsets
=
antenna_field_table
.
getcell
(
'
ELEMENT_OFFSET
'
,
station_name_index
)
tiles_not_used
=
antenna_field_table
.
getcell
(
'
ELEMENT_FLAG
'
,
station_name_index
)
index_tiles_used
=
numpy
.
where
(
(
tiles_not_used
[:,
HolographyMeasurementSet
.
CASA_X_INDEX
]
==
False
)
&
(
tiles_not_used
[:,
HolographyMeasurementSet
.
CASA_Y_INDEX
]
==
False
))[
0
]
(
tiles_not_used
[:,
CASA_POLARIZATION_INDEX
.
CASA_X_INDEX
]
==
False
)
&
(
tiles_not_used
[:,
CASA_POLARIZATION_INDEX
.
CASA_Y_INDEX
]
==
False
))[
0
]
tile_offsets
=
tile_offsets
[
index_tiles_used
,
:]
axes_coordinate
=
antenna_field_table
.
getcell
(
'
COORDINATE_AXES
'
,
station_name_index
)
...
...
@@ -193,16 +196,16 @@ class HolographyMeasurementSet(object):
beams_crosscorrelations_array
[
reference_station_index
,
:][
'
XX
'
]
=
\
crosscorrelations
[
reference_station_index
,
:,
HolographyMeasurementSet
.
CASA_XX_INDEX
]
reference_station_index
,
:,
CASA_POLARIZATION_INDEX
.
CASA_XX_INDEX
]
beams_crosscorrelations_array
[
reference_station_index
,
:][
'
XY
'
]
=
\
crosscorrelations
[
reference_station_index
,
:,
HolographyMeasurementSet
.
CASA_XY_INDEX
]
reference_station_index
,
:,
CASA_POLARIZATION_INDEX
.
CASA_XY_INDEX
]
beams_crosscorrelations_array
[
reference_station_index
,
:][
'
YX
'
]
=
\
crosscorrelations
[
reference_station_index
,
:,
HolographyMeasurementSet
.
CASA_YX_INDEX
]
reference_station_index
,
:,
CASA_POLARIZATION_INDEX
.
CASA_YX_INDEX
]
beams_crosscorrelations_array
[
reference_station_index
,
:][
'
YY
'
]
=
\
crosscorrelations
[
reference_station_index
,
:,
HolographyMeasurementSet
.
CASA_YY_INDEX
]
reference_station_index
,
:,
CASA_POLARIZATION_INDEX
.
CASA_YY_INDEX
]
beams_crosscorrelations_array
[
reference_station_index
,
:][
'
flag
'
]
=
\
flags
[
reference_station_index
,
:]
...
...
@@ -275,7 +278,7 @@ class HolographyMeasurementSet(object):
return_value
=
numpy
.
empty
(
n_samples
,
dtype
=
return_value_dtype
)
l_m_arrays
=
pqr_from_icrs
(
numpy
.
array
((
ra
,
dec
)),
astropy_times
,
rotation_matrix
)
return_value
[
'
l
'
][:]
=
l_m_arrays
[:,
0
]
return_value
[
'
m
'
][:]
=
l_m_arrays
[:,
1
]
else
:
...
...
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