From df81935e117eb8766447f3fa3db2790265577be9 Mon Sep 17 00:00:00 2001 From: "Andrew S. Messecar" <38142726+AndrewMessecar@users.noreply.github.com> Date: Tue, 21 Nov 2023 23:47:35 -0500 Subject: [PATCH] Added Power vs. Nitrogen Pressure Mapping Scripts Added "Mapping Data - Median.py" for the generation of a test/mapping data set that is used to produce a PAMBE processing space of two axes: one of RF plasma power and the other of substrate temperature. The other script, "Random Forest - Median.py" is used to train a random forest on the GaN Lattice Disorder S^2 training data CSV file and then makes predictions using the testing/mapping data previously produced by the "Mapping Data - Median.py" file. --- .../Lattice Disorder/Mapping Data - Median.py | 22 +++++++++ .../Random Forest - Median.py | 47 +++++++++++++++++++ 2 files changed, 69 insertions(+) create mode 100644 Code/Python/Gallium Nitride/Lattice Disorder/Mapping Data - Median.py create mode 100644 Code/Python/Gallium Nitride/Lattice Disorder/Random Forest - Median.py diff --git a/Code/Python/Gallium Nitride/Lattice Disorder/Mapping Data - Median.py b/Code/Python/Gallium Nitride/Lattice Disorder/Mapping Data - Median.py new file mode 100644 index 0000000..07c7d91 --- /dev/null +++ b/Code/Python/Gallium Nitride/Lattice Disorder/Mapping Data - Median.py @@ -0,0 +1,22 @@ +# Andrew S. Messecar +import csv + +# Median Substrate Temperature = 770 +N2_Pressure = 0.00001 +Gallium_Temperature = 960 +# Median RF Power = 150 +# Median Growth Time = 180 + +header = ['Substrate Temperature', 'RF Power', 'Ga Temperature', 'N2 Pressure'] + +with open('/home/garibasen/Documents/Data/WMU/Dropbox/S-squared/Mapping Data/Mapping_Data_Median.csv', 'w', encoding='UTF8', newline='') as f: + writer = csv.writer(f) + writer.writerow(header) + + for i in range(550): + + for j in range(1000): + + data = [j, 550 - i, Gallium_Temperature, N2_Pressure] + + writer.writerow(data) \ No newline at end of file diff --git a/Code/Python/Gallium Nitride/Lattice Disorder/Random Forest - Median.py b/Code/Python/Gallium Nitride/Lattice Disorder/Random Forest - Median.py new file mode 100644 index 0000000..89e5d3e --- /dev/null +++ b/Code/Python/Gallium Nitride/Lattice Disorder/Random Forest - Median.py @@ -0,0 +1,47 @@ +# Andrew Messecar + +from sklearn.ensemble import RandomForestRegressor +from sklearn.preprocessing import MinMaxScaler +# from sklearn.preprocessing import StandardScaler +from numpy import array, empty, reshape, arange +import pandas as pd +import seaborn as sb +from pylab import title, show, xlabel, ylabel, savefig, figure, yticks, xticks + +Epitaxy = pd.read_csv(r'/home/garibasen/Documents/Data/WMU/Dropbox/S-squared/GaN_S2.csv') + +Test_Inputs = pd.read_csv(r'/home/garibasen/Documents/Data/WMU/Dropbox/S-squared/Mapping Data/Mapping_Data_Median.csv') + +Training_Data = pd.DataFrame(Epitaxy, columns=['Substrate Temperature', 'RF Power', 'Ga Temperature', 'N2 Pressure', 'S2']) + +Map_Space = pd.DataFrame(Test_Inputs, columns=['Substrate Temperature', 'RF Power', 'Ga Temperature', 'N2 Pressure']) + + +Training_Inputs = Training_Data.loc[:, ['Substrate Temperature', 'RF Power', 'Ga Temperature', 'N2 Pressure']] + +Training_Outputs = Training_Data.loc[:, 'S2'] + +scaler = MinMaxScaler() +scaler.fit(Training_Inputs) +Training_Inputs = scaler.transform(Training_Inputs) +Map_Space = scaler.transform(Map_Space) + +Predictor = RandomForestRegressor(max_features=5, random_state=42, n_estimators=245) + +Predictor.fit(Training_Inputs, Training_Outputs) + +# Map = empty([550 , 1000]) + +# Parameter_Space = Map_Space.to_numpy() + +Map = Predictor.predict(Map_Space) + +figure(dpi=1200) +sb.heatmap(Map.reshape(550, 1000)) +yticks(arange(-0.01, 550, step=50), ['550', '500', '450', '400', '350', '300', '250', '200', '150', '100', '50', '0']) +xticks(arange(-0.01, 1000, step=100), ['0' , '100', '200', '300', '400', '500', '600', '700', '800', '900', '1000'],rotation=0) +# title("Predicted S^2 in GaN Thin Film Crystal") +xlabel("Substrate Temperature (Celsius)") +ylabel("Plasma Source Power (Watts)") + +show() \ No newline at end of file