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

SSB-47: Reformat and rename

parent 5e93194c
No related branches found
No related tags found
1 merge request!44Merge back holography to master
......@@ -9,7 +9,7 @@ from typing import List
from dataclasses import dataclass, asdict, field
from h5py import File
from numpy import empty as empty_ndarray, ndarray, fromiter as array_from_iter, float64,\
from numpy import empty as empty_ndarray, ndarray, fromiter as array_from_iter, float64, \
array_equal, arange, array
from copy import deepcopy
......@@ -61,6 +61,7 @@ class CalibrationTable:
observation_antennaset: str = ''
observation_band: str = ''
@staticmethod
def load_from_file(file_path):
logger.info('loading file %s', file_path)
......@@ -177,6 +178,16 @@ class CalibrationTable:
raise InvalidFileException('empty header')
return header
def _parse_header(self):
self.observation_mode = int(self.observation_mode)
self.calibration_version = int(self.calibration_version)
if isinstance(self.calibration_ppsdelay, str):
self.calibration_ppsdelay = list(map(int, self.calibration_ppsdelay.
lstrip('[').
rstrip(']').
strip().
split(' ')))
@staticmethod
def _parse_data(data_buffer: bytes):
data = array_from_iter(map(lambda x: x[0], iter_unpack('d', data_buffer)), dtype=float)
......@@ -196,18 +207,8 @@ class CalibrationTable:
return complex_data
def _parse_attributes(self):
self.observation_mode = int(self.observation_mode)
self.calibration_version = int(self.calibration_version)
if isinstance(self.calibration_ppsdelay, str):
self.calibration_ppsdelay = list(map(int, self.calibration_ppsdelay.
lstrip('[').
rstrip(']').
strip().
split(' ')))
def __post_init__(self):
self._parse_attributes()
self._parse_header()
def __eq__(self, other):
return super().__eq__(other) and array_equal(self.data, other.data)
......
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