Skip to content

Commit 4f12507

Browse files
committed
Update laser.py
1 parent 09bc8c9 commit 4f12507

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
@@ -25,41 +25,46 @@ def laser_dfb(param, current):
2525
Parameters
2626
----------
2727
param : Namespace
28-
An object containing parameters for the DFB simulation.
28+
A namespace containing parameters for the DFB laser simulation.
2929
- noise_terms : bool, optional
30-
Flag to include noise terms in the simulation. Default is False.
30+
Flag to include noise terms in the simulation (default: False).
3131
- v : float, optional
32-
Active layer volume. Default is 1.5e-10 cm^3.
32+
Active layer volume (default: 1.5e-10).
3333
- tau_n : float, optional
34-
Carrier lifetime. Default is 1.0e-9 s.
34+
Carrier lifetime (default: 1.0e-9).
3535
- a0 : float, optional
36-
Active layer gain coefficient. Default is 2.5e-16 m^3.
36+
Active layer gain coefficient (default: 2.5e-16).
3737
- vg : float, optional
38-
Group velocity. Default is 8.5e+9 m/s.
38+
Group velocity of light in the medium (default: 8.5e+9).
3939
- n_t : float, optional
40-
Carrier density at transparency. Default is 1.0e+18 cm^-3.
40+
Carrier density at transparency (default: 1.0e+18).
4141
- epsilon : float, optional
42-
Gain compression factor. Default is 1.0e-17 cm^3.
42+
Gain compression factor (default: 1.0e-17).
4343
- gamma : float, optional
44-
Mode confinement factor. Default is 0.4.
44+
Mode confinement factor (default: 0.4).
4545
- tau_p : float, optional
46-
Photon lifetime. Default is 3.0e-12 s.
46+
Photon lifetime (default: 3.0e-12).
4747
- beta : float, optional
48-
Fraction of spontaneous emission coupling. Default is 3.0e-5.
48+
Fraction of spontaneous emission coupling (default: 3.0e-5).
4949
- alpha : float, optional
50-
Linewidth enhancement factor. Default is 5.
50+
Linewidth enhancement factor (default: 5).
5151
- sigma : float, optional
52-
Absorption cross-section. Default is 2e-20 m^2.
52+
Absorption cross-section (default: 2e-20).
5353
- i_bias : float, optional
54-
Bias current. Default is 0.078 A.
54+
Bias current (default: 0.078).
5555
- i_max : float, optional
56-
Maximum current. Default is 0.188 A.
56+
Maximum current (default: 0.188).
5757
- eta_0 : float, optional
58-
Quantum efficiency. Default is 0.4.
58+
Quantum efficiency (default: 0.4).
5959
- lmbd : float, optional
60-
Wavelength of the laser. Default is 1300e-9 m.
61-
62-
current : Namespace
60+
Wavelength of the laser (default: 1300e-9).
61+
- freq_0 : float, optional
62+
Frequency of the laser (derived from lmbd).
63+
- ith : float, optional
64+
Current threshold for laser operation.
65+
Note: All parameters have default values and are optional.
66+
67+
current : array_like
6368
An object containing information about the current distribution.
6469
- signal : ndarray
6570
Current signal distribution.
@@ -68,9 +73,14 @@ def laser_dfb(param, current):
6873
6974
Returns
7075
-------
71-
tuple
72-
A tuple containing the updated `param`, the modified `current`, and the result of solving the laser DFB simulation.
76+
param : Namespace
77+
The updated parameter namespace after the simulation.
78+
current : ndarray
79+
The updated current distribution after the simulation.
80+
laser_solution : array_like
81+
The solution of the DFB laser simulation.
7382
"""
83+
7484
param.noise_terms = getattr(param, "noise_terms", False)
7585
param.v = getattr(param, "v", 1.5e-10)
7686
param.tau_n = getattr(param, "tau_n", 1.0e-9)
@@ -114,7 +124,7 @@ def set_current(param, current):
114124
Current signal distribution.
115125
- t : ndarray
116126
Time array representing the current signal over time.
117-
- t_step : float
127+
- t_step : float, optional
118128
Time step between consecutive elements in `t`.
119129
120130
Returns
@@ -134,11 +144,11 @@ def laser_dynamic_response(y, param):
134144
----------
135145
y : ndarray
136146
An array containing the state variables of the laser.
137-
- y[0, :] : float
147+
- y[0, :] : ndarray
138148
Carrier density.
139-
- y[1, :] : float
149+
- y[1, :] : ndarray
140150
Photon density.
141-
- y[2, :] : float
151+
- y[2, :] : ndarray
142152
Optical phase.
143153
144154
param : Namespace
@@ -149,18 +159,18 @@ def laser_dynamic_response(y, param):
149159
-------
150160
Namespace
151161
An object containing the calculated dynamic response parameters.
152-
- N : float
162+
- N : ndarray
153163
Carrier density.
154-
- S : float
164+
- S : ndarray
155165
Photon density.
156-
- phase : float
157-
Optical phase.
158-
- power : float
166+
- phase : ndarray
167+
Phase of the optical field.
168+
- power : ndarray
159169
Optical power.
160-
- chirp : float
170+
- chirp : ndarray
161171
Chirp parameter.
162-
- e_out : complex
163-
Complex electric field.
172+
- e_out : ndarray, complex
173+
Complex representation of the optical field.
164174
"""
165175
out = parameters()
166176
# get physical parameters
@@ -209,7 +219,7 @@ def solve_laser_dfb(param, current):
209219
210220
Returns
211221
-------
212-
scipy.integrate.OdeResult
222+
solution : scipy.integrate.OdeResult
213223
The result of solving the rate equations for the laser DFB simulation.
214224
"""
215225
# Initial conditions
@@ -248,7 +258,7 @@ def get_initial_conditions(param,current):
248258
- y0[1] : float
249259
Initial photon density.
250260
- y0[2] : float
251-
Initial phase.
261+
Initial phase of the optical field.
252262
"""
253263
y0 = np.zeros([3])
254264
y0[1] = param.gamma * param.tau_p/(param.v * e) * (get_current(current,0)-param.ith)
@@ -271,7 +281,7 @@ def laser_rate_equations(t, y, param, current):
271281
- y[1] : float
272282
Photon density.
273283
- y[2] : float
274-
Optical phase.
284+
Phase of the optical field.
275285
param : Namespace
276286
An object containing parameters for the simulation.
277287
(Refer to laser_dfb function docstring for details.)
@@ -281,7 +291,7 @@ def laser_rate_equations(t, y, param, current):
281291
282292
Returns
283293
-------
284-
ndarray
294+
dy : ndarray
285295
An array containing the calculated rate equations.
286296
- dy[0] : float
287297
Rate of change of carrier density.
@@ -309,12 +319,7 @@ def carrier_density(t,y,param,current):
309319
Time.
310320
y : ndarray
311321
An array containing the state variables of the laser.
312-
- y[0] : float
313-
Carrier density.
314-
- y[1] : float
315-
Photon density.
316-
- y[2] : float
317-
Optical phase.
322+
(Refer to laser_rate_equations function docstring for details.)
318323
param : Namespace
319324
An object containing parameters for the simulation.
320325
(Refer to laser_dfb function docstring for details.)
@@ -338,12 +343,7 @@ def photon_density(y,param):
338343
----------
339344
y : ndarray
340345
An array containing the state variables of the laser.
341-
- y[0] : float
342-
Carrier density.
343-
- y[1] : float
344-
Photon density.
345-
- y[2] : float
346-
Optical phase.
346+
(Refer to laser_rate_equations function docstring for details.)
347347
param : Namespace
348348
An object containing parameters for the simulation.
349349
(Refer to laser_dfb function docstring for details.)
@@ -363,12 +363,7 @@ def optical_phase(y,param):
363363
----------
364364
y : ndarray
365365
An array containing the state variables of the laser.
366-
- y[0] : float
367-
Carrier density.
368-
- y[1] : float
369-
Photon density.
370-
- y[2] : float
371-
Optical phase.
366+
(Refer to laser_rate_equations function docstring for details.)
372367
param : Namespace
373368
An object containing parameters for the simulation.
374369
(Refer to laser_dfb function docstring for details.)
@@ -388,20 +383,10 @@ def add_noise_rate_equations(y, dy, param, current):
388383
----------
389384
y : ndarray
390385
An array containing the state variables of the laser.
391-
- y[0] : float
392-
Carrier density.
393-
- y[1] : float
394-
Photon density.
395-
- y[2] : float
396-
Optical phase.
386+
(Refer to laser_rate_equations function docstring for details.)
397387
dy : ndarray
398388
An array containing the calculated rate equations.
399-
- dy[0] : float
400-
Rate of change of carrier density.
401-
- dy[1] : float
402-
Rate of change of photon density.
403-
- dy[2] : float
404-
Rate of change of optical phase.
389+
(Refer to laser_rate_equations function docstring for details.)
405390
param : Namespace
406391
An object containing parameters for the simulation.
407392
(Refer to laser_dfb function docstring for details.)
@@ -428,12 +413,7 @@ def laser_noise_sources(y,param,current):
428413
----------
429414
y : ndarray
430415
An array containing the state variables of the laser.
431-
- y[0] : float
432-
Carrier density.
433-
- y[1] : float
434-
Photon density.
435-
- y[2] : float
436-
Optical phase.
416+
(Refer to laser_rate_equations function docstring for details.)
437417
param : Namespace
438418
An object containing parameters for the simulation.
439419
(Refer to laser_dfb function docstring for details.)
@@ -477,18 +457,7 @@ def get_im_response(param, out, f, type='exact'):
477457
478458
out : Namespace
479459
An object containing laser simulation output.
480-
- N : ndarray
481-
Carrier density over time.
482-
- S : ndarray
483-
Photon density over time.
484-
- phase : ndarray
485-
Optical phase over time.
486-
- power : ndarray
487-
Optical power over time.
488-
- chirp : ndarray
489-
Optical chirp over time.
490-
- e_out : ndarray
491-
Optical output over time.
460+
(Refer to laser_dynamic_response function docstring for details.)
492461
493462
f : float
494463
The frequency of interest for the IM frequency response.
@@ -529,7 +498,7 @@ def im_response_yz(param,out):
529498
(Refer to laser_dfb function docstring for details.)
530499
531500
out : Namespace
532-
An object containing parameters for the simulation.
501+
An object containing laser simulation output.
533502
(Refer to laser_dynamic_response function docstring for details.)
534503
535504
@@ -555,7 +524,7 @@ def im_response_y(param,out):
555524
(Refer to laser_dfb function docstring for details.)
556525
557526
out : Namespace
558-
An object containing parameters for the simulation.
527+
An object containing laser simulation output.
559528
(Refer to laser_dynamic_response function docstring for details.)
560529
561530
Returns
@@ -578,7 +547,7 @@ def im_response_z(param,out):
578547
(Refer to laser_dfb function docstring for details.)
579548
580549
out : Namespace
581-
An object containing parameters for the simulation.
550+
An object containing laser simulation output.
582551
(Refer to laser_dynamic_response function docstring for details.)
583552
584553
Returns

0 commit comments

Comments
 (0)