finesse.tracing package

Submodules

finesse.tracing.abcd module

Collection of ABCD functions for standard optical components.

finesse.tracing.abcd.beamsplitter_refl_s(Rc, alpha, nr=1)

Sagittal (perpendicular plane-of-incidence) reflection from a curved surface at a non-normal angle of incidence. Due to coordinate system change on reflection the sagittal plane is reflected (parity operation) and an additional minus sign is applied.

Parameters

Rcfloat

Radius of curvature of the surface being reflected from. A positive Rc means the surface appears concave to the incident beam.

alphafloat

Angle of incidence in degrees

nrfloat

refractive index of medium the reflection occurs in

Notes

See [17], table 15.1(d) and “Ray Inversion” section in 15.1

finesse.tracing.abcd.beamsplitter_refl_t(Rc, alpha, nr=1)

Tangential (in plane-of-incidence)reflection from a curved surface at a non- normal angle of incidence. Due to coordinate system change on reflection the sagittal plane is reflected (parity operation) and an additional minus sign is applied.

Parameters

Rcfloat

Radius of curvature of the surface being reflected from. A positive Rc means the surface appears concave to the incident beam.

alphafloat

Angle of incidence in degrees

nrfloat

refractive index of medium the reflection occurs in

Notes

See [17], table 15.1(d) and “Ray Inversion” section in 15.1

finesse.tracing.abcd.beamsplitter_trans_s(Rc, alpha, nr1=1, nr2=1)

Sagittal (perpendicular plane-of-incidence) transmission through a curved surface at an angle of incidence.

Parameters

Rcfloat

Radius of curvature of the surface being reflected from. A positive Rc means the surface appears concave to the incident beam.

alphafloat

Angle of incidence in degrees

nr1float

refractive index of medium the beam starts in

nr2float

refractive index of medium the beam ends up in

Notes

See [17], table 15.1(g)

finesse.tracing.abcd.beamsplitter_trans_t(Rc, alpha, nr1=1, nr2=1)

Tangential (in plane-of-incidence) transmission through a curved surface at an angle of incidence.

Parameters

Rcfloat

Radius of curvature of the surface being reflected from. A positive Rc means the surface appears concave to the incident beam.

alphafloat

Angle of incidence in degrees

nr1float

refractive index of medium the beam starts in

nr2float

refractive index of medium the beam ends up in

Notes

See [17], table 15.1(f)

finesse.tracing.abcd.lens(f)

Propagation through a thin lens.

Parameters

ffloat

Focal lenth of thin lens in metres

Notes

See [17], table 15.1(b)

finesse.tracing.abcd.mirror_refl_s(Rc, nr=1)

Sagittal (perpendicular plane-of-incidence) reflection from a curved surface.

Parameters

Rcfloat

Radius of curvature of the surface being reflected from. A positive Rc means the surface appears concave to the incident beam.

nrfloat

refractive index of medium in which the reflection occurs

Notes

See [17], table 15.1(c)

finesse.tracing.abcd.mirror_refl_t(Rc, nr=1)

Tangential (in plane-of-incidence) reflection from a curved surface. Due to coordinate system change on reflection the sagittal plane is reflected (parity operation) and an additional minus sign is applied.

Parameters

Rcfloat

Radius of curvature of the surface being reflected from. A positive Rc means the surface appears concave to the incident beam.

nrfloat

refractive index of medium in which the reflection occurs

Notes

See [17], table 15.1(c) and “Ray Inversion” section in 15.1

finesse.tracing.abcd.mirror_trans(Rc, nr1=1, nr2=1)

Transmission through a curved surface.

Parameters

Rcfloat

Radius of curvature of the surface being reflected from. A positive Rc means the surface appears concave to the incident beam.

nr1float

refractive index of medium the beam starts in

nr2float

refractive index of medium the beam ends up in

Notes

See [17], table 15.1(e)

finesse.tracing.abcd.none()

Unit matrix for no propagation.

finesse.tracing.abcd.space(L, nr=1)

