Node

class samplomatic.samplex.nodes.Node[source]

Bases: object

Parent class for samplex node operations.

Attributes Summary

num_parameters

The number of parameter values this node requires at sampling time.

outgoing_register_type

The virtual gate type of outgoing registers.

parameter_idxs

Which evaluated parameter expressions this node needs access to at sampling time.

Methods Summary

get_style()

Return the style of this node when plotted.

instantiates()

Return a manifest of new virtual registers that this node instantiates.

outputs_to()

Return the set of names of outputs this node mutates.

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.

writes_to()

Return a manifest of which virtual register values this node needs to write to.

Attributes Documentation

num_parameters

The number of parameter values this node requires at sampling time.

outgoing_register_type

The virtual gate type of outgoing registers.

parameter_idxs

Which evaluated parameter expressions this node needs access to at sampling time.

Methods Documentation

get_style() NodeStyle[source]

Return the style of this node when plotted.

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() or writes_to() for an instantiated register, these powers are implicit.

outputs_to() set[str][source]

Return the set of names of outputs this node mutates.

reads_from() dict[str, tuple[set[int], VirtualType]][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: dict[str, tuple[int, VirtualType]])[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.

writes_to() dict[str, tuple[set[int], VirtualType]][source]

Return a manifest of which virtual register values this node needs to write to.