Skip to content
Snippets Groups Projects
Commit 3cd0bb67 authored by Mattia Mancini's avatar Mattia Mancini
Browse files

SSB-44: missing import os

parent d9618ed4
No related branches found
No related tags found
1 merge request!44Merge back holography to master
import logging
import h5py
import os
import h5py
from lofar.calibration.common.datacontainers.holography_observation import HolographyObservation
from .holography_dataset_definitions import *
from .holography_specification import HolographySpecification
......@@ -207,7 +209,8 @@ class HolographyDataset():
# the geometrical distance are not really cutting it since RA
# and DEC are coordinates of a spherical coordinate system.
# But here the pseudo distance is good enough.
pseudo_distance[frequency_string][beamlet_string] = abs(ra - source_ra) + 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
# _frequencies the same beamlet is the central one. It is allowed that
......@@ -227,7 +230,8 @@ class HolographyDataset():
# All is good. Only one central beamlet.
central_beamlet[frequency_string] = keys[values.index(minimal_distance)]
else:
text = "Found %d beamlets that have the same distance from the source position. Therefore a unique central beamlet does not exist." % (values.count(minimal_distance))
text = "Found %d beamlets that have the same distance from the source position. Therefore a unique central beamlet does not exist." % (
values.count(minimal_distance))
logger.error(text)
raise ValueError(text)
......@@ -237,7 +241,9 @@ class HolographyDataset():
# the set will be 1.
central_beamlet_set = set(central_beamlet.values())
if len(central_beamlet_set) == 1:
logger.debug("All is good, unicorns everywhere, there is only one central beamlet \"%s\" for all _frequencies.", central_beamlet_set)
logger.debug(
"All is good, unicorns everywhere, there is only one central beamlet \"%s\" for all _frequencies.",
central_beamlet_set)
else:
logger.warning("Multiple central beamlets have been identified: ", central_beamlet)
return central_beamlet
......@@ -561,7 +567,6 @@ class HolographyDataset():
result.frequencies = list(f[HDS_FREQUENCY])
result.ra_dec = dict()
for frequency in f["RA_DEC"].keys():
for beamlet in f["RA_DEC"][frequency].keys():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment