semi_cr.core.lab.station.routing_v1 package

Submodules

semi_cr.core.lab.station.routing_v1.attachment module

class semi_cr.core.lab.station.routing_v1.attachment.RoutedQuantitySpec(name: 'str', quantity_class: 'Type', modality: 'str')[source]

Bases: object

name: str
quantity_class: Type
modality: str
semi_cr.core.lab.station.routing_v1.attachment.quantities_for_pin(pin)[source]
semi_cr.core.lab.station.routing_v1.attachment.attach_routed_pin_quantities(graph: MultiDiGraph, device: PinnedDevice, replace: bool = False) None[source]

Attach the routed quantities supported by each device pin.

Parameters:
  • graph – Effective station graph used for route resolution.

  • device – Device whose pins receive routed quantities.

  • replace – If False, preserve quantities already attached to a pin. If True, rebuild them using the supplied graph.

semi_cr.core.lab.station.routing_v1.conversions module

class semi_cr.core.lab.station.routing_v1.conversions.ConvertedVoltageQuantity(instrument_voltage, conversion_factor: float)[source]

Bases: object

Device-side voltage quantity backed by an instrument-side voltage source.

Convention:

V_device = conversion_factor * V_instrument

set(device_voltage: float) None[source]

Set the desired voltage at the device.

The required instrument voltage is calculated automatically.

get() float[source]

Return the instrument readback expressed as device-side voltage.

class semi_cr.core.lab.station.routing_v1.conversions.CurrentFromTransimpedanceVoltage(voltage: Any, transimpedance_gain: Callable[[], float])[source]

Bases: object

voltage: Any
transimpedance_gain: Callable[[], float]
measure() float[source]
semi_cr.core.lab.station.routing_v1.conversions.attach_converted_voltage_quantity(device, source_pin_name: str = 'source', voltage_quantity_name: str = 'dc_voltage', conversion_module=None) None[source]

Replace the source’s public voltage quantity with a device-side, converted voltage quantity while preserving the original routed instrument voltage.

semi_cr.core.lab.station.routing_v1.conversions.attach_transimpedance_current_quantity(device, drain_pin_name: str = 'drain', voltage_quantity_name: str = 'dc_voltage', transimpedance_module=None)[source]

semi_cr.core.lab.station.routing_v1.dc module

semi_cr.core.lab.station.routing_v1.dc.find_voltage_source_for_pin(graph: MultiDiGraph, device, pin_name: str) VoltageSource[source]
semi_cr.core.lab.station.routing_v1.dc.find_voltage_meter_for_pin_pair(graph: MultiDiGraph, device, high_pin: str, low_pin: str, mode: str = '2probe') RoutedVoltageMeter[source]
semi_cr.core.lab.station.routing_v1.dc.find_current_source_for_pin(graph: MultiDiGraph, device, pin_name: str) CurrentSource[source]
semi_cr.core.lab.station.routing_v1.dc.find_current_meter_for_pin(graph: MultiDiGraph, device, pin_name: str) CurrentMeter[source]
semi_cr.core.lab.station.routing_v1.dc.find_voltage_source_for_method(graph: MultiDiGraph, device, profile_name: str, method_name: str)[source]
semi_cr.core.lab.station.routing_v1.dc.find_voltage_meter_for_method(graph: MultiDiGraph, device, profile_name: str, method_name: str) RoutedVoltageMeter[source]
semi_cr.core.lab.station.routing_v1.dc.find_current_meter_for_method(graph: MultiDiGraph, device, profile_name: str, method_name: str)[source]

semi_cr.core.lab.station.routing_v1.errors module

exception semi_cr.core.lab.station.routing_v1.errors.RoutingError[source]

Bases: Exception

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception semi_cr.core.lab.station.routing_v1.errors.PinNotInGraphError[source]

Bases: RoutingError

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception semi_cr.core.lab.station.routing_v1.errors.NoRouteError[source]

Bases: RoutingError

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception semi_cr.core.lab.station.routing_v1.errors.AmbiguousRouteError[source]

Bases: RoutingError

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception semi_cr.core.lab.station.routing_v1.errors.BackendResolutionError[source]

Bases: RoutingError

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception semi_cr.core.lab.station.routing_v1.errors.IncompatibleRouteError[source]

Bases: RoutingError

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception semi_cr.core.lab.station.routing_v1.errors.RoutingValidationError[source]

Bases: RoutingError

Raised when a station graph does not satisfy the routing contract.

add_note()

Exception.add_note(note) – add a note to the exception

