Skip to content

Commit

Permalink
added new fit types
Browse files Browse the repository at this point in the history
  • Loading branch information
henry-e-n committed May 30, 2024
1 parent 4ba9f2d commit a2c31a5
Show file tree
Hide file tree
Showing 14 changed files with 533 additions and 152 deletions.
99 changes: 66 additions & 33 deletions compile_TC.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,45 +13,78 @@
path_to_lib = f"{os.getcwd()}\\lib"
mat_directories = [folder for folder in os.listdir(path_to_lib) if not folder.endswith(".md")]

path_to_fits = dict()
path_to_nistfits = dict()
everything_bagel = dict()
simple_bagel = dict()
path_to_otherfits = dict()
path_to_rawData = dict()

for mat in mat_directories:
mat_str = f"{path_to_lib}\\{mat}"
fit_str = f"{mat_str}\\fits"
other_str = f"{mat_str}\\OTHERFITS"
nist_str = f"{mat_str}\\NIST"
raw_str = f"{mat_str}\\RAW"
if os.path.exists(fit_str):
path_to_fits[mat] = fit_str
path_to_rawData[mat] = fit_str
elif os.path.exists(other_str):
path_to_fits[mat] = other_str
elif os.path.exists(nist_str):
path_to_fits[mat] = nist_str

if os.path.exists(nist_str):
path_to_nistfits[mat] = nist_str
if os.path.exists(other_str):
path_to_otherfits[mat] = other_str

output_array = compile_csv(path_to_fits)
def make_pathtofit(mat_direct, subset=None, fits_to_parse="ALL"):
path_to_fit_dict = dict()
if subset!=None:
subset_array = []
for mat in mat_direct:
if mat in subset:
subset_array = np.append(subset_array, mat)
mat_direct = subset_array
for mat in mat_direct:
mat_str = f"{path_to_lib}\\{mat}"
fit_str = f"{mat_str}\\fits"
other_str = f"{mat_str}\\OTHERFITS"
nist_str = f"{mat_str}\\NIST"
raw_str = f"{mat_str}\\RAW"

if fits_to_parse=="ALL":
if os.path.exists(fit_str): # Prioritize RAW fits
path_to_fit_dict[mat] = fit_str
path_to_rawData[mat] = fit_str
elif os.path.exists(other_str): # Then other fits
path_to_fit_dict[mat] = other_str
elif os.path.exists(nist_str): # Lastly NIST Fits
path_to_fit_dict[mat] = nist_str

if fits_to_parse=="OTHER":
if os.path.exists(other_str): # Then other fits
path_to_fit_dict[mat] = other_str
elif os.path.exists(nist_str): # Lastly NIST Fits
path_to_fit_dict[mat] = nist_str

if fits_to_parse=="RAW":
if os.path.exists(raw_str): # Prioritize RAW fits
path_to_fit_dict[mat] = fit_str

return path_to_fit_dict

current_date = datetime.now().date()

create_data_table(output_array, f"..\\thermal_conductivity_compilation_{current_date}.txt")
create_tc_csv(output_array, f"..\\thermal_conductivity_compilation_{current_date}.csv")
# Want to create 4 output files
# 1. Plain Bagel : Simple file that has only 1 fit per material and ignores weird materials
simple_mat_direct = ["Aluminum_110", "Beryllium_Copper","Brass","CFRP","Constantan","Cu_OFHC_RRR50",
"G10_FR4","Glass_FabricPolyester_He_warp","Graphite","Inconel_718","Invar_Fe36Ni",
"Iron","Kapton","Ketron","Kevlar49_Composite_Aramid","Lead","Macor","Manganin",
"Molybdenum","MylarPET","NbTi","Nichrome","Nickel_Steel_Fe_2.25_Ni","Nylon",
"Phosbronze","Platinum","Polystyrene_2.0_lbft3","Polyurethane_2.0_lbft3_CO2",
"PVC_1.25_lbft3_air","Stainless_Steel","Teflon","Ti6Al4V","Titanium_15333",
"Torlon","Tungsten","VESPEL"]
simple_bagel = make_pathtofit(mat_directories, subset=simple_mat_direct)
output_array = compile_csv(simple_bagel)
create_data_table(output_array, f"..\\tc_generic_{current_date}.txt")
create_tc_csv(output_array, f"..\\tc_generic_{current_date}.csv")


output_array = compile_csv(path_to_nistfits)
create_data_table(output_array, f"..\\thermal_conductivity_compilation_NIST_{current_date}.txt")
create_tc_csv(output_array, f"..\\thermal_conductivity_compilation_NIST_{current_date}.csv")
# 2. Everything Bagel : File that contains every single material and alloy
everything_bagel = make_pathtofit(mat_directories, fits_to_parse="ALL")
output_array = compile_csv(everything_bagel)
create_data_table(output_array, f"..\\tc_fullrepo_{current_date}.txt")
create_tc_csv(output_array, f"..\\tc_fullrepo_{current_date}.csv")

output_array = compile_csv(path_to_otherfits)
create_data_table(output_array, f"..\\other_fits_{current_date}.txt")
create_tc_csv(output_array, f"..\\other_fits_{current_date}.csv")
# 3. Other fits + NIST
other_fits = make_pathtofit(mat_directories, fits_to_parse="OTHER")
output_array = compile_csv(other_fits)
create_data_table(output_array, f"..\\tc_other_fits_{current_date}.txt")
create_tc_csv(output_array, f"..\\tc_other_fits_{current_date}.csv")

output_array = compile_csv(path_to_rawData)
create_data_table(output_array, f"..\\rawData_Fits_{current_date}.txt")
create_tc_csv(output_array, f"..\\rawData_Fits_{current_date}.csv")
# 4. RAW / from data fits
raw_fits = make_pathtofit(mat_directories, fits_to_parse="RAW")
output_array = compile_csv(raw_fits)
create_data_table(output_array, f"..\\tc_rawdata_fits_{current_date}.txt")
create_tc_csv(output_array, f"..\\tc_rawdata_fits_{current_date}.csv")
22 changes: 0 additions & 22 deletions other_fits_2024-05-30.csv

This file was deleted.

Loading

0 comments on commit a2c31a5

Please sign in to comment.