Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • 1493-extend-python-bindings
  • 28-add-scripts-for-manual-comparison-of-everybeam-s-oskar-model-implementations-and-oskar
  • 46-add-stationresponse-comparison-for-oskar-trigger-pipeline
  • activate-oskar-pybindings
  • ast-1111-add-vector-bindings
  • ast-1325-prototype-ska-beam-model-interface
  • ast-1384-fix-sorted-frequencies-check-sphericalharmonicsresponse-1
  • ast-1386-create-default-element
  • ast-1387-createxxxresponse
  • ast-1416-oskar-ska-sdp-func-1
  • ast-1493-implement-response-dishpoint-1
  • ast-1527-spack
  • ast-645-add-beam-normalisation-mode-jm
  • ast-645-add-beam-normalisation-mode-preapplied
  • ast-865-ncp-fix
  • ast-919-readthedocs
  • ast-973-add-test-for-lobes-coefficients
  • coordinate_transform_via_erfa
  • debugging-ci-newer-pip
  • disable-element-beam-1
  • extend-add_beaminfo-script
  • extend-telescope-interface-to-support-dp3
  • fix-eigen
  • jakob/test-oskar
  • just-testing
  • lobes
  • lobes-investigation
  • lobes-se607-1
  • master
  • ncp_check
  • ncp_fix
  • random-fixes
  • stub-delta-geometric-response
  • submodulesync
  • test-schaapcommon
  • tilebeam-arrayresponse-timer
  • vdtol-oskar-stationresponse
  • vdtol-oskar-stationresponse1
  • workaround-wsclean-issue-83
  • v0.1.0
  • v0.1.1
  • v0.1.2
  • v0.1.3
  • v0.2.0
  • v0.3.0
  • v0.3.1
  • v0.4.0
  • v0.5.1
  • v0.5.2
  • v0.5.3
  • v0.5.4
  • v0.5.5
  • v0.5.6
  • v0.5.7
54 results

Target

Select target project
  • RD/EveryBeam
  • zhang/EveryBeam
  • sweijen/EveryBeam
  • mancini/EveryBeam
  • rozendaal/every-beam-refactor
5 results
Select Git revision
  • 1493-extend-python-bindings
  • 28-add-scripts-for-manual-comparison-of-everybeam-s-oskar-model-implementations-and-oskar
  • 46-add-stationresponse-comparison-for-oskar-trigger-pipeline
  • add-test-for-squared-mueller-matrices
  • ast-1111-add-vector-bindings
  • ast-1325-prototype-ska-beam-model-interface
  • ast-1384-fix-sorted-frequencies-check-sphericalharmonicsresponse-1
  • ast-1384-remove-element-index-argument
  • ast-1386-create-default-element
  • ast-1416-oskar-ska-sdp-func-1
  • ast-1493-implement-response-dishpoint-1
  • ast-1509-fix-polarization-orientation-in-gridded-response
  • ast-1600-fix-beam-for-meerkat-ska-mid
  • ast-1644-temp-fix
  • ast-645-add-beam-normalisation-mode-preapplied
  • ast-973-add-test-for-lobes-coefficients
  • disable-element-beam-1
  • extend-add_beaminfo-script
  • initialize_telescope_class_without_ms
  • just-testing
  • lobes
  • lobes-investigation
  • master
  • mwa_python_wrapper
  • readthedocs-c++17
  • rtd-ubuntu24-plucky
  • stub-delta-geometric-response
  • tilebeam-arrayresponse-timer
  • v0.1.0
  • v0.1.1
  • v0.1.2
  • v0.1.3
  • v0.2.0
  • v0.3.0
  • v0.3.1
  • v0.4.0
  • v0.5.1
  • v0.5.2
  • v0.5.3
  • v0.5.4
  • v0.5.5
  • v0.5.6
  • v0.5.7
  • v0.5.8
  • v0.6.0
  • v0.6.1
  • v0.6.2
  • v0.7.0
  • v0.7.1
  • v0.7.2
50 results
Show changes

Commits on Source 1

