From 4711a9f885b060b3d6130bbcd24aa5030ceca1f3 Mon Sep 17 00:00:00 2001 From: "Tobias Hangleiter (Valhalla)" Date: Fri, 3 May 2024 11:02:19 +0200 Subject: [PATCH 1/3] Add update_snapshot arg to load_instrument It is passed through to add_component() --- src/qcodes/station.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/qcodes/station.py b/src/qcodes/station.py index a6dc8841a08..701392ac394 100644 --- a/src/qcodes/station.py +++ b/src/qcodes/station.py @@ -519,6 +519,7 @@ def close_and_remove_instrument(self, instrument: Instrument | str) -> None: def load_instrument(self, identifier: str, revive_instance: bool = False, + update_snapshot: bool = True, **kwargs: Any) -> Instrument: """ Creates an :class:`~.Instrument` instance as described by the @@ -529,6 +530,8 @@ def load_instrument(self, identifier: str, configuration file, which identifies the instrument to be added. revive_instance: If ``True``, try to return an instrument with the specified name instead of closing it and creating a new one. + update_snapshot: Immediately update the snapshot + of the instrument as it is added to the Station. **kwargs: Additional keyword arguments that get passed on to the ``__init__``-method of the instrument to be added. """ @@ -688,7 +691,7 @@ def update_monitor() -> None: if isinstance(local_instr, ChannelTuple): raise RuntimeError("A parameter cannot be added to an ChannelTuple") add_parameter_from_dict(local_instr, parts[-1], options) - self.add_component(instr) + self.add_component(instr, update_snapshot=update_snapshot) update_monitor() return instr From 854345211027825bb8a6e0827153f56571e2fe36 Mon Sep 17 00:00:00 2001 From: Tobias Hangleiter Date: Fri, 17 May 2024 16:42:49 +0200 Subject: [PATCH 2/3] Add newsfragment --- docs/changes/newsfragments/6075.improved | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/changes/newsfragments/6075.improved diff --git a/docs/changes/newsfragments/6075.improved b/docs/changes/newsfragments/6075.improved new file mode 100644 index 00000000000..2f1f7a1a9ef --- /dev/null +++ b/docs/changes/newsfragments/6075.improved @@ -0,0 +1 @@ +Add update_spapshot argument to Station.load_instrument() From 8ce4f73eb4914eb7691840ac0a0922003ed97182 Mon Sep 17 00:00:00 2001 From: Tobias Hangleiter Date: Sat, 18 May 2024 14:46:13 +0200 Subject: [PATCH 3/3] Darker --- src/qcodes/station.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/qcodes/station.py b/src/qcodes/station.py index 701392ac394..3b27482d9c2 100644 --- a/src/qcodes/station.py +++ b/src/qcodes/station.py @@ -517,10 +517,13 @@ def close_and_remove_instrument(self, instrument: Instrument | str) -> None: instrument.close() del instrument - def load_instrument(self, identifier: str, - revive_instance: bool = False, - update_snapshot: bool = True, - **kwargs: Any) -> Instrument: + def load_instrument( + self, + identifier: str, + revive_instance: bool = False, + update_snapshot: bool = True, + **kwargs: Any, + ) -> Instrument: """ Creates an :class:`~.Instrument` instance as described by the loaded configuration file.