semi_cr.core.lab.station package¶
Subpackages¶
- semi_cr.core.lab.station.context package
- Submodules
- semi_cr.core.lab.station.context.bindings module
- semi_cr.core.lab.station.context.config module
- semi_cr.core.lab.station.context.graph module
- semi_cr.core.lab.station.context.models module
- semi_cr.core.lab.station.context.runtime module
StationContextStationContext.stationStationContext.staticStationContext.bindingsStationContext.resolve_runtime()StationContext.instrumentsStationContext.devicesStationContext.chipsStationContext.pcbsStationContext.connectorsStationContext.graphStationContext.modulesStationContext.has_runtimeStationContext.stateStationContext.loadedStationContext.connectedStationContext.partially_connectedStationContext.connected_instrument_namesStationContext.has_connectionsStationContext.load()StationContext.connect()StationContext.disconnect()
- semi_cr.core.lab.station.context.static module
- Module contents
ContextStateInfrastructureContextRuntimeBindingRuntimeBindingRegistryStaticStationContextStationContextStationContext.stationStationContext.staticStationContext.bindingsStationContext.resolve_runtime()StationContext.instrumentsStationContext.devicesStationContext.chipsStationContext.pcbsStationContext.connectorsStationContext.graphStationContext.modulesStationContext.has_runtimeStationContext.stateStationContext.loadedStationContext.connectedStationContext.partially_connectedStationContext.connected_instrument_namesStationContext.has_connectionsStationContext.load()StationContext.connect()StationContext.disconnect()
- semi_cr.core.lab.station.graphing package
- Submodules
- semi_cr.core.lab.station.graphing.context module
- semi_cr.core.lab.station.graphing.ids module
safe_id_part()lab_node_id()terminal_node_id()connector_node_id()connector_connection_node_id()chip_node_id()device_node_id()pin_node_id()pad_node_id()instrument_node_id()instrument_module_node_id()instrument_connection_node_id()terminal_id()qcodes_node_id()local_device_name()qualified_device_name()resolve_terminal_id()
- semi_cr.core.lab.station.graphing.models module
NodeEdgeGraphRelationGraphRelation.CONTAINSGraphRelation.DEPENDENCYGraphRelation.CONNECTIONGraphRelation.REPRESENTSGraphRelation.INTERNAL_CONNECTIONGraphRelation.PHYSICALGraphRelation.DEVICEGraphRelation.__new_member__()GraphRelation.encode()GraphRelation.replace()GraphRelation.split()GraphRelation.rsplit()GraphRelation.join()GraphRelation.capitalize()GraphRelation.casefold()GraphRelation.title()GraphRelation.center()GraphRelation.count()GraphRelation.expandtabs()GraphRelation.find()GraphRelation.partition()GraphRelation.index()GraphRelation.ljust()GraphRelation.lower()GraphRelation.lstrip()GraphRelation.rfind()GraphRelation.rindex()GraphRelation.rjust()GraphRelation.rstrip()GraphRelation.rpartition()GraphRelation.splitlines()GraphRelation.strip()GraphRelation.swapcase()GraphRelation.translate()GraphRelation.upper()GraphRelation.startswith()GraphRelation.endswith()GraphRelation.removeprefix()GraphRelation.removesuffix()GraphRelation.isascii()GraphRelation.islower()GraphRelation.isupper()GraphRelation.istitle()GraphRelation.isspace()GraphRelation.isdecimal()GraphRelation.isdigit()GraphRelation.isnumeric()GraphRelation.isalpha()GraphRelation.isalnum()GraphRelation.isidentifier()GraphRelation.isprintable()GraphRelation.zfill()GraphRelation.format()GraphRelation.format_map()GraphRelation.maketrans()GraphRelation.__dir__()
- semi_cr.core.lab.station.graphing.operations module
- semi_cr.core.lab.station.graphing.overlay module
- semi_cr.core.lab.station.graphing.parsing module
- semi_cr.core.lab.station.graphing.resolver module
- semi_cr.core.lab.station.graphing.runtime_builder module
- semi_cr.core.lab.station.graphing.static_builder module
- semi_cr.core.lab.station.graphing.validation module
- semi_cr.core.lab.station.graphing.view module
- Module contents
- semi_cr.core.lab.station.routing_v1 package
- Submodules
- semi_cr.core.lab.station.routing_v1.attachment module
- semi_cr.core.lab.station.routing_v1.conversions module
- semi_cr.core.lab.station.routing_v1.dc module
- semi_cr.core.lab.station.routing_v1.errors module
- semi_cr.core.lab.station.routing_v1.graph module
- semi_cr.core.lab.station.routing_v1.integration module
- semi_cr.core.lab.station.routing_v1.matching module
CapabilityCapability.VOLTAGE_SOURCECapability.VOLTAGE_METERCapability.CURRENT_SOURCECapability.CURRENT_METERCapability.RF_SOURCECapability.IQ_RECEIVERCapability.DIGITAL_TRIGGERCapability.__new_member__()Capability.encode()Capability.replace()Capability.split()Capability.rsplit()Capability.join()Capability.capitalize()Capability.casefold()Capability.title()Capability.center()Capability.count()Capability.expandtabs()Capability.find()Capability.partition()Capability.index()Capability.ljust()Capability.lower()Capability.lstrip()Capability.rfind()Capability.rindex()Capability.rjust()Capability.rstrip()Capability.rpartition()Capability.splitlines()Capability.strip()Capability.swapcase()Capability.translate()Capability.upper()Capability.startswith()Capability.endswith()Capability.removeprefix()Capability.removesuffix()Capability.isascii()Capability.islower()Capability.isupper()Capability.istitle()Capability.isspace()Capability.isdecimal()Capability.isdigit()Capability.isnumeric()Capability.isalpha()Capability.isalnum()Capability.isidentifier()Capability.isprintable()Capability.zfill()Capability.format()Capability.format_map()Capability.maketrans()Capability.__dir__()
requested_capability()
- semi_cr.core.lab.station.routing_v1.models module
- semi_cr.core.lab.station.routing_v1.profiles module
- semi_cr.core.lab.station.routing_v1.quantities module
- semi_cr.core.lab.station.routing_v1.queries module
node_supports_role()node_matches_filters()find_device_pin_node()find_pin_node()electrical_net_for_pin()find_pin_route_to_role()find_route()represented_objects_for_node()objects_on_electrical_net()objects_reachable_from_device()find_instruments()find_instruments_for_device()resolve_synchronization_config()objects_in_pin_route_with_attr()
- semi_cr.core.lab.station.routing_v1.resolution module
- semi_cr.core.lab.station.routing_v1.validation module
ValidationSeverityValidationSeverity.ERRORValidationSeverity.WARNINGValidationSeverity.__new_member__()ValidationSeverity.encode()ValidationSeverity.replace()ValidationSeverity.split()ValidationSeverity.rsplit()ValidationSeverity.join()ValidationSeverity.capitalize()ValidationSeverity.casefold()ValidationSeverity.title()ValidationSeverity.center()ValidationSeverity.count()ValidationSeverity.expandtabs()ValidationSeverity.find()ValidationSeverity.partition()ValidationSeverity.index()ValidationSeverity.ljust()ValidationSeverity.lower()ValidationSeverity.lstrip()ValidationSeverity.rfind()ValidationSeverity.rindex()ValidationSeverity.rjust()ValidationSeverity.rstrip()ValidationSeverity.rpartition()ValidationSeverity.splitlines()ValidationSeverity.strip()ValidationSeverity.swapcase()ValidationSeverity.translate()ValidationSeverity.upper()ValidationSeverity.startswith()ValidationSeverity.endswith()ValidationSeverity.removeprefix()ValidationSeverity.removesuffix()ValidationSeverity.isascii()ValidationSeverity.islower()ValidationSeverity.isupper()ValidationSeverity.istitle()ValidationSeverity.isspace()ValidationSeverity.isdecimal()ValidationSeverity.isdigit()ValidationSeverity.isnumeric()ValidationSeverity.isalpha()ValidationSeverity.isalnum()ValidationSeverity.isidentifier()ValidationSeverity.isprintable()ValidationSeverity.zfill()ValidationSeverity.format()ValidationSeverity.format_map()ValidationSeverity.maketrans()ValidationSeverity.__dir__()
ValidationIssueRoutingValidationReportvalidate_routing_graph()
- Module contents
Submodules¶
semi_cr.core.lab.station.base module¶
- class semi_cr.core.lab.station.base.GraphRelation(*values)[source]¶
Bases:
StrEnum- CONTAINS = 'contains'¶
- DEPENDENCY = 'dependency'¶
- CONNECTION = 'connection'¶
- REPRESENTS = 'represents'¶
- INTERNAL_CONNECTION = 'internal_connection'¶
- PHYSICAL = 'physical'¶
- DEVICE = 'device'¶
- __new_member__(*values)¶
values must already be of type str
- encode(encoding='utf-8', errors='strict')¶
Encode the string using the codec registered for encoding.
- encoding
The encoding in which to encode the string.
- errors
The error handling scheme to use for encoding errors. The default is ‘strict’ meaning that encoding errors raise a UnicodeEncodeError. Other possible values are ‘ignore’, ‘replace’ and ‘xmlcharrefreplace’ as well as any other name registered with codecs.register_error that can handle UnicodeEncodeErrors.
- replace(old, new, count=-1, /)¶
Return a copy with all occurrences of substring old replaced by new.
- count
Maximum number of occurrences to replace. -1 (the default value) means replace all occurrences.
If the optional argument count is given, only the first count occurrences are replaced.
- split(sep=None, maxsplit=-1)¶
Return a list of the substrings in the string, using sep as the separator string.
- sep
The separator used to split the string.
When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.
- maxsplit
Maximum number of splits. -1 (the default value) means no limit.
Splitting starts at the front of the string and works to the end.
Note, str.split() is mainly useful for data that has been intentionally delimited. With natural text that includes punctuation, consider using the regular expression module.
- rsplit(sep=None, maxsplit=-1)¶
Return a list of the substrings in the string, using sep as the separator string.
- sep
The separator used to split the string.
When set to None (the default value), will split on any whitespace character (including n r t f and spaces) and will discard empty strings from the result.
- maxsplit
Maximum number of splits. -1 (the default value) means no limit.
Splitting starts at the end of the string and works to the front.
- join(iterable, /)¶
Concatenate any number of strings.
The string whose method is called is inserted in between each given string. The result is returned as a new string.
Example: ‘.’.join([‘ab’, ‘pq’, ‘rs’]) -> ‘ab.pq.rs’
- capitalize()¶
Return a capitalized version of the string.
More specifically, make the first character have upper case and the rest lower case.
- casefold()¶
Return a version of the string suitable for caseless comparisons.
- title()¶
Return a version of the string where each word is titlecased.
More specifically, words start with uppercased characters and all remaining cased characters have lower case.
- center(width, fillchar=' ', /)¶
Return a centered string of length width.
Padding is done using the specified fill character (default is a space).
- count(sub[, start[, end]]) int¶
Return the number of non-overlapping occurrences of substring sub in string S[start:end]. Optional arguments start and end are interpreted as in slice notation.
- expandtabs(tabsize=8)¶
Return a copy where all tab characters are expanded using spaces.
If tabsize is not given, a tab size of 8 characters is assumed.
- find(sub[, start[, end]]) int¶
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.
- partition(sep, /)¶
Partition the string into three parts using the given separator.
This will search for the separator in the string. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.
If the separator is not found, returns a 3-tuple containing the original string and two empty strings.
- index(sub[, start[, end]]) int¶
Return the lowest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.
- ljust(width, fillchar=' ', /)¶
Return a left-justified string of length width.
Padding is done using the specified fill character (default is a space).
- lower()¶
Return a copy of the string converted to lowercase.
- lstrip(chars=None, /)¶
Return a copy of the string with leading whitespace removed.
If chars is given and not None, remove characters in chars instead.
- rfind(sub[, start[, end]]) int¶
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Return -1 on failure.
- rindex(sub[, start[, end]]) int¶
Return the highest index in S where substring sub is found, such that sub is contained within S[start:end]. Optional arguments start and end are interpreted as in slice notation.
Raises ValueError when the substring is not found.
- rjust(width, fillchar=' ', /)¶
Return a right-justified string of length width.
Padding is done using the specified fill character (default is a space).
- rstrip(chars=None, /)¶
Return a copy of the string with trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
- rpartition(sep, /)¶
Partition the string into three parts using the given separator.
This will search for the separator in the string, starting at the end. If the separator is found, returns a 3-tuple containing the part before the separator, the separator itself, and the part after it.
If the separator is not found, returns a 3-tuple containing two empty strings and the original string.
- splitlines(keepends=False)¶
Return a list of the lines in the string, breaking at line boundaries.
Line breaks are not included in the resulting list unless keepends is given and true.
- strip(chars=None, /)¶
Return a copy of the string with leading and trailing whitespace removed.
If chars is given and not None, remove characters in chars instead.
- swapcase()¶
Convert uppercase characters to lowercase and lowercase characters to uppercase.
- translate(table, /)¶
Replace each character in the string using the given translation table.
- table
Translation table, which must be a mapping of Unicode ordinals to Unicode ordinals, strings, or None.
The table must implement lookup/indexing via __getitem__, for instance a dictionary or list. If this operation raises LookupError, the character is left untouched. Characters mapped to None are deleted.
- upper()¶
Return a copy of the string converted to uppercase.
- startswith(prefix[, start[, end]]) bool¶
Return True if S starts with the specified prefix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. prefix can also be a tuple of strings to try.
- endswith(suffix[, start[, end]]) bool¶
Return True if S ends with the specified suffix, False otherwise. With optional start, test S beginning at that position. With optional end, stop comparing S at that position. suffix can also be a tuple of strings to try.
- removeprefix(prefix, /)¶
Return a str with the given prefix string removed if present.
If the string starts with the prefix string, return string[len(prefix):]. Otherwise, return a copy of the original string.
- removesuffix(suffix, /)¶
Return a str with the given suffix string removed if present.
If the string ends with the suffix string and that suffix is not empty, return string[:-len(suffix)]. Otherwise, return a copy of the original string.
- isascii()¶
Return True if all characters in the string are ASCII, False otherwise.
ASCII characters have code points in the range U+0000-U+007F. Empty string is ASCII too.
- islower()¶
Return True if the string is a lowercase string, False otherwise.
A string is lowercase if all cased characters in the string are lowercase and there is at least one cased character in the string.
- isupper()¶
Return True if the string is an uppercase string, False otherwise.
A string is uppercase if all cased characters in the string are uppercase and there is at least one cased character in the string.
- istitle()¶
Return True if the string is a title-cased string, False otherwise.
In a title-cased string, upper- and title-case characters may only follow uncased characters and lowercase characters only cased ones.
- isspace()¶
Return True if the string is a whitespace string, False otherwise.
A string is whitespace if all characters in the string are whitespace and there is at least one character in the string.
- isdecimal()¶
Return True if the string is a decimal string, False otherwise.
A string is a decimal string if all characters in the string are decimal and there is at least one character in the string.
- isdigit()¶
Return True if the string is a digit string, False otherwise.
A string is a digit string if all characters in the string are digits and there is at least one character in the string.
- isnumeric()¶
Return True if the string is a numeric string, False otherwise.
A string is numeric if all characters in the string are numeric and there is at least one character in the string.
- isalpha()¶
Return True if the string is an alphabetic string, False otherwise.
A string is alphabetic if all characters in the string are alphabetic and there is at least one character in the string.
- isalnum()¶
Return True if the string is an alpha-numeric string, False otherwise.
A string is alpha-numeric if all characters in the string are alpha-numeric and there is at least one character in the string.
- isidentifier()¶
Return True if the string is a valid Python identifier, False otherwise.
Call keyword.iskeyword(s) to test whether string s is a reserved identifier, such as “def” or “class”.
- isprintable()¶
Return True if the string is printable, False otherwise.
A string is printable if all of its characters are considered printable in repr() or if it is empty.
- zfill(width, /)¶
Pad a numeric string with zeros on the left, to fill a field of the given width.
The string is never truncated.
- format(*args, **kwargs) str¶
Return a formatted version of S, using substitutions from args and kwargs. The substitutions are identified by braces (‘{’ and ‘}’).
- format_map(mapping) str¶
Return a formatted version of S, using substitutions from mapping. The substitutions are identified by braces (‘{’ and ‘}’).
- static maketrans()¶
Return a translation table usable for str.translate().
If there is only one argument, it must be a dictionary mapping Unicode ordinals (integers) or characters to Unicode ordinals, strings or None. Character keys will be then converted to ordinals. If there are two arguments, they must be strings of equal length, and in the resulting dictionary, each character in x will be mapped to the character at the same position in y. If there is a third argument, it must be a string, whose characters will be mapped to None in the result.
- __dir__()¶
Returns public methods and other interesting attributes.
- class semi_cr.core.lab.station.base.InstrumentSpec(name: str, type: str, init: dict[str, ~typing.Any]=<factory>)[source]¶
Bases:
objectStatic description of an instrument.
Does not represent an active connection and does not contain a QCoDeS Instrument instance.
- semi_cr.core.lab.station.base.static_instrument_node_id(spec: InstrumentSpec) str[source]¶
- class semi_cr.core.lab.station.base.ConfigBundle(files: str | Path | tuple[str | Path, ...] | None = None)[source]¶
Bases:
objectA container class for QCoDes configuration that has been loaded from one or more yaml files. Instantiate a ConfigBundle with or without files, and add more using import_yaml.
Jens has a suspicion that we can avoid some complexity by encapsulating the configuration merging logic properly in here and having it here only. I believe now the ConfifBundle does that properly.
- load() dict[str, Any][source]¶
Loads a dict of paths to configuration files into a merged dict. A
Maintaining parity by initializing self.config to the empty dict. Would be nice if the ConfigBundle would maintain state.
DEPRECATED: Get rid of this method and self.config in order to maintain atomicity. :return:
- import_yaml(yamlfile: str | Path | tuple[str | Path, ...]) None[source]¶
Takes a reference to a file or a tuple of such references and augments the current set of configurations with it.
- merge(other: ConfigBundle) ConfigBundle[source]¶
- dump_yaml(stream) None[source]¶
Dumps a YaML structure from the current ConfigBundle contents into a provided stream.
- get_yaml() str[source]¶
- Returns:
a string containing a YaML document containing the current state of the ConfigBundle.
- classmethod combine(*bundles: ConfigBundle) ConfigBundle[source]¶
semi_cr.core.lab.station.context_old module¶
- class semi_cr.core.lab.station.context_old.StaticTerminalRef(instrument: str, module: str | None, terminal: str)[source]¶
Bases:
object
- class semi_cr.core.lab.station.context_old.InfrastructureContext(wiring_config: semi_cr.core.lab.station.base.ConfigBundle, electronics_config: semi_cr.core.lab.station.base.ConfigBundle)[source]¶
Bases:
object- wiring_config: ConfigBundle¶
- electronics_config: ConfigBundle¶
- config: ConfigBundle¶
- graph: MultiDiGraph¶
- semi_cr.core.lab.station.context_old.build_instrument_specs(config: dict[str, Any]) dict[str, InstrumentSpec][source]¶
- class semi_cr.core.lab.station.context_old.StaticStationContext(device: ConfigContext, infrastructure: InfrastructureContext)[source]¶
Bases:
objectDescription of the complete station without talking to hardware.
- device: ConfigContext¶
- infrastructure: InfrastructureContext¶
- config: ConfigBundle¶
- instruments: dict[str, InstrumentSpec]¶
- graph: MultiDiGraph¶
- class semi_cr.core.lab.station.context_old.RuntimeBinding(static_id: str, runtime_id: str, runtime_object: Any)[source]¶
Bases:
object
- class semi_cr.core.lab.station.context_old.RuntimeBindingRegistry[source]¶
Bases:
object- get_binding(static_id: str) RuntimeBinding[source]¶
- semi_cr.core.lab.station.context_old.normalize_qcodes_config(config: dict[str, Any]) dict[str, Any][source]¶
- class semi_cr.core.lab.station.context_old.ContextState(*values)[source]¶
Bases:
Enum- CREATED = 1¶
- LOADED = 2¶
- PARTIALLY_CONNECTED = 3¶
- CONNECTED = 4¶
- classmethod __contains__(value)¶
Return True if value is in cls.
value is in cls if: 1) value is a member of cls, or 2) value is the value of one of the cls’s members.
- classmethod __getitem__(name)¶
Return the member matching name.
- classmethod __iter__()¶
Return members in definition order.
- classmethod __len__()¶
Return the number of members (no aliases)
- class semi_cr.core.lab.station.context_old.StationContext(station: LabStation, static: StaticStationContext)[source]¶
Bases:
objectRuntime realization of a StaticStationContext.
Construction is intentionally side-effect free.
Lifecycle:
context = StationContext(station, static)
context.load() context.connect()
…
context.disconnect()
- station: LabStation¶
- static: StaticStationContext¶
- property bindings: RuntimeBindingRegistry¶
- resolve_runtime(static_id: str) Any[source]¶
Resolve a static object ID to its runtime realization.
Runtime resolution is available once bindings have been created, including while the context is being connected.
- property instruments: dict[str, Instrument]¶
- property graph: MultiDiGraph¶
- property state: ContextState¶
- property has_connections: bool¶
True when at least one instrument owned by this context is currently connected.
- load() None[source]¶
Load the static configuration into the QCoDeS station.
This does not connect to physical instruments.
- connect(instruments: str | Iterable[str] | None = None) None[source]¶
Connect one, several, or all configured instruments.
- Parameters:
instruments – QCoDeS instrument config name, iterable of config names, or None to connect all configured instruments.
Examples
context.connect() context.connect(“qdac_1”) context.connect([“qdac_1”, “smu”])
- disconnect(instruments: str | Iterable[str] | None = None) None[source]¶
Disconnect one, several, or all runtime instruments instantiated by this context.
QCoDeS configuration remains loaded.
- Parameters:
instruments – Config name, iterable of config names, or None to disconnect all instruments owned by this context.
Examples
context.disconnect() context.disconnect(“qdac_1”) context.disconnect([“qdac_1”, “smu”])
semi_cr.core.lab.station.metadata module¶
- class semi_cr.core.lab.station.metadata.LabStation(cfg_file: str | pathlib.Path)[source]¶
Bases:
Station- __getitem__(key: str) Metadatable¶
Shortcut to components dictionary.
- add_component(component: MetadatableWithName, name: str | None = None, update_snapshot: bool = True) str¶
Record one component as part of this Station.
- Parameters:
component – Components to add to the Station.
name – Name of the component.
update_snapshot – Immediately update the snapshot of each component as it is added to the Station.
- Returns:
- The name assigned this component, which may have been changed
to make it unique among previously added components.
- Return type:
- close_all_registered_instruments() None¶
Closes all instruments that are registered to this Station object by calling the
base.Instrument.close()-method on each one. The instruments will be removed from the station and from the QCoDeS monitor.
- close_and_remove_instrument(instrument: Instrument | str) None¶
Safely close instrument and remove from station and monitor list.
- config: StationConfig | None = None¶
A user dict representing the YAML file that the station was loaded from
- delegate_attr_dicts: ClassVar[list[str]] = ['components']¶
A list of names (strings) of dictionaries which are (or will be) attributes of
self, whose keys should be treated as attributes ofself.
- delegate_attr_objects: ClassVar[list[str]] = []¶
A list of names (strings) of objects which are (or will be) attributes of
self, whose attributes should be passed through toself.
- get_component(full_name: str) MetadatableWithName¶
Get a (sub)component with a given name from this Station. The name may be of a component that is a sub-component of another component, e.g. a parameter on an instrument, an instrument module or an top-level instrument.
- Parameters:
full_name – Name of the component.
- Returns:
The component with the given name.
- Raises:
KeyError – If a component with the given name is not part of this station.
- load_all_instruments(only_names: Iterable[str] | None = None, only_types: Iterable[str] | None = None) tuple[str, ...]¶
Load all instruments specified in the loaded YAML station configuration.
Optionally, the instruments to be loaded can be filtered by their names or types, use
only_namesandonly_typesarguments for that. It is an error to supply bothonly_namesandonly_types.- Parameters:
only_names – List of instrument names to load from the config. If left as None, then all instruments are loaded.
only_types – List of instrument types e.g. the class names of the instruments to load. If left as None, then all instruments are loaded.
- Returns:
The names of the loaded instruments
- load_config(config: str | IO) None¶
Loads a configuration from a supplied string or file/stream handle. The string or file/stream is expected to be YAML formatted
Loading of a configuration will update the snapshot of the station and make the instruments described in the config file available for instantiation with the
load_instrument()method.Additionally the shortcut methods
load_<instrument_name>will be updated.
- load_config_file(filename: str | None = None) None¶
Loads a configuration from a YAML file. If filename is not specified the default file name from the qcodes configuration will be used.
Loading of a configuration will update the snapshot of the station and make the instruments described in the config file available for instantiation with the
load_instrument()method.Additionally the shortcut methods
load_<instrument_name>will be updated.
- load_config_files(*filenames: str) None¶
Loads configuration from multiple YAML files after merging them into one. If filenames are not specified the default file name from the qcodes configuration will be used.
Loading of configuration will update the snapshot of the station and make the instruments described in the config files available for instantiation with the
load_instrument()method.Additionally the shortcut methods
load_<instrument_name>will be updated.
- load_instrument(identifier: str, revive_instance: bool = False, update_snapshot: bool = True, **kwargs: Any) Instrument¶
Creates an
Instrumentinstance as described by the loaded configuration file.- Parameters:
identifier – The identifying string that is looked up in the yaml 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.
- load_metadata(metadata: Mapping[str, Any]) None¶
Load metadata into this classes metadata dictionary.
- Parameters:
metadata – Metadata to load.
- omit_delegate_attrs: ClassVar[list[str]] = []¶
A list of attribute names (strings) to not delegate to any other dictionary or object.
- remove_component(name: str) MetadatableWithName | None¶
Remove a component with a given name from this Station.
- Parameters:
name – Name of the component.
- Returns:
The component that has been removed (this behavior is the same as for Python dictionaries).
- Raises:
KeyError – If a component with the given name is not part of this station.
- snapshot(update: bool | None = False) dict[str, Any]¶
Decorate a snapshot dictionary with metadata. DO NOT override this method if you want metadata in the snapshot instead, override
snapshot_base().- Parameters:
update – Passed to snapshot_base.
- Returns:
Base snapshot.
- snapshot_base(update: bool | None = True, params_to_skip_update: Sequence[str] | None = None) dict[Any, Any]¶
State of the station as a JSON-compatible dictionary (everything that the custom JSON encoder class
NumpyJSONEncodersupports).Note: If the station contains an instrument that has already been closed, not only will it not be snapshotted, it will also be removed from the station during the execution of this function.
- Parameters:
update – If
True, update the state by querying the all the children: f.ex. instruments, parameters, components, etc. If None only update if the state is known to be invalid. IfFalse, just use the latest values in memory and never update the state.params_to_skip_update – Not used.
- Returns:
Base snapshot.
- Return type:
semi_cr.core.lab.station.nodes module¶
- class semi_cr.core.lab.station.nodes.BetterDelegateParameter(name: str, *, source: Parameter | None, **kwargs: Unpack[ParameterKWArgs[ParameterDataTypeVar, InstrumentTypeVar_co]])[source]¶
Bases:
DelegateParameter- validate(value: Any | None) None[source]¶
Validate the supplied value. If it has a source parameter, validate the value as well with the source validator.
- Parameters:
value – value to validate
- Raises:
TypeError – If the value is of the wrong type.
ValueError – If the value is outside the bounds specified by the validator.
- __getitem__(keys: Any) SweepFixedValues¶
Slice a Parameter to get a SweepValues object to iterate over during a sweep
- add_validator(vals: Validator) None¶
Add a validator for the parameter. The parameter is validated against all validators in reverse order of how they are added.
- Parameters:
vals – Validator to add to the parameter.
- property depends_on: ParameterSet¶
- extra_validator(vals: Validator) Generator[None, None, None]¶
Contextmanager to to temporarily add a validator to the parameter within the given context. The validator is removed from the parameter when the context ends.
- property full_name: str¶
Name of the parameter including the name of the instrument and submodule that the parameter may be bound to. The names are separated by underscores, like this:
instrument_submodule_parameter.
- get_ramp_values(value: NumberType | Sized, step: NumberType | None = None) Sequence[NumberType | Sized]¶
Return values to sweep from current value to target value. This method can be overridden to have a custom sweep behaviour. It can even be overridden by a generator.
- Parameters:
value – target value
step – maximum step size
- Returns:
List of stepped values, including target value.
- get_raw() Any¶
get_rawis called to perform the actual data acquisition from the instrument. This method should either be overwritten to perform the desired operation or alternatively forParametera suitable method is automatically generated ifget_cmdis supplied to the parameter constructor. The method is automatically wrapped to provide agetmethod on the parameter instance.
- global_on_set_callback = None¶
- property has_control_of: ParameterSet¶
- increment(value: ParameterDataTypeVar) None¶
Increment the parameter with a value
- Parameters:
value – Value to be added to the parameter.
- property instrument: InstrumentTypeVar_co¶
Return the first instrument that this parameter is bound to. E.g if this is bound to a channel it will return the channel and not the instrument that the channel is bound too. Use
root_instrument()to get the real instrument.
- property inter_delay: float¶
Delay time between consecutive set operations. The actual time will not be shorter than this, but may be longer if the underlying set call takes longer.
Typically used in conjunction with step to create an effective ramp rate, but can also be used without a step to enforce a delay between sets.
- Getter:
Returns the current inter_delay.
- Setter:
Sets the value of the inter_delay.
- Raises:
TypeError – If delay is not int nor float
ValueError – If delay is negative
- property is_controlled_by: ParameterSet¶
- property label: str¶
Label of the data used for plots etc. Read from source if not explicitly overwritten. Set to None to disable overwrite.
- load_metadata(metadata: Mapping[str, Any]) None¶
Load metadata into this classes metadata dictionary.
- Parameters:
metadata – Metadata to load.
- property name: str¶
Name of the parameter. This is identical to
short_name().
- property param_spec: ParamSpecBase¶
- property post_delay: float¶
Delay time after start of set operation, for each set. The actual time will not be shorter than this, but may be longer if the underlying set call takes longer.
Typically used in conjunction with step to create an effective ramp rate, but can also be used without a step to enforce a delay after every set. One might think of post_delay as how long a set operation is supposed to take. For example, there might be an instrument that needs extra time after setting a parameter although the command for setting the parameter returns quickly.
- Getter:
Returns the current post_delay.
- Setter:
Sets the value of the post_delay.
- Raises:
TypeError – If delay is not int nor float
ValueError – If delay is negative
- property raw_value: Any¶
Note that this property will be deprecated soon. Use
cache.raw_valueinstead.Represents the cached raw value of the parameter.
- Getter:
Returns the cached raw value of the parameter.
- property register_name: str¶
Name that will be used to register this parameter in a dataset By default, this returns
full_nameor the value of theregister_nameargument if it was passed at initialization.
- remove_validator() Validator | None¶
Remove the last validator added to the parameter and return it. Returns None if there are no validators associated with the parameter.
- Returns:
The last validator added to the parameter or None if there are no validators associated with the parameter.
- restore_at_exit(allow_changes: bool = True) _SetParamContext¶
Use a context manager to restore the value of a parameter after a
withblock.By default, the parameter value may be changed inside the block, but this can be prevented with
allow_changes=False. This can be useful, for example, for debugging a complex measurement that unintentionally modifies a parameter.Example
>>> p = Parameter("p", set_cmd=None, get_cmd=None) >>> p.set(2) >>> with p.restore_at_exit(): ... p.set(3) ... print(f"value inside with block: {p.get()}") # prints 3 >>> print(f"value after with block: {p.get()}") # prints 2 >>> with p.restore_at_exit(allow_changes=False): ... p.set(5) # raises an exception
- property root_instrument: InstrumentBase | None¶
Return the fundamental instrument that this parameter belongs too. E.g if the parameter is bound to a channel this will return the fundamental instrument that that channel belongs to. Use
instrument()to get the channel.
- set_raw(value: Any) None¶
set_rawis called to perform the actual setting of a parameter on the instrument. This method should either be overwritten to perform the desired operation or alternatively forParametera suitable method is automatically generated ifset_cmdis supplied to the parameter constructor. The method is automatically wrapped to provide asetmethod on the parameter instance.
- set_to(value: ParameterDataTypeVar, allow_changes: bool = False) _SetParamContext¶
Use a context manager to temporarily set a parameter to a value. By default, the parameter value cannot be changed inside the context. This may be overridden with
allow_changes=True.Examples
>>> from qcodes.parameters import Parameter >>> p = Parameter("p", set_cmd=None, get_cmd=None) >>> p.set(2) >>> with p.set_to(3): ... print(f"p value in with block {p.get()}") # prints 3 ... p.set(5) # raises an exception >>> print(f"p value outside with block {p.get()}") # prints 2 >>> with p.set_to(3, allow_changes=True): ... p.set(5) # now this works >>> print(f"value after second block: {p.get()}") # still prints 2
- property short_name: str¶
Short name of the parameter. This is without the name of the instrument or submodule that the parameter may be bound to. For full name refer to
full_name().
- snapshot(update: bool | None = False) dict[str, Any]¶
Decorate a snapshot dictionary with metadata. DO NOT override this method if you want metadata in the snapshot instead, override
snapshot_base().- Parameters:
update – Passed to snapshot_base.
- Returns:
Base snapshot.
- snapshot_base(update: bool | None = True, params_to_skip_update: Sequence[str] | None = None) dict[Any, Any]¶
State of the parameter as a JSON-compatible dict (everything that the custom JSON encoder class
NumpyJSONEncodersupports).If the parameter has been initiated with
snapshot_value=False, the snapshot will NOT include thevalueandraw_valueof the parameter.- Parameters:
update – If True, update the state by calling
parameter.get()unlesssnapshot_getof the parameter isFalse. IfupdateisNone, use the current value from thecacheunless the cache is invalid. IfFalse, never callparameter.get().params_to_skip_update – No effect but may be passed from superclass
- Returns:
base snapshot
- property source: Parameter | None¶
The source parameter that this
DelegateParameteris bound to orNoneif thisDelegateParameteris unbound.- Getter:
Returns the current source.
- Setter:
Sets the source.
- property step: int | float | integer | floating | None¶
Stepsize that this Parameter uses during set operation. Stepsize must be a positive number or None. If step is a positive number, this is the maximum value change allowed in one hardware call, so a single set can result in many calls to the hardware if the starting value is far from the target. All but the final change will attempt to change by +/- step exactly. If step is None stepping will not be used.
- Getter:
Returns the current stepsize.
- Setter:
Sets the value of the step.
- Raises:
TypeError – if step is set to not numeric or None
ValueError – if step is set to negative
TypeError – if step is set to not integer or None for an integer parameter
TypeError – if step is set to not a number on None
- sweep(start: float, stop: float, step: float | None = None, num: int | None = None) SweepFixedValues¶
Create a collection of parameter values to be iterated over. Requires start and stop and (step or num) The sign of step is not relevant.
- Parameters:
start – The starting value of the sequence.
stop – The end value of the sequence.
step – Spacing between values.
num – Number of values to generate.
- Returns:
Collection of parameter values to be iterated over.
- Return type:
SweepFixedValues
Examples
>>> sweep(0, 10, num=5) [0.0, 2.5, 5.0, 7.5, 10.0] >>> sweep(5, 10, step=1) [5.0, 6.0, 7.0, 8.0, 9.0, 10.0] >>> sweep(15, 10.5, step=1.5) >[15.0, 13.5, 12.0, 10.5]
- property underlying_instrument: InstrumentBase | None¶
Returns an instance of the underlying hardware instrument that this parameter communicates with, per this parameter’s implementation.
This is useful in the case where a parameter does not belongs to an instrument instance that represents a real hardware instrument but actually uses a real hardware instrument in its implementation (e.g. via calls to one or more parameters of that real hardware instrument). This is also useful when a parameter does belong to an instrument instance but that instance does not represent the real hardware instrument that the parameter interacts with: hence
root_instrumentof the parameter cannot be thehardware_instrument, howeverunderlying_instrumentcan be implemented to return thehardware_instrument.By default it returns the
root_instrumentof the parameter.
- property unit: str¶
The unit of measure. Read from source if not explicitly overwritten. Set to None to disable overwrite.
- property validators: tuple[Validator, ...]¶
Tuple of all validators associated with the parameter. Note that this includes validators of the source parameter if source parameter is set and has any validators.
- Getter:
All validators associated with the parameter.
- property vals: Validator | None¶
The first validator of the parameter. None if no validators are set for this parameter.
- Getter:
Returns the first validator or None if no validators.
- Setter:
Sets the first validator. Set to None to remove the first validator.
- Raises:
RuntimeError – If removing the first validator when more than one validator is set.
- get_parser¶
- set_parser¶
- cache¶
- get_latest¶
- get¶
- set¶
- metadata¶
- class semi_cr.core.lab.station.nodes.NoneParameter(**kwargs: Any)[source]¶
Bases:
Parameter- __getitem__(keys: Any) SweepFixedValues¶
Slice a Parameter to get a SweepValues object to iterate over during a sweep
- add_validator(vals: Validator) None¶
Add a validator for the parameter. The parameter is validated against all validators in reverse order of how they are added.
- Parameters:
vals – Validator to add to the parameter.
- property depends_on: ParameterSet¶
- extra_validator(vals: Validator) Generator[None, None, None]¶
Contextmanager to to temporarily add a validator to the parameter within the given context. The validator is removed from the parameter when the context ends.
- property full_name: str¶
Name of the parameter including the name of the instrument and submodule that the parameter may be bound to. The names are separated by underscores, like this:
instrument_submodule_parameter.
- get_ramp_values(value: NumberType | Sized, step: NumberType | None = None) Sequence[NumberType | Sized]¶
Return values to sweep from current value to target value. This method can be overridden to have a custom sweep behaviour. It can even be overridden by a generator.
- Parameters:
value – target value
step – maximum step size
- Returns:
List of stepped values, including target value.
- get_raw() Any¶
get_rawis called to perform the actual data acquisition from the instrument. This method should either be overwritten to perform the desired operation or alternatively forParametera suitable method is automatically generated ifget_cmdis supplied to the parameter constructor. The method is automatically wrapped to provide agetmethod on the parameter instance.
- global_on_set_callback = None¶
- property has_control_of: ParameterSet¶
- increment(value: ParameterDataTypeVar) None¶
Increment the parameter with a value
- Parameters:
value – Value to be added to the parameter.
- property instrument: InstrumentTypeVar_co¶
Return the first instrument that this parameter is bound to. E.g if this is bound to a channel it will return the channel and not the instrument that the channel is bound too. Use
root_instrument()to get the real instrument.
- property inter_delay: float¶
Delay time between consecutive set operations. The actual time will not be shorter than this, but may be longer if the underlying set call takes longer.
Typically used in conjunction with step to create an effective ramp rate, but can also be used without a step to enforce a delay between sets.
- Getter:
Returns the current inter_delay.
- Setter:
Sets the value of the inter_delay.
- Raises:
TypeError – If delay is not int nor float
ValueError – If delay is negative
- property is_controlled_by: ParameterSet¶
- load_metadata(metadata: Mapping[str, Any]) None¶
Load metadata into this classes metadata dictionary.
- Parameters:
metadata – Metadata to load.
- property name: str¶
Name of the parameter. This is identical to
short_name().
- property param_spec: ParamSpecBase¶
- property post_delay: float¶
Delay time after start of set operation, for each set. The actual time will not be shorter than this, but may be longer if the underlying set call takes longer.
Typically used in conjunction with step to create an effective ramp rate, but can also be used without a step to enforce a delay after every set. One might think of post_delay as how long a set operation is supposed to take. For example, there might be an instrument that needs extra time after setting a parameter although the command for setting the parameter returns quickly.
- Getter:
Returns the current post_delay.
- Setter:
Sets the value of the post_delay.
- Raises:
TypeError – If delay is not int nor float
ValueError – If delay is negative
- property raw_value: Any¶
Note that this property will be deprecated soon. Use
cache.raw_valueinstead.Represents the cached raw value of the parameter.
- Getter:
Returns the cached raw value of the parameter.
- property register_name: str¶
Name that will be used to register this parameter in a dataset By default, this returns
full_nameor the value of theregister_nameargument if it was passed at initialization.
- remove_validator() Validator | None¶
Remove the last validator added to the parameter and return it. Returns None if there are no validators associated with the parameter.
- Returns:
The last validator added to the parameter or None if there are no validators associated with the parameter.
- restore_at_exit(allow_changes: bool = True) _SetParamContext¶
Use a context manager to restore the value of a parameter after a
withblock.By default, the parameter value may be changed inside the block, but this can be prevented with
allow_changes=False. This can be useful, for example, for debugging a complex measurement that unintentionally modifies a parameter.Example
>>> p = Parameter("p", set_cmd=None, get_cmd=None) >>> p.set(2) >>> with p.restore_at_exit(): ... p.set(3) ... print(f"value inside with block: {p.get()}") # prints 3 >>> print(f"value after with block: {p.get()}") # prints 2 >>> with p.restore_at_exit(allow_changes=False): ... p.set(5) # raises an exception
- property root_instrument: InstrumentBase | None¶
Return the fundamental instrument that this parameter belongs too. E.g if the parameter is bound to a channel this will return the fundamental instrument that that channel belongs to. Use
instrument()to get the channel.
- set_raw(value: Any) None¶
set_rawis called to perform the actual setting of a parameter on the instrument. This method should either be overwritten to perform the desired operation or alternatively forParametera suitable method is automatically generated ifset_cmdis supplied to the parameter constructor. The method is automatically wrapped to provide asetmethod on the parameter instance.
- set_to(value: ParameterDataTypeVar, allow_changes: bool = False) _SetParamContext¶
Use a context manager to temporarily set a parameter to a value. By default, the parameter value cannot be changed inside the context. This may be overridden with
allow_changes=True.Examples
>>> from qcodes.parameters import Parameter >>> p = Parameter("p", set_cmd=None, get_cmd=None) >>> p.set(2) >>> with p.set_to(3): ... print(f"p value in with block {p.get()}") # prints 3 ... p.set(5) # raises an exception >>> print(f"p value outside with block {p.get()}") # prints 2 >>> with p.set_to(3, allow_changes=True): ... p.set(5) # now this works >>> print(f"value after second block: {p.get()}") # still prints 2
- property short_name: str¶
Short name of the parameter. This is without the name of the instrument or submodule that the parameter may be bound to. For full name refer to
full_name().
- snapshot(update: bool | None = False) dict[str, Any]¶
Decorate a snapshot dictionary with metadata. DO NOT override this method if you want metadata in the snapshot instead, override
snapshot_base().- Parameters:
update – Passed to snapshot_base.
- Returns:
Base snapshot.
- snapshot_base(update: bool | None = True, params_to_skip_update: Sequence[str] | None = None) dict[Any, Any]¶
State of the parameter as a JSON-compatible dict (everything that the custom JSON encoder class
NumpyJSONEncodersupports).If the parameter has been initiated with
snapshot_value=False, the snapshot will NOT include thevalueandraw_valueof the parameter.- Parameters:
update – If True, update the state by calling
parameter.get()unlesssnapshot_getof the parameter isFalse. IfupdateisNone, use the current value from thecacheunless the cache is invalid. IfFalse, never callparameter.get().params_to_skip_update – No effect but may be passed from superclass
- Returns:
base snapshot
- property step: int | float | integer | floating | None¶
Stepsize that this Parameter uses during set operation. Stepsize must be a positive number or None. If step is a positive number, this is the maximum value change allowed in one hardware call, so a single set can result in many calls to the hardware if the starting value is far from the target. All but the final change will attempt to change by +/- step exactly. If step is None stepping will not be used.
- Getter:
Returns the current stepsize.
- Setter:
Sets the value of the step.
- Raises:
TypeError – if step is set to not numeric or None
ValueError – if step is set to negative
TypeError – if step is set to not integer or None for an integer parameter
TypeError – if step is set to not a number on None
- sweep(start: float, stop: float, step: float | None = None, num: int | None = None) SweepFixedValues¶
Create a collection of parameter values to be iterated over. Requires start and stop and (step or num) The sign of step is not relevant.
- Parameters:
start – The starting value of the sequence.
stop – The end value of the sequence.
step – Spacing between values.
num – Number of values to generate.
- Returns:
Collection of parameter values to be iterated over.
- Return type:
SweepFixedValues
Examples
>>> sweep(0, 10, num=5) [0.0, 2.5, 5.0, 7.5, 10.0] >>> sweep(5, 10, step=1) [5.0, 6.0, 7.0, 8.0, 9.0, 10.0] >>> sweep(15, 10.5, step=1.5) >[15.0, 13.5, 12.0, 10.5]
- property underlying_instrument: InstrumentBase | None¶
Returns an instance of the underlying hardware instrument that this parameter communicates with, per this parameter’s implementation.
This is useful in the case where a parameter does not belongs to an instrument instance that represents a real hardware instrument but actually uses a real hardware instrument in its implementation (e.g. via calls to one or more parameters of that real hardware instrument). This is also useful when a parameter does belong to an instrument instance but that instance does not represent the real hardware instrument that the parameter interacts with: hence
root_instrumentof the parameter cannot be thehardware_instrument, howeverunderlying_instrumentcan be implemented to return thehardware_instrument.By default it returns the
root_instrumentof the parameter.
- validate(value: ParameterDataTypeVar) None¶
Validate the value supplied.
- Parameters:
value – value to validate
- Raises:
TypeError – If the value is of the wrong type.
ValueError – If the value is outside the bounds specified by the validator.
- property validators: tuple[Validator, ...]¶
Tuple of all validators associated with the parameter.
- Getter:
All validators associated with the parameter.
- property vals: Validator | None¶
The first validator of the parameter. None if no validators are set for this parameter.
- Getter:
Returns the first validator or None if no validators.
- Setter:
Sets the first validator. Set to None to remove the first validator.
- Raises:
RuntimeError – If removing the first validator when more than one validator is set.
- get_parser¶
- set_parser¶
- cache¶
- get_latest¶
- get¶
- set¶
- metadata¶
- class semi_cr.core.lab.station.nodes.Node(name: str = 'Node', parameters: Iterable[Parameter] = ())[source]¶
Bases:
ABC
- class semi_cr.core.lab.station.nodes.Edge(*values)[source]¶
Bases:
Enum- Active = 1¶
- Inactive = 2¶
- Disabled = 3¶
- classmethod __contains__(value)¶
Return True if value is in cls.
value is in cls if: 1) value is a member of cls, or 2) value is the value of one of the cls’s members.
- classmethod __getitem__(name)¶
Return the member matching name.
- classmethod __iter__()¶
Return members in definition order.
- classmethod __len__()¶
Return the number of members (no aliases)
- class semi_cr.core.lab.station.nodes.SingleSourceNode(name: str = 'SingleSourceNode')[source]¶
Bases:
Node
- class semi_cr.core.lab.station.nodes.ForwardingNode(name: str = 'SingleSourceNode')[source]¶
Bases:
SingleSourceNode
- class semi_cr.core.lab.station.nodes.MultiSourceForwardingNode(name: str = 'MultiSourceForwardingNode')[source]¶
Bases:
Node
- class semi_cr.core.lab.station.nodes.CompositeParameter(name: str, **kwargs: Any)[source]¶
Bases:
Parameter- get_raw() Any[source]¶
get_rawis called to perform the actual data acquisition from the instrument. This method should either be overwritten to perform the desired operation or alternatively forParametera suitable method is automatically generated ifget_cmdis supplied to the parameter constructor. The method is automatically wrapped to provide agetmethod on the parameter instance.
- __getitem__(keys: Any) SweepFixedValues¶
Slice a Parameter to get a SweepValues object to iterate over during a sweep
- add_validator(vals: Validator) None¶
Add a validator for the parameter. The parameter is validated against all validators in reverse order of how they are added.
- Parameters:
vals – Validator to add to the parameter.
- property depends_on: ParameterSet¶
- extra_validator(vals: Validator) Generator[None, None, None]¶
Contextmanager to to temporarily add a validator to the parameter within the given context. The validator is removed from the parameter when the context ends.
- property full_name: str¶
Name of the parameter including the name of the instrument and submodule that the parameter may be bound to. The names are separated by underscores, like this:
instrument_submodule_parameter.
- get_ramp_values(value: NumberType | Sized, step: NumberType | None = None) Sequence[NumberType | Sized]¶
Return values to sweep from current value to target value. This method can be overridden to have a custom sweep behaviour. It can even be overridden by a generator.
- Parameters:
value – target value
step – maximum step size
- Returns:
List of stepped values, including target value.
- global_on_set_callback = None¶
- property has_control_of: ParameterSet¶
- increment(value: ParameterDataTypeVar) None¶
Increment the parameter with a value
- Parameters:
value – Value to be added to the parameter.
- property instrument: InstrumentTypeVar_co¶
Return the first instrument that this parameter is bound to. E.g if this is bound to a channel it will return the channel and not the instrument that the channel is bound too. Use
root_instrument()to get the real instrument.
- property inter_delay: float¶
Delay time between consecutive set operations. The actual time will not be shorter than this, but may be longer if the underlying set call takes longer.
Typically used in conjunction with step to create an effective ramp rate, but can also be used without a step to enforce a delay between sets.
- Getter:
Returns the current inter_delay.
- Setter:
Sets the value of the inter_delay.
- Raises:
TypeError – If delay is not int nor float
ValueError – If delay is negative
- property is_controlled_by: ParameterSet¶
- load_metadata(metadata: Mapping[str, Any]) None¶
Load metadata into this classes metadata dictionary.
- Parameters:
metadata – Metadata to load.
- property name: str¶
Name of the parameter. This is identical to
short_name().
- property param_spec: ParamSpecBase¶
- property post_delay: float¶
Delay time after start of set operation, for each set. The actual time will not be shorter than this, but may be longer if the underlying set call takes longer.
Typically used in conjunction with step to create an effective ramp rate, but can also be used without a step to enforce a delay after every set. One might think of post_delay as how long a set operation is supposed to take. For example, there might be an instrument that needs extra time after setting a parameter although the command for setting the parameter returns quickly.
- Getter:
Returns the current post_delay.
- Setter:
Sets the value of the post_delay.
- Raises:
TypeError – If delay is not int nor float
ValueError – If delay is negative
- property raw_value: Any¶
Note that this property will be deprecated soon. Use
cache.raw_valueinstead.Represents the cached raw value of the parameter.
- Getter:
Returns the cached raw value of the parameter.
- property register_name: str¶
Name that will be used to register this parameter in a dataset By default, this returns
full_nameor the value of theregister_nameargument if it was passed at initialization.
- remove_validator() Validator | None¶
Remove the last validator added to the parameter and return it. Returns None if there are no validators associated with the parameter.
- Returns:
The last validator added to the parameter or None if there are no validators associated with the parameter.
- restore_at_exit(allow_changes: bool = True) _SetParamContext¶
Use a context manager to restore the value of a parameter after a
withblock.By default, the parameter value may be changed inside the block, but this can be prevented with
allow_changes=False. This can be useful, for example, for debugging a complex measurement that unintentionally modifies a parameter.Example
>>> p = Parameter("p", set_cmd=None, get_cmd=None) >>> p.set(2) >>> with p.restore_at_exit(): ... p.set(3) ... print(f"value inside with block: {p.get()}") # prints 3 >>> print(f"value after with block: {p.get()}") # prints 2 >>> with p.restore_at_exit(allow_changes=False): ... p.set(5) # raises an exception
- property root_instrument: InstrumentBase | None¶
Return the fundamental instrument that this parameter belongs too. E.g if the parameter is bound to a channel this will return the fundamental instrument that that channel belongs to. Use
instrument()to get the channel.
- set_raw(value: Any) None¶
set_rawis called to perform the actual setting of a parameter on the instrument. This method should either be overwritten to perform the desired operation or alternatively forParametera suitable method is automatically generated ifset_cmdis supplied to the parameter constructor. The method is automatically wrapped to provide asetmethod on the parameter instance.
- set_to(value: ParameterDataTypeVar, allow_changes: bool = False) _SetParamContext¶
Use a context manager to temporarily set a parameter to a value. By default, the parameter value cannot be changed inside the context. This may be overridden with
allow_changes=True.Examples
>>> from qcodes.parameters import Parameter >>> p = Parameter("p", set_cmd=None, get_cmd=None) >>> p.set(2) >>> with p.set_to(3): ... print(f"p value in with block {p.get()}") # prints 3 ... p.set(5) # raises an exception >>> print(f"p value outside with block {p.get()}") # prints 2 >>> with p.set_to(3, allow_changes=True): ... p.set(5) # now this works >>> print(f"value after second block: {p.get()}") # still prints 2
- property short_name: str¶
Short name of the parameter. This is without the name of the instrument or submodule that the parameter may be bound to. For full name refer to
full_name().
- snapshot(update: bool | None = False) dict[str, Any]¶
Decorate a snapshot dictionary with metadata. DO NOT override this method if you want metadata in the snapshot instead, override
snapshot_base().- Parameters:
update – Passed to snapshot_base.
- Returns:
Base snapshot.
- snapshot_base(update: bool | None = True, params_to_skip_update: Sequence[str] | None = None) dict[Any, Any]¶
State of the parameter as a JSON-compatible dict (everything that the custom JSON encoder class
NumpyJSONEncodersupports).If the parameter has been initiated with
snapshot_value=False, the snapshot will NOT include thevalueandraw_valueof the parameter.- Parameters:
update – If True, update the state by calling
parameter.get()unlesssnapshot_getof the parameter isFalse. IfupdateisNone, use the current value from thecacheunless the cache is invalid. IfFalse, never callparameter.get().params_to_skip_update – No effect but may be passed from superclass
- Returns:
base snapshot
- property step: int | float | integer | floating | None¶
Stepsize that this Parameter uses during set operation. Stepsize must be a positive number or None. If step is a positive number, this is the maximum value change allowed in one hardware call, so a single set can result in many calls to the hardware if the starting value is far from the target. All but the final change will attempt to change by +/- step exactly. If step is None stepping will not be used.
- Getter:
Returns the current stepsize.
- Setter:
Sets the value of the step.
- Raises:
TypeError – if step is set to not numeric or None
ValueError – if step is set to negative
TypeError – if step is set to not integer or None for an integer parameter
TypeError – if step is set to not a number on None
- sweep(start: float, stop: float, step: float | None = None, num: int | None = None) SweepFixedValues¶
Create a collection of parameter values to be iterated over. Requires start and stop and (step or num) The sign of step is not relevant.
- Parameters:
start – The starting value of the sequence.
stop – The end value of the sequence.
step – Spacing between values.
num – Number of values to generate.
- Returns:
Collection of parameter values to be iterated over.
- Return type:
SweepFixedValues
Examples
>>> sweep(0, 10, num=5) [0.0, 2.5, 5.0, 7.5, 10.0] >>> sweep(5, 10, step=1) [5.0, 6.0, 7.0, 8.0, 9.0, 10.0] >>> sweep(15, 10.5, step=1.5) >[15.0, 13.5, 12.0, 10.5]
- property underlying_instrument: InstrumentBase | None¶
Returns an instance of the underlying hardware instrument that this parameter communicates with, per this parameter’s implementation.
This is useful in the case where a parameter does not belongs to an instrument instance that represents a real hardware instrument but actually uses a real hardware instrument in its implementation (e.g. via calls to one or more parameters of that real hardware instrument). This is also useful when a parameter does belong to an instrument instance but that instance does not represent the real hardware instrument that the parameter interacts with: hence
root_instrumentof the parameter cannot be thehardware_instrument, howeverunderlying_instrumentcan be implemented to return thehardware_instrument.By default it returns the
root_instrumentof the parameter.
- validate(value: ParameterDataTypeVar) None¶
Validate the value supplied.
- Parameters:
value – value to validate
- Raises:
TypeError – If the value is of the wrong type.
ValueError – If the value is outside the bounds specified by the validator.
- property validators: tuple[Validator, ...]¶
Tuple of all validators associated with the parameter.
- Getter:
All validators associated with the parameter.
- property vals: Validator | None¶
The first validator of the parameter. None if no validators are set for this parameter.
- Getter:
Returns the first validator or None if no validators.
- Setter:
Sets the first validator. Set to None to remove the first validator.
- Raises:
RuntimeError – If removing the first validator when more than one validator is set.
- get_parser¶
- set_parser¶
- cache¶
- get_latest¶
- get¶
- set¶
- metadata¶
- class semi_cr.core.lab.station.nodes.SeriesResistanceParameter(name: str, **kwargs: Any)[source]¶
Bases:
CompositeParameter- get_raw() float[source]¶
get_rawis called to perform the actual data acquisition from the instrument. This method should either be overwritten to perform the desired operation or alternatively forParametera suitable method is automatically generated ifget_cmdis supplied to the parameter constructor. The method is automatically wrapped to provide agetmethod on the parameter instance.
- __getitem__(keys: Any) SweepFixedValues¶
Slice a Parameter to get a SweepValues object to iterate over during a sweep
- add_validator(vals: Validator) None¶
Add a validator for the parameter. The parameter is validated against all validators in reverse order of how they are added.
- Parameters:
vals – Validator to add to the parameter.
- property depends_on: ParameterSet¶
- extra_validator(vals: Validator) Generator[None, None, None]¶
Contextmanager to to temporarily add a validator to the parameter within the given context. The validator is removed from the parameter when the context ends.
- property full_name: str¶
Name of the parameter including the name of the instrument and submodule that the parameter may be bound to. The names are separated by underscores, like this:
instrument_submodule_parameter.
- get_ramp_values(value: NumberType | Sized, step: NumberType | None = None) Sequence[NumberType | Sized]¶
Return values to sweep from current value to target value. This method can be overridden to have a custom sweep behaviour. It can even be overridden by a generator.
- Parameters:
value – target value
step – maximum step size
- Returns:
List of stepped values, including target value.
- global_on_set_callback = None¶
- property has_control_of: ParameterSet¶
- increment(value: ParameterDataTypeVar) None¶
Increment the parameter with a value
- Parameters:
value – Value to be added to the parameter.
- property instrument: InstrumentTypeVar_co¶
Return the first instrument that this parameter is bound to. E.g if this is bound to a channel it will return the channel and not the instrument that the channel is bound too. Use
root_instrument()to get the real instrument.
- property inter_delay: float¶
Delay time between consecutive set operations. The actual time will not be shorter than this, but may be longer if the underlying set call takes longer.
Typically used in conjunction with step to create an effective ramp rate, but can also be used without a step to enforce a delay between sets.
- Getter:
Returns the current inter_delay.
- Setter:
Sets the value of the inter_delay.
- Raises:
TypeError – If delay is not int nor float
ValueError – If delay is negative
- property is_controlled_by: ParameterSet¶
- load_metadata(metadata: Mapping[str, Any]) None¶
Load metadata into this classes metadata dictionary.
- Parameters:
metadata – Metadata to load.
- property name: str¶
Name of the parameter. This is identical to
short_name().
- property param_spec: ParamSpecBase¶
- property post_delay: float¶
Delay time after start of set operation, for each set. The actual time will not be shorter than this, but may be longer if the underlying set call takes longer.
Typically used in conjunction with step to create an effective ramp rate, but can also be used without a step to enforce a delay after every set. One might think of post_delay as how long a set operation is supposed to take. For example, there might be an instrument that needs extra time after setting a parameter although the command for setting the parameter returns quickly.
- Getter:
Returns the current post_delay.
- Setter:
Sets the value of the post_delay.
- Raises:
TypeError – If delay is not int nor float
ValueError – If delay is negative
- property raw_value: Any¶
Note that this property will be deprecated soon. Use
cache.raw_valueinstead.Represents the cached raw value of the parameter.
- Getter:
Returns the cached raw value of the parameter.
- property register_name: str¶
Name that will be used to register this parameter in a dataset By default, this returns
full_nameor the value of theregister_nameargument if it was passed at initialization.
- remove_validator() Validator | None¶
Remove the last validator added to the parameter and return it. Returns None if there are no validators associated with the parameter.
- Returns:
The last validator added to the parameter or None if there are no validators associated with the parameter.
- restore_at_exit(allow_changes: bool = True) _SetParamContext¶
Use a context manager to restore the value of a parameter after a
withblock.By default, the parameter value may be changed inside the block, but this can be prevented with
allow_changes=False. This can be useful, for example, for debugging a complex measurement that unintentionally modifies a parameter.Example
>>> p = Parameter("p", set_cmd=None, get_cmd=None) >>> p.set(2) >>> with p.restore_at_exit(): ... p.set(3) ... print(f"value inside with block: {p.get()}") # prints 3 >>> print(f"value after with block: {p.get()}") # prints 2 >>> with p.restore_at_exit(allow_changes=False): ... p.set(5) # raises an exception
- property root_instrument: InstrumentBase | None¶
Return the fundamental instrument that this parameter belongs too. E.g if the parameter is bound to a channel this will return the fundamental instrument that that channel belongs to. Use
instrument()to get the channel.
- set_raw(value: Any) None¶
set_rawis called to perform the actual setting of a parameter on the instrument. This method should either be overwritten to perform the desired operation or alternatively forParametera suitable method is automatically generated ifset_cmdis supplied to the parameter constructor. The method is automatically wrapped to provide asetmethod on the parameter instance.
- set_to(value: ParameterDataTypeVar, allow_changes: bool = False) _SetParamContext¶
Use a context manager to temporarily set a parameter to a value. By default, the parameter value cannot be changed inside the context. This may be overridden with
allow_changes=True.Examples
>>> from qcodes.parameters import Parameter >>> p = Parameter("p", set_cmd=None, get_cmd=None) >>> p.set(2) >>> with p.set_to(3): ... print(f"p value in with block {p.get()}") # prints 3 ... p.set(5) # raises an exception >>> print(f"p value outside with block {p.get()}") # prints 2 >>> with p.set_to(3, allow_changes=True): ... p.set(5) # now this works >>> print(f"value after second block: {p.get()}") # still prints 2
- property short_name: str¶
Short name of the parameter. This is without the name of the instrument or submodule that the parameter may be bound to. For full name refer to
full_name().
- snapshot(update: bool | None = False) dict[str, Any]¶
Decorate a snapshot dictionary with metadata. DO NOT override this method if you want metadata in the snapshot instead, override
snapshot_base().- Parameters:
update – Passed to snapshot_base.
- Returns:
Base snapshot.
- snapshot_base(update: bool | None = True, params_to_skip_update: Sequence[str] | None = None) dict[Any, Any]¶
State of the parameter as a JSON-compatible dict (everything that the custom JSON encoder class
NumpyJSONEncodersupports).If the parameter has been initiated with
snapshot_value=False, the snapshot will NOT include thevalueandraw_valueof the parameter.- Parameters:
update – If True, update the state by calling
parameter.get()unlesssnapshot_getof the parameter isFalse. IfupdateisNone, use the current value from thecacheunless the cache is invalid. IfFalse, never callparameter.get().params_to_skip_update – No effect but may be passed from superclass
- Returns:
base snapshot
- property step: int | float | integer | floating | None¶
Stepsize that this Parameter uses during set operation. Stepsize must be a positive number or None. If step is a positive number, this is the maximum value change allowed in one hardware call, so a single set can result in many calls to the hardware if the starting value is far from the target. All but the final change will attempt to change by +/- step exactly. If step is None stepping will not be used.
- Getter:
Returns the current stepsize.
- Setter:
Sets the value of the step.
- Raises:
TypeError – if step is set to not numeric or None
ValueError – if step is set to negative
TypeError – if step is set to not integer or None for an integer parameter
TypeError – if step is set to not a number on None
- sweep(start: float, stop: float, step: float | None = None, num: int | None = None) SweepFixedValues¶
Create a collection of parameter values to be iterated over. Requires start and stop and (step or num) The sign of step is not relevant.
- Parameters:
start – The starting value of the sequence.
stop – The end value of the sequence.
step – Spacing between values.
num – Number of values to generate.
- Returns:
Collection of parameter values to be iterated over.
- Return type:
SweepFixedValues
Examples
>>> sweep(0, 10, num=5) [0.0, 2.5, 5.0, 7.5, 10.0] >>> sweep(5, 10, step=1) [5.0, 6.0, 7.0, 8.0, 9.0, 10.0] >>> sweep(15, 10.5, step=1.5) >[15.0, 13.5, 12.0, 10.5]
- property underlying_instrument: InstrumentBase | None¶
Returns an instance of the underlying hardware instrument that this parameter communicates with, per this parameter’s implementation.
This is useful in the case where a parameter does not belongs to an instrument instance that represents a real hardware instrument but actually uses a real hardware instrument in its implementation (e.g. via calls to one or more parameters of that real hardware instrument). This is also useful when a parameter does belong to an instrument instance but that instance does not represent the real hardware instrument that the parameter interacts with: hence
root_instrumentof the parameter cannot be thehardware_instrument, howeverunderlying_instrumentcan be implemented to return thehardware_instrument.By default it returns the
root_instrumentof the parameter.
- validate(value: ParameterDataTypeVar) None¶
Validate the value supplied.
- Parameters:
value – value to validate
- Raises:
TypeError – If the value is of the wrong type.
ValueError – If the value is outside the bounds specified by the validator.
- property validators: tuple[Validator, ...]¶
Tuple of all validators associated with the parameter.
- Getter:
All validators associated with the parameter.
- property vals: Validator | None¶
The first validator of the parameter. None if no validators are set for this parameter.
- Getter:
Returns the first validator or None if no validators.
- Setter:
Sets the first validator. Set to None to remove the first validator.
- Raises:
RuntimeError – If removing the first validator when more than one validator is set.
- get_parser¶
- set_parser¶
- cache¶
- get_latest¶
- get¶
- set¶
- metadata¶