Propagation along a physical length L

Parameters

Lfloat

Length in metres

nrfloat

refractive index of medium

Notes

See [17], table 15.1(a)

finesse.tracing.cytools module

Internal Cythonised tools for performing the calculations required by each function in tracing.tools.

Note that the functions documented here are typically only to be used as a developer reference. Users should instead refer to tracing.tools for the Python functions which provide beam propagation tools which return useful solution objects.

finesse.tracing.cytools.compute_numeric_abcd(TraceTree last_branch, str direction) ndarray
finesse.tracing.cytools.compute_numeric_acc_gouy(TraceTree t, double complex q_in, str direction, bool deg=True) double
finesse.tracing.cytools.compute_symbolic_abcd(TraceTree last_branch, str direction, bool simplify, tuple symbols_to_keep=None) ndarray
finesse.tracing.cytools.compute_symbolic_acc_gouy(TraceTree t, q_in, str direction, bool deg=True)
finesse.tracing.cytools.extract_symbols_to_keep(symbols)
finesse.tracing.cytools.generate_rt_abcd_str(TraceTree tree)
finesse.tracing.cytools.propagate_beam_numeric(TraceTree t, q_in, str direction) tuple
finesse.tracing.cytools.propagate_beam_symbolic(TraceTree t, q_in, str direction, bool simplify=False, tuple symbols_to_keep=None)

finesse.tracing.forest module

The TraceForest data structure used for representing propagating beams in a model.

Details on each class, method and function in this sub-module are provided mostly for developers. Users should refer to Tracing the beam for details on beam tracing, Model.beam_trace() for the main method through which beam traces can be performed on a model and tracing.tools for the various beam propagation tools which the beam tracing library provides.

class finesse.tracing.forest.TraceForest(model, bool symmetric, list trees=None)

Bases: object

A container structure which stores multiple TraceTree instances.

The Model stores a TraceForest object which then represents the current tracing state of the configuration. Each time a Model.beam_trace() is called, either directly or indirectly, the TraceForest of the Model will be used to perform the tracing via propagation of the beam parameters through each tree. This is also detailed in Tracing the beam.

Determination of the ordering and overall structure of the TraceForest happens through the “planting” of the forest. By calling TraceForest.plant(), the forest is cleared and re-planted according to the ordered list of trace dependencies passed to this method. This is a step which is performed automatically in Model.beam_trace(), where this re-planting process only occurs under the following condition:

  • a connector has been added or removed since the last call,

  • the type of beam tracing has been switched from symmetric to asymmetric or vice-verase,

  • or the tracing priority (i.e. ordered list of trace dependencies) has changed in any way.

In the initialisation process of building a simulation, a specialised version of a TraceForest is constructed from the model TraceForest using the TraceForest.make_changing_forest method. This inspects the model forest and selects only those trees, and branches of trees, which will have changing beam parameters during the simulation; i.e. due to some GeometricParameter being scanned. This new, “changing TraceForest” is then the optimised structure via which simulation-time beam traces (on changing beam parameter paths) are performed. More details on this, including additional powerful features that this changing forest provides, can be found in Tracing the beam.

Special method support

This class implements the following special methods: __getitem__, __len__, __iter__, __next__ and __contains__, providing the following behaviour (assuming forest is an instance of this class):

  • tree = forest[x] - either get the TraceTree at index x (i.e. the x-th tree to be traced when performing a beam trace on the forest), OR if x is a TraceDependency get a list of all the trees in the forest which are associated with that dependency.

  • N_trees = len(forest) - the number of trees in the forest, equivalent to TraceForest.size().

  • for tree in forest: - iteration support over the forest, in order of tracing priority.

  • flag = x in forest - check whether some object x is in the forest. This can be a TraceTree, an OpticalNode, a Space or a Connector. Equivalent to TraceForest.contains().

clear(self) void

Clears the trace forest, removing all trace trees.

contains(self, o) bool

Whether the forest contains the specified object, determined recursively for each tree within the forest.

