Skip to content

FloatingPointError: underflow encountered in exp #79

@nuhanb

Description

@nuhanb

Hi, I encountered another issue where I am unable to 'calculate' under the interpolation tab. However, my data is loaded just fine and grid is showing, so I was wondering if it is a bug or issues with my initial point data.

I am using QGIS version 3.34.6-Prizren
SM Plugin version 1.4
Python version 3.12.3

Error message and code:

2024-07-12T10:29:57 WARNING Traceback (most recent call last):
File "C:\Users/Nur Hanisah/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Smart_Map\krig\semivariogram.py", line 255, in Fit
[Nugget,Range,Sill], _ = curve_fit(func, lag, gamma,method='trf', check_finite = check, p0=self.init_vals ,bounds=(0, maxlim) )
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\PROGRA1\QGIS331.6\apps\Python312\Lib\site-packages\scipy\optimize_minpack_py.py", line 1011, in curve_fit
res = least_squares(func, p0, jac=jac, bounds=bounds, method=method,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\PROGRA1\QGIS331.6\apps\Python312\Lib\site-packages\scipy\optimize_lsq\least_squares.py", line 820, in least_squares
raise ValueError("x0 is infeasible.")
ValueError: x0 is infeasible.

         During handling of the above exception, another exception occurred:
         
         Traceback (most recent call last):
          File "C:\Users/Nur Hanisah/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Smart_Map\krig\semivariogram.py", line 300, in Fit
          Nugget,Range,Sill = self.Gold_Rule(model)
          ^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users/Nur Hanisah/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Smart_Map\krig\semivariogram.py", line 427, in Gold_Rule
          Range=self.gold(ivar, xL, xU, model, Nugget, Range, Sill, maxIt, es)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users/Nur Hanisah/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Smart_Map\krig\semivariogram.py", line 381, in gold
          _,f2,_=self.Gamma(model,[x,x2,z])
          ^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users/Nur Hanisah/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Smart_Map\krig\semivariogram.py", line 174, in Gamma
          gammaT=func(self.lag,parameter[0],parameter[1],parameter[2])
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users/Nur Hanisah/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Smart_Map\krig\variogram_models.py", line 61, in exponential_variogram_model
          return nugget+(psill-nugget)*(1-np.exp(-3.0*d/range_))
          ^^^^^^^^^^^^^^^^^^^^^
         FloatingPointError: underflow encountered in exp
         
         During handling of the above exception, another exception occurred:
         
         Traceback (most recent call last):
          File "C:\Users/Nur Hanisah/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Smart_Map\Smart_Map.py", line 3659, in pushButton_VariogramaAjust_clicked
          self.calculate_variogram(initial_variogram = True, Nugget_Range_Sill = False)
          File "C:\Users/Nur Hanisah/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Smart_Map\Smart_Map.py", line 3008, in calculate_variogram
          self.models = Semiv.Fit(use_models)
          ^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users/Nur Hanisah/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Smart_Map\krig\semivariogram.py", line 311, in Fit
          _,rss,r2=self.Gamma(model,[Nugget,Range,Sill])
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users/Nur Hanisah/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Smart_Map\krig\semivariogram.py", line 174, in Gamma
          gammaT=func(self.lag,parameter[0],parameter[1],parameter[2])
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
          File "C:\Users/Nur Hanisah/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Smart_Map\krig\variogram_models.py", line 61, in exponential_variogram_model
          return nugget+(psill-nugget)*(1-np.exp(-3.0*d/range_))
          ^^^^^^^^^^^^^^^^^^^^^
         FloatingPointError: underflow encountered in exp

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions