1. Basic Syntax

This page provides an overview of the most used Methods and Classes in the GenSol package. This is by no meand a full API guide (which can be found here ), but just shows the most common Methods, grouped by functionality.

1.1. Circuit Definition

Classes and Methods for building a circuit:

Definition of Solver

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

Class Solver This class defines the simulations.

Solver.__enter__()

Make the Solver the active solver

Adding and connecting componets

Model([pin_dic, param_dic, Smatrix])

Class Model

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

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

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

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

connect(tup1, tup2)

Connect two structures in the active Solver

Naming external pins

Pin(basename[, mode_name])

Class representing a pin in the circuit.

Pin.put([pin])

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

Adding monitors

add_structure_to_monitors(structure[, name])

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

Solver.monitor_structure([structure, name])

Add structure to the ones to be monitored for internal modes

Available 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

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

1.2. Circuit Simulation

Methods for running the simulation:

Solver.solve(**kwargs)

Calculates the scattering matrix of the solver

solve(**kwargs)

Solve active solver and returns the model

1.3. Data Extraction

Calsses and Methods for extraction of the data after the simulation is run:

General Methods

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

Class for storing data of a solver mode.

SolvedModel.get_T(pin1, pin2)

Function for returning the energy transmission between two ports

SolvedModel.get_A(pin1, pin2)

Function for returning complex amplitude of the transmission between two ports

SolvedModel.get_PH(pin1, pin2)

Function for returning the phase of the transmission between two ports

SolvedModel.get_output(input_dic[, power])

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

Methos for sweeps

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_full_data()

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

Data from monitors

SolvedModel.get_monitor(input_dic[, power])

Function for returning data from monitors

1.4. Export and import of models

Model_from_InPulse(file[, ...])

Class for model from InPulse S-Matrix RAW DATA file

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

Export scattering matrix in InPulse format