Open maierbn opened 1 week ago
The issue arises with numpy>=2, even when using Python 3.12 (it is not specific to Python 3.13).
If you have a Python project that uses numpy version 2 and you import the released pylife (which is only tested with numpy 1), certain results—specifically those utilizing the HCM algorithm—will be incorrect. There won’t be any runtime errors, but the computed values will be wrong.
Using the fix with copy(x0)
will make it work also for numpy 2 (at least in the cases in my setup)
Describe the bug After call to
notch_approximation_law.stress(value)
, the value object is sometimes changed. This is an unwanted side effect of this function.To Reproduce Hard to reproduce, it was observed in
_compute_hcm_RAM
where we have:This calls
materiallaws.notch_approximation_law.Binned._create_bins_single_assessment_point
whereself._lut_primary_branch.load
is changed duringExpected result
self._notch_approximation_law.stress
does not change the argument,self._lut_primary_branch.load
in this case.Environment (please complete the following information):
Additional context The problem was tracked back and it seems
scipy.optimize.newton(func, x0)
changesx0
if it is an object like a pd.Series.