Skip to content
Snippets Groups Projects
Commit 8fdd7d83 authored by Taya Snijder's avatar Taya Snijder
Browse files

sarted work on new tests

parent 62cb9791
No related branches found
No related tags found
2 merge requests!232Draft: Resolve L2SS-595 "Replace fpga weights rw",!229Resolve L2SS-554 "Delay pointing unit tests"
......@@ -79,3 +79,54 @@ if __name__ == '__main__':
# print the delays
print(f"Direction: {direction}: {delays}, diff: {diff}")
# # 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 antenna position identical to the reference position
speed_of_light = 299792458.0
antenna_itrf = [[reference_itrf[0], reference_itrf[1], reference_itrf[2]]] # CS001LBA, in ITRF2005 epoch 2012.5
for i in range(24):
# # set the timestamp to solve for
timestamp = datetime.datetime(2022, 1, 27, i, 28, 0) # sunrise this particular day
d.set_measure_time(timestamp)
# compute the delays for an antennas w.r.t. the reference position
# # obtain the direction vector for a specific pointing
direction = "SUN", "0deg", "0deg"
# calculate the delays based on the set reference position, the set time and now the set direction and antenna positions.
pointing = d.measure.direction(*direction)
dir = d.get_direction_vector(pointing)
if i == 9:
print("sunrise")
print(f"time: {i:2}:28,\tdirection: {dir}" )
self.assertTrue()
""""
############################################################
"""
# # # 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 = "AZEL", "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(delays)
\ No newline at end of file
from delays import *
from math import sqrt, pow
from tangostationcontrol.test import base
......@@ -12,116 +13,152 @@ import mock
class TestAttributeTypes(base.TestCase):
def setUp(self):
# # 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)
self.reference_itrf = [3826577.066, 461022.948, 5064892.786] # CS002LBA, in ITRF2005 epoch 2012.5
self.d = delay_calculator(self.reference_itrf)
# # set the timestamp to solve for
timestamp = datetime.datetime(2021, 1, 1, 0, 0, 5)
d.set_measure_time(timestamp)
self.timestamp = datetime.datetime(2021, 1, 1, 0, 0, 5)
self.d.set_measure_time(self.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
self.antenna_itrf = [[3826923.546, 460915.441, 5064643.489]] # CS001LBA, in ITRF2005 epoch 2012.5 (XYZ from centre of the earth in metres)
# # obtain the direction vector for a specific pointing
direction = "J2000", "0deg", "0deg"
self.direction = "J2000", "0deg", "0deg" # sky at 1 jan 00:00 2000, right ascension, declination
def test_time_change(self):
# # set the timestamp to solve for
timestamp = datetime.datetime(2021, 1, 1, 0, i, 5)
d.set_measure_time(timestamp)
for i in range(10):
self.timestamp = datetime.datetime(2021, 1, 1, 0, i, 5)
self.d.set_measure_time(self.timestamp)
delays = d.convert(direction, antenna_itrf)
delays = self.d.convert(self.direction, self.antenna_itrf)
# print the delays
print(f"Timestamp: {timestamp}: {delays}")
# print the delays
print(f"Timestamp: {self.timestamp}: {delays}")
def test_direction_change(self):
# test changing the direction
antenna_itrf = [[3826923.546, 460915.441, 5064643.489]] # CS001LBA, in ITRF2005 epoch 2012.5
print(f"Changing direction test.\nBase parametres: Time: {timestamp} , position: {antenna_itrf}")
self.antenna_itrf = [[3826923.546, 460915.441, 5064643.489]] # CS001LBA, in ITRF2005 epoch 2012.5
print(f"Changing direction test.\nBase parametres: Time: {self.timestamp} , position: {self.antenna_itrf}")
for i in range(10):
direction = "J2000", f"{i}deg", "0deg"
self.direction = "J2000", f"{i}deg", "0deg"
delays = d.convert(direction, antenna_itrf)
delays = self.d.convert(self.direction, self.antenna_itrf)
# print the delays
print(f"Direction: {direction}: {delays}")
print(f"Direction: {self.direction}: {delays}")
def test_position_change(self):
# test changing the antenna position
print(f"Changing Antenna position test.\nBase parametres: Time: {timestamp} Direction: {direction}")
print(f"Changing Antenna position test.\nBase parametres: Time: {self.timestamp} Direction: {self.direction}")
for i in range(10):
antenna_itrf = [[3826577.066 + i, 461022.948, 5064892.786]] # CS002LBA, in ITRF2005 epoch 2012.5
self.antenna_itrf = [[3826577.066 + i, 461022.948, 5064892.786]] # CS002LBA, in ITRF2005 epoch 2012.5
delays = d.convert(direction, antenna_itrf)
delays = self.d.convert(self.direction, self.antenna_itrf)
# print the delays
print(f"Antenna position: {antenna_itrf}: {delays}")
print(f"Antenna position: {self.antenna_itrf}: {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 = delay_calculator(reference_itrf)
def test_set_measure_time(self):
""""
create a measure object, set a time and check that it is what we set it to.
"""
# # set the timestamp to solve for
timestamp = datetime.datetime(2021,1,1,0,0,5)
d.set_measure_time(timestamp)
def test_azul(self):
# # 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)
# 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
# # set the timestamp to solve for
timestamp = datetime.datetime(2021, 1, 1, 0, 0, 5)
d.set_measure_time(timestamp)
# # obtain the direction vector for a specific pointing
direction = "J2000","0deg","0deg"
# 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
# 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)
# # obtain the direction vector for a specific pointing
direction = "AZUL", "0deg", "0deg"
# print the delays
# pprint.pprint(delays)
# 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)
def test_init(self):
pass
#test changing the time
def test_sun(self):
# # 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)
print(f"Changing timestamp test\nBase parametres: Direction: {direction}, position: {antenna_itrf}")
for i in range(10):
# # set the timestamp to solve for
timestamp = datetime.datetime(2021,1,1,0,i,5)
d.set_measure_time(timestamp)
# set the antenna position identical to the reference position
speed_of_light = 299792458.0
antenna_itrf = [[reference_itrf[0], reference_itrf[1], reference_itrf[2]]] # CS001LBA, in ITRF2005 epoch 2012.5
delays = d.convert(direction, antenna_itrf)
for i in range(24):
# # set the timestamp to solve for
timestamp = datetime.datetime(2022, 1, 27, i, 28, 0) # 9:28 sunrise this particular day
d.set_measure_time(timestamp)
# print the delays
print(f"Timestamp: {timestamp}: {delays}")
# compute the delays for an antennas w.r.t. the reference position
# # obtain the direction vector for a specific pointing
direction = "SUN", "0deg", "0deg"
# reset time
timestamp = datetime.datetime(2021, 1, 1, 0, 0, 5)
d.set_measure_time(timestamp)
# calculate the delays based on the set reference position, the set time and now the set direction and antenna positions.
pointing = d.measure.direction(*direction)
dir = d.get_direction_vector(pointing)
print(f"time: {i:2}:28,\tdirection: {dir}")
#test changing the antenna position
print(f"Changing Antenna position test.\nBase parametres: Time: {timestamp} Direction: {direction}")
for i in range(10):
antenna_itrf = [[3826577.066 + i, 461022.948, 5064892.786]] # CS002LBA, in ITRF2005 epoch 2012.5
self.assertTrue()
def test_identical_location(self):
# # 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 antenna position identical to the reference position
antenna_itrf = [reference_itrf] # CS001LBA, in ITRF2005 epoch 2012.5
# # set the timestamp to solve for
timestamp = datetime.datetime(2000, 1, 1, 0, 0, 0)
d.set_measure_time(timestamp)
# compute the delays for an antennas w.r.t. the reference position
# # 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
print(f"Antenna position: {antenna_itrf}: {delays}")
print("identical location delay: ", delays)
def test_light_second_delay(self):
# # 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 antenna position identical to the reference position
speed_of_light = 299792458.0
antenna_itrf = [[reference_itrf[0], reference_itrf[1] - speed_of_light, reference_itrf[2]]] # CS001LBA, in ITRF2005 epoch 2012.5
# test changing the direction
# # set the timestamp to solve for
timestamp = datetime.datetime(2000, 1, 1, 0, 0, 0)
d.set_measure_time(timestamp)
antenna_itrf = [[3826923.546, 460915.441, 5064643.489]] # CS001LBA, in ITRF2005 epoch 2012.5
print(f"Changing direction test.\nBase parametres: Time: {timestamp} , position: {antenna_itrf}")
# compute the delays for an antennas w.r.t. the reference position
for i in range(10):
direction = "J2000", f"{i}deg", "0deg"
# # 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
print(f"Direction: {direction}: {delays}")
print("One second delay: ", delays)
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