Telecominfraproject / oopt-gnpy

Optical Route Planning Library, Based on a Gaussian Noise Model
http://telecominfraproject.com
BSD 3-Clause "New" or "Revised" License
198 stars 87 forks source link

Overflow Error in core.parameters.FiberParameters #496

Open akhil-mutike opened 4 months ago

akhil-mutike commented 4 months ago

Describe the bug FiberParameters takes effective area and Gamma as Keyword arguments(there are many more).Whenever the Effective area and gamma are given as None ,the module uses some default values and doesn't produce any errors.But whenever a value is provided for gamma(for example gamma:1.3) or for effective area, It is producing an Over flow error

To Reproduce Steps to reproduce the behavior: Execute the following script

from gnpy.core.parameters import  FiberParams
from gnpy.core.utils import lin2db, db2lin
FiberParams(length=80,length_units='km',con_in=0,con_out=0,dispersion=1.7*(10**-5),dispersion_slope=None,gamma=1.3,pmd_coef=0,loss_coef=db2lin(0.2)``` 
The following output pops out:
```shell
C:\Users\admin\PycharmProjects\gnpy_api_exploration\oopt-gnpy\gnpy\core\parameters.py:210: RuntimeWarning: overflow encountered in scalar power
  self._contrast = 0.5 * (c / (2 * pi * self._ref_frequency * self._core_radius * self._n1) * exp(

Expected behavior It is supposed to generate a FiberParams object without any error