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
92a8950e
Commit
92a8950e
authored
6 years ago
by
Mattia Mancini
Browse files
Options
Downloads
Patches
Plain Diff
SW-43
: minor fixes in the beamlet searching
parent
9aa42457
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_dataset.py
+15
-7
15 additions, 7 deletions
...alibrationCommon/lib/datacontainers/holography_dataset.py
with
15 additions
and
7 deletions
CAL/CalibrationCommon/lib/datacontainers/holography_dataset.py
+
15
−
7
View file @
92a8950e
...
@@ -84,6 +84,8 @@ class HolographyDataset():
...
@@ -84,6 +84,8 @@ class HolographyDataset():
# a dict of dicts and eventually str, ndarray or that can be converted in a ndarray calling
# a dict of dicts and eventually str, ndarray or that can be converted in a ndarray calling
# numpy.array()
# numpy.array()
self
.
derived_data
=
None
self
.
derived_data
=
None
# the index of the central beamlet
self
.
central_beamlet
=
None
@staticmethod
@staticmethod
def
compare_dicts
(
dict1
,
dict2
):
def
compare_dicts
(
dict1
,
dict2
):
...
@@ -179,7 +181,9 @@ class HolographyDataset():
...
@@ -179,7 +181,9 @@ class HolographyDataset():
# and iterate over the beamlets.
# and iterate over the beamlets.
for
beamlet
in
beamlets
:
for
beamlet
in
beamlets
:
beamlet_string
=
str
(
beamlet
)
beamlet_string
=
str
(
beamlet
)
(
ra
,
dec
,
epoch
)
=
ra_dec
[
frequency_string
][
beamlet_string
]
ra
=
ra_dec
[
frequency_string
][
beamlet_string
][
'
RA
'
]
dec
=
ra_dec
[
frequency_string
][
beamlet_string
][
'
DEC
'
]
# calculate a pseudo distance that is an indicator if this
# calculate a pseudo distance that is an indicator if this
# beamlet is closer to the source than the ones before.
# beamlet is closer to the source than the ones before.
# Note that I am too lazy to calculate the spherical distance.
# Note that I am too lazy to calculate the spherical distance.
...
@@ -187,7 +191,7 @@ class HolographyDataset():
...
@@ -187,7 +191,7 @@ class HolographyDataset():
# the geometrical distance are not really cutting it since RA
# the geometrical distance are not really cutting it since RA
# and DEC are coordinates of a spherical coordinate system.
# and DEC are coordinates of a spherical coordinate system.
# But here the pseudo distance is good enough.
# But here the pseudo distance is good enough.
pseudo_distance
[
frequency
][
beamlet
]
=
math
.
abs
(
ra
-
source_ra
)
+
math
.
abs
(
dec
-
source_dec
)
pseudo_distance
[
frequency
_string
][
beamlet
_string
]
=
abs
(
ra
-
source_ra
)
+
abs
(
dec
-
source_dec
)
# OK. Done with all the iteration business. Now check if across all
# OK. Done with all the iteration business. Now check if across all
# frequencies the same beamlet is the central one. It is allowed that
# frequencies the same beamlet is the central one. It is allowed that
...
@@ -220,7 +224,7 @@ class HolographyDataset():
...
@@ -220,7 +224,7 @@ class HolographyDataset():
logger
.
debug
(
"
All is good, unicorns everywhere, there is only one central beamlet
\"
%s
\"
for all frequencies.
"
,
self
.
central_beamlet
)
logger
.
debug
(
"
All is good, unicorns everywhere, there is only one central beamlet
\"
%s
\"
for all frequencies.
"
,
self
.
central_beamlet
)
else
:
else
:
logger
.
warn
(
"
Multiple central beamlets have been identified:
"
,
central_beamlet
)
logger
.
warn
(
"
Multiple central beamlets have been identified:
"
,
central_beamlet
)
return
central_beamlet
return
list
(
central_beamlet
)
def
load_from_beam_specification_and_ms
(
self
,
station_name
,
list_of_hbs_ms_tuples
):
def
load_from_beam_specification_and_ms
(
self
,
station_name
,
list_of_hbs_ms_tuples
):
"""
"""
...
@@ -231,10 +235,14 @@ class HolographyDataset():
...
@@ -231,10 +235,14 @@ class HolographyDataset():
"""
"""
logger
.
info
(
"
Creating a holography data set for station
\"
%s
\"
...
"
,
station_name
)
logger
.
info
(
"
Creating a holography data set for station
\"
%s
\"
...
"
,
station_name
)
self
.
__collect_preliminary_information
(
station_name
,
list_of_hbs_ms_tuples
)
try
:
self
.
__read_data
(
station_name
,
list_of_hbs_ms_tuples
)
self
.
__collect_preliminary_information
(
station_name
,
list_of_hbs_ms_tuples
)
self
.
central_beamlets
=
self
.
find_central_beamlets
(
self
.
source_position
,
self
.
ra_dec
,
self
.
frequencies
,
self
.
beamlets
)
self
.
__read_data
(
station_name
,
list_of_hbs_ms_tuples
)
logger
.
info
(
"
Creation of a holography data set for station
\"
%s
\"
done.
"
,
station_name
)
self
.
central_beamlets
=
self
.
find_central_beamlets
(
self
.
source_position
,
self
.
ra_dec
,
self
.
frequencies
,
self
.
beamlets
)
logger
.
info
(
"
Creation of a holography data set for station
\"
%s
\"
done.
"
,
station_name
)
except
Exception
as
e
:
logger
.
exception
(
"
Errore creating dataset for station
\"
%s
\"
: %s
"
,
station_name
,
e
)
raise
e
def
__read_data
(
self
,
station_name
,
list_of_hbs_ms_tuples
):
def
__read_data
(
self
,
station_name
,
list_of_hbs_ms_tuples
):
"""
"""
...
...
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