finesse.components.node module

Objects for connecting and registering connections between components.

class finesse.components.node.ElectricalPort(name: str, component, node_type: NodeType = NodeType.ELECTRICAL, input: bool = True, input_unit: str = 'W', output: bool = True, output_unit: str = 'W')[source]

Bases: Port

class finesse.components.node.MechanicalPort(name, component, node_type=NodeType.MECHANICAL)[source]

Bases: Port

class finesse.components.node.Node(name, port, node_type, direction, unit: str)[source]

Bases: object

Represents a specific connection at a component.

Mathematically a node represents a single equation in the interferometer matrix.

A node can only be owned by a single component instance - with weak references stored by the connected components.

Parameters

namestr

Name of newly created node.

componentPort

The port that this node belongs to.

node_typeNodeType

Physical node type.

property component: ModelElement[source]

The component which has ownership of this node.

Getter:

Returns the component that this node belongs to (read-only).

property connections[source]

Connections of this node.

Getter:

Returns a collection of Space, Wire, or DegreeOfFreedom objects attached to this node (read-only).

property direction[source]

NodeDirection of this node.

This is largely a description to help understand how external information flow in and out of a component. Inside a component all nodes will couple to one another in more complex ways.

Input nodes are those going into a component, whereas output describe those leaving. For example incident and reflected light fields.

Bidrectional takes information either direction. For example a mechanical degree of freedom, external forces can be applied to it, or its motion can be coupled to some external system.

Getter:

Returns the directionality of the node (read-only).

property full_name[source]

Full name.

Getter:

Returns a full name of the node: {component name}.{port name}.{node name}

property is_input[source]

Flag indicating whether this node is an input to the associated component.

Getter:

Returns True if the field at this node goes into self.component (read-only).

is_neighbour(node)[source]

Checks if node is a connected by an edge to this node.

Parameters

nodeNode

Node with which to check connection.

Returns

flagbool

True if node is connected to this node, False otherwise.

property name[source]

Name of the node object.

Getter:

Returns the name of the node (read-only).

property port: Port[source]

Port this node is attached to.

Getter:

Returns the port of this node (read-only).

property port_name[source]

Port name.

Getter:

Returns a shortened name of the node: {port name}.{node name}

property tag[source]

Tagged name of the node object.

Getter:

Returns the tagged (user-defined) name of the node (read-only).

property type[source]

NodeType of the node object.

Getter:

Returns the node-type of the node (read-only).

property unit[source]
class finesse.components.node.NodeDirection(*values)[source]

Bases: Enum

Enum describing the direction that information at a Node flows.

This is largely a description to help understand how external information flows in and out of a component. Inside a component all nodes will couple to one another in more complex ways.

Input nodes are those going into a component, whereas output describe those leaving. For example incident and reflected light fields.

Bidrectional takes information either direction. For example a mechanical degree of freedom, external forces can be applied to it, or its motion can be coupled to some external system.

BIDIRECTIONAL = 2
INPUT = 0
OUTPUT = 1
class finesse.components.node.NodeType(*values)[source]

Bases: Enum

Enum describing the physical connection type of a Node

ELECTRICAL = 1
MECHANICAL = 2
OPTICAL = 0
class finesse.components.node.OpticalNode(name, port, direction, unit: str = 'sqrt(W)')[source]

Bases: Node

Represents a specific optical port connection at a component.

OpticalNodes also have additional physical properties such as the beam parameter (of type BeamParam) at the nodes’ position within the interferometer.

Parameters

namestr

Name of the optical node.

portPort

The port that this node belongs to.

directionNodeDirection

True if the field at this node is going into the component.

static get_opposite_direction(node)[source]

Returns the opposite direction of a node from either a Node object or a full string name qualifier for a node, component.port.direction l1.p1.o.

Parameters

node[str | Node]

Node to invert

property opposite[source]

The opposite direction node.

Getter:

Returns the opposite direction node to this one.

property q[source]

Beam parameter value at this node.

Getter:

Returns the beam parameter at this node. If the beam parameters in the tangential and sagittal planes are different then it returns a tuple of the two parameters.

Setter:

Sets the beam parameter at this node. If the argument provided is a 2-tuple then the parameter is set astigmatically for the node.

property qx[source]

Beam parameter value in the tangential plane.

Getter:

Returns the beam parameter at the node in the tangential plane.

Setter:

Sets the beam parameter at the node in the tangential plane.

property qy[source]

Beam parameter value in the sagittal plane.

Getter:

Returns the beam parameter at the node in the sagittal plane.

Setter:

Sets the beam parameter at the node in the sagittal plane.

property space[source]

A reference to the Space object attached to this node.

Getter:

Returns a reference to the Space object attached to the node (read-only).

class finesse.components.node.OpticalPort(name: str, component, node_type: NodeType = NodeType.OPTICAL, input: bool = True, output: bool = True)[source]

Bases: Port

class finesse.components.node.Port(name, component, node_type)[source]

Bases: Freezable

A collection of all the nodes at a specific point/surface of a component.

Parameters

namestr

Name of newly created node.

componentSub-class of Connector

The component that this node belongs to.

node_typeNodeType

Physical node type.

property attached_to[source]

Components that this port is attached to. Optical ports are only ever connected to Space elements. Ports containing signal nodes can have multiple connections and returns a Set.

Getter:

Returns the component this port is attached to, or returns None if no such connected component exists. Signal ports return a Set of components attached (read-only).

property component: ModelElement[source]

The component which has ownership of this port.

Getter:

Returns the component that this port belongs to (read-only).

property enabled[source]
property full_name: str[source]
Getter:

Returns a full name of the port: {component name}.{port name}

get_unique_node(predicate: Callable[[Node], bool])[source]

Returns the unique node at this port that satisfies the provided predicate. If multiple nodes satisfy this predicate then a RuntimeError is raised.

Parameters

predicateCallable[[Node], bool]

A callable that accepts a Node and returns a boolean value

Examples

Selecting a unique output node:

port.get_unique_node(lambda node: not node.is_input)

property is_connected[source]

Flag indicating whether the port is attached to another component.

Getter:

Returns true if this port is attached to another component (read-only).

mechanical_connection: MechanicalConnector | None
property name[source]

Name of the port object.

Getter:

Returns the name of the port (read-only).

node(name)[source]

Get a node at this port by its name.

property nodes: tuple[Node, ...][source]

Nodes associated with the port.

Getter:

Returns a tuple of the associated nodes at this port (read-only).

property refractive_index[source]

If the port is an Optical port, this will return a symbolic value for the refractive index at this port. The refractive index is set by the Space elements that are attached to it.

Returns

nrSymbol

Symbolic value for refractive index

property space[source]

Space that the port is attached to. Equivalent to Port.attached_to.

Getter:

Returns the space that this port is attached to (read-only).

property type[source]

NodeType of the port object.

Getter:

Returns the node-type of the port (read-only).

class finesse.components.node.SignalNode(name, port, direction, node_type, unit: str = 'n/a')[source]

Bases: Node

Represents a specific small signal degree of freedom. A signal is some small AC oscillation in some property, such as longitudinal motion, voltage, laser amplitude, etc.

Parameters

namestr

Name of the mechanical motion.

portPort

The port that this node belongs to.

num_frequenciesint

Number of mechanical frequencies to model

property frequencies[source]
property num_frequencies[source]