Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
LISA Instrument
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
LISA Simulation
LISA Instrument
Commits
ce977617
Commit
ce977617
authored
1 year ago
by
Jean-Baptiste Bayle
Browse files
Options
Downloads
Patches
Plain Diff
Fix the fplan unit tests
parent
526db172
No related branches found
No related tags found
No related merge requests found
Pipeline
#276580
failed
1 year ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tests/test_fplan.py
+36
-12
36 additions, 12 deletions
tests/test_fplan.py
with
36 additions
and
12 deletions
tests/test_fplan.py
+
36
−
12
View file @
ce977617
...
...
@@ -25,7 +25,9 @@ def _consistent_locking_beatnotes(instru, fplan=None):
# Read fplan file
if
fplan
is
None
:
with
File
(
instru
.
fplan_file
,
'
r
'
)
as
fplanf
:
t
=
np
.
arange
(
fplanf
.
attrs
[
'
size
'
])
*
fplanf
.
attrs
[
'
dt
'
]
with
File
(
instru
.
orbit_file
,
'
r
'
)
as
orbitsf
:
t0
=
orbitsf
.
attrs
[
'
t0
'
]
t
=
t0
+
np
.
arange
(
fplanf
.
attrs
[
'
size
'
])
*
fplanf
.
attrs
[
'
dt
'
]
if
instru
.
lock_config
==
'
N1-12
'
:
fplan
=
{
'
13
'
:
interp1d
(
t
,
-
fplanf
[
instru
.
lock_config
][
'
rfi_12
'
][:]
*
1E6
)(
instru
.
physics_t
),
...
...
@@ -217,25 +219,36 @@ def test_keplerian_fplan_1_1():
# Check fplan file with standard lock configs
for
primary
in
Instrument
.
MOSAS
:
for
topology
in
Instrument
.
LOCK_TOPOLOGIES
:
instru
=
Instrument
(
size
=
100
,
lock
=
f
'
{
topology
}
-
{
primary
}
'
,
fplan
=
'
tests/keplerian-fplan-1-1.h5
'
)
instru
=
Instrument
(
size
=
100
,
lock
=
f
'
{
topology
}
-
{
primary
}
'
,
fplan
=
'
tests/keplerian-fplan-1-1.h5
'
,
orbits
=
'
tests/keplerian-orbits-1-0-2.h5
'
,
# does not match, but okay
)
# Should raise an error for non-standard lock config
with
pytest
.
raises
(
ValueError
):
Instrument
(
size
=
100
,
lock
=
'
six
'
,
fplan
=
'
tests/keplerian-fplan-1-1.h5
'
)
Instrument
(
size
=
100
,
lock
=
'
six
'
,
fplan
=
'
tests/keplerian-fplan-1-1.h5
'
,
orbits
=
'
tests/keplerian-orbits-1-0-2.h5
'
)
with
pytest
.
raises
(
ValueError
):
lock
=
{
'
12
'
:
'
cavity
'
,
'
13
'
:
'
cavity
'
,
'
21
'
:
'
distant
'
,
'
31
'
:
'
distant
'
,
'
23
'
:
'
adjacent
'
,
'
32
'
:
'
adjacent
'
}
Instrument
(
size
=
100
,
lock
=
lock
,
fplan
=
'
tests/keplerian-fplan-1-1.h5
'
)
# Should raise an error without orbit file
with
pytest
.
raises
(
ValueError
):
Instrument
(
size
=
100
,
lock
=
'
N1-12
'
,
fplan
=
'
tests/keplerian-fplan-1-1.h5
'
)
# Check locking beatnotes
instru
=
Instrument
(
size
=
100
,
lock
=
'
N1-12
'
,
fplan
=
'
tests/keplerian-fplan-1-1.h5
'
)
with
File
(
'
tests/keplerian-orbits-1-0-2.h5
'
,
'
r
'
)
as
f
:
t0
=
f
.
attrs
[
'
t0
'
]
+
100
instru
=
Instrument
(
size
=
100
,
lock
=
'
N1-12
'
,
t0
=
t0
,
fplan
=
'
tests/keplerian-fplan-1-1.h5
'
,
orbits
=
'
tests/keplerian-orbits-1-0-2.h5
'
)
instru
.
simulate
()
instru
.
write
(
mode
=
'
w
'
)
assert
_consistent_locking_beatnotes
(
instru
)
instru
=
Instrument
(
size
=
100
,
lock
=
'
N1-21
'
,
fplan
=
'
tests/keplerian-fplan-1-1.h5
'
)
instru
=
Instrument
(
size
=
100
,
lock
=
'
N1-21
'
,
t0
=
t0
,
fplan
=
'
tests/keplerian-fplan-1-1.h5
'
,
orbits
=
'
tests/keplerian-orbits-1-0-2.h5
'
)
instru
.
simulate
()
instru
.
write
(
mode
=
'
w
'
)
assert
_consistent_locking_beatnotes
(
instru
)
instru
=
Instrument
(
size
=
100
,
lock
=
'
N4-12
'
,
fplan
=
'
tests/keplerian-fplan-1-1.h5
'
)
instru
=
Instrument
(
size
=
100
,
lock
=
'
N4-12
'
,
t0
=
t0
,
fplan
=
'
tests/keplerian-fplan-1-1.h5
'
,
orbits
=
'
tests/keplerian-orbits-1-0-2.h5
'
)
instru
.
simulate
()
instru
.
write
(
mode
=
'
w
'
)
assert
_consistent_locking_beatnotes
(
instru
)
...
...
@@ -246,25 +259,36 @@ def test_esa_trailing_fplan_1_1():
# Check fplan file with standard lock configs
for
primary
in
Instrument
.
MOSAS
:
for
topology
in
Instrument
.
LOCK_TOPOLOGIES
:
instru
=
Instrument
(
size
=
100
,
lock
=
f
'
{
topology
}
-
{
primary
}
'
,
fplan
=
'
tests/esa-trailing-fplan-1-1.h5
'
)
instru
=
Instrument
(
size
=
100
,
lock
=
f
'
{
topology
}
-
{
primary
}
'
,
fplan
=
'
tests/esa-trailing-fplan-1-1.h5
'
,
orbits
=
'
tests/esa-orbits-1-0-2.h5
'
,
# does not match, but okay
)
# Should raise an error for non-standard lock config
with
pytest
.
raises
(
ValueError
):
Instrument
(
size
=
100
,
lock
=
'
six
'
,
fplan
=
'
tests/esa-trailing-fplan-1-1.h5
'
)
Instrument
(
size
=
100
,
lock
=
'
six
'
,
fplan
=
'
tests/esa-trailing-fplan-1-1.h5
'
,
orbits
=
'
tests/esa-orbits-1-0-2.h5
'
)
with
pytest
.
raises
(
ValueError
):
lock
=
{
'
12
'
:
'
cavity
'
,
'
13
'
:
'
cavity
'
,
'
21
'
:
'
distant
'
,
'
31
'
:
'
distant
'
,
'
23
'
:
'
adjacent
'
,
'
32
'
:
'
adjacent
'
}
Instrument
(
size
=
100
,
lock
=
lock
,
fplan
=
'
tests/esa-trailing-fplan-1-1.h5
'
)
Instrument
(
size
=
100
,
lock
=
lock
,
fplan
=
'
tests/esa-trailing-fplan-1-1.h5
'
,
orbits
=
'
tests/esa-orbits-1-0-2.h5
'
)
# Should raise an error without orbit file
with
pytest
.
raises
(
ValueError
):
Instrument
(
size
=
100
,
lock
=
'
six
'
,
fplan
=
'
tests/esa-trailing-fplan-1-1.h5
'
)
# Check locking beatnotes
instru
=
Instrument
(
size
=
100
,
lock
=
'
N1-12
'
,
fplan
=
'
tests/esa-trailing-fplan-1-1.h5
'
)
with
File
(
'
tests/esa-orbits-1-0-2.h5
'
,
'
r
'
)
as
f
:
t0
=
f
.
attrs
[
'
t0
'
]
+
100
instru
=
Instrument
(
size
=
100
,
lock
=
'
N1-12
'
,
t0
=
t0
,
fplan
=
'
tests/esa-trailing-fplan-1-1.h5
'
,
orbits
=
'
tests/esa-orbits-1-0-2.h5
'
)
instru
.
simulate
()
instru
.
write
(
mode
=
'
w
'
)
assert
_consistent_locking_beatnotes
(
instru
)
instru
=
Instrument
(
size
=
100
,
lock
=
'
N1-21
'
,
fplan
=
'
tests/esa-trailing-fplan-1-1.h5
'
)
instru
=
Instrument
(
size
=
100
,
lock
=
'
N1-21
'
,
t0
=
t0
,
fplan
=
'
tests/esa-trailing-fplan-1-1.h5
'
,
orbits
=
'
tests/esa-orbits-1-0-2.h5
'
)
instru
.
simulate
()
instru
.
write
(
mode
=
'
w
'
)
assert
_consistent_locking_beatnotes
(
instru
)
instru
=
Instrument
(
size
=
100
,
lock
=
'
N4-12
'
,
fplan
=
'
tests/esa-trailing-fplan-1-1.h5
'
)
instru
=
Instrument
(
size
=
100
,
lock
=
'
N4-12
'
,
t0
=
t0
,
fplan
=
'
tests/esa-trailing-fplan-1-1.h5
'
,
orbits
=
'
tests/esa-orbits-1-0-2.h5
'
)
instru
.
simulate
()
instru
.
write
(
mode
=
'
w
'
)
assert
_consistent_locking_beatnotes
(
instru
)
...
...
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