Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tango
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Jira issues
Open Jira
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue 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
LOFAR2.0
tango
Commits
5aff2bfb
Commit
5aff2bfb
authored
3 years ago
by
Taya Snijder
Browse files
Options
Downloads
Patches
Plain Diff
worked on tests
parent
8fdd7d83
No related branches found
No related tags found
2 merge requests
!232
Draft: Resolve L2SS-595 "Replace fpga weights rw"
,
!229
Resolve L2SS-554 "Delay pointing unit tests"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tangostationcontrol/tangostationcontrol/beam/old_test.py
+54
-28
54 additions, 28 deletions
tangostationcontrol/tangostationcontrol/beam/old_test.py
tangostationcontrol/tangostationcontrol/beam/test_delays.py
+20
-54
20 additions, 54 deletions
tangostationcontrol/tangostationcontrol/beam/test_delays.py
with
74 additions
and
82 deletions
tangostationcontrol/tangostationcontrol/beam/old_test.py
+
54
−
28
View file @
5aff2bfb
...
@@ -80,33 +80,33 @@ if __name__ == '__main__':
...
@@ -80,33 +80,33 @@ if __name__ == '__main__':
# print the delays
# print the delays
print
(
f
"
Direction:
{
direction
}
:
{
delays
}
, diff:
{
diff
}
"
)
print
(
f
"
Direction:
{
direction
}
:
{
delays
}
, diff:
{
diff
}
"
)
# # create a frame tied to the reference position
# #
#
create a frame tied to the reference position
reference_itrf
=
[
3826577.066
,
461022.948
,
5064892.786
]
# CS002LBA, in ITRF2005 epoch 2012.5
#
reference_itrf = [3826577.066, 461022.948, 5064892.786] # CS002LBA, in ITRF2005 epoch 2012.5
d
=
delay_calculator
(
reference_itrf
)
#
d = delay_calculator(reference_itrf)
#
# set the antenna position identical to the reference position
#
#
set the antenna position identical to the reference position
speed_of_light
=
299792458.0
#
speed_of_light = 299792458.0
antenna_itrf
=
[[
reference_itrf
[
0
],
reference_itrf
[
1
],
reference_itrf
[
2
]]]
# CS001LBA, in ITRF2005 epoch 2012.5
#
antenna_itrf = [[reference_itrf[0], reference_itrf[1], reference_itrf[2]]] # CS001LBA, in ITRF2005 epoch 2012.5
#
for
i
in
range
(
24
):
#
for i in range(24):
# # set the timestamp to solve for
#
# # set the timestamp to solve for
timestamp
=
datetime
.
datetime
(
2022
,
1
,
27
,
i
,
28
,
0
)
# sunrise this particular day
#
timestamp = datetime.datetime(2022, 1, 27, i, 28, 0) # sunrise this particular day
d
.
set_measure_time
(
timestamp
)
#
d.set_measure_time(timestamp)
#
# compute the delays for an antennas w.r.t. the reference position
#
# compute the delays for an antennas w.r.t. the reference position
#
# # obtain the direction vector for a specific pointing
#
# # obtain the direction vector for a specific pointing
direction
=
"
SUN
"
,
"
0deg
"
,
"
0deg
"
#
direction = "SUN", "0deg", "0deg"
#
# calculate the delays based on the set reference position, the set time and now the set direction and antenna positions.
#
# 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
)
#
pointing = d.measure.direction(*direction)
dir
=
d
.
get_direction_vector
(
pointing
)
#
dir = d.get_direction_vector(pointing)
#
if
i
==
9
:
#
if i == 9:
print
(
"
sunrise
"
)
#
print("sunrise")
print
(
f
"
time:
{
i
:
2
}
:28,
\t
direction:
{
dir
}
"
)
#
print(f"time: {i:2}:28,\tdirection: {dir}" )
#
self
.
assertTrue
()
#
print(d.measure.epoch
()
)
""""
""""
############################################################
############################################################
...
@@ -129,4 +129,30 @@ if __name__ == '__main__':
...
@@ -129,4 +129,30 @@ if __name__ == '__main__':
# # calculate the delays based on the set reference position, the set time and now the set direction and antenna positions.
# # 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)
# delays = d.convert(direction, antenna_itrf)
#
#
# print(delays)
# print(delays)
\ No newline at end of file
# # 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
(
2000
,
1
,
1
,
0
,
0
,
0
)
d
.
set_measure_time
(
timestamp
)
# # obtain the direction vector for a specific pointing
direction
=
"
J2000
"
,
"
0deg
"
,
"
0deg
"
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
# 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
(
"
One second delay:
"
,
delays
)
antenna_itrf
=
[[
reference_itrf
[
0
],
reference_itrf
[
1
]
-
speed_of_light
-
speed_of_light
,
reference_itrf
[
2
]]]
# 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
)
print
(
"
Two second delay:
"
,
delays
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
tangostationcontrol/tangostationcontrol/beam/test_delays.py
+
20
−
54
View file @
5aff2bfb
import
datetime
from
delays
import
*
from
delays
import
*
from
math
import
sqrt
,
pow
from
math
import
sqrt
,
pow
...
@@ -11,63 +13,28 @@ import mock
...
@@ -11,63 +13,28 @@ import mock
class
TestAttributeTypes
(
base
.
TestCase
):
class
TestAttributeTypes
(
base
.
TestCase
):
def
setUp
(
self
):
def
test_init
(
self
):
# # create a frame tied to the reference position
"""
self
.
reference_itrf
=
[
3826577.066
,
461022.948
,
5064892.786
]
# CS002LBA, in ITRF2005 epoch 2012.5
Fail condition is simply the object creation failing
self
.
d
=
delay_calculator
(
self
.
reference_itrf
)
"""
# # set the timestamp to solve for
reference_itrf
=
[
3826577.066
,
461022.948
,
5064892.786
]
# CS002LBA, in ITRF2005 epoch 2012.5
self
.
timestamp
=
datetime
.
datetime
(
2021
,
1
,
1
,
0
,
0
,
5
)
d
=
delay_calculator
(
reference_itrf
)
self
.
d
.
set_measure_time
(
self
.
timestamp
)
# compute the delays for an antennas w.r.t. the reference position
def
test_set_measure_time
(
self
):
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
"""
self
.
direction
=
"
J2000
"
,
"
0deg
"
,
"
0deg
"
# sky at 1 jan 00:00 2000, right ascension, declination
# # 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_time_change
(
self
):
# # set the timestamp to solve for
# # set the timestamp to solve for
for
i
in
range
(
10
):
timestamp
=
datetime
.
datetime
(
2000
,
1
,
1
,
0
,
0
,
5
)
self
.
timestamp
=
datetime
.
datetime
(
2021
,
1
,
1
,
0
,
i
,
5
)
d
.
set_measure_time
(
timestamp
)
self
.
d
.
set_measure_time
(
self
.
timestamp
)
delays
=
self
.
d
.
convert
(
self
.
direction
,
self
.
antenna_itrf
)
# print the delays
print
(
f
"
Timestamp:
{
self
.
timestamp
}
:
{
delays
}
"
)
def
test_direction_change
(
self
):
# test changing the direction
self
.
antenna_itrf
=
[[
3826923.546
,
460915.441
,
5064643.489
]]
# CS001LBA, in ITRF2005 epoch 2012.5
print
(
f
"
Changing direction test.
\n
Base parametres: Time:
{
self
.
timestamp
}
, position:
{
self
.
antenna_itrf
}
"
)
for
i
in
range
(
10
):
self
.
direction
=
"
J2000
"
,
f
"
{
i
}
deg
"
,
"
0deg
"
delays
=
self
.
d
.
convert
(
self
.
direction
,
self
.
antenna_itrf
)
# print the delays
print
(
f
"
Direction:
{
self
.
direction
}
:
{
delays
}
"
)
def
test_position_change
(
self
):
# test changing the antenna position
print
(
f
"
Changing Antenna position test.
\n
Base parametres: Time:
{
self
.
timestamp
}
Direction:
{
self
.
direction
}
"
)
for
i
in
range
(
10
):
self
.
antenna_itrf
=
[[
3826577.066
+
i
,
461022.948
,
5064892.786
]]
# CS002LBA, in ITRF2005 epoch 2012.5
delays
=
self
.
d
.
convert
(
self
.
direction
,
self
.
antenna_itrf
)
# print the delays
print
(
f
"
Antenna position:
{
self
.
antenna_itrf
}
:
{
delays
}
"
)
def
test_set_measure_time
(
self
):
""""
create a measure object, set a time and check that it is what we set it to.
"""
def
test_azul
(
self
):
def
test_azul
(
self
):
# # create a frame tied to the reference position
# # create a frame tied to the reference position
...
@@ -87,9 +54,6 @@ class TestAttributeTypes(base.TestCase):
...
@@ -87,9 +54,6 @@ class TestAttributeTypes(base.TestCase):
# calculate the delays based on the set reference position, the set time and now the set direction and antenna positions.
# 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
)
delays
=
d
.
convert
(
direction
,
antenna_itrf
)
def
test_init
(
self
):
pass
def
test_sun
(
self
):
def
test_sun
(
self
):
# # create a frame tied to the reference position
# # create a frame tied to the reference position
reference_itrf
=
[
3826577.066
,
461022.948
,
5064892.786
]
# CS002LBA, in ITRF2005 epoch 2012.5
reference_itrf
=
[
3826577.066
,
461022.948
,
5064892.786
]
# CS002LBA, in ITRF2005 epoch 2012.5
...
@@ -137,7 +101,7 @@ class TestAttributeTypes(base.TestCase):
...
@@ -137,7 +101,7 @@ class TestAttributeTypes(base.TestCase):
# calculate the delays based on the set reference position, the set time and now the set direction and antenna positions.
# 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
)
delays
=
d
.
convert
(
direction
,
antenna_itrf
)
print
(
"
identical location delay:
"
,
delays
)
self
.
assertTrue
(
delays
==
[
0.0
]
)
def
test_light_second_delay
(
self
):
def
test_light_second_delay
(
self
):
# # create a frame tied to the reference position
# # create a frame tied to the reference position
...
@@ -145,7 +109,7 @@ class TestAttributeTypes(base.TestCase):
...
@@ -145,7 +109,7 @@ class TestAttributeTypes(base.TestCase):
d
=
delay_calculator
(
reference_itrf
)
d
=
delay_calculator
(
reference_itrf
)
# set the antenna position identical to the reference position
# set the antenna position identical to the reference position
speed_of_light
=
299792458.0
speed_of_light
=
304389329.123
#
299792458.0
antenna_itrf
=
[[
reference_itrf
[
0
],
reference_itrf
[
1
]
-
speed_of_light
,
reference_itrf
[
2
]]]
# CS001LBA, in ITRF2005 epoch 2012.5
antenna_itrf
=
[[
reference_itrf
[
0
],
reference_itrf
[
1
]
-
speed_of_light
,
reference_itrf
[
2
]]]
# CS001LBA, in ITRF2005 epoch 2012.5
# # set the timestamp to solve for
# # set the timestamp to solve for
...
@@ -162,3 +126,5 @@ class TestAttributeTypes(base.TestCase):
...
@@ -162,3 +126,5 @@ class TestAttributeTypes(base.TestCase):
print
(
"
One second delay:
"
,
delays
)
print
(
"
One second delay:
"
,
delays
)
self
.
assertTrue
(
0.98
<=
delays
[
0
]
<=
1.02
)
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