graph.py: Graphing tools

Various objects for visually representing quantum networks

class simba.graph.ConnectionType(value)[source]

Represents a connection between two main modes in the setup.

It can either be beamsplitter-like (i.e. \hat{a}\hat{b}^\dagger + \hat{a}^\dagger\hat{b}) or non-energy conserving squeezing-style interaction (i.e. \hat{a}\hat{b} + \hat{a}^\dagger\hat{b}^\dagger).

class simba.graph.Connection(index: int, connection_type: simba.graph.ConnectionType)[source]

Represents a single connection to the node at given index (starting at zero).

class simba.graph.Internal(value)[source]

Represents the type of internal dynamics of the system.

class simba.graph.Node(internal=Internal.TUNED)[source]

Represents a single generalised open oscillator.

self.connections is a list of Connection to other generalised open oscillators, not including the series connection self.self_connections is a set of ConnectionType for connecting this node to itself, for realising the K matrix

get_connections_to(index: int) set[source]

Filter for set of ConnectionType to the Node with given index.

property is_series_connected: bool

If the auxiliary mode is not coupled to the main mode, then the main mode is not connected to the series connections, so we can ignore it in the series connections.

__str__() str[source]

Return str(self).

class simba.graph.Nodes(nodes: Optional[List[simba.graph.Node]] = None)[source]

List of Nodes connected in series, indexes starting at zero.

__iter__()[source]
__str__()[source]

Return str(self).

as_graphviz_agraph()[source]

Convert to a pygraphviz.AGraph object for display.

simba.graph.nodes_from_dofs(gs, h_d) simba.graph.Nodes[source]

Construct the Node graph for an n degree-of-freedom generalised open oscillator :param gs: list of n 1-dof generalised open oscillators :param h_d: the direct interaction Hamiltonian matrix :return: a Nodes instance

simba.graph.nodes_from_network(network: simba.core.SplitNetwork) simba.graph.Nodes[source]

Call nodes_from_dofs with contents of network.

simba.graph.transfer_function_to_graph(tf, filename, *, layout='neato')[source]

Directly convert SISO transfer function to graph.

Examples:

>>>from sympy import symbols >>>s = symbols(‘s’) >>>gamma = symbols(‘gamma’, real=True, positive=True) >>>tf = (s - gamma) / (s + gamma) >>>transfer_function_to_graph(tf, ‘unstable-filter.pdf’)