ConversionNode
class samplomatic.samplex.nodes.ConversionNode(existing_name: str, existing_type: VirtualType, new_name: str, new_type: VirtualType, num_subsystems: int, remove_existing: bool)
Bases: EvaluationNode
Converts a node from one type to another.
Parameters
- existing_name – The name of the register to convert.
- existing_type – The type of the register to convert.
- new_name – The name of the the converted register, possibly equal to
existing_name. - new_type – The type to convert to.
- num_subsystems – The number of subsystems in the register to convert.
- remove_existing – Whether to remove the existing register following conversion.
Raises
SamplexConstructionError – If the names are the same, and remove_existing is true.
Attributes Summary
Column 1 | Column 2 |
|---|---|
outgoing_register_type | The virtual gate type of outgoing registers. |
Methods Summary
Column 1 | Column 2 |
|---|---|
evaluate(registers, *_) | Evaluate this node. |
get_style() | Return the style of this node when plotted. |
instantiates() | Return a manifest of new virtual registers that this node instantiates. |
reads_from() | Return a manifest of which virtual register values this node needs to read from. |
removes() | Return a manifest of virtual registers that this node removes. |
validate_and_update(register_descriptions) | Validate provided register descriptions are compatible, update with changes. |
Attributes Documentation
outgoing_register_type
Methods Documentation
evaluate
evaluate(registers, *_)
Evaluate this node.
Parameters
- registers – At least those registers needed by this node to read from or write to.
- parameter_values – Parameter values to use during evaluation.
Raises
SamplexRuntimeError – If the number of parameter values received does not equal the number required by this node.
get_style
instantiates
instantiates() → dict[str, tuple[int, VirtualType]]
Return a manifest of new virtual registers that this node instantiates.
- To change the type or size of a register, both instantiate and remove it.
- Do not specify
reads_from()orwrites_to()for an instantiated register, these powers are implicit.
reads_from
removes
removes() → set[str]
Return a manifest of virtual registers that this node removes.
It is assumed that registers are removed as a last step; it is not ill-defined to read and write from a removed register.
validate_and_update
validate_and_update(register_descriptions)
Validate provided register descriptions are compatible, update with changes.
This method can be used by a samplex to determine when a node execution order has well-defined dependencies before sampling begins.
Parameters
register_descriptions – A map from existing register names to their size and type.