finesse.model.Model

Overview

class finesse.model.Model[source]

Bases: Freezable

Optical configuration class for handling models of interferometers.

This class stores the interferometer configuration as a directed graph and contains methods to interface with this data structure.

Properties

Model.Nhoms

Number of higher-order modes (HOMs) included in the model.

Model.all_parameters

Returns a generator of all the parameters in this model and the elements added to this model.

Model.analysis

The root action to apply to the model when Model.run() is called.

Model.cavities

The cavities stored in the model as a tuple object.

Model.components

The components stored in the model as a tuple object.

Model.detectors

The detectors stored in the model as a tuple object.

Model.dofs

Model.elements

Dictionary of all the model elements with the keys as their names.

Model.f0

The default frequency to use for the model.

Model.frequencies

The frequencies stored in the model as a list instance.

Model.gausses

A dictionary of optical node to Gauss instance mappings.

Model.hom_labels

Labels for the HOMs present in this model.

Model.homs

An array of higher-order modes (HOMs) included in the model.

Model.input_matrix_dc

The DC input matrix is used to relate degrees of freedoms and readouts within a model.

Model.is_built

Flag indicating whether the model has been built.

Model.is_modal

Flag indicating whether the model is modal or plane-wave.

Model.is_traced

Flag indicating whether the model has been traced.

Model.k0

The default wavenumber used for the model.

Model.lambda0

The default wavelength to use for the model.

Model.last_trace

An instance of BeamTraceSolution containing the output of the most recently stored beam trace performed on the model.

Model.locks

Model.mode_index_map

An ordered dictionary where the key type is the modes in the model and the mapped type is the index of the mode.

Model.modes_setting

Model.network

The directed graph object containing the optical configuration as a networkx.DiGraph instance.

Model.optical_network

A read-only view of the directed graph object stored by Model.network but only containing nodes of type OpticalNode and only with edges that have couplings to optical nodes.

Model.optical_nodes

The optical nodes stored in the model.

Model.parameters

Returns any parameters added to this model, see also .all_parameters.

Model.phase_level

An integer corresponding to the phase level given to the phase command of a Finesse 2 kat script.

Model.readouts

Returns all readouts in the model.

Model.signal_nodes

The signal nodes stored in the model.

Model.sim_initial_trace_args

Filtered dictionary of Model.sim_trace_config corresponding to only those options which match the arguments of Model.beam_trace().

Model.sim_trace_config

Dictionary corresponding to beam tracing configuration options for simulations.

Model.source_frequencies

The source frequencies stored in the model as a dict instance.

Model.trace_forest

The TraceForest instance held by the model.

Model.trace_order

A list of beam tracing dependencies, ordered by their tracing priority.

Model.trace_order_names

A convenience property to retrieve a list of the names of each TraceDependency instance in Model.trace_order.

Methods

Model.__init__()

Constructs a new instance of Freezable and freezes it.

Model.ABCD([from_node, to_node, via_node, ...])

See finesse.tracing.tools.compute_abcd()

Model.acc_gouy([from_node, to_node, ...])

See finesse.tracing.tools.acc_gouy()

Model.add(obj, *[, unremovable])

Adds an element (or sequence of elements) to the model - these can be ModelElement sub-class instances.

Model.add_all_ad(node[, f])

Adds amplitude detectors at the specified node and frequency f for all Higher Order Modes in the model.

Model.add_fd_to_every_node([freq])

Adds a FieldDetector at every optical node in model at a given frequency The name of each FieldDetector is automatically generated using the following pattern: E_<component>_<port>_<node>

Model.add_frequency(freq)

Add a specific optical carrier frequency to the model description.

Model.add_matched_gauss(node[, name, ...])

Adds a Gauss object mode matched to the model at the specified node.

Model.add_parameter(name, value, *[, ...])

Adds a new parameter to the Model.

Model.beam_trace([order, disable, ...])

Performs a full beam trace on the model, calculating the beam parameters at each optical node.

Model.built()

Model.cavity_mismatch([cav1, cav2])

See finesse.tracing.tools.compute_cavity_mismatches()

Model.cavity_mismatches_table([direction, ...])

Prints the mismatches between each cavity in an easily readable table format.

Model.chain(*args[, start, port])

Utility function for connecting multiple connectable objects in a sequential list together.

Model.component_tree([root])

Retrieves a tree containing the network representing the components connected to the specified root.

Model.compute_space_gouys([deg])

Calculate the Gouy phases accumulated over each space.

