mirror of
https://github.com/Telecominfraproject/oopt-gnpy.git
synced 2025-11-02 11:07:57 +00:00
Fiber: beta2: use a default value directly
Rather than do the None-dance and document the default value within a docstring, let's use the default value directly. This is safe because numbers are immutable.
This commit is contained in:
@@ -339,17 +339,16 @@ class Fiber(Node):
|
|||||||
else:
|
else:
|
||||||
yield c.power._asdict().get(attr, None)
|
yield c.power._asdict().get(attr, None)
|
||||||
|
|
||||||
def beta2(self, ref_wavelength=None):
|
def beta2(self, ref_wavelength=1550e-9):
|
||||||
"""Returns beta2 from dispersion parameter.
|
"""Returns beta2 from dispersion parameter.
|
||||||
Dispersion is entered in ps/nm/km.
|
Dispersion is entered in ps/nm/km.
|
||||||
Disperion can be a numpy array or a single value.
|
Disperion can be a numpy array or a single value.
|
||||||
|
|
||||||
:param ref_wavelength: can be a numpy array; default: 1550e-9m
|
:param ref_wavelength: can be a numpy array; default: 1550nm
|
||||||
"""
|
"""
|
||||||
# TODO|jla: discuss beta2 as method or attribute
|
# TODO|jla: discuss beta2 as method or attribute
|
||||||
wl = 1550e-9 if ref_wavelength is None else ref_wavelength
|
|
||||||
D = abs(self.dispersion)
|
D = abs(self.dispersion)
|
||||||
b2 = (wl ** 2) * D / (2 * pi * c) # 10^21 scales [ps^2/km]
|
b2 = (ref_wavelength ** 2) * D / (2 * pi * c) # 10^21 scales [ps^2/km]
|
||||||
return b2 # s/Hz/m
|
return b2 # s/Hz/m
|
||||||
|
|
||||||
def dbkm_2_lin(self):
|
def dbkm_2_lin(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user