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
70898457
Commit
70898457
authored
2 years ago
by
Corné Lukken
Browse files
Options
Downloads
Patches
Plain Diff
L2SS-572
: Raise exceptions instead of using assert
parent
909640a2
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!396
Resolve L2SS-572 "Refactor delays"
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tangostationcontrol/tangostationcontrol/beam/delays.py
+4
-4
4 additions, 4 deletions
tangostationcontrol/tangostationcontrol/beam/delays.py
tangostationcontrol/tangostationcontrol/test/beam/test_delays.py
+12
-3
12 additions, 3 deletions
...ationcontrol/tangostationcontrol/test/beam/test_delays.py
with
16 additions
and
7 deletions
tangostationcontrol/tangostationcontrol/beam/delays.py
+
4
−
4
View file @
70898457
...
...
@@ -14,8 +14,8 @@ class Delays:
measure
=
casacore
.
measures
.
measures
()
frame_location
=
measure
.
position
(
"
ITRF
"
,
*
[
f
"
{
x
}
m
"
for
x
in
itrf
])
result
=
measure
.
do_frame
(
frame_location
)
assert
result
==
True
,
f
"
measure.do_frame failed for ITRF location
{
itrf
}
"
if
not
measure
.
do_frame
(
frame_location
)
:
raise
ValueError
(
f
"
measure.do_frame failed for ITRF location
{
itrf
}
"
)
self
.
reference_itrf
=
itrf
self
.
measure
=
measure
...
...
@@ -26,8 +26,8 @@ class Delays:
utc_time_str
=
utc_time
.
isoformat
(
'
'
)
frame_time
=
self
.
measure
.
epoch
(
"
UTC
"
,
utc_time_str
)
result
=
self
.
measure
.
do_frame
(
frame_time
)
assert
result
==
True
,
f
"
measure.do_frame failed for UTC time
{
utc_time_str
}
"
if
not
self
.
measure
.
do_frame
(
frame_time
)
:
raise
ValueError
(
f
"
measure.do_frame failed for UTC time
{
utc_time_str
}
"
)
def
get_direction_vector
(
self
,
pointing
:
numpy
.
ndarray
)
->
numpy
.
ndarray
:
"""
Compute direction vector for a given pointing, relative to the measure.
"""
...
...
This diff is collapsed.
Click to expand it.
tangostationcontrol/tangostationcontrol/test/beam/test_delays.py
+
12
−
3
View file @
70898457
import
datetime
import
time
import
logging
import
mock
import
numpy
import
numpy.testing
import
casacore
from
tangostationcontrol.beam.delays
import
Delays
from
tangostationcontrol.test
import
base
...
...
@@ -10,15 +13,21 @@ from tangostationcontrol.test import base
class
TestDelays
(
base
.
TestCase
):
def
test_init
(
self
):
"""
Fail condition is simply the object creation failing
"""
"""
Fail condition is simply the object creation failing
"""
reference_itrf
=
[
3826577.066
,
461022.948
,
5064892.786
]
# CS002LBA, in ITRF2005 epoch 2012.5
d
=
Delays
(
reference_itrf
)
self
.
assertIsNotNone
(
d
)
def
test_init_fails
(
self
):
"""
Test do_measure returning false is correctly caught
"""
with
mock
.
patch
.
object
(
casacore
.
measures
,
"
measures
"
)
as
m_measure
:
m_measure
.
return_value
.
do_frame
.
return_value
=
False
self
.
assertRaises
(
ValueError
,
Delays
,
[
0
,
0
,
0
])
def
test_is_valid_direction
(
self
):
d
=
Delays
([
0
,
0
,
0
])
...
...
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