def on_args_changed(self): self.suspend_autoupdate() available = self._source_argsets() normalized = [] for d in available: w1, w2, L = [(key, d.get(key)) for key in self._args_keys] normalized.append( { w1[0]: round(str2float(w1[1]) * 1e-9, 15), w2[0]: round(str2float(w2[1]) * 1e-9, 15), L[0]: round(str2float(L[1]) * 1e-6, 15), } ) idx = self._get_matched_args(normalized, self.args) valid_args = available[idx] sparams = parser.read_params(self._get_file(valid_args)) self._f, self._s = parser.build_matrix(sparams) self.freq_range = (self._f[0], self._f[-1]) for key, value in normalized[idx].items(): setattr(self, key, value) self.enable_autoupdate()
def on_args_changed(self) -> None: self.suspend_autoupdate() available = self._source_argsets() normalized = [{k: round(str2float(v), 15) for k, v in d.items()} for d in available] idx = self._get_matched_args(normalized, self.args) valid_args = available[idx] sparams = parser.read_params(self._get_file(valid_args)) self._f, self._s = parser.build_matrix(sparams) self.freq_range = (self._f[0], self._f[-1]) for key, value in normalized[idx].items(): setattr(self, key, value) self.enable_autoupdate()
def on_args_changed(self): self.suspend_autoupdate() available = self._source_argsets() normalized = [ {k: round(str2float(v) * 1e-9, 21) for k, v in d.items()} for d in available ] idx = self._get_matched_args(normalized, self.args) valid_args = available[idx] sparams = parser.read_params(self._get_file(valid_args)) sparams = list( filter(lambda sparams: sparams["mode"] == self.polarization, sparams) ) for key, value in normalized[idx].items(): setattr(self, key, value) self._f, self._s = parser.build_matrix(sparams) self.freq_range = (self._f[0], self._f[-1]) self.enable_autoupdate()