Skip to content

Commit

Permalink
Merge pull request #6075 from qutech/enh/station_load_instrument
Browse files Browse the repository at this point in the history
Add update_snapshot arg to load_instrument
  • Loading branch information
jenshnielsen authored May 19, 2024
2 parents 48804ca + 8ce4f73 commit 2db9cc4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions docs/changes/newsfragments/6075.improved
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add update_spapshot argument to Station.load_instrument()
14 changes: 10 additions & 4 deletions src/qcodes/station.py
Original file line number Diff line number Diff line change
Expand Up @@ -517,9 +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,
**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.
Expand All @@ -529,6 +533,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.
"""
Expand Down Expand Up @@ -688,7 +694,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

Expand Down

0 comments on commit 2db9cc4

Please sign in to comment.