|
13 | 13 | path_to_lib = f"{os.getcwd()}\\lib"
|
14 | 14 | mat_directories = [folder for folder in os.listdir(path_to_lib) if not folder.endswith(".md")]
|
15 | 15 |
|
16 |
| -path_to_fits = dict() |
17 |
| -path_to_nistfits = dict() |
| 16 | +everything_bagel = dict() |
| 17 | +simple_bagel = dict() |
18 | 18 | path_to_otherfits = dict()
|
19 | 19 | path_to_rawData = dict()
|
20 | 20 |
|
21 |
| -for mat in mat_directories: |
22 |
| - mat_str = f"{path_to_lib}\\{mat}" |
23 |
| - fit_str = f"{mat_str}\\fits" |
24 |
| - other_str = f"{mat_str}\\OTHERFITS" |
25 |
| - nist_str = f"{mat_str}\\NIST" |
26 |
| - raw_str = f"{mat_str}\\RAW" |
27 |
| - if os.path.exists(fit_str): |
28 |
| - path_to_fits[mat] = fit_str |
29 |
| - path_to_rawData[mat] = fit_str |
30 |
| - elif os.path.exists(other_str): |
31 |
| - path_to_fits[mat] = other_str |
32 |
| - elif os.path.exists(nist_str): |
33 |
| - path_to_fits[mat] = nist_str |
34 |
| - |
35 |
| - if os.path.exists(nist_str): |
36 |
| - path_to_nistfits[mat] = nist_str |
37 |
| - if os.path.exists(other_str): |
38 |
| - path_to_otherfits[mat] = other_str |
39 |
| - |
40 |
| -output_array = compile_csv(path_to_fits) |
| 21 | +def make_pathtofit(mat_direct, subset=None, fits_to_parse="ALL"): |
| 22 | + path_to_fit_dict = dict() |
| 23 | + if subset!=None: |
| 24 | + subset_array = [] |
| 25 | + for mat in mat_direct: |
| 26 | + if mat in subset: |
| 27 | + subset_array = np.append(subset_array, mat) |
| 28 | + mat_direct = subset_array |
| 29 | + for mat in mat_direct: |
| 30 | + mat_str = f"{path_to_lib}\\{mat}" |
| 31 | + fit_str = f"{mat_str}\\fits" |
| 32 | + other_str = f"{mat_str}\\OTHERFITS" |
| 33 | + nist_str = f"{mat_str}\\NIST" |
| 34 | + raw_str = f"{mat_str}\\RAW" |
| 35 | + |
| 36 | + if fits_to_parse=="ALL": |
| 37 | + if os.path.exists(fit_str): # Prioritize RAW fits |
| 38 | + path_to_fit_dict[mat] = fit_str |
| 39 | + path_to_rawData[mat] = fit_str |
| 40 | + elif os.path.exists(other_str): # Then other fits |
| 41 | + path_to_fit_dict[mat] = other_str |
| 42 | + elif os.path.exists(nist_str): # Lastly NIST Fits |
| 43 | + path_to_fit_dict[mat] = nist_str |
| 44 | + |
| 45 | + if fits_to_parse=="OTHER": |
| 46 | + if os.path.exists(other_str): # Then other fits |
| 47 | + path_to_fit_dict[mat] = other_str |
| 48 | + elif os.path.exists(nist_str): # Lastly NIST Fits |
| 49 | + path_to_fit_dict[mat] = nist_str |
| 50 | + |
| 51 | + if fits_to_parse=="RAW": |
| 52 | + if os.path.exists(raw_str): # Prioritize RAW fits |
| 53 | + path_to_fit_dict[mat] = fit_str |
| 54 | + |
| 55 | + return path_to_fit_dict |
41 | 56 |
|
42 | 57 | current_date = datetime.now().date()
|
43 | 58 |
|
44 |
| -create_data_table(output_array, f"..\\thermal_conductivity_compilation_{current_date}.txt") |
45 |
| -create_tc_csv(output_array, f"..\\thermal_conductivity_compilation_{current_date}.csv") |
| 59 | +# Want to create 4 output files |
| 60 | +# 1. Plain Bagel : Simple file that has only 1 fit per material and ignores weird materials |
| 61 | +simple_mat_direct = ["Aluminum_110", "Beryllium_Copper","Brass","CFRP","Constantan","Cu_OFHC_RRR50", |
| 62 | + "G10_FR4","Glass_FabricPolyester_He_warp","Graphite","Inconel_718","Invar_Fe36Ni", |
| 63 | + "Iron","Kapton","Ketron","Kevlar49_Composite_Aramid","Lead","Macor","Manganin", |
| 64 | + "Molybdenum","MylarPET","NbTi","Nichrome","Nickel_Steel_Fe_2.25_Ni","Nylon", |
| 65 | + "Phosbronze","Platinum","Polystyrene_2.0_lbft3","Polyurethane_2.0_lbft3_CO2", |
| 66 | + "PVC_1.25_lbft3_air","Stainless_Steel","Teflon","Ti6Al4V","Titanium_15333", |
| 67 | + "Torlon","Tungsten","VESPEL"] |
| 68 | +simple_bagel = make_pathtofit(mat_directories, subset=simple_mat_direct) |
| 69 | +output_array = compile_csv(simple_bagel) |
| 70 | +create_data_table(output_array, f"..\\tc_generic_{current_date}.txt") |
| 71 | +create_tc_csv(output_array, f"..\\tc_generic_{current_date}.csv") |
| 72 | + |
46 | 73 |
|
47 |
| -output_array = compile_csv(path_to_nistfits) |
48 |
| -create_data_table(output_array, f"..\\thermal_conductivity_compilation_NIST_{current_date}.txt") |
49 |
| -create_tc_csv(output_array, f"..\\thermal_conductivity_compilation_NIST_{current_date}.csv") |
| 74 | +# 2. Everything Bagel : File that contains every single material and alloy |
| 75 | +everything_bagel = make_pathtofit(mat_directories, fits_to_parse="ALL") |
| 76 | +output_array = compile_csv(everything_bagel) |
| 77 | +create_data_table(output_array, f"..\\tc_fullrepo_{current_date}.txt") |
| 78 | +create_tc_csv(output_array, f"..\\tc_fullrepo_{current_date}.csv") |
50 | 79 |
|
51 |
| -output_array = compile_csv(path_to_otherfits) |
52 |
| -create_data_table(output_array, f"..\\other_fits_{current_date}.txt") |
53 |
| -create_tc_csv(output_array, f"..\\other_fits_{current_date}.csv") |
| 80 | +# 3. Other fits + NIST |
| 81 | +other_fits = make_pathtofit(mat_directories, fits_to_parse="OTHER") |
| 82 | +output_array = compile_csv(other_fits) |
| 83 | +create_data_table(output_array, f"..\\tc_other_fits_{current_date}.txt") |
| 84 | +create_tc_csv(output_array, f"..\\tc_other_fits_{current_date}.csv") |
54 | 85 |
|
55 |
| -output_array = compile_csv(path_to_rawData) |
56 |
| -create_data_table(output_array, f"..\\rawData_Fits_{current_date}.txt") |
57 |
| -create_tc_csv(output_array, f"..\\rawData_Fits_{current_date}.csv") |
| 86 | +# 4. RAW / from data fits |
| 87 | +raw_fits = make_pathtofit(mat_directories, fits_to_parse="RAW") |
| 88 | +output_array = compile_csv(raw_fits) |
| 89 | +create_data_table(output_array, f"..\\tc_rawdata_fits_{current_date}.txt") |
| 90 | +create_tc_csv(output_array, f"..\\tc_rawdata_fits_{current_date}.csv") |
0 commit comments