Parameters

o[TraceTree | OpticalNode | Space | Connector]

The object to search for in the forest.

Returns

flagbool

True if o is in the forest, False otherwise.

dependencies
draw(self)

Draws the forest, by trace priority, as a string representation.

The order in which trees appear in this string represents the order in which they will be traced during the beam tracing algorithm.

In the rare cases where a subsequent tree contains a duplicate node (from an earlier tree), the latter tree trace will overwrite the former. This is only applicable to configurations with overlapping cavities, and this overwriting behaviour will take account of the desired cavity ordering given by the user.

Returns

forest_strstr

A string representation of the ordered forest.

draw_by_dependency(self)

Draws the forest as a string representation.

All the trees in the forest are sorted by their dependency and stored in the resultant string by these dependency sub-headings. Each tree also has its index (i.e. tracing priority) stored in the string above the drawn tree.

Returns

forest_strstr

A string representation of the forest, sorted by dependency with tracing priority indices displayed for each tree.

empty(self) bool

Whether the forest is empty (no trees) or not.

external_cavity_trees
find_dependency_from_node(self, node, bool raise_not_found=True)

Finds the dependency object associated with the optical node.

If no tree is found associated with this node, and raise_not_found is true, then a BeamTraceException is raised. Otherwise None is returned.

Parameters

nodeOpticalNode

An optical node.

raise_not_foundbool, optional; default: True

Raises a BeamTraceException if no dependency found. Returns None if False.

find_intersection_couplings(self, TraceForest other=None) tuple

Finds the node couplings at which trees with differing trace dependencies intersect.

Parameters

otherTraceForest

Find dependencies from a different trace forest than this one when checking for intersections.

Returns

couplingstuple

A tuple of the node couplings where each element is (from_node, to_node).

find_potential_mismatch_couplings(self, TraceForest other=None) tuple

Retrieves the node couplings which are potentially mode mismatched. If other is not given then the couplings which are local to this forest only will be found, otherwise couplings between this forest and other will be retrieved.

If this forest is asymmetric, then calling this method is equivalent to calling TraceForest.find_intersection_couplings().

This method is used internally for obtaining all the possible mode mismatch couplings between a changing trace forest (held by a modal simulation) and the main model trace forest.

Parameters

otherTraceForest

Find dependencies from a different trace forest than this one when checking for mode mismatch couplings.

Returns

couplingstuple

A tuple of the node couplings where each element is (from_node, to_node).

find_tree_from_node(self, node) TraceTree

Given an optical node, this finds the TraceTree instance corresponding to this node (if one exists).

Parameters

nodeOpticalNode

An optical node.

Returns

treeTraceTree

The tree corresponding to node, or None if none found.

find_untraversed_nodes(self) OrderedSet

Finds all the optical nodes in the model which are not covered by the trace forest.

forest
gauss_trees
get_mirror_reflection_couplings(self, bool ignore_internal_cavities=True, list skip_dependencies=None) tuple

Get the node couplings in the forest which correspond to self-reflections from mirror-like components.

Parameters

ignore_internal_cavitiesbool, default: True

Ignore the node couplings inside cavities.

skip_dependencieslist

Optional list of trees to skip based on their dependencies.

Returns

couplingstuple

A sequence of tuples consisting of the node1 -> node2 self reflection couplings.

get_nodes_with_changing_q(self)

For a given TraceForest this method will determine which optical nodes in a model will have a changing complex beam parameter.

This relies on element Parameters having their is_tunable or is_changing being set as True. In such cases the Model will construct a simulation where the calculations dependent on these parameters will be recomputed at multiple steps.

Returns

q_changing_nodesset{OpticalNode}

Set of of OpticalNodes which will have a changing complex beam parameter during a simulation.

internal_cavity_trees
make_changing_forest(self) TraceForest

Constructs a new TraceForest from this forest, consisting of only the trees which will have changing beam parameters.

This method is called in BaseSimulation._initialise for setting up the simulation trace forest used for efficient beam tracing.

model
plant(self, list trace_order)

Constructs and stores all the trace trees according to the order of dependencies in trace_order.

Parameters

trace_orderlist

List of the dependency objects by priority of tracing.

size(self) Py_ssize_t

The number of trees in the forest.

symmetric

symmetric: ‘bool’

trace_beam(self) dict

Performs a “model-time” beam trace on all trace trees.

This method is called internally by Model.beam_trace(). One should use that method to get a more complete representation of the tracing of the beam through a model.

Returns

tracedict

Dictionary of node: (qx, qy) mappings where node is each OpticalNode instance and qx, qy are the beam parameters in the tangential and sagittal planes, respectively, at these nodes.

trees_of_dependency(self, dependency) list

Get a list of all the TraceTree instances with the associated trace dependency object.

Parameters

dependencyTraceDependency

A trace dependency object.

Returns

treeslist

A list of all trace trees with dependency equal to above object.

class finesse.tracing.forest.tree_container(list trees=None)

Bases: object

A container of TraceTree objects.

Consists of a wrapper around a list of trees and a set of all the OpticalNode instances covered by this tree list. All of these attributes are read-only in the sense that they can only be accessed via C code.

trees

finesse.tracing.tools module

Beam propagation tools for use outside of a simulation context.

The recommended function for most use-cases is propagate_beam() (and propagate_beam_astig() for astigmatic beam propagations) which traces a beam through a specified path of a model. See Beam propagation for details and examples.

finesse.tracing.tools.acc_gouy(from_node=None, to_node=None, via_node=None, path=None, q_in=None, direction='x', symbolic=False, deg=True, **kwargs)

Computes the accumulated Gouy phase along a specified path.

By setting the argument symbolic to true, this method will return a symbolic representation of the accumulated Gouy phase rather than a number.

If the argument q_in is not specified then this value will be determined from a call to Model.beam_trace(). Arguments to this beam trace call can be passed via the kwargs of this method.

Parameters

from_nodeNode

Node to trace from.

to_nodeNode

Node to trace to.

via_nodeNode, optional

Optional node to trace via.

pathOpticalPath, optional

A pre-generated path to use.

q_inBeamParam, complex, optional

Beam parameter to use at starting node. If not specified then this will be determined from a beam trace. Note that, if specified, this can also be a symbolic beam parameter.

directionstr, optional; default: “x”

Plane of computation (can be ‘x’, ‘y’ or None).

symbolicbool, optional; default: False

Flag determining whether to return a symbolic representation.

degreesbool, optional; default: True

Flag determining whether to convert return value from radians to degrees.

finesse.tracing.tools.compute_abcd(from_node=None, to_node=None, via_node=None, path=None, direction='x', symbolic=False, simplify=False, solution_name=None)

Computes the composite ABCD matrix through a given path.

By setting the argument symbolic to true, this method will return a symbolic representation of the ABCD matrix rather than a numeric matrix.

Parameters

from_nodeNode

Node to trace from.

to_nodeNode

Node to trace to.

via_nodeNode, optional

Optional node to trace via.

pathOpticalPath, optional

A pre-generated path to use (produced from a call to Model.path()).

directonstr, optional

Direction of ABCD matrix computation (can be ‘x’, for tangential plane, or ‘y’, for sagittal plane).

symbolicbool, tuple(Parameters), optional; default: False

If False a numerical ABCD propagation is computed. If True, a symbolic ABCD propagation is calculated instead. A tuple of parameters can also be provided, in this case these parameters will be kept symbolic

simplifybool, optional

Attempt to simplify symbolic equations, can be slow for complex models

Returns

outABCDSolution

ABCD matrix solution object between the specified nodes.

finesse.tracing.tools.compute_cavity_mismatches(model, cav1=None, cav2=None)

Computes the mismatch parameter (see BeamParam.mismatch() for the equation) between cavities of the model.

