3. Full API Reference

3.1. Direct methods

add_param(old_name, func[, default])

Define a paramter of the active solver in term of new paramter(s)

add_structure_to_monitors(structure[, name])

Add structure to the ones to be monitored for internal modes.

connect(tup1, tup2)

Connect two structures in the active Solver

connect_all(structure1, pin1, structure2, pin2)

Connect in the active solver the two structures using all the pins with the matching basename

debugfile([filename])

Set up and additional logfile for debug

diag_blocks(array_list)

Function building a block diagonal array for list of array

logfile([filename, stdout, level])

Switch log output to file

putpin(name, tup)

Maps a pin of the current active solver

raise_pins()

Raise all pins in the solver.

set_default_params(dic)

Set default parameters for the solver

solve(**kwargs)

Solve active solver and returns the model

update_default_params(dic)

Update default parameters for the solver

3.2. Model

3.2.1. Base Models

Model([pin_dic, param_dic, Smatrix])

Class Model

SolvedModel(pin_dic, param_dic, Smatrix[, ...])

Class for storing data of a solver mode.

3.2.2. Methods

Model.expand_mode(mode_list)

This function expands the model by adding additional modes.

Model.get_A(pin1, pin2)

Function for returning complex amplitude of the transmission between two ports

Model.get_PH(pin1, pin2)

Function for returning the phase of the transmission between two ports

Model.get_T(pin1, pin2)

Function for returning the energy transmission between two ports

Model.get_output(input_dic[, power])

Returns the outputs from all ports of the model given the inputs amplitudes

Model.get_pin_modes(basename)

Parse the pins for locating the pins with the same base name

Model.inspect()

Function that print self.

Model.pin_mapping(pin_mapping)

Function for changing the names of the pins of a model

Model.print_S([func])

Function for nice printing of scattering matrix in agreement with pins

Model.prune()

Check if the model is empty

Model.put([source_pin, target_pin, ...])

Function for putting a model in a Solver object, and eventually specify connections

Model.show_free_pins()

Function for printing pins of model

Model.solve(**kargs)

Function for returning the solved model

Model.update_params(update_dic)

Update the parameters of model, setting defaults when value is not provides

SolvedModel.get_data(pin1, pin2)

Function for returning transmission data between two ports

SolvedModel.get_full_output(input_dic[, power])

Function for getting the output do the system given the inputs

SolvedModel.get_monitor(input_dic[, power])

Function for returning data from monitors

SolvedModel.set_intermediate(int_func, ...)

Methods for setting the function and mapping for monitors

SolvedModel.get_full_data()

Returns the scattering matrix for all the solved parametes in form of padas DataFrame

SolvedModel.export_InPulse([filename, ...])

Export scattering matrix in InPulse format

3.2.3. Functional Models

Attenuator([loss])

Model of attenuator in dB

BeamSplitter([ratio, t, phase])

Model of variable ration beam splitter

FPR(n, m, R, d1, d2[, Ri])

Simplified model of FPR circle mount

FPRGaussian(n, m, R, d1, d2, w1, w2, n_slab)

Simplified model of FPR circle mount based on Gaussian beams.

FPR_NxM(N, M[, phi])

Model of Free Propagation Region.

LinearAttenuator([c])

Model of attenuator in absolute unit

LinearNDInterpolator(points, values[, ...])

Piecewise linear interpolator in N > 1 dimensions.

Mirror([ref, phase])

Model of partially reflected Mirror

Model_from_InPulse(file[, ...])

Class for model from InPulse S-Matrix RAW DATA file

PerfectMirror([phase])

Model of perfect mirror (only one port), 100% reflection

PhaseShifter([param_name, param_default])

Model of multimode variable phase shifter

PolRot([angle, angle_name])

Model of a 2 modes polarization rotator

ProtectedPartial

Like partial, but keywords provided at creation cannot be overwritten al call time

PushPullPhaseShifter([param_name])

Model of multimode variable phase shifter

Splitter1x2()

Model of 1x2 Splitter

Splitter1x2Gen([cross, phase])

Model of 1x2 Splitter with possible reflection between the 2 port side.

TH_PhaseShifter(L, Neff[, R, w, wl, pol, ...])

Model of thermal phase shifter (dispersive waveguide + phase shifter)

UserWaveguide(L, func[, param_dic, allowedmodes])

Template for a user defined waveguide

Waveguide(L[, n, wl])

Model of a simple waveguide

