Skip to content
Snippets Groups Projects
Commit 121f73c5 authored by Bas van der Tol's avatar Bas van der Tol
Browse files

Conditionally add ARRAY_CENTER column to OBSERVATION subtable

Add the column only when is does not exist yet.
parent 6d0c79b8
Branches
Tags
No related merge requests found
...@@ -39,13 +39,13 @@ def fix_antenna(oskar_ms_name: str, telescope_center_itrf: np.array): ...@@ -39,13 +39,13 @@ def fix_antenna(oskar_ms_name: str, telescope_center_itrf: np.array):
def add_array_center(oskar_ms_name: str, telescope_center_itrf: np.array): def add_array_center(oskar_ms_name: str, telescope_center_itrf: np.array):
"""Add ARRAY_CENTER column to ::OBSERVATION subtable""" """Add ARRAY_CENTER column to ::OBSERVATION subtable"""
obstable = pt.table(f"{oskar_ms_name}::OBSERVATION", readonly=False, ack=False)
if 'ARRAY_CENTER' not in obstable.colnames():
anttable = pt.table(f"{oskar_ms_name}::ANTENNA", ack=False) anttable = pt.table(f"{oskar_ms_name}::ANTENNA", ack=False)
coldesc = anttable.getcoldesc("POSITION") coldesc = anttable.getcoldesc("POSITION")
coldesc["name"] = "ARRAY_CENTER" coldesc["name"] = "ARRAY_CENTER"
coldesc["comment"] = "Reference position for array" coldesc["comment"] = "Reference position for array"
obstable.addcols(coldesc)
obstable = pt.table(f"{oskar_ms_name}::OBSERVATION", readonly=False, ack=False)
#obstable.addcols(coldesc)
obstable.putcol("ARRAY_CENTER", np.array([telescope_center_itrf])) obstable.putcol("ARRAY_CENTER", np.array([telescope_center_itrf]))
obstable.close() obstable.close()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment