Please enable JavaScript to view this site.

Application Gallery

This example shows the Traveling Wave Laser model's (TWLM) gain curve fitting function by using the script command mczfit. The gain curve data is retrieved from a text file with a certain format. Please refer to the linked page in the See Also section for the implementation details of this command.


Associated files





See Also


Laser TW (TWLM)

Fabry-Perot Laser

DBR Laser

DFB Laser

Ring Vernier Laser


Lumerical products R2017a or newer








The gain curve data is stored in the text file sampleGainData.txt. The format of the data file is shown below:

(1, Nc)

carrierdensity_1, carrierdenisty_2, …, carrierdensity_Nc

(Ns, Nc+1)

freq_1                gain_1_1        gain_1_2        …        gain_1_Nc

freq_2                gain_2_1        gain_2_2        …        gain_2_Nc

…                        …                …                …        …

freq_Ns                gain_Ns_1        gain_Ns_2        …        gain_Ns_Nc


where the parameters are:


the number of gain curves


the number of frequency samples


the carrier density corresponding to the j-th gain curve


the i-th frequency sample


the gain value for the i-th frequency sample in the j-th curve


Please note that the frequencies must be in ascending order and the gain curves as well as the carrier densities must be in descending order of the carrier density in the file.


Based on the data in the text file, the following command in the script file fitplotBasic.lsf will find the variable gain filter coefficients that fits to the curves.



The out put fit_out is a struct that contains the following return values:


a struct with fields


a column vector of the frequency sample points


a matrix with the column vectors containing the input frequency response to be fit for each operating point


a row vector containing the input operating points corresponding to the input frequency responses in the columns of the input matrix


a row vector containing values of the linearly interpolated values of operating points between the input values of operating points


a matrix with the column vectors containing the fit frequency response for each input operating point


a matrix with the column vectors containing the fit frequency response for each linearly interpolated operating point contained in row vector ‘operatingPointInterpolated’.


This script function also produces a gain filter coefficients to be used by the TWLM element. The name of the file will be outputfilename.mcfdb. This file can then be loaded into the TWLM element and used to define the laser's gain curves.


The following figure is the fitting result for the file sampleGainData.txt. The solid lines are the gain curves defined in the file and the dashed lines are the fitting results. Great agreements are shown in the figure for the interested central frequency band.




Then the generated file which contains the gain filter coefficients twlmGainFitTest.mcfdb is loaded to the TWLM element in the example file twlmGainFitTest.icp. The circuit in the example file is showing below:



The sweep object "sweep" defined in the project file sweeps the initial carrier densities in the gain material and records the transmission as the result. Since the carrier decay rates and input currents are set to zero, and the Optical Network Analyzer (ONA) sends in an impulse response, the carriers in the TWLM do not change significantly and hence the impulse response of the gain filters can be obtained for comparison with the diagnostic result from the TWLM.


Run the simulation project and the sweep. Open and run the script file plotDiagAndIR.lsf in the project file. The script will retrieve the diagnostic result from the TWLM and compares it to the impulse response result obtained from the sweep. The following figure is the comparison result and great agreement between the diagnostic result and impulse response is shown.



Copyright Lumerical Inc. | Privacy | Site Map