ipkiss3.all.CircuitModelView

class ipkiss3.all.CircuitModelView(*args, **kwargs)

The Model View stores parameters and a model to use in circuit simulation.

The model view data is called model. Use _generate_model to define a model on the view. The _generate_model should return either a CompactModel or HierarchicalModel.

Parameters:

view_name: str, optional

The name of the view

layout_view: optional

netlist_view: optional

dependencies()

returns the set of dependencies (child views) of this View.

Should be overloaded by specific views.

get_smatrix(wavelengths, debug=False)

Run a simple frequency-domain simulation of the circuit model in Caphe, returing an S-matrix for all the outside terms.

Parameters:

wavelengths : array

Array of wavelengths that is contained in the simulation.

debug : boolean

When True, run all models in debug mode. That means they are run in pure Python, allowing you to debug your model more easily.

Returns:

smatrix

An smatrix containing the transmissions from/to all terms of this circuit model.

Examples

>>> import numpy as np
>>> import ipkiss3.all as i3
>>> from pylab import plt
>>> dev = MyDevice()
>>> model = dev.CircuitModel(length=10.)
>>> wavelengths = np.linspace(1.4, 1.6, 1001)
>>> S = wg.get_smatrix(wavelengths)
>>> transmission = S['in', 'out', :]
>>> plt.plot(wavelengths, np.abs(transmission) ** 2)
>>> plt.show()
get_time_response(t0, dt, t1, center_wavelength, integration_method='runge_kutta4', debug=False)

Get the transient time response of a CircuitModelView.

This runs a time-domain simulation in the circuit simulator Caphe. The testbench must contain certain excitations and monitors. The output is a structure containing the times that were simulated, and the input on each monitors.

Please check out the tutorial in IPKISS (Tutorials –> Implementing circuit models in IPKISS) for an example and more information.

Examples

>>> import numpy as np
>>> from pylab import plt
>>> import ipkiss3.all as i3
>>> laser = MyLaser()
>>> def my_signal(t):
>>>     return np.sin(t)
>>> testbench = i3.ConnectComponents(
>>>     child_cells={
>>>         'input': i3.FunctionExcitation(port_domain=i3.ElectricalDomain, excitation_function=my_signal),
>>>         'laser': laser,
>>>         'monitor': i3.Probe(port_domain=i3.OpticalDomain)
>>>     },
>>>     links=[('input:out', 'laser:in'),
>>>            ('laser:optical_out', 'monitor:in')]
>>> )
>>> res = testbench.get_time_response(0, 1e-12, 5e-9, 1.55)
>>> plt.plot(res.times, res.data['monitor'])
>>>