Conversation
…13) tune_band_serial(from_old_tune=True) loads tune data from disk without running a fresh full-band sweep, but still wrote self.freq_resp[band]['full_band_resp'] = {} unconditionally and persisted the empty dict via save_tune(). On a later session, plot_tune_summary(band, eta_scan=True) found the parent key, took the full-band branch, and crashed with KeyError: 'freq' on the missing subkeys. - tune_band_serial: only assign full_band_resp when both freq and resp are populated, so future tune files no longer carry an empty dict. - plot_tune_summary: also require the 'freq' and 'resp' subkeys before taking the full-band branch, so already-saved bad tune files fall through to the existing per-resonance freq_eta_scan/resp_eta_scan branch instead of raising.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #13.
plot_tune_summary(band, eta_scan=True)crashes withKeyError: 'freq'when the loaded tune file contains an emptyfull_band_resp = {}.The empty dict is written by
tune_band_serial(from_old_tune=True): that path loads tune data from disk without running a fresh full-band sweep, butfreq_resp[band]['full_band_resp'] = {}was assigned unconditionally and the empty dict was then persisted bysave_tune(). On a later session, the existence check inplot_tune_summary(if 'full_band_resp' in self.freq_resp[band]) passed, but accessing['freq']raised.Changes
tune_band_serial(smurf_tune.py:389-393): only assignfull_band_respwhen bothfreqandrespare populated. Prevents future tune files from carrying an empty dict.plot_tune_summary(smurf_tune.py:533-541): also require the'freq'and'resp'subkeys before taking the full-band branch. Already-saved bad tune files fall through to the existing per-resonancefreq_eta_scan/resp_eta_scanbranch instead of raising.Test plan
flake8 --count python/— 0 errors (matches CI).KeyError('freq')on an emptyfull_band_resp, post-fix code falls through to theelsebranch and the populated-full_band_resphappy path is unchanged.plot_tune_summary(band, eta_scan=True)against a tune file produced bytune_band_serial(from_old_tune=True)— requires SMuRF hardware; not feasible from this checkout.