Skip to content
Snippets Groups Projects
Commit 9fb8693b authored by Martin Staab's avatar Martin Staab
Browse files

Add `lock="three"` option + some tests

parent 547fb0da
No related branches found
No related tags found
1 merge request!173Resolve "Add locking configuration "three""
Pipeline #326576 passed
......@@ -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
......
......@@ -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()
......
......@@ -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"]:
......
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