3.3. Solver

Solver([name, structures, connections, ...])

Class Solver This class defines the simulations.

3.3.2. Methods

Solver.__enter__()

Make the Solver the active solver

Solver.add_param(old_name, func[, default])

Define a paramter of the solver in term of new paramter(s)

Solver.add_structure(structure)

Add a structure to the solver

Solver.connect(structure1, pin1, structure2, ...)

Connect two different structures in the solver by the specified pins

Solver.connect_all(structure1, basename1, ...)

Connect the two structures using all the pins with the matching basename

Solver.cut_structure(structure)

Remove structure from solver, cutting all the connections to other structures (pins in connected structure are not removed, but freed again)

Solver.flatten()

Collapse the hyerarchycal structure of the solver in only one level.

Solver.flatten_top_level()

Flatten top level of a solver

Solver.inspect([max_depth])

Print the full hierarchy of the solver

Solver.map_pins(pin_mapping)

Add mapping of pins

Solver.maps_all_pins()

Function for automatically map all pins.

Solver.monitor_structure([structure, name])

Add structure to the ones to be monitored for internal modes

Solver.prune()

Remove dead branch in the solver hierarchy (the ones ending with an empy solver)

Solver.put([source_pin, target_pin, ...])

Function for putting a Solver in another Solver object, and eventually specify connections

Solver.remove_structure(structure)

Remove structure from solver, also removing all the connections to other structures

Solver.set_param(name[, value])

Set a value for one parameter.

Solver.show_connections()

Print all connected pins in the solver

Solver.show_default_params()

Print the names of all the top-level parameters and corresponding default value

Solver.show_free_pins()

Print all pins of the structure in the solver whcih are not connected.

Solver.show_pin_mapping()

If a pin mapping is defined, print only mapped pins

Solver.show_structures()

Print all structures in the solver

Solver.solve(**kwargs)

Calculates the scattering matrix of the solver

Solver.update_params(update_dic)

Update the parameters of solver, setting defaults when value is not provides.

3.4. Structure

Structure([pin_list, model, solver, ...])

Class defining a single element of the photonic circuit

3.4.2. Methods

Structure.add_conn(pin, target, target_pin)

Add connection between a self pin and a pin in another structure

Structure.add_pin(pin)

Add pin to structure

Structure.createS()

Creates the scattering matrix of the components

Structure.get_S_back()

Recreates the scattering matrix as ndarray

Structure.cut_connections(target)

Remove all connection to target structure.

Structure.get_in_from(st)

Find pins of self with are connected from a target structure

Structure.get_model([pin_mapping, name])

Retunrn model corresponding to structure

Structure.get_out_to(st)

Find pins of self with are connected to a target structure

Structure.intermediate(st, pin_mapping)

Used to generate the function for monitoring the modes between two structures

Structure.join(st)

Join two structures to create the one cotaining the merged structure

Structure.pin

Alllows the feeding of the sintax structure.pin['pin_name'] where the tuple of structure and pin is required

Structure.print_conn()

Print the connection of this structure to other ones

Structure.print_pindic()

Print the mappping between the pins and the entries of the scatterng matrix

Structure.print_pins()

Print all pins of the structures, divided in self pins and contained pins

Structure.remove_connections(target)

Remove all connection to target structure.

Structure.remove_pin(pin)

Remove pin from structure

Structure.reset()

Reset the mapping that keeps track of the solving

Structure.sel_input(pin_list)

Divide pins to be connected providing inputs pins

Structure.sel_output(pin_list)

Divide pins to be connected providing output pins

Structure.split_in_out([in_pins, out_pins])

Created the scattering matrix object with left pins separated from right pins

Structure.update_params(param_dic)

Updated the parametes dictionary of the represented optic componet

3.5. S_matrix

S_matrix(N, M[, ns])

Class implmenting the scattering matrix object and recursion alghoritms for joining two of them

3.5.2. Methods

S_matrix.S_print([i, j])

Print scattering matrix as numpy array

S_matrix.add(s)

Recursion algorith for joining two matrices

S_matrix.det()

Calculated determinat of scattering matrix

S_matrix.int_complete(S2, u, d)

Function for computing the internal modal coefficients between two structures

S_matrix.matrix()

Return scattering matrix as ndarray

3.6. Pin

Pin(basename[, mode_name])

Class representing a pin in the circuit.

3.6.2. Methods

Pin.put([pin])

Creates an pin in the solver and maps it to the given pin.