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
6ac7b61f
Commit
6ac7b61f
authored
5 years ago
by
Mattia Mancini
Browse files
Options
Downloads
Patches
Plain Diff
SSB-47
: Reformat and rename
parent
5e93194c
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/calibration_table.py
+13
-12
13 additions, 12 deletions
...CalibrationCommon/lib/datacontainers/calibration_table.py
with
13 additions
and
12 deletions
CAL/CalibrationCommon/lib/datacontainers/calibration_table.py
+
13
−
12
View file @
6ac7b61f
...
...
@@ -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
)
...
...
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