args
with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

semi_cr.core.lab.station.routing_v1.graph module

semi_cr.core.lab.station.routing_v1.graph.edge_supports_modality(data: dict[str, Any], modality: str | None) bool[source]
semi_cr.core.lab.station.routing_v1.graph.is_routable_edge(attrs: dict[str, Any]) bool[source]
semi_cr.core.lab.station.routing_v1.graph.edge_is_available(attrs: dict[str, Any], include_configurable: bool) bool[source]

Return whether an edge can participate in route discovery.

Ordinary static edges are always available.

Configurable edges are available when: - they are currently active; or - configurable alternatives were explicitly requested.

semi_cr.core.lab.station.routing_v1.graph.build_routing_graph(graph: MultiDiGraph, modality: str | None = None, include_configurable: bool = False) Graph[source]

Build an undirected routable view of the station graph.

Parameters:
  • graph – Complete station graph.

  • modality – Required signal modality, such as "dc", "ac", or "rf". If None, no modality filtering is performed.

  • include_configurable – If False, include only currently active connections. If True, also include inactive connections that can be activated through a configurable routing component such as the CQCC switch.

Returns:

Undirected routing view containing only usable or configurable routing connections.

Return type:

nx.Graph

semi_cr.core.lab.station.routing_v1.integration module

class semi_cr.core.lab.station.routing_v1.integration.RoutingIntegrationResult(graph: 'nx.MultiDiGraph', devices: 'tuple[PinnedDevice, ...]', validation: 'RoutingValidationReport')[source]

Bases: object

graph: MultiDiGraph
devices: tuple[PinnedDevice, ...]
validation: RoutingValidationReport
semi_cr.core.lab.station.routing_v1.integration.initialize_device_routing(graph: MultiDiGraph, device: PinnedDevice, *, replace: bool = False, validate: bool = True) RoutingIntegrationResult[source]

Validate the station graph and attach routed quantities to one device.

semi_cr.core.lab.station.routing_v1.integration.initialize_station_routing(graph: MultiDiGraph, devices: Iterable[PinnedDevice], *, replace: bool = False, validate: bool = True) RoutingIntegrationResult[source]

Initialize routed quantities for a collection of devices.

Validation occurs before mutation so an invalid graph does not leave some devices partially initialized.

semi_cr.core.lab.station.routing_v1.matching module

class semi_cr.core.lab.station.routing_v1.matching.Capability(*values)[source]

Bases: StrEnum

VOLTAGE_SOURCE = 'voltage_source'
VOLTAGE_METER = 'voltage_meter'
CURRENT_SOURCE = 'current_source'
CURRENT_METER = 'current_meter'
RF_SOURCE = 'rf_source'
IQ_RECEIVER = 'iq_receiver'
DIGITAL_TRIGGER = 'digital_trigger'
__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.

semi_cr.core.lab.station.routing_v1.matching.requested_capability(role: str, quantity: str | None) Capability | str[source]

semi_cr.core.lab.station.routing_v1.models module

class semi_cr.core.lab.station.routing_v1.models.RouteRequest(pin: semi_cr.core.lab.pins.base.BasePinChannel, role: str, quantity: str | None = None, modality: str | None = None)[source]

Bases: object

pin: BasePinChannel
role: str
quantity: str | None = None
modality: str | None = None
class semi_cr.core.lab.station.routing_v1.models.Routable[source]

Bases: ABC

abstract property graph: MultiDiGraph
class semi_cr.core.lab.station.routing_v1.models.ConnectionRoutable[source]

Bases: Routable

property connections: tuple[dict[str, Any], ...]
property graph: MultiDiGraph
class semi_cr.core.lab.station.routing_v1.models.RouteAction(instrument: object, parameter: str, value: object)[source]

Bases: object

instrument: object
parameter: str
value: object
class semi_cr.core.lab.station.routing_v1.models.RouteEdge(source: str, target: str, key: object, attributes: dict[str, Any])[source]

Bases: object

source: str
target: str
key: object
attributes: dict[str, Any]
class semi_cr.core.lab.station.routing_v1.models.RoutePlan(device_pin: semi_cr.core.lab.pins.base.BasePinChannel, terminal: object, path: tuple[object, ...], actions: tuple[semi_cr.core.lab.station.routing_v1.models.RouteAction, ...])[source]

Bases: object

device_pin: BasePinChannel
terminal: object
path: tuple[object, ...]
actions: tuple[RouteAction, ...]
class semi_cr.core.lab.station.routing_v1.models.Route(request: semi_cr.core.lab.station.routing_v1.models.RouteRequest, target_node: str, path: tuple[str, ...])[source]

