Skip to content

Commit

Permalink
Figure size check
Browse files Browse the repository at this point in the history
  • Loading branch information
aronwalsh committed Jan 24, 2024
1 parent 974a754 commit a940e01
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 31 deletions.
42 changes: 12 additions & 30 deletions Lecture1.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@
"rates = arrhenius(activation_energy, T)\n",
"\n",
"# Plotting\n",
"pl.figure()\n",
"plt.figure(figsize=(5, 3)) \n",
"plt.plot(T, rates, label=f'Activation Energy = {activation_energy} eV')\n",
"plt.xlabel('Temperature (K)')\n",
"plt.ylabel('$D_{ion}$ (cm$^2$/s)') # Adding units to y-axis\n",
Expand Down Expand Up @@ -575,7 +575,7 @@
"T = np.linspace(100, 1000, 0)\n",
"\n",
"# Calculate rates and plot curves\n",
"plt.figure()\n",
"plt.figure(figsize=(5, 3)) \n",
"for activation_energy in activation_energies:\n",
" rates = arrhenius(activation_energy, T)\n",
" plt.plot(T, rates, label=f'{activation_energy:.1f} eV')\n",
Expand Down Expand Up @@ -624,7 +624,7 @@
"outputs": [],
"source": [
"# Plotting ln(R) vs 1000/T\n",
"plt.figure()\n",
"plt.figure(figsize=(5, 3)) \n",
"for activation_energy in activation_energies:\n",
" rates = arrhenius(activation_energy, T)\n",
" plt.plot(1000/T, np.log(rates), label=f'{activation_energy:.1f} eV')\n",
Expand Down Expand Up @@ -716,6 +716,7 @@
"error_bars = np.abs(residuals)\n",
"\n",
"# Plot the linear regression line\n",
"plt.figure(figsize=(5, 3)) \n",
"plt.errorbar(df['X'], df['Y'], yerr=error_bars, fmt='o', color='blue', label='Data with Errors')\n",
"plt.scatter(df['X'], df['Y'])\n",
"plt.plot(df['X'], y_pred, color='red')\n",
Expand Down Expand Up @@ -820,22 +821,9 @@
"source": [
"### Tasks\n",
"\n",
"Due to their importance in the electronics industry, diffusion of atoms in semiconductors has been well studied for decades. Below is a set of data for impurity diffusion in crystalline Si [Source: [Casey and Pearson (1975)](https://link.springer.com/chapter/10.1007/978-1-4684-0904-8_2)]. It has been arranged into a DataFrame for your convenience."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"colab": {
"base_uri": "https://localhost:8080/"
},
"id": "dt5CS9zOb5zt",
"outputId": "49d17988-e4ef-415f-a2e6-ef18d37e089e",
"tags": []
},
"outputs": [],
"source": [
"Due to their importance in the electronics industry, diffusion of atoms in semiconductors has been well studied for decades. Below is a set of data for impurity diffusion in crystalline Si [Source: [Casey and Pearson (1975)](https://link.springer.com/chapter/10.1007/978-1-4684-0904-8_2)]. It has been arranged into a DataFrame for your convenience.\n",
"\n",
"```python\n",
"import pandas as pd\n",
"\n",
"data = {\n",
Expand All @@ -845,24 +833,18 @@
"}\n",
"\n",
"df = pd.DataFrame(data)\n",
"print(df)"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "mm-bgIL_b5zt"
},
"source": [
"You have two tasks to complete:\n",
"print(df)\n",
"```\n",
"\n",
"You have two tasks to complete for this exercise:\n",
"\n",
"1. Produce a single plot using Matplotlib that contains diffusion coefficient vs reciprocal temperature for each of the impurities.\n",
"\n",
"2. Assess if the activation energy is correlated to the atomic mass of the elements using a plot. Is there a simple linear relationship? Provide a brief written statement to explain your analysis.\n",
"\n",
"<details>\n",
"<summary> Task hint </summary>\n",
"To speed up part 2: df['AtomicMass'] = [10.81, 26.98, 69.72, 114.82, 30.97, 74.92, 121.76, 208.98]\n",
"To speed up task 2: df['AtomicMass'] = [10.81, 26.98, 69.72, 114.82, 30.97, 74.92, 121.76, 208.98]\n",
"</details>\n",
"\n",
"```{admonition} Submission\n",
Expand Down
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
title: Machine Learning for Materials
author: Aron Walsh
logo: logo.png
copyright: "2023"
copyright: "2024"

# Force re-execution of notebooks on each build.
# See https://jupyterbook.org/content/execute.html
Expand Down

0 comments on commit a940e01

Please sign in to comment.