ConversionNode¶
- class samplomatic.samplex.nodes.ConversionNode(existing_name: str, existing_type: VirtualType, new_name: str, new_type: VirtualType, num_subsystems: int, remove_existing: bool)[source]¶
Bases:
EvaluationNodeConverts 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_existingis true.
Attributes Summary
The virtual gate type of outgoing registers.
Methods Summary
evaluate(registers, *_)Evaluate this node.
Return the style of this node when plotted.
Return a manifest of new virtual registers that this node instantiates.
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(registers, *_)[source]¶
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.
- instantiates() dict[str, tuple[int, VirtualType]][source]¶
Return a manifest of new virtual registers that this node instantiates.
Note
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()[source]¶
Return a manifest of which virtual register values this node needs to read from.
- removes() set[str][source]¶
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(register_descriptions)[source]¶
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.