Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add update_snapshot arg to load_instrument #6075

Merged
merged 4 commits into from
May 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading