[BUG] - ALT_fitters.py IndexError: list index out of range
Closed this issue · 3 comments
Describe the bug
Reliability==0.8.9 gives while running an example:
"ALT_fitters.py IndexError: list index out of range"
Reliability==0.8.8 does not have this problem.
Additionally, there is no requirements.txt for Reliability==0.8.9
To Reproduce
Install reliability==0.8.9 instead of 0.8.8.
The code you executed when you found the bug:
- Fitting a dual stress model to ALT data - Example 1
Taken from: ReadTheDocs
Fitting a dual stress model to ALT data - Example 2
Taken from: ReadTheDocs
The output that Python gave you:
/usr/local/lib/python3.10/dist-packages/reliability/Utils.py:2263: FutureWarning: In a future version of pandas, a length 1 tuple will be returned when iterating over a groupby with a grouper equal to a list of length 1. Don't supply a list with a single grouper to avoid this warning.
for key, items in failure_df_ungrouped.groupby(["failure_stress_pairs"]):
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
<ipython-input-3-ae39736ff8e9> in <cell line: 8>()
6 import matplotlib.pyplot as plt
7 data = ALT_temperature_voltage()
----> 8 Fit_Normal_Dual_Exponential(failures=data.failures, failure_stress_1=data.failure_stress_temp, failure_stress_2=data.failure_stress_voltage,use_level_stress=[330,2.5])
9 plt.show()
/usr/local/lib/python3.10/dist-packages/reliability/ALT_fitters.py in __init__(self, failures, failure_stress_1, failure_stress_2, right_censored, right_censored_stress_1, right_censored_stress_2, use_level_stress, CI, optimizer, show_probability_plot, show_life_stress_plot, print_results)
10374 stresses_for_groups_str = []
10375 for stress in stresses_for_groups:
> 10376 new_mus.append(life_func(S1=stress[0], S2=stress[1]))
10377 stresses_for_groups_str.append(
10378 str(
Expected behavior
Some statistics and 2 plots
Additional context
-
Here are the Google colabs for debugging:
[0.8.9] https://colab.research.google.com/drive/1B7xXzEtTX5Y6LsmZKpBQT0hYr0zC64JM?usp=sharing
[0.8.8] https://colab.research.google.com/drive/1is2SU4TEaXuaaYL6TeF1z9JreMR2AZbP?usp=sharing -
There is no requirements.txt for 0.8.9., it still says 0.8.8
Thank you for making this software package. Greetings from another AE.
I ran the same code in PyCharm that you have in Colab and I cannot reproduce your error. I am using python 3.11.3 and reliability 0.8.9.
Can you please try to run your example outside of Google Colab. Sometimes Colab does strange things that aren't reproducible in IDEs. Until I can reproduce the error you are getting, I am unable to debug it.
Also, I don't understand why you think there's no requirements.txt for 0.8.9. The requirements are listed in the setup.py file and the requirements.txt file is in the root directory. If you are seeing the 0.8.8 next to requirements.txt on GitHub, that's just a comment applied when the file was uploaded. The requirements have not changed between 0.8.8 and 0.8.9 so I did not update the requirements.txt file.
Thank you for your reply and suggestions.
The first line of the output already made me suspicious. I will copy and paste it again for your convenience:
/usr/local/lib/python3.10/dist-packages/reliability/Utils.py:2263: FutureWarning: In a future version of pandas, a length 1 tuple will be returned when iterating over a groupby with a grouper equal to a list of length 1. Don't supply a list with a single grouper to avoid this warning.
for key, items in failure_df_ungrouped.groupby(["failure_stress_pairs"]):
Per your suggestion, I created an empty Conda environment with just the bare minimum installed by default (python==3.10.11) and reliability, ipythonwidgets, and seaborn. When running reliability, pandas==2.0.1 got installed: no Issue. ✔️
Then I downgraded pandas to pandas==1.5.3: error. ❌
Requirements.txt says: pandas(>=1.4.2)
However: 1.5.3 > 1.4.2. Note that I have not tried running the aforementioned code with pandas==1.4.2, just 1.5.3. as this should satisfy the requirements.txt already.
Concluding
- Requirements have changed for reliability==0.8.9 w.r.t. reliability==0.8.8. Namely regarding pandas, as pandas==1.5.3 > pandas==1.4.2, yet still throws an error.
- pandas==2.0.1 is fine. 😄
- It's not a Google Colab issue
Short-term suggestions
Update requirements.txt
Long-term suggestions
- Run a version with all updated packages obtained after just doing "pip install reliability" and specify the versions of the by you downloaded dependencies, if not done so already.
- Run a version with the minimum requirements as stated in requirements.txt
- Before pushing, please update requirements.txt
This is now resolved with the release of v0.8.10.
Thanks very much for identifying and reporting this with such a thorough analysis.