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
3e8eb449
Commit
3e8eb449
authored
6 years ago
by
Mattia Mancini
Browse files
Options
Downloads
Patches
Plain Diff
SSB-42
: implemented ra_dec to l_m conversion
parent
644a8e02
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/CalibrationCommon/lib/datacontainers/holography_dataset.py
+50
-40
50 additions, 40 deletions
...alibrationCommon/lib/datacontainers/holography_dataset.py
with
50 additions
and
40 deletions
CAL/CalibrationCommon/lib/datacontainers/holography_dataset.py
+
50
−
40
View file @
3e8eb449
from
.holography_specification
import
HolographySpecification
from
.holography_dataset_definitions
import
*
from
lofar.calibration.common.datacontainers.holography_observation
import
HolographyObservation
import
logging
import
logging
import
numpy
import
h5py
import
h5py
from
lofar.calibration.common.datacontainers.holography_observation
import
HolographyObservation
from
.holography_dataset_definitions
import
*
from
.holography_specification
import
HolographySpecification
logger
=
logging
.
getLogger
(
__name__
)
logger
=
logging
.
getLogger
(
__name__
)
class
HolographyDataset
():
class
HolographyDataset
():
def
__init__
(
self
):
def
__init__
(
self
):
'''
'''
...
@@ -79,7 +80,8 @@ class HolographyDataset():
...
@@ -79,7 +80,8 @@ class HolographyDataset():
if
isinstance
(
dict1
[
key
],
dict
)
and
isinstance
(
dict2
[
key
],
dict
):
if
isinstance
(
dict1
[
key
],
dict
)
and
isinstance
(
dict2
[
key
],
dict
):
result
=
result
and
HolographyDataset
.
compare_dicts
(
dict1
[
key
],
dict2
[
key
])
result
=
result
and
HolographyDataset
.
compare_dicts
(
dict1
[
key
],
dict2
[
key
])
else
:
else
:
if
isinstance
(
dict1
[
key
],
numpy
.
ndarray
)
and
isinstance
(
dict2
[
key
],
numpy
.
ndarray
):
if
isinstance
(
dict1
[
key
],
numpy
.
ndarray
)
and
isinstance
(
dict2
[
key
],
numpy
.
ndarray
):
# Compares element by element the two arrays
# Compares element by element the two arrays
return
numpy
.
array_equal
(
dict1
[
key
],
dict2
[
key
])
return
numpy
.
array_equal
(
dict1
[
key
],
dict2
[
key
])
else
:
else
:
...
@@ -107,10 +109,13 @@ class HolographyDataset():
...
@@ -107,10 +109,13 @@ class HolographyDataset():
other_value
=
getattr
(
hds
,
attribute_name
)
other_value
=
getattr
(
hds
,
attribute_name
)
this_equality
=
True
this_equality
=
True
try
:
try
:
if
isinstance
(
attribute_value
,
numpy
.
ndarray
)
is
True
and
isinstance
(
other_value
,
numpy
.
ndarray
)
is
True
:
if
isinstance
(
attribute_value
,
numpy
.
ndarray
)
is
True
and
isinstance
(
other_value
,
numpy
.
ndarray
)
is
True
:
this_equality
=
numpy
.
array_equal
(
attribute_value
,
other_value
)
this_equality
=
numpy
.
array_equal
(
attribute_value
,
other_value
)
elif
isinstance
(
attribute_value
,
dict
)
is
True
and
isinstance
(
other_value
,
dict
)
is
True
:
elif
isinstance
(
attribute_value
,
dict
)
is
True
and
isinstance
(
other_value
,
this_equality
=
HolographyDataset
.
compare_dicts
(
attribute_value
,
other_value
)
dict
)
is
True
:
this_equality
=
HolographyDataset
.
compare_dicts
(
attribute_value
,
other_value
)
elif
attribute_value
!=
other_value
:
elif
attribute_value
!=
other_value
:
this_equality
=
False
this_equality
=
False
except
Exception
as
e
:
except
Exception
as
e
:
...
@@ -141,7 +146,6 @@ class HolographyDataset():
...
@@ -141,7 +146,6 @@ class HolographyDataset():
self
.
__collect_preliminary_information
(
station_name
,
list_of_hbs_ms_tuples
)
self
.
__collect_preliminary_information
(
station_name
,
list_of_hbs_ms_tuples
)
self
.
__read_data
(
station_name
,
list_of_hbs_ms_tuples
)
self
.
__read_data
(
station_name
,
list_of_hbs_ms_tuples
)
def
__read_data
(
self
,
station_name
,
list_of_hbs_ms_tuples
):
def
__read_data
(
self
,
station_name
,
list_of_hbs_ms_tuples
):
"""
"""
...
@@ -159,9 +163,12 @@ class HolographyDataset():
...
@@ -159,9 +163,12 @@ class HolographyDataset():
for
beamlet
in
self
.
beamlets
:
for
beamlet
in
self
.
beamlets
:
beamlet_string
=
str
(
beamlet
)
beamlet_string
=
str
(
beamlet
)
reference_station_names
,
cross_correlation
=
\
reference_station_names
,
cross_correlation
=
\
ho
.
ms_for_a_given_beamlet_number
[
beamlet
].
\
ho
.
ms_for_a_given_beamlet_number
[
read_cross_correlation_time_flags_per_station_names
(
station_name
,
beamlet
].
read_cross_correlation_time_flags_lm_per_station_name
(
self
.
reference_stations
)
station_name
,
self
.
reference_stations
,
self
.
ra_dec
[
frequency_string
][
beamlet_string
],
self
.
rotation_matrix
)
for
reference_station_index
,
reference_station
in
\
for
reference_station_index
,
reference_station
in
\
enumerate
(
reference_station_names
):
enumerate
(
reference_station_names
):
...
@@ -175,7 +182,6 @@ class HolographyDataset():
...
@@ -175,7 +182,6 @@ class HolographyDataset():
self
.
data
[
reference_station
][
frequency_string
][
beamlet_string
]
=
\
self
.
data
[
reference_station
][
frequency_string
][
beamlet_string
]
=
\
cross_correlation
[
reference_station_index
,
:]
cross_correlation
[
reference_station_index
,
:]
def
__collect_preliminary_information
(
self
,
station_name
,
list_of_hbs_ho_tuples
):
def
__collect_preliminary_information
(
self
,
station_name
,
list_of_hbs_ho_tuples
):
"""
"""
This routines reads both the holography beam specifications files and the holography
This routines reads both the holography beam specifications files and the holography
...
@@ -266,7 +272,6 @@ class HolographyDataset():
...
@@ -266,7 +272,6 @@ class HolographyDataset():
virtual_pointing
[(
frequency
,
beamlet
)],
virtual_pointing
[(
frequency
,
beamlet
)],
dtype
=
coordinate_type
)
dtype
=
coordinate_type
)
# reads the target station position and the coordinate of its axes
# reads the target station position and the coordinate of its axes
# and does this only once since the coordinate will not change
# and does this only once since the coordinate will not change
first_holography_observation
=
list_of_hbs_ho_tuples
[
0
][
1
]
first_holography_observation
=
list_of_hbs_ho_tuples
[
0
][
1
]
...
@@ -374,11 +379,14 @@ class HolographyDataset():
...
@@ -374,11 +379,14 @@ class HolographyDataset():
result
.
data
[
reference_station
]
=
dict
()
result
.
data
[
reference_station
]
=
dict
()
if
frequency
not
in
result
.
data
[
reference_station
]:
if
frequency
not
in
result
.
data
[
reference_station
]:
result
.
data
[
reference_station
][
frequency
]
=
dict
()
result
.
data
[
reference_station
][
frequency
]
=
dict
()
result
.
data
[
reference_station
][
frequency
][
beamlet
]
=
numpy
.
array
(
f
[
"
CROSSCORRELATION
"
][
reference_station
][
frequency
][
beamlet
])
result
.
data
[
reference_station
][
frequency
][
beamlet
]
=
numpy
.
array
(
f
[
"
CROSSCORRELATION
"
][
reference_station
][
frequency
][
beamlet
])
result
.
beamlets
=
list
(
beamlets
)
result
.
beamlets
=
list
(
beamlets
)
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
exception
(
"
Cannot read the Holography Data Set data from the HDF5 file
\"
%s
\"
. This is the exception that was thrown: %s
"
,
path
,
e
)
logger
.
exception
(
"
Cannot read the Holography Data Set data from the HDF5 file
\"
%s
\"
. This is the exception that was thrown: %s
"
,
path
,
e
)
raise
e
raise
e
finally
:
finally
:
if
f
is
not
None
:
if
f
is
not
None
:
...
@@ -446,10 +454,12 @@ class HolographyDataset():
...
@@ -446,10 +454,12 @@ class HolographyDataset():
for
frequency
in
self
.
data
[
reference_station
].
keys
():
for
frequency
in
self
.
data
[
reference_station
].
keys
():
f
[
"
CROSSCORRELATION
"
][
reference_station
].
create_group
(
frequency
)
f
[
"
CROSSCORRELATION
"
][
reference_station
].
create_group
(
frequency
)
for
beamlet
in
self
.
data
[
reference_station
][
frequency
].
keys
():
for
beamlet
in
self
.
data
[
reference_station
][
frequency
].
keys
():
f
[
"
CROSSCORRELATION
"
][
reference_station
][
frequency
][
beamlet
]
=
\
f
[
"
CROSSCORRELATION
"
][
reference_station
][
frequency
][
beamlet
]
=
self
.
data
[
reference_station
][
frequency
][
beamlet
]
self
.
data
[
reference_station
][
frequency
][
beamlet
]
except
Exception
as
e
:
except
Exception
as
e
:
logger
.
exception
(
"
Cannot write the Holography Data Set data to the HDF5 file
\"
%s
\"
. This is the exception that was thrown: %s
"
,
path
,
e
)
logger
.
exception
(
"
Cannot write the Holography Data Set data to the HDF5 file
\"
%s
\"
. This is the exception that was thrown: %s
"
,
path
,
e
)
raise
e
raise
e
finally
:
finally
:
if
f
is
not
None
:
if
f
is
not
None
:
...
...
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