Model.connect(A, B[, L, nr, gain, delay, ...])

Connects two ports in a model together.

Model.create_mismatch(node[, w0_mm, z_mm])

Sets the beam parameters such that a mismatch of the specified percentage magnitude (in terms of \(w_0\) and \(z\)) exists at the given node.

Model.deepcopy()

Model.detect_mismatches([ignore_AR])

Detect the mode mismatches in the model.

Model.disconnect(A, B)

Disconnects two elements A and B.

Model.display_signal_blockdiagram(*nodes, ...)

Displays a block diagram of the signal paths in this model.

Model.element_order(element)

Get the order in which element was added to the model.

Model.get(attr)

Get an attribute of the model using a string path representation like l1.p1.o.q.

Model.get_active_signal_nodes()

Returns the electrical and mechanical nodes that are active in a model, i.e. ones that need to be solved for because:.

Model.get_changing_edges_elements()

Returns

Model.get_element(value)

Returns an element in this model that matches the requested value.

Model.get_elements_connected_to(element)

Returns a set of elements that element is connected to.

Model.get_elements_of_type(*element_type)

Extracts elements of a specific type from this model.

Model.get_frequency_object(frequency_value)

Model.get_network([network_type])

Get specified network.

Model.get_parameters(*[, include, exclude, ...])

Get all or a filtered list of parameters from all elements in the model.

Model.include_modes(modes)

Inserts the mode indices in modes into the Model.homs array at the correct (sorted) position(s).

Model.info([modes, components, detectors, ...])

Get string containing information about this model.

Model.link(*args[, verbose])

Connect multiple components together in one quick command.

Model.merge(other, from_comp, from_port, ...)

Merges the model other with this model using a connection at the specified ports.

Model.mismatches_table([ignore_AR, numfmt])

Prints the mismatches computed by Model.detect_mismatches() to an easily readable table.

Model.modes([modes, maxtem, include, remove])

Select the HOM indices to include in the model.

Model.parse(text[, spec])

Parses kat script and adds the resulting objects to the model.

Model.parse_file(path[, spec])

Parses kat script from a file and adds the resulting objects to the model.

Model.parse_legacy(text)

Parses legacy (Finesse 2) kat script and adds the resulting objects to the model.

Model.parse_legacy_file(path)

Parses legacy (Finesse 2) kat script from a file and adds the resulting objects to the model.

Model.path(from_node, to_node[, via_node, ...])

Retrieves an ordered container of the path trace between the specified nodes.

Model.phase_config([zero_k00, zero_tem00_gouy])

Coupling coefficient and Gouy phase scaling:

Model.plot_graph([network_type, layout])

Plot the node network.

Model.propagate_beam([from_node, to_node, ...])

See finesse.tracing.tools.propagate_beam()

Model.propagate_beam_astig([from_node, ...])

See finesse.tracing.tools.propagate_beam_astig()

Model.reduce_get_attr(attr)

Model.reduce_set_attr(attr, value)

Model.remove(obj)

Removes an object from the model.

Model.remove_modes(modes)

Removes the mode indices in modes from the Model.homs array.

Model.reset_sim_trace_config()

Resets the simulation beam tracing configuration dict, given by Model.sim_trace_config, to the default values.

Model.run([analysis, return_state, progress_bar])

Runs the current analysis set for this model.

Model.set(attr, value)

Set an attribute of the model using a string path representation like l1.p1.o.q.

Model.sim_trace_config_manager(**kwargs)

Change the Model.sim_trace_config within a context.

Model.sort_elements(key)

Sort the display order of the elements in the model.

Model.space_gouys_table([deg, numfmt])

Prints the space Gouy phases, as computed by

Model.sub_model(from_node, to_node)

Obtains a subgraph of the complete configuration graph between the two specified nodes.

Model.switch_off_homs()

Turns off HOMs, switching the model to a plane wave basis.

Model.tag_node(node, tag)

Tag a node with a unique name.

Model.temporary_parameters([include, exclude])

Context manager that lets user change any ModelParameter then return it to the original value once completed.

Model.to_component_network()

Generate an undirected graph containing components as the nodes of the graph and connections (spaces, wires) between component nodes as the edges of the graph.

Model.unbuild()

If a model has been built then this function undoes the process so the model can be changed and rebuilt if required.

Model.unparse([inplace])

Serialise the model to kat script.

Model.unparse_file(path[, inplace])

Serialise the model to kat script in a file.

Model.update_gauss(node[, qx, qy])

Update the value of a manual beam parameter (i.e.