From 08090e13226b2ad672c498ef83b0a544bc3283fc Mon Sep 17 00:00:00 2001 From: thijs snijder <snijder@astron.nl> Date: Fri, 10 Dec 2021 14:01:17 +0100 Subject: [PATCH] update --- .../beam/{test.py => delays.py} | 29 +++---------------- .../tangostationcontrol/beam/test_delays.py | 23 +++++++++++++++ 2 files changed, 27 insertions(+), 25 deletions(-) rename tangostationcontrol/tangostationcontrol/beam/{test.py => delays.py} (68%) create mode 100644 tangostationcontrol/tangostationcontrol/beam/test_delays.py diff --git a/tangostationcontrol/tangostationcontrol/beam/test.py b/tangostationcontrol/tangostationcontrol/beam/delays.py similarity index 68% rename from tangostationcontrol/tangostationcontrol/beam/test.py rename to tangostationcontrol/tangostationcontrol/beam/delays.py index 59b6a87e5..771fad6c9 100644 --- a/tangostationcontrol/tangostationcontrol/beam/test.py +++ b/tangostationcontrol/tangostationcontrol/beam/delays.py @@ -7,10 +7,11 @@ def subtract(a, b): return numpy.array([x - y for x, y in zip(a, b)]) -class tempname: +class delay_calculator: def __init__(self, itrf: list([float])): - """ Return a measure object, configured for the specified location. """ + """ Create a measure object, configured for the specified terrestrial location. """ + measure = casacore.measures.measures() frame_location = measure.position("ITRF", *[f"{x}m" for x in itrf]) @@ -55,29 +56,7 @@ class tempname: reference_dir_vector = self.get_direction_vector(pointing) # # compute the delays for an antennas w.r.t. the reference position - antenna_relative_itrf = [subtract(pos, reference_itrf) for pos in antenna_itrf] + antenna_relative_itrf = [subtract(pos, self.reference_itrf) for pos in antenna_itrf] delays = [self._get_delay(reference_dir_vector, relative_itrf) for relative_itrf in antenna_relative_itrf] return delays - -if __name__ == '__main__': - # # create a frame tied to the reference position - reference_itrf = [3826577.066, 461022.948, 5064892.786] # CS002LBA, in ITRF2005 epoch 2012.5 - d = tempname(reference_itrf) - - # # set the timestamp to solve for - timestamp = datetime.datetime(2021,1,1,0,0,5) - d.set_measure_time(timestamp) - - # compute the delays for an antennas w.r.t. the reference position - antenna_itrf = [[3826923.546, 460915.441, 5064643.489]] # CS001LBA, in ITRF2005 epoch 2012.5 - - # # obtain the direction vector for a specific pointing - direction = "J2000","0deg","0deg" - - # calculate the delays based on the set reference position, the set time and now the set direction and antenna positions. - delays = d.convert(direction, antenna_itrf) - - # print the delays - import pprint - pprint.pprint(delays) diff --git a/tangostationcontrol/tangostationcontrol/beam/test_delays.py b/tangostationcontrol/tangostationcontrol/beam/test_delays.py new file mode 100644 index 000000000..986ac2bc8 --- /dev/null +++ b/tangostationcontrol/tangostationcontrol/beam/test_delays.py @@ -0,0 +1,23 @@ +from delays import * + +if __name__ == '__main__': + # # create a frame tied to the reference position + reference_itrf = [3826577.066, 461022.948, 5064892.786] # CS002LBA, in ITRF2005 epoch 2012.5 + d = delay_calculator(reference_itrf) + + # # set the timestamp to solve for + timestamp = datetime.datetime(2021,1,1,0,0,5) + d.set_measure_time(timestamp) + + # compute the delays for an antennas w.r.t. the reference position + antenna_itrf = [[3826923.546, 460915.441, 5064643.489]] # CS001LBA, in ITRF2005 epoch 2012.5 + + # # obtain the direction vector for a specific pointing + direction = "J2000","0deg","0deg" + + # calculate the delays based on the set reference position, the set time and now the set direction and antenna positions. + delays = d.convert(direction, antenna_itrf) + + # print the delays + import pprint + pprint.pprint(delays) -- GitLab