MatthewReid854/reliability

Lognormal_probability_plot fails for sufficiently large failure times

Closed this issue · 1 comments

I observed an error in Probability_plotting.py. For large failure times in Lognormal_probability_plot, such as samples from Lognormal_Distribution(50, 10), the calculation of xvals (line 484) raises a TypeError from np.log10. This occurs when xmax_log > 10**20 approximately, and of type int. Conversion to int type occurs in line 480, and appears to be unneeded, because 10**x works if x is a float. Removing the int conversion resolves the error.

This error also occurs in line 550, setting the plotting limits, due to the int conversion in line 549. Removing the int conversion resolves the error.

Side note: in line 479 and 480, the values of the variables xmin_log and xmax_log are powers of 10. When those values are used in line 484, the logarithm of each is used. That is, the code is performing the calculation np.log10(10 ** x).

Thanks so much for finding this. It's a weird bug since it only occurs at absurdly large numbers.
I don't know why I originally used int but it certainly fixed the problem.
I also removed the np.log10(10 ** x) redundancy in the code.
This will be part of the next major release....later this week :)
Thanks again.