Closed DaBiebs closed 2 years ago
Thank you for this bug report. The underlying problem is apparently that v1 and v2 of the circle fit do not have the exact same return values which resonator.py expects. @DennisRieger could you maybe have a look at it and fix it in the resonator.py?
@DaBiebs I think it makes much more sense to have both versions of the fit working as expected instead of simply ignoring the error on v1. In the mean time, you can simply use the following code to circumvent this issue without touching the config file:
import qkit
qkit.cfg['circle_fit_version'] = 2
qkit.start()
....
Yeah I can take a look!
Edit: I misread your above comment and thought you asked me to look. Thanks for the workaround! If @DennisRieger doesn't have time I can look as well, but unless told otherwise I will sit tight. From about 10 minutes of looking, it appears that circle_fit_version == 1 implied that the author wanted to use circle_fit_classic.circuit instead of circle_fit_2019.circuit.... Since the classic version doesn't have an autofit it won't be very plug and play.
Probably the best solution is to either:
The bug occured because the result keys were correctly chosen depending on the circle fit version but the imported (and therefore used) circle fit was hardcoded to the 2019 version 😃 Should be fixed by 7a02c202cec1b315634dd928193d28025daff86e.
Addressing a bug in resonator.py.
From what I can tell, circle_fit_version is set in https://github.com/qkitgroup/qkit/blob/master/qkit/analysis/resonator.py on line 289, where it is read in from the config:
circle_fit_version = qkit.cfg.get("circle_fit_version", 1)
I don't know another way to change circle_fit_version than to update the config
Alternative fixes:
Bug occurs in https://github.com/qkitgroup/qkit/blob/master/qkit/analysis/resonator.py on line 281
self._results[str(key)].append(float(self._circle_port.fitresults[str(key)]))
because the keys in _results do not align with the keys in _circle_port.fitresultsthis happens in in _do_fit_circle() which is called in fit_circle()
switching to circle_fit_version = 2 makes the keys the same and thus corrects the bug