Skip to content

Commit 60feebe

Browse files
committed
Update laser.py
1 parent 61757ef commit 60feebe

File tree

1 file changed

+57
-88
lines changed

1 file changed

+57
-88
lines changed

optic/models/laser.py

Lines changed: 57 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,46 @@ def laser_dfb(param, current):
1212
Parameters
1313
----------
1414
param : Namespace
15-
An object containing parameters for the DFB simulation.
15+
A namespace containing parameters for the DFB laser simulation.
1616
- noise_terms : bool, optional
17-
Flag to include noise terms in the simulation. Default is False.
17+
Flag to include noise terms in the simulation (default: False).
1818
- v : float, optional
19-
Active layer volume. Default is 1.5e-10 cm^3.
19+
Active layer volume (default: 1.5e-10).
2020
- tau_n : float, optional
21-
Carrier lifetime. Default is 1.0e-9 s.
21+
Carrier lifetime (default: 1.0e-9).
2222
- a0 : float, optional
23-
Active layer gain coefficient. Default is 2.5e-16 m^3.
23+
Active layer gain coefficient (default: 2.5e-16).
2424
- vg : float, optional
25-
Group velocity. Default is 8.5e+9 m/s.
25+
Group velocity of light in the medium (default: 8.5e+9).
2626
- n_t : float, optional
27-
Carrier density at transparency. Default is 1.0e+18 cm^-3.
27+
Carrier density at transparency (default: 1.0e+18).
2828
- epsilon : float, optional
29-
Gain compression factor. Default is 1.0e-17 cm^3.
29+
Gain compression factor (default: 1.0e-17).
3030
- gamma : float, optional
31-
Mode confinement factor. Default is 0.4.
31+
Mode confinement factor (default: 0.4).
3232
- tau_p : float, optional
33-
Photon lifetime. Default is 3.0e-12 s.
33+
Photon lifetime (default: 3.0e-12).
3434
- beta : float, optional
35-
Fraction of spontaneous emission coupling. Default is 3.0e-5.
35+
Fraction of spontaneous emission coupling (default: 3.0e-5).
3636
- alpha : float, optional
37-
Linewidth enhancement factor. Default is 5.
37+
Linewidth enhancement factor (default: 5).
3838
- sigma : float, optional
39-
Absorption cross-section. Default is 2e-20 m^2.
39+
Absorption cross-section (default: 2e-20).
4040
- i_bias : float, optional
41-
Bias current. Default is 0.078 A.
41+
Bias current (default: 0.078).
4242
- i_max : float, optional
43-
Maximum current. Default is 0.188 A.
43+
Maximum current (default: 0.188).
4444
- eta_0 : float, optional
45-
Quantum efficiency. Default is 0.4.
45+
Quantum efficiency (default: 0.4).
4646
- lmbd : float, optional
47-
Wavelength of the laser. Default is 1300e-9 m.
48-
49-
current : Namespace
47+
Wavelength of the laser (default: 1300e-9).
48+
- freq_0 : float, optional
49+
Frequency of the laser (derived from lmbd).
50+
- ith : float, optional
51+
Current threshold for laser operation.
52+
Note: All parameters have default values and are optional.
53+
54+
current : array_like
5055
An object containing information about the current distribution.
5156
- signal : ndarray
5257
Current signal distribution.
@@ -55,9 +60,14 @@ def laser_dfb(param, current):
5560
5661
Returns
5762
-------
58-
tuple
59-
A tuple containing the updated `param`, the modified `current`, and the result of solving the laser DFB simulation.
63+
param : Namespace
64+
The updated parameter namespace after the simulation.
65+
current : ndarray
66+
The updated current distribution after the simulation.
67+
laser_solution : array_like
68+
The solution of the DFB laser simulation.
6069
"""
70+
6171
param.noise_terms = getattr(param, "noise_terms", False)
6272
param.v = getattr(param, "v", 1.5e-10)
6373
param.tau_n = getattr(param, "tau_n", 1.0e-9)
@@ -101,7 +111,7 @@ def set_current(param, current):
101111
Current signal distribution.
102112
- t : ndarray
103113
Time array representing the current signal over time.
104-
- t_step : float
114+
- t_step : float, optional
105115
Time step between consecutive elements in `t`.
106116
107117
Returns
@@ -121,11 +131,11 @@ def laser_dynamic_response(y, param):
121131
----------
122132
y : ndarray
123133
An array containing the state variables of the laser.
124-
- y[0, :] : float
134+
- y[0, :] : ndarray
125135
Carrier density.
126-
- y[1, :] : float
136+
- y[1, :] : ndarray
127137
Photon density.
128-
- y[2, :] : float
138+
- y[2, :] : ndarray
129139
Optical phase.
130140
131141
param : Namespace
@@ -136,18 +146,18 @@ def laser_dynamic_response(y, param):
136146
-------
137147
Namespace
138148
An object containing the calculated dynamic response parameters.
139-
- N : float
149+
- N : ndarray
140150
Carrier density.
141-
- S : float
151+
- S : ndarray
142152
Photon density.
143-
- phase : float
144-
Optical phase.
145-
- power : float
153+
- phase : ndarray
154+
Phase of the optical field.
155+
- power : ndarray
146156
Optical power.
147-
- chirp : float
157+
- chirp : ndarray
148158
Chirp parameter.
149-
- e_out : complex
150-
Complex electric field.
159+
- e_out : ndarray, complex
160+
Complex representation of the optical field.
151161
"""
152162
out = parameters()
153163
# get physical parameters
@@ -196,7 +206,7 @@ def solve_laser_dfb(param, current):
196206
197207
Returns
198208
-------
199-
scipy.integrate.OdeResult
209+
solution : scipy.integrate.OdeResult
200210
The result of solving the rate equations for the laser DFB simulation.
201211
"""
202212
# Initial conditions
@@ -235,7 +245,7 @@ def get_initial_conditions(param,current):
235245
- y0[1] : float
236246
Initial photon density.
237247
- y0[2] : float
238-
Initial phase.
248+
Initial phase of the optical field.
239249
"""
240250
y0 = np.zeros([3])
241251
y0[1] = param.gamma * param.tau_p/(param.v * e) * (get_current(current,0)-param.ith)
@@ -258,7 +268,7 @@ def laser_rate_equations(t, y, param, current):
258268
- y[1] : float
259269
Photon density.
260270
- y[2] : float
261-
Optical phase.
271+
Phase of the optical field.
262272
param : Namespace
263273
An object containing parameters for the simulation.
264274
(Refer to laser_dfb function docstring for details.)
@@ -268,7 +278,7 @@ def laser_rate_equations(t, y, param, current):
268278
269279
Returns
270280
-------
271-
ndarray
281+
dy : ndarray
272282
An array containing the calculated rate equations.
273283
- dy[0] : float
274284
Rate of change of carrier density.
@@ -296,12 +306,7 @@ def carrier_density(t,y,param,current):
296306
Time.
297307
y : ndarray
298308
An array containing the state variables of the laser.
299-
- y[0] : float
300-
Carrier density.
301-
- y[1] : float
302-
Photon density.
303-
- y[2] : float
304-
Optical phase.
309+
(Refer to laser_rate_equations function docstring for details.)
305310
param : Namespace
306311
An object containing parameters for the simulation.
307312
(Refer to laser_dfb function docstring for details.)
@@ -325,12 +330,7 @@ def photon_density(y,param):
325330
----------
326331
y : ndarray
327332
An array containing the state variables of the laser.
328-
- y[0] : float
329-
Carrier density.
330-
- y[1] : float
331-
Photon density.
332-
- y[2] : float
333-
Optical phase.
333+
(Refer to laser_rate_equations function docstring for details.)
334334
param : Namespace
335335
An object containing parameters for the simulation.
336336
(Refer to laser_dfb function docstring for details.)
@@ -350,12 +350,7 @@ def optical_phase(y,param):
350350
----------
351351
y : ndarray
352352
An array containing the state variables of the laser.
353-
- y[0] : float
354-
Carrier density.
355-
- y[1] : float
356-
Photon density.
357-
- y[2] : float
358-
Optical phase.
353+
(Refer to laser_rate_equations function docstring for details.)
359354
param : Namespace
360355
An object containing parameters for the simulation.
361356
(Refer to laser_dfb function docstring for details.)
@@ -375,20 +370,10 @@ def add_noise_rate_equations(y, dy, param, current):
375370
----------
376371
y : ndarray
377372
An array containing the state variables of the laser.
378-
- y[0] : float
379-
Carrier density.
380-
- y[1] : float
381-
Photon density.
382-
- y[2] : float
383-
Optical phase.
373+
(Refer to laser_rate_equations function docstring for details.)
384374
dy : ndarray
385375
An array containing the calculated rate equations.
386-
- dy[0] : float
387-
Rate of change of carrier density.
388-
- dy[1] : float
389-
Rate of change of photon density.
390-
- dy[2] : float
391-
Rate of change of optical phase.
376+
(Refer to laser_rate_equations function docstring for details.)
392377
param : Namespace
393378
An object containing parameters for the simulation.
394379
(Refer to laser_dfb function docstring for details.)
@@ -415,12 +400,7 @@ def laser_noise_sources(y,param,current):
415400
----------
416401
y : ndarray
417402
An array containing the state variables of the laser.
418-
- y[0] : float
419-
Carrier density.
420-
- y[1] : float
421-
Photon density.
422-
- y[2] : float
423-
Optical phase.
403+
(Refer to laser_rate_equations function docstring for details.)
424404
param : Namespace
425405
An object containing parameters for the simulation.
426406
(Refer to laser_dfb function docstring for details.)
@@ -464,18 +444,7 @@ def get_im_response(param, out, f, type='exact'):
464444
465445
out : Namespace
466446
An object containing laser simulation output.
467-
- N : ndarray
468-
Carrier density over time.
469-
- S : ndarray
470-
Photon density over time.
471-
- phase : ndarray
472-
Optical phase over time.
473-
- power : ndarray
474-
Optical power over time.
475-
- chirp : ndarray
476-
Optical chirp over time.
477-
- e_out : ndarray
478-
Optical output over time.
447+
(Refer to laser_dynamic_response function docstring for details.)
479448
480449
f : float
481450
The frequency of interest for the IM frequency response.
@@ -516,7 +485,7 @@ def im_response_yz(param,out):
516485
(Refer to laser_dfb function docstring for details.)
517486
518487
out : Namespace
519-
An object containing parameters for the simulation.
488+
An object containing laser simulation output.
520489
(Refer to laser_dynamic_response function docstring for details.)
521490
522491
@@ -542,7 +511,7 @@ def im_response_y(param,out):
542511
(Refer to laser_dfb function docstring for details.)
543512
544513
out : Namespace
545-
An object containing parameters for the simulation.
514+
An object containing laser simulation output.
546515
(Refer to laser_dynamic_response function docstring for details.)
547516
548517
Returns
@@ -565,7 +534,7 @@ def im_response_z(param,out):
565534
(Refer to laser_dfb function docstring for details.)
566535
567536
out : Namespace
568-
An object containing parameters for the simulation.
537+
An object containing laser simulation output.
569538
(Refer to laser_dynamic_response function docstring for details.)
570539
571540
Returns

0 commit comments

Comments
 (0)