If either / both of cav1, cav2 are not specified then these will be set to all the cavities of the model. This means that the default behaviour of this method (specifying no args) is to compute mismatches between each cavity in the model.

If either of each cavity in a coupling is unstable then the mismatch values between these will be given as np.nan.

Parameters

cav1Cavity, str, optional; default: None

A single cavity object (or its name). Defaults to None such that all cavities are used.

cav2Cavity, str, optional; default: None

A single cavity object (or its name). Defaults to None such that all cavities are used.

Returns

mmxfloat or dict

If both cav1 and cav2 were specified then this will be a single number giving the mismatch between these cavities in the tangential plane.

Otherwise, mmx is a dictionary of (c1, c2): mm_x mappings, where c1 and c2 are the cavity names and mm_x is the mismatch between any two cavities in the tangential plane.

mmyfloat or dict

If both cav1 and cav2 were specified then this will be a single number giving the mismatch between these cavities in the sagittal plane.

Otherwise, mmy is a dictionary of (c1, c2): mm_y mappings, where c1 and c2 are the cavity names and mm_y is the mismatch between any two cavities in the sagittal plane.

finesse.tracing.tools.handle_symbolic(*args, symbolic: tuple | bool, simplify: bool, sym_func: Callable, num_func: Callable)

Handles logic for the ‘symbolic’ argument for propagate_beam() and compute_abcd().

Parameters

symbolictuple | bool

If True or a tuple, returns a symbolic equation. If tuple, only returns symbolic equation with symbols in the tuple. Else returns numeric.

simplifybool

Wether to simplify the symbolics

sym_funcCallable

Function to call for symbolic solution

num_funcCallable

Function to call for numeric solution

Returns

Any

Symbolic or numeric solution

Raises

ValueError

When ‘symbolic’ is not a tuple or a boolean

finesse.tracing.tools.propagate_beam(from_node=None, to_node=None, via_node=None, path=None, q_in=None, direction='x', symbolic=False, simplify=False, solution_name=None, reverse_propagate=False, **kwargs)

Propagates a beam through a specified path, returning dictionaries of the beam parameter at each node and component.

This method returns a PropagationSolution instance.

See Beam propagation for details and examples on using this function.

By setting the argument symbolic to true, this method will return symbolic representations of the beam parameters, ABCD matrices and accumulated Gouy phases. Specific symbols can be kept by passing a list of symbol names to symbolic instead of a True or False flag. Any symbol names not provided will use their current evaluated value. The simplify flag when True will try to apply symbolic simplification to the beam propagation. For long propagations through many components using many symbols, this will be slow and might be faster not using any simplification.

The argument q_in can be used to specify an arbitrary input beam parameter to be used at the starting node of the propagation. If not given then this will be determined from a call to Model.beam_trace(). Arguments to this beam trace call can be passed via the kwargs of this method.

Parameters

from_nodeOpticalNode

Node to trace from.

to_nodeOpticalNode

Node to trace to.

via_nodeOpticalNode, optional

Optional node to trace via.

pathOpticalPath, optional

A pre-generated path to use.

q_inBeamParam, complex, optional

Beam parameter to use at starting node. If not specified then this will be determined from a beam trace. Note that, if specified, this can also be a symbolic beam parameter.

directionstr, optional; default: “x”

Plane of computation (can be ‘x’, ‘y’ or None).

symbolicbool, tuple(Parameters), optional; default: False

If False a numerical ABCD propagation is computed. If True, a symbolic ABCD propagation is calculated instead. A tuple of parameters can also be provided, in this case these parameters will be kept symbolic

simplifybool, optional

When True, symbolic simplication will be attempted. When using many symbols and large propagation paths this will significantly increase computational time.

reverse_propagatebool, optional

When True, the beam will be propagated in the reverse of the optical path found. This allows beams to be traced backwards through components like directional beamsplitters.

Returns

psPropagationSolution

A solution object for the propagation.

finesse.tracing.tools.propagate_beam_astig(from_node=None, to_node=None, via_node=None, path=None, qx_in=None, qy_in=None, symbolic=False, solution_name=None, reverse_propagate=False, **kwargs)

