-
Notifications
You must be signed in to change notification settings - Fork 0
/
material.py
38 lines (31 loc) · 1.12 KB
/
material.py
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
import pandas as pd
import os
def import_matprops(mat):
matprops = pd.read_csv(os.path.join(os.path.dirname(__file__), "materials.csv"), index_col=0)
mat = matprops[mat]
return mat
def material(mat):
mat = import_matprops(mat)
exp = "not found"
data = dict()
data['info'] = "an unConventional project"
# TODO differentiate material type(isotropic,orthotropic,fiber....)
data['data'] = {}
data['data']['material_name'] = mat.name
data['data']['type'] = mat.type
if mat.type == 'alloy':
data['data']['composition'] = {}
# TODO add alloy composition,fix add a string field
data['data']['density'] = mat.density
data['data']['tensile_strength'] = mat.F1t
data['data']['shear_strength'] = exp
data['data']['shear_modulus'] = mat.G12
data['data']['poisson_ratio'] = mat.nu12
data['data']['youngs_modulus'] = mat.E1
data['data']['melting_point'] = mat.mp
data['data']['boiling_point'] = mat.bp
data['source'] = mat.url
return data
if __name__ == '__main__':
print(material('steel'))
# TODO Handle 'NaN',known fix = Fill all values