Skip to content

Allow for `lock` dictionary that uses only subset of locking options

Currently, the "three laser" locking topology is not possible as

instru = Instrument(lock={'12': 'cavity', '13': 'adjacent', '23': 'cavity', '21': 'adjacent', '31': 'cavity', '32': 'adjacent'})

failes with

ValueError                                Traceback (most recent call last)
Cell In[2], line 1
----> 1 instru = Instrument(lock={'12': 'cavity', '13': 'adjacent', '23': 'cavity', '21': 'adjacent', '31': 'cavity', '32': 'adjacent'})

File ~/repos/instrument/lisainstrument/instrument.py:377, in Instrument.__init__(self, size, dt, t0, physics_upsampling, aafilter, telemetry_downsampling, initial_telemetry_size, orbits, orbit_dataset, gws, interpolation, glitches, lock, fplan, laser_asds, laser_shape, central_freq, offset_freqs, modulation_asds, modulation_freqs, tdir_modulations, clock_asds, clock_offsets, clock_freqoffsets, clock_freqlindrifts, clock_freqquaddrifts, clockinv_tolerance, clockinv_maxiter, backlink_asds, backlink_fknees, testmass_asds, testmass_fknees, testmass_fbreak, testmass_shape, testmass_frelax, oms_asds, oms_fknees, moc_time_correlation_asds, ttl_coeffs, sc_jitter_asds, sc_jitter_fknees, mosa_jitter_asds, mosa_jitter_fknees, mosa_angles, dws_asds, ranging_biases, ranging_asds, prn_ambiguity, electro_delays, concurrent, multiproc, io_nprocess)
    375 # Instrument topology
    376 self.central_freq = float(central_freq)
--> 377 self.init_lock(lock)
    378 self.init_fplan(fplan)
    379 if offset_freqs == "default":
    380     # Default set yields valid beatnote frequencies for all lasers ('six')
    381     # with default 'static' set of MPRs

File ~/repos/instrument/lisainstrument/instrument.py:754, in Instrument.init_lock(self, lock)
    750 logger.info("Using explicit locking configuration '%s'", lock)
    751 if set(lock.keys()) != set(self.MOSAS) or set(lock.values()) != set(
    752     ["cavity", "distant", "adjacent"]
    753 ):
--> 754     raise ValueError(f"invalid locking configuration '{lock}'")
    755 self.lock_config = None
    756 self.lock = lock

ValueError: invalid locking configuration '{'12': 'cavity', '13': 'adjacent', '23': 'cavity', '21': 'adjacent', '31': 'cavity', '32': 'adjacent'}'

as init_lock(self, lock) requires explicitly that all locking options (i.e., 'cavity', 'distant' and 'adjacent') are used in the lock dictionary. I would suggest to change it to only require that a subset of the former is required. This is already done for the special case of lock='six' where all six lasers are locked to the local cavity.