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
9fb8693b
Commit
9fb8693b
authored
10 months ago
by
Martin Staab
Browse files
Options
Downloads
Patches
Plain Diff
Add `lock="three"` option + some tests
parent
547fb0da
No related branches found
No related tags found
1 merge request
!173
Resolve "Add locking configuration "three""
Pipeline
#326576
passed
10 months ago
Stage: test
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
lisainstrument/instrument.py
+11
-0
11 additions, 0 deletions
lisainstrument/instrument.py
tests/test_fplan.py
+32
-1
32 additions, 1 deletion
tests/test_fplan.py
tests/test_instrument.py
+3
-0
3 additions, 0 deletions
tests/test_instrument.py
with
46 additions
and
1 deletion
lisainstrument/instrument.py
+
11
−
0
View file @
9fb8693b
...
...
@@ -733,6 +733,17 @@ class Instrument:
"
32
"
:
"
cavity
"
,
"
21
"
:
"
cavity
"
,
}
elif
lock
==
"
three
"
:
logger
.
info
(
"
Using pre-defined locking configuration
'
three
'"
)
self
.
lock_config
=
None
# not a standard lock config
self
.
lock
=
{
'
12
'
:
'
cavity
'
,
'
13
'
:
'
adjacent
'
,
'
23
'
:
'
cavity
'
,
'
21
'
:
'
adjacent
'
,
'
31
'
:
'
cavity
'
,
'
32
'
:
'
adjacent
'
}
elif
isinstance
(
lock
,
str
):
logger
.
info
(
"
Using pre-defined locking configuration
'
%s
'"
,
lock
)
self
.
lock_config
=
lock
...
...
This diff is collapsed.
Click to expand it.
tests/test_fplan.py
+
32
−
1
View file @
9fb8693b
...
...
@@ -272,6 +272,8 @@ def test_keplerian_fplan_1_1():
# 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
"
)
with
pytest
.
raises
(
ValueError
):
Instrument
(
size
=
100
,
lock
=
"
three
"
,
fplan
=
"
tests/keplerian-fplan-1-1.h5
"
)
with
pytest
.
raises
(
ValueError
):
lock
=
{
"
12
"
:
"
cavity
"
,
...
...
@@ -310,6 +312,8 @@ def test_esa_trailing_fplan_1_1():
# 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
"
)
with
pytest
.
raises
(
ValueError
):
Instrument
(
size
=
100
,
lock
=
"
three
"
,
fplan
=
"
tests/esa-trailing-fplan-1-1.h5
"
)
with
pytest
.
raises
(
ValueError
):
lock
=
{
"
12
"
:
"
cavity
"
,
...
...
@@ -355,7 +359,7 @@ def test_offset_freqs():
assert
np
.
all
(
np
.
abs
(
rfi_carriers
[
mosa
])
<=
25e6
)
assert
np
.
all
(
np
.
abs
(
rfi_usbs
[
mosa
])
<=
25e6
)
# Check that unlocked laser frequency offsets are correctly set
# Check that unlocked laser frequency offsets are correctly set
for 'six' lock config
offset_freqs
=
{
"
12
"
:
8.1e6
,
"
23
"
:
9.2e6
,
...
...
@@ -371,6 +375,33 @@ def test_offset_freqs():
for
mosa
in
instru
.
MOSAS
:
assert
local_carrier_offsets
[
mosa
]
==
offset_freqs
[
mosa
]
# Check that unlocked laser frequency offsets are correctly set for 'three' lock config
offset_freqs
=
{
"
12
"
:
8.1e6
,
"
23
"
:
9.2e6
,
"
31
"
:
10.3e6
,
"
13
"
:
1.4e6
,
"
32
"
:
-
11.6e6
,
"
21
"
:
-
9.5e6
,
}
fplan
=
{
"
12
"
:
8e6
,
"
23
"
:
9e6
,
"
31
"
:
10e6
,
"
13
"
:
-
8.2e6
,
"
32
"
:
-
8.5e6
,
"
21
"
:
-
8.7e6
,
}
instru
=
Instrument
(
size
=
100
,
lock
=
"
three
"
,
offset_freqs
=
offset_freqs
,
clock_freqoffsets
=
0
,
clock_freqlindrifts
=
0
,
clock_freqquaddrifts
=
0
)
instru
.
write
(
keep_all
=
True
,
mode
=
"
w
"
)
with
File
(
"
measurements.h5
"
,
"
r
"
)
as
hdf5
:
local_carrier_offsets
=
hdf5
[
"
local_carrier_offsets
"
][()]
for
mosa
in
instru
.
MOSAS
[:
3
]:
assert
local_carrier_offsets
[
mosa
]
==
offset_freqs
[
mosa
]
for
left
,
right
in
zip
([
'
12
'
,
'
23
'
,
'
31
'
],
[
'
13
'
,
'
21
'
,
'
32
'
]):
assert
local_carrier_offsets
[
right
]
==
offset_freqs
[
left
]
-
fplan
[
right
]
# Check that frequency offsets are only set on unlocked lasers
instru
=
Instrument
(
size
=
100
,
lock
=
"
N1-12
"
,
offset_freqs
=
offset_freqs
)
instru
.
disable_all_noises
()
...
...
This diff is collapsed.
Click to expand it.
tests/test_instrument.py
+
3
−
0
View file @
9fb8693b
...
...
@@ -81,6 +81,9 @@ def test_locking():
# Test six free-running lasers
instru
=
Instrument
(
size
=
100
,
lock
=
"
six
"
)
instru
.
write
(
mode
=
"
w
"
)
# Test three free-running lasers
instru
=
Instrument
(
size
=
100
,
lock
=
"
three
"
)
instru
.
write
(
mode
=
"
w
"
)
# Test non-swap configurations
for
i
in
range
(
1
,
6
):
for
primary
in
[
"
12
"
,
"
23
"
,
"
31
"
,
"
13
"
,
"
32
"
,
"
21
"
]:
...
...
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