0

I am currently working on a project where I need to plot a cyclic loading figure using Python. the code is not working probably, something wrong with it. what is remaining or what i should do to fix the problem. Or if there any way that i can draw without python and in easy way please tell me. Even if there are way in Excel, it doesn't matter.

from reliability.PoF import stress_strain_life_parameters_from_data, stress_strain_diagram
import matplotlib.pyplot as plt
import pandas as pd
from io import StringIO

data = """
X,Y
0,0
0.01,275.89
0,-272.24
-0.01,-311.41
0,246.13
0.01,248.98
0,-226.53
-0.01,-227.98
0,205.37
0.01,225.16
0,-212.1
-0.01,-249.51
0,230.47
0.01,271.59
0,-246.49
-0.01,-290.18
0,260.86
0.01,306.21
0,-275.57
-0.01,-319.53
0,299.99
"""

df = pd.read_csv(StringIO(data))
stress_data = df['X'].values
strain_data = df['Y'].values
params = stress_strain_life_parameters_from_data(stress=stress_data, strain=strain_data, E=71500)
stress_strain_diagram(E = 71500,n = params.n, K = params.K, max_strain=0.001)
plt.show()

The error:

ValueError: On entry to DLASCL parameter number 4 had an illegal value

The above exception was the direct cause of the following exception:

SystemError                               Traceback (most recent call last)
<ipython-input-29-c65a2006f310> in <cell line: 34>()
     32 stress_data = df['X'].values
     33 strain_data = df['Y'].values
---> 34 params = stress_strain_life_parameters_from_data(stress=stress_data, strain=strain_data,E=71500)
     35 stress_strain_diagram(E = 71500,n = params.n, K = params.K, max_strain=0.001)
     36 plt.show()

5 frames
/usr/local/lib/python3.10/dist-packages/numpy/linalg/linalg.py in _raise_linalgerror_lstsq(err, flag)
     98     raise LinAlgError("SVD did not converge")
     99 
--> 100 def _raise_linalgerror_lstsq(err, flag):
    101     raise LinAlgError("SVD did not converge in Linear Least Squares")
    102 

SystemError: <class 'numpy.linalg.LinAlgError'> returned a result with an exception set

I tried to draw, but the code is not working

Mohammed
  • 127
  • 3
  • 9
  • The error is telling you “SVD did not converge in Linear Least Squares”. Your sample data didn’t converge. I suggest looking up the SystemError – Trenton McKinney May 25 '23 at 16:17

0 Answers0