Propagates the beam through a specified path over both the tangential and sagittal planes.

Internally this calls propagate_beam() twice - for both the tangential and sagittal planes - and returns a solution object which stores the returns of these as properties.

Parameters

from_nodeNode

Node to trace from.

to_nodeNode

Node to trace to.

via_nodeNode, optional

Optional node to trace via.

pathOpticalPath, optional

A pre-generated path to use.

qx_inBeamParam, complex, optional

Beam parameter, in the tangential plane, to use at starting node. If not specified then this will be determined from a beam trace. Note that, if specified, this can also be a symbolic beam parameter.

qy_inBeamParam, complex, optional

Beam parameter, in the sagittal plane, to use at starting node. If not specified then this will be determined from a beam trace. Note that, if specified, this can also be a symbolic beam parameter.

symbolicbool, optional; default: False

Flag determining whether to return a symbolic representation.

Returns

astig_solAstigmaticPropagationSolution

A solution object consisting of the propagation solutions for both planes and methods for accessing the per-plane beam parameters and overlaps.

finesse.tracing.tree module

The TraceTree data structure and associated algorithms.

Details on each class, method and function in this sub-module are provided mostly for developers. Users should refer to Tracing the beam for details on beam tracing, Model.beam_trace() for the main method through which beam traces can be performed on a model and tracing.tools for the various beam propagation tools which the beam tracing library provides.

class finesse.tracing.tree.TraceTree(node, dependency)

Bases: object

A binary tree data structure representing all the beam tracing paths from some root optical node of a model.

Each instance of this class has a left and right sub-tree (of the class type) and a parent tree. These linked tree attributes can be None. If the tree has a left / right sub-tree then the memoryviews left_abcd_x, left_abcd_y etc. will be initialised from the numerical ABCD matrix from the tree’s optical node to the next tree’s optical node.

Every sub-tree has a dependency attribute which is the object that the trace tree depends on - either a Cavity or a Gauss instance.

add_left(self, TraceTree sub_tree) TraceTree

Add a left sub-tree to the tree.

Parameters

sub_treeTraceTree

The tree to add to the left.

Returns

sub_treeTraceTree

The same tree that was added. This is useful for looping over a single branch of the tree as a parent tree can be set to the return of this method on each iteration.

add_right(self, TraceTree sub_tree) TraceTree

Add a right sub-tree to the tree.

Parameters

sub_treeTraceTree

The tree to add to the right.

Returns

sub_treeTraceTree

The same tree that was added. This is useful for looping over a single branch of the tree as a parent tree can be set to the return of this method on each iteration.

compute_rt_abcd(self, double[:, ::1] abcdx=None, double[:, ::1] abcdy=None)
contains(self, o) bool

Whether the tree contains the specified object, determined recursively.

Parameters

o[TraceTree | OpticalNode | Space | Connector]

The object to search for in the trace tree.

Returns

flagbool

True if o is in the tree, False otherwise.

dependency
draw(self, str left_pad='')
find_tree_at_node(self, node, bool include_opposite=False) TraceTree

Recursively search for the TraceTree corresponding to the optical node.

classmethod from_cavity(cls, cavity)

Construct a TraceTree from a cavity instance.

The resulting tree decays to a linked list as it just includes the internal path of the cavity.

Parameters

cavityCavity

The cavity object.

Returns

treeTraceTree

The tree representing the internal cavity path.

classmethod from_node(cls, node, dependency, bool symmetric, pre_node=None, bool is_source=False, exclude=None)

Construct a TraceTree from an optical node root.

The resulting tree includes all optical node paths traced forward from node.

Parameters

nodeOpticalNode

The root node.

dependencyCavity or Gauss

The dependency object - i.e. what the trace sub-trees depend on.

symmetricbool

Flag indicating whether the tree should be constructed assuming that opposite node beam parameters will be set via the reverse of the original node beam parameter (true indicates this will be the case). In practice, this means that the resultant tree will not include any duplicate ports.

