SINTEF / pyopia

Python Ocean Particle Image Analysis
https://pyopia.readthedocs.io
BSD 3-Clause "New" or "Revised" License
11 stars 5 forks source link

RuntimeWarning during the processing from get_j/statistics.py: divide by zero encountered in log p = np.polyfit(np.log(dias[ind]), np.log(number_distribution[ind]), 1) #313

Open arsalanmstn opened 2 days ago

arsalanmstn commented 2 days ago

Describe the bug A clear and concise description of what the bug is.

To Reproduce Detailed steps to reproduce the behavior.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots If applicable add screenshots to help explain your problem.

Additional context Add any other context about the problem here.

arsalanmstn commented 2 days ago

Suggestion: update the following line in the get_j function: p = np.polyfit(np.log(dias[ind]), np.log(number_distribution[ind]), 1) to: p = np.polyfit(np.log(dias[ind]), np.log(number_distribution[ind], where= number_distribution[ind]> 0), 1)