Bases: object

request: RouteRequest
target_node: str
path: tuple[str, ...]

semi_cr.core.lab.station.routing_v1.profiles module

semi_cr.core.lab.station.routing_v1.profiles.find_rf_source_for_method(context: StationContext, device: TankInductor | Multiplexer, profile_name: str, method_name: str, subprofile_name: str | None = None) OPXRFSource[source]
semi_cr.core.lab.station.routing_v1.profiles.find_iq_receiver_for_method(context: StationContext, device: TankInductor | Multiplexer, profile_name: str, method_name: str) OPXIQReceiver[source]
semi_cr.core.lab.station.routing_v1.profiles.find_iq_receivers_for_method(context: StationContext, device: Multiplexer, profile_name: str, method_name: str, subprofile_name: str | None = None) dict[str, OPXIQReceiver][source]

semi_cr.core.lab.station.routing_v1.quantities module

class semi_cr.core.lab.station.routing_v1.quantities.RoutedVoltage(graph: nx.MultiDiGraph, pin: BasePinChannel, modality: str)[source]

Bases: object

property source
property readback_parameter
property meter
set(value: float) None[source]
get()[source]
readback() float[source]
measure() float[source]
invalidate() None[source]

Discard cached backend parameters.

The next operation resolves the route again. This is needed after station reconnection, graph reconstruction, or configurable-routing changes.

class semi_cr.core.lab.station.routing_v1.quantities.RoutedCurrent(graph: nx.MultiDiGraph, pin: BasePinChannel, modality: str)[source]

Bases: object

property source
property readback_parameter
property meter
set(value: float) None[source]
get()[source]
readback() float[source]
measure() float[source]
invalidate() None[source]

Discard cached backend parameters.

The next operation resolves the route again. This is needed after station reconnection, graph reconstruction, or configurable-routing changes.

class semi_cr.core.lab.station.routing_v1.quantities.CurrentFromTransimpedanceVoltage(voltage: 'Any', transimpedance_gain: 'Callable[[], float]')[source]

Bases: object

voltage: Any
transimpedance_gain: Callable[[], float]
measure() float[source]
class semi_cr.core.lab.station.routing_v1.quantities.RoutedRFDrive(graph: nx.MultiDiGraph, pin: RFInput, modality: str = 'rf')[source]

Bases: object

property source
property port
property intermediate_frequency
property frequency
property amplitude
property readout_pulse
update_frequency(frequency)[source]
class semi_cr.core.lab.station.routing_v1.quantities.RoutedIQReceiver(graph: nx.MultiDiGraph, pin: RFInput, modality: str = 'rf')[source]

Bases: object

property receiver
property port
property time_of_flight
class semi_cr.core.lab.station.routing_v1.quantities.RoutedRFFrequency(graph, pin, modality='rf')[source]

Bases: object

set(frequency)[source]
class semi_cr.core.lab.station.routing_v1.quantities.RoutedPulseAmplitude(graph: nx.MultiDiGraph, pin: BasePinChannel, modality='rf')[source]

Bases: object

set(amplitude)[source]
get()[source]

Return the current QUA amplitude scale.

This is protocol-construction state, not a physical hardware readback.

reset() None[source]

semi_cr.core.lab.station.routing_v1.queries module

semi_cr.core.lab.station.routing_v1.queries.node_supports_role(data: dict[str, Any], role: str, quantity: str | None = None) bool[source]

Determine whether a graph node supplies the requested capability.

The new capabilities representation is authoritative whenever present. The legacy role attribute is only consulted when the node has no capabilities attribute.

semi_cr.core.lab.station.routing_v1.queries.node_matches_filters(data: dict[str, Any], filters: dict[str, Any]) bool[source]

Check node attributes against routing filters.

Singular query quantity is matched against the newer plural node attribute quantities when available.

semi_cr.core.lab.station.routing_v1.queries.find_device_pin_node(graph: MultiDiGraph, device, pin_name: str) str[source]

Find the graph node representing one of a device’s pins.

Object identity is used deliberately. Two different pin objects that happen to compare equal must not be treated as the same physical pin.

semi_cr.core.lab.station.routing_v1.queries.find_pin_node(graph: MultiDiGraph, pin: object) str[source]

Find the graph node representing a specific pin object.

semi_cr.core.lab.station.routing_v1.queries.electrical_net_for_pin(graph: MultiDiGraph, device: object, pin_name: str, modality: str = 'dc') set[str][source]
semi_cr.core.lab.station.routing_v1.queries.find_pin_route_to_role(graph: MultiDiGraph, device: object, pin_name: str, role: str, **filters: Any) list[str][source]

Compatibility wrapper around find_route().

New code should construct a RouteRequest directly.

semi_cr.core.lab.station.routing_v1.queries.find_route(graph: MultiDiGraph, request: RouteRequest) Route[source]

Find an unambiguous route satisfying a routing request.

Raises:
semi_cr.core.lab.station.routing_v1.queries.represented_objects_for_node(graph: MultiDiGraph, node: str) Iterator[Any][source]

Yield objects attached through incoming or outgoing represents edges.

semi_cr.core.lab.station.routing_v1.queries.objects_on_electrical_net(graph: MultiDiGraph, device: object, pin_name: str, modality: str = 'dc') list[Any][source]
semi_cr.core.lab.station.routing_v1.queries.objects_reachable_from_device(graph: MultiDiGraph, device: PinnedDevice, modality: str | None = None, include_configurable: bool = False) list[Any][source]
semi_cr.core.lab.station.routing_v1.queries.find_instruments(graph: MultiDiGraph, instrument_type: type[InstrumentBase] | None = None) list[InstrumentBase][source]
semi_cr.core.lab.station.routing_v1.queries.find_instruments_for_device(graph: MultiDiGraph, device: PinnedDevice, instrument_type: type[InstrumentBase] | None = None, modality: str | None = None, include_configurable: bool = False) list[InstrumentBase][source]
semi_cr.core.lab.station.routing_v1.queries.resolve_synchronization_config(device: Any, method: str) Any | None[source]

Find synchronization configuration belonging to a measurement method.

semi_cr.core.lab.station.routing_v1.queries.objects_in_pin_route_with_attr(graph: MultiDiGraph, device, pin_name: str, attr_name: str) list[Any][source]

semi_cr.core.lab.station.routing_v1.resolution module

semi_cr.core.lab.station.routing_v1.resolution.find_backend_parameter_for_pin(graph: nx.MultiDiGraph, device: PinnedDevice, pin_name: str, role: str, parameter_name: str, quantity: str | None = None, modality: str | None = None) Parameter[source]

Find a route from a device pin and resolve a QCoDeS parameter from that route.

semi_cr.core.lab.station.routing_v1.resolution.find_backend_object_for_pin(graph: nx.MultiDiGraph, device: PinnedDevice, pin_name: str, role: str, *, quantity: str | None = None, modality: str | None = None) object[source]

Find a route from a device pin and return its runtime backend object.

semi_cr.core.lab.station.routing_v1.resolution.resolve_backend_object(graph: MultiDiGraph, route: Route) object[source]

Resolve the runtime backend object represented by a route.

The target node is authoritative: route discovery is responsible for selecting a target node that provides the requested capability.

semi_cr.core.lab.station.routing_v1.resolution.resolve_parameter(graph: MultiDiGraph, route: Route, parameter_name: str) Parameter[source]

Resolve a QCoDeS parameter from objects attached to a route.

Nodes are inspected from the route target back toward the device pin. This supports graphs where the runtime object is attached to the backend node itself or to an adjacent represented node.

semi_cr.core.lab.station.routing_v1.validation module

class semi_cr.core.lab.station.routing_v1.validation.ValidationSeverity(*values)[source]

Bases: StrEnum

ERROR = 'error'
WARNING = 'warning'
__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.routing_v1.validation.ValidationIssue(code: 'str', message: 'str', severity: 'ValidationSeverity', node: 'object | None' = None, edge: 'tuple[object, object, object] | None' = None)[source]

Bases: object

code: str
message: str
severity: ValidationSeverity
node: object | None = None
edge: tuple[object, object, object] | None = None
class semi_cr.core.lab.station.routing_v1.validation.RoutingValidationReport(issues: 'tuple[ValidationIssue, ...]')[source]

Bases: object

issues: tuple[ValidationIssue, ...]
property errors: tuple[ValidationIssue, ...]
property warnings: tuple[ValidationIssue, ...]
property is_valid: bool
raise_for_errors() None[source]
semi_cr.core.lab.station.routing_v1.validation.validate_routing_graph(graph: MultiDiGraph) RoutingValidationReport[source]

Validate the graph structure required by routing.

Validation checks graph metadata and internal consistency. It does not require every device pin to have a route because unrouted pins may be legitimate.

Module contents