pre_nodeOpticalNode, optional; default: None

An optional node to add before the root for the root sub-tree.

is_sourcebool, optional; default: False

Whether the root node is the source node of a TraceDependency.

excludeset, optional

Set of optical nodes to avoid branching to.

Returns

treeTraceTree

The tree of all paths from node.

static from_path(list path)

Construct a TraceTree from a list of optical nodes.

The resulting tree decays to a linked list as the path is 1D - no branches will occur.

Parameters

pathlist

A list of optical nodes representing the node path. This can be obtained from a OpticalPath instance by invoking OpticalPath.nodes.

Returns

treeTraceTree

The tree representing the node path.

get_all_nodes(self) OrderedSet

Retrieve a set consisting of all the OpticalNode objects covered by this tree.

Returns

nodesset

A set of all the optical nodes in the tree.

get_broadest_changing_subtrees(self) list

Retrieve a list of each TraceTree, from here, which is changing.

get_last_input_nodes(self) list

Retrieves a list of the final input optical nodes within the tree.

get_last_left_branch(self) TraceTree

Finds the final left sub-tree from this tree node.

get_mirror_reflection_couplings(self) list

Obtain a list of all the node couplings corresponding to self-reflections.

is_changing(self, bool recursive=True) bool
is_left_surf_refl
is_source
is_x_changing
is_y_changing
left
left_abcd_x
left_abcd_x_args
left_abcd_x_kwargs
left_abcd_x_target
left_abcd_y
left_abcd_y_args
left_abcd_y_kwargs
left_abcd_y_target
node
nr
parent
propagate(self, dict trace, double lambda0, bool symmetric)
remove_left(self) TraceTree

Removes the left sub-tree and returns it.

Sets the left trace tree attribute to None, and nullifies left ABCD memory-views and pointers.

Returns

ltreeTraceTree

The removed left sub-tree.

remove_right(self) TraceTree

Removes the right sub-tree and returns it.

Sets the right trace tree attribute to None, and nullifies right ABCD memory-views and pointers.

Returns

rtreeTraceTree

The removed right sub-tree.

right
right_abcd_x
right_abcd_x_args
right_abcd_x_kwargs
right_abcd_x_target
right_abcd_y
right_abcd_y_args
right_abcd_y_kwargs
right_abcd_y_target
set_left_abcd_x_memory(self, target, *args, **kwargs)

Set the left ABCD matrix memory-views from the target function. Stores where this ABCD matrix came from for later retrieval and recreation if copied or pickled.

set_left_abcd_y_memory(self, target, *args, **kwargs)

Set the left ABCD matrix memory-views from the target function. Stores where this ABCD matrix came from for later retrieval and recreation if copied or pickled.

set_right_abcd_x_memory(self, target, *args, **kwargs)

Set the right ABCD matrix memory-views from the target function. Stores where this ABCD matrix came from for later retrieval and recreation if copied or pickled.

set_right_abcd_y_memory(self, target, *args, **kwargs)

Set the right ABCD matrix memory-views from the target function. Stores where this ABCD matrix came from for later retrieval and recreation if copied or pickled.

sym_left_abcd_x
sym_left_abcd_y
sym_right_abcd_x
sym_right_abcd_y
trace_beam(self, double lambda0, bool symmetric) dict

Trace the beam through the source tree.

trim_at_nodes(self, nodes, bool include_opposite=False)

Trims branches from the tree starting at any optical node in nodes.

finesse.tracing.tree.get_tracing_tree(optical_network: networkx.DiGraph) networkx.DiGraph

Creates a view of an optical network that removes edges that should not be ABCD traced. These are determined by checking the objects Connector._trace_through flag.

Module contents

The beam tracing library of Finesse.

This sub-package includes the core data structures and algorithms used for structuring and performing beam traces (tree and forest, for developer reference mostly), and tools for executing propagations of beams outside of the context of a simulation (tools).