-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDatabase.py
More file actions
48 lines (40 loc) · 1.36 KB
/
Copy pathDatabase.py
File metadata and controls
48 lines (40 loc) · 1.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# -*- coding: utf-8 -*-
"""
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% SAFRAN SEAT FRANCE
% sashi
% version 1
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Version 01 - XXXX
Created on %(date)
@author: Sashi.madugula - Simulation Engineer - SSFR
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
"""
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from scipy.optimize import curve_fit
import streamlit as st
xls = pd.ExcelFile('Data.xlsx')
D1000 = pd.read_excel(xls,0)
D1000.head()
def JC (x,A,B,n):
return A+B*(np.power(x,n))
xdata = D1000["Strain"].values #
ydata = D1000["Stress (Mpa)"].values #
g = [0,0,0.9]
c, cov = curve_fit(f = JC,xdata = xdata,ydata = ydata,p0 = g, bounds=((0, 0, 0), (np.inf,np.inf,np.inf)))
print(c)
A = c[0]
B = c[1]
n = c[2]
fun1000 = A+B*(np.power(D1000["Strain"],n))
plt.plot(D1000["Strain"],D1000["Stress (Mpa)"],'r-',label="raw")
plt.plot(D1000["Strain"],fun1000,'k.',label='fit A= %.1f B= %.1f n= %.2f' %(A,B,n))
plt.grid()
plt.legend(loc="upper right")
plt.xlim([0,0.35])
plt.xlabel("True Strain [mm/mm]")
plt.ylabel("True Stress (MPa)")
plt.show()
xls.close()