...@@ -10,12 +10,15 @@ from numpy.linalg import norm ...@@ -10,12 +10,15 @@ from numpy.linalg import norm
import numpy as np import numpy as np
import logging import logging
import sys import sys
import os
from glob import glob
def read_telescope_center(oskar_telescope_dir: str): def read_telescope_center(oskar_telescope_dir: str):
"""Read telescope center from OSKAR metadata and convert to ITRF""" """Read telescope center from OSKAR metadata and convert to ITRF"""
# separator is either comma or whitespace, plus any extra whitespace
oskar_telescope_center = pd.read_csv(f"{oskar_telescope_dir}/position.txt", oskar_telescope_center = pd.read_csv(f"{oskar_telescope_dir}/position.txt",
header=None, sep=" ") header=None, sep="[,\s]\s*")
if len(oskar_telescope_center.columns) == 2: if len(oskar_telescope_center.columns) == 2:
oskar_telescope_center["Height"] = [0.] oskar_telescope_center["Height"] = [0.]
...@@ -24,8 +27,22 @@ def read_telescope_center(oskar_telescope_dir: str): ...@@ -24,8 +27,22 @@ def read_telescope_center(oskar_telescope_dir: str):
telescope_center_itrf = geo.xyz_from_geographic(np.deg2rad(oskar_telescope_center["Lon"][0]), telescope_center_itrf = geo.xyz_from_geographic(np.deg2rad(oskar_telescope_center["Lon"][0]),
np.deg2rad(oskar_telescope_center["Lat"][0]), np.deg2rad(oskar_telescope_center["Lat"][0]),
oskar_telescope_center["Height"][0]) oskar_telescope_center["Height"][0])
return telescope_center_itrf
normal_vector_ellipsoid = geo.normal_vector_ellipsoid(np.deg2rad(oskar_telescope_center["Lon"][0]),
np.deg2rad(oskar_telescope_center["Lat"][0]))
local_to_itrf_projection_matrix = geo.projection_matrix(telescope_center_itrf,
normal_vector_ellipsoid)
return telescope_center_itrf, local_to_itrf_projection_matrix
def read_element_locations(oskar_layout_file: str):
# separator is either comma or whitespace, plus any extra whitespace
element_locations = pd.read_csv(oskar_layout_file,
header=None, sep="[,\s]\s*")
if len(element_locations.columns) == 2:
element_locations["Z"] = np.zeros_like(element_locations[0])
return element_locations
def fix_antenna(oskar_ms_name: str, telescope_center_itrf: np.array): def fix_antenna(oskar_ms_name: str, telescope_center_itrf: np.array):
"""Make POSITION in ::ANTENNA subtable absolute""" """Make POSITION in ::ANTENNA subtable absolute"""
...@@ -93,29 +110,26 @@ def add_phased_array_table(oskar_ms_name: str): ...@@ -93,29 +110,26 @@ def add_phased_array_table(oskar_ms_name: str):
def fill_phased_array(oskar_ms_name: str, oskar_telescope_dir: str): def fill_phased_array(oskar_ms_name: str, oskar_telescope_dir: str):
"""Fill the ::PHASED_ARRAY subtable with info from the OSKAR directory""" """Fill the ::PHASED_ARRAY subtable with info from the OSKAR directory"""
element_locations = pd.read_csv(f"{oskar_telescope_dir}/station/layout.txt",
header=None, sep=" ")
if len(element_locations.columns) == 2:
element_locations["Z"] = np.zeros_like(element_locations[0])
oskar_telescope_center = pd.read_csv(f"{oskar_telescope_dir}/position.txt",
header=None, sep=" ")
oskar_telescope_center.columns = ["Lon", "Lat"]
telescope_center_itrf = read_telescope_center(oskar_telescope_dir)
normal_vector_ellipsoid = geo.normal_vector_ellipsoid(np.deg2rad(oskar_telescope_center["Lon"][0]), telescope_center_itrf, local_to_itrf_projection_matrix = read_telescope_center(oskar_telescope_dir)
np.deg2rad(oskar_telescope_center["Lat"][0]))
local_to_itrf_projection_matrix = geo.projection_matrix(telescope_center_itrf, element_layout_file = f"{oskar_telescope_dir}/station/layout.txt"
normal_vector_ellipsoid) if os.path.exists(element_layout_file):
element_locations = read_element_locations(element_layout_file)
element_locations_itrf = local_to_itrf_projection_matrix @ element_locations.to_numpy().T
nr_pol = 2 nr_pol = 2
all_unflagged = np.zeros((nr_pol, element_locations_itrf.shape[1]))
phasedarraytable = pt.table(f"{oskar_ms_name}::PHASED_ARRAY", readonly=False, ack=False) phasedarraytable = pt.table(f"{oskar_ms_name}::PHASED_ARRAY", readonly=False, ack=False)
for stationnr in range(len(phasedarraytable)): oskar_station_dirs = sorted(glob(f"{oskar_telescope_dir}/station*"))
for stationnr, oskar_station_dir in enumerate(oskar_station_dirs):
element_layout_file = f"{oskar_station_dir}/layout.txt"
print(element_layout_file)
if os.path.exists(element_layout_file):
element_locations = read_element_locations(element_layout_file)
element_locations_itrf = local_to_itrf_projection_matrix @ element_locations.to_numpy().T
all_unflagged = np.zeros((nr_pol, element_locations_itrf.shape[1]))
phasedarraytable.putcell("COORDINATE_AXES", stationnr, local_to_itrf_projection_matrix.T) phasedarraytable.putcell("COORDINATE_AXES", stationnr, local_to_itrf_projection_matrix.T)
phasedarraytable.putcell("ELEMENT_OFFSET", stationnr, element_locations_itrf) phasedarraytable.putcell("ELEMENT_OFFSET", stationnr, element_locations_itrf)
phasedarraytable.putcell("ELEMENT_FLAG", stationnr, all_unflagged) phasedarraytable.putcell("ELEMENT_FLAG", stationnr, all_unflagged)
...@@ -127,7 +141,7 @@ def fill_phased_array(oskar_ms_name: str, oskar_telescope_dir: str): ...@@ -127,7 +141,7 @@ def fill_phased_array(oskar_ms_name: str, oskar_telescope_dir: str):
def main(oskar_ms_name: str, oskar_telescope_dir: str): def main(oskar_ms_name: str, oskar_telescope_dir: str):
"""Add beam info to OSKAR generated MeasurementSet""" """Add beam info to OSKAR generated MeasurementSet"""
telescope_center_itrf = read_telescope_center(oskar_telescope_dir) telescope_center_itrf,_ = read_telescope_center(oskar_telescope_dir)
fix_antenna(oskar_ms_name, telescope_center_itrf) fix_antenna(oskar_ms_name, telescope_center_itrf)
add_array_center(oskar_ms_name, telescope_center_itrf) add_array_center(oskar_ms_name, telescope_center_itrf)
add_phased_array_table(oskar_ms_name) add_phased_array_table(oskar_ms_name)
......