Files
Aconity_ML_Expt1/process_y_data.ipynb
2023-08-03 21:33:03 +01:00

214 lines
5.9 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"cells": [
{
"cell_type": "code",
"execution_count": 49,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import pickle"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [],
"source": [
"# Read the excel file\n",
"doe_df = pd.read_excel(\n",
" \"data/NiTi_Cubes_Analysis.xlsx\",\n",
" sheet_name=\"DOE & RSPNS\",\n",
" header=1,\n",
" usecols=\"A:M, T:AC\",\n",
" nrows=81,\n",
")\n",
"# Remove newlines from column names\n",
"doe_df.rename(\n",
" mapper=dict(zip(doe_df.keys(), (k.replace(\"\\n\", \" \") for k in doe_df.keys()))),\n",
" axis=1,\n",
" inplace=True,\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"doe_df"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {},
"outputs": [],
"source": [
"# Split the dataframe into a dictionary of dataframes, one for each sample\n",
"sample_y = dict(iter(doe_df.groupby(\"Sample\")))"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"sample_y[1]"
]
},
{
"cell_type": "code",
"execution_count": 50,
"metadata": {},
"outputs": [],
"source": [
"# Finally, pickle this data for use in experiments\n",
"with open(\"sample_y.pkl\", \"wb\") as f:\n",
" pickle.dump(sample_y, f)"
]
},
{
"cell_type": "code",
"execution_count": 27,
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>Sample</th>\n",
" <th>Laser power, P\\n(W)</th>\n",
" <th>Scan speed, V\\n(mm/sec)</th>\n",
" <th>Spot size, F\\n(µm)</th>\n",
" <th>Hatch spacing, H\\n(µm)</th>\n",
" <th>Surface Energy Density @ 90µm Layer thickness, El (J/mm2)</th>\n",
" <th>Surface Energy Density @ Spot size, EF (J/mm2)</th>\n",
" <th>Vol. Energy Density @ Hatch Spacing, VEDH (J/mm3)</th>\n",
" <th>Vol. Energy Density @ Spot Size, VEDF (J/mm3)</th>\n",
" <th>Density\\n(Archimedes by Acetone)</th>\n",
" <th>...</th>\n",
" <th>Ni</th>\n",
" <th>Ti</th>\n",
" <th>Oxygen</th>\n",
" <th>Carbon</th>\n",
" <th>Ni (Norm)</th>\n",
" <th>Ti (Norm)</th>\n",
" <th>Sa (um)</th>\n",
" <th>Sku</th>\n",
" <th>Ssk</th>\n",
" <th>Sz (um)</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>1</td>\n",
" <td>180</td>\n",
" <td>1000</td>\n",
" <td>40</td>\n",
" <td>40</td>\n",
" <td>2.0</td>\n",
" <td>4.5</td>\n",
" <td>50.0</td>\n",
" <td>50.0</td>\n",
" <td>6.343695</td>\n",
" <td>...</td>\n",
" <td>41.33</td>\n",
" <td>43.76</td>\n",
" <td>1.1</td>\n",
" <td>13.81</td>\n",
" <td>48.5721</td>\n",
" <td>51.4279</td>\n",
" <td>18.686</td>\n",
" <td>3.243</td>\n",
" <td>0.28</td>\n",
" <td>187.116</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>1 rows × 23 columns</p>\n",
"</div>"
],
"text/plain": [
" Sample Laser power, P\\n(W) Scan speed, V\\n(mm/sec) Spot size, F\\n(µm) \\\n",
"0 1 180 1000 40 \n",
"\n",
" Hatch spacing, H\\n(µm) \\\n",
"0 40 \n",
"\n",
" Surface Energy Density @ 90µm Layer thickness, El (J/mm2) \\\n",
"0 2.0 \n",
"\n",
" Surface Energy Density @ Spot size, EF (J/mm2) \\\n",
"0 4.5 \n",
"\n",
" Vol. Energy Density @ Hatch Spacing, VEDH (J/mm3) \\\n",
"0 50.0 \n",
"\n",
" Vol. Energy Density @ Spot Size, VEDF (J/mm3) \\\n",
"0 50.0 \n",
"\n",
" Density\\n(Archimedes by Acetone) ... Ni Ti Oxygen Carbon \\\n",
"0 6.343695 ... 41.33 43.76 1.1 13.81 \n",
"\n",
" Ni (Norm) Ti (Norm) Sa (um) Sku Ssk Sz (um) \n",
"0 48.5721 51.4279 18.686 3.243 0.28 187.116 \n",
"\n",
"[1 rows x 23 columns]"
]
},
"execution_count": 27,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"sample_y[1]"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.3"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}