Skip to content

Commit c6a7922

Browse files
authored
Merge pull request #27 from DurhamARC-Training/dev
Merge changes for June 2025 course
2 parents 64626a7 + e28a16e commit c6a7922

11 files changed

Lines changed: 525 additions & 354 deletions

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
.ipynb_checkpoints
2-
matplotlib_output.*
2+
matplotlib_output.*
3+
*.pdf
4+
*.png
5+
*.svg

Course/01_Welcome.ipynb

Lines changed: 16 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,16 @@
1313
"# Data Analysis with Python\n",
1414
"\n",
1515
"## Course by Advanced Research Computing\n",
16-
"Tutors: Dmitry Nikolaenko, Jordan Byers, Paul Niklas Ruth, Thomas Flynn"
16+
"Tutors: Paul Niklas Ruth, Jordan Byers, Samantha Finnigan, Dmitry Nikolaenko"
1717
]
1818
},
1919
{
2020
"cell_type": "markdown",
2121
"metadata": {
22-
"editable": false,
2322
"slideshow": {
2423
"slide_type": "slide"
25-
}
24+
},
25+
"editable": false
2626
},
2727
"source": [
2828
"# Introduction\n",
@@ -32,52 +32,27 @@
3232
{
3333
"cell_type": "markdown",
3434
"metadata": {
35-
"editable": false,
36-
"slideshow": {
37-
"slide_type": "slide"
38-
}
39-
},
40-
"source": [
41-
"# Setting up your Python environment\n",
42-
"Use one of these possibilities:\n",
43-
" - https://notebooks.dmaitre.phyip3.dur.ac.uk/arc --> The Jupyter Notebook server set up by Daniel Maitre from the Physics department (log in with your CIS account; the loading process may take some time).\n",
44-
" - Your own Jupyter Notebook or Jupyter Lab --> If you haven't installed either of them yet, you can do so using pip (Python's package manager) or Conda (a package manager from Anaconda). See an installation script example in the attachment if you already have conda in your system, or follow the installation steps for pip on https://jupyter.org/install.\n",
45-
" - https://colab.research.google.com/ --> Google Colaboratory is a free cloud-based service hosted by Google. You don't need to worry about installing, all necessary libraries are already provided in the cloud."
46-
]
47-
},
48-
{
49-
"cell_type": "markdown",
50-
"metadata": {
51-
"editable": false,
5235
"slideshow": {
5336
"slide_type": "slide"
54-
}
37+
},
38+
"editable": false
5539
},
5640
"source": [
57-
"# Getting the Data\n",
41+
"# The Python Environment\n",
42+
"For this course we are using [JupyterLite](https://jupyterlite.readthedocs.io/en/stable/), which is a tool that allows us to launch [JupyterLab](https://jupyterlab.readthedocs.io/en/latest/) and run our Python code in the web browser through these notebook (.ipynb) files.\n",
5843
"\n",
59-
"- Access https://github.com/DurhamARC-Training/DataAnalysisPython and download the `Course` directory\n",
60-
"- The `Filled_Course` directory contains the filled in exercises for your reference\n",
61-
"- There is also a Python script which downloads everything (including the filled notebook) as a ZIP archive and extracts to a folder, if GIT isn't an available option for you:\n",
44+
"To access and run the course materials, start by:\n",
6245
"\n",
63-
" You can execute \n",
64-
" ```bash\n",
65-
" wget https://raw.githubusercontent.com/DurhamARC-Training/DataAnalysisPython/main/pull_files_from_repo_dap.py && python pull_files_from_repo_dap.py\n",
66-
" ```\n",
46+
"Navigating to the course materials on our GitHub page: \n",
6747
"\n",
68-
" This will automatically\n",
48+
"https://durhamarc-training.github.io/DataAnalysisPython/\n",
6949
"\n",
70-
" a. Download the `pull_files_from_repo_dap.py` file and put it into your environment.\n",
50+
"On the left side bar\n",
51+
" - find and open the \"Courses\" folder\n",
52+
" - open the file \"01_Welcome.ipynb\"\n",
7153
"\n",
72-
" b. Execute `python pull_files_from_repo_dap.py` in the folder."
54+
"NOTE: The first time you run your code/new modules, there may be a small wait while the module is loaded."
7355
]
74-
},
75-
{
76-
"cell_type": "code",
77-
"execution_count": null,
78-
"metadata": {},
79-
"outputs": [],
80-
"source": []
8156
}
8257
],
8358
"metadata": {
@@ -96,9 +71,9 @@
9671
"name": "python",
9772
"nbconvert_exporter": "python",
9873
"pygments_lexer": "ipython3",
99-
"version": "3.12.3"
74+
"version": "3.10.12"
10075
}
10176
},
10277
"nbformat": 4,
10378
"nbformat_minor": 4
104-
}
79+
}

Course/03_Matplotlib.ipynb

Lines changed: 44 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@
8181
{
8282
"cell_type": "code",
8383
"execution_count": null,
84-
"id": "39e06d4b",
84+
"id": "a1c0a7c7-8de5-4356-a769-dd2d935f5195",
8585
"metadata": {
8686
"editable": true,
8787
"remove_code": "non-comments",
@@ -130,7 +130,8 @@
130130
"\n",
131131
"# Plot the data on the subplots\n",
132132
"\n",
133-
"# Show plot\n"
133+
"# Show plot\n",
134+
"#plt.show()"
134135
]
135136
},
136137
{
@@ -190,8 +191,10 @@
190191
"# Add legends to the subplots\n",
191192
"\n",
192193
"# Adjust the spacing between subplots\n",
194+
"#fig.tight_layout()\n",
193195
"\n",
194-
"# Show the plot\n"
196+
"# Show the plot\n",
197+
"#plt.show()"
195198
]
196199
},
197200
{
@@ -260,7 +263,8 @@
260263
"\n",
261264
"# Customize plot appearance using grid and legend\n",
262265
"\n",
263-
"# Show the plot\n"
266+
"# Show the plot\n",
267+
"#plt.show()"
264268
]
265269
},
266270
{
@@ -318,7 +322,8 @@
318322
"\n",
319323
"# Demonstrate horizontal bar plot\n",
320324
"\n",
321-
"# Show the plot\n"
325+
"# Show the plot\n",
326+
"#plt.show()"
322327
]
323328
},
324329
{
@@ -365,7 +370,8 @@
365370
"\n",
366371
"# Create sorted horizontal bar plot\n",
367372
"\n",
368-
"# Show the plot\n"
373+
"# Show the plot\n",
374+
"#plt.show()"
369375
]
370376
},
371377
{
@@ -405,13 +411,13 @@
405411
{
406412
"cell_type": "code",
407413
"execution_count": null,
408-
"id": "86873b14-658d-41fc-b84e-75a8f60badb5",
409-
"metadata": {
410-
"remove_code": "non-comments"
411-
},
414+
"id": "4157aada-b18e-48b8-b1a8-0f74c94d554b",
415+
"metadata": {},
412416
"outputs": [],
413417
"source": [
414-
"# Set the plot style\n"
418+
"# Set the plot style\n",
419+
"plt.style.use('../mpl_styles/colors.mplstyle')\n",
420+
"colors = ['C1', 'C1', 'C2', 'C2', 'C3', 'C4', 'C5']"
415421
]
416422
},
417423
{
@@ -433,7 +439,8 @@
433439
"\n",
434440
"# Create the same sorted horizontal bar plot, but with colours\n",
435441
"\n",
436-
"# Show the plot\n"
442+
"# Show the plot\n",
443+
"#plt.show()"
437444
]
438445
},
439446
{
@@ -453,43 +460,46 @@
453460
{
454461
"cell_type": "code",
455462
"execution_count": null,
456-
"id": "31f6e1b3",
457-
"metadata": {
458-
"remove_code": "non-comments"
459-
},
463+
"id": "3b91fd43-f4ff-4bf0-afbe-b913329f73fd",
464+
"metadata": {},
460465
"outputs": [],
461466
"source": [
462467
"# Apply style to plot\n",
463-
"\n",
464-
" # Plot the data\n"
468+
"with plt.style.context(('../mpl_styles/presentation.mplstyle')):\n",
469+
" # Plot the data\n",
470+
" plt.plot(np.sin(np.linspace(0, 2 * np.pi)), 'C1-o')"
465471
]
466472
},
467473
{
468474
"cell_type": "code",
469475
"execution_count": null,
470-
"id": "d8235648",
471-
"metadata": {
472-
"remove_code": "non-comments"
473-
},
476+
"id": "b84d6086-fe3c-4fe7-8f67-58f35282e323",
477+
"metadata": {},
474478
"outputs": [],
475479
"source": [
476480
"# Apply style to plot\n",
477-
"\n",
478-
" # Plot the data\n"
481+
"with plt.style.context((\n",
482+
" '../mpl_styles/publication.mplstyle',\n",
483+
" '../mpl_styles/publication_onecolumn.mplstyle')\n",
484+
"):\n",
485+
" # Plot the data\n",
486+
" plt.plot(np.sin(np.linspace(0, 2 * np.pi)), 'C2-o')"
479487
]
480488
},
481489
{
482490
"cell_type": "code",
483491
"execution_count": null,
484-
"id": "795750e0",
485-
"metadata": {
486-
"remove_code": "non-comments"
487-
},
492+
"id": "f4381929-f222-4f55-b895-c57ba25a3d06",
493+
"metadata": {},
488494
"outputs": [],
489495
"source": [
490496
"# Apply style to plot\n",
491-
"\n",
492-
" # Plot the data\n"
497+
"with plt.style.context((\n",
498+
" '../mpl_styles/publication.mplstyle',\n",
499+
" '../mpl_styles/publication_twocolumn.mplstyle'\n",
500+
")):\n",
501+
" # Plot the data\n",
502+
" plt.plot(np.sin(np.linspace(0, 2 * np.pi)), 'C2-o')"
493503
]
494504
},
495505
{
@@ -527,7 +537,7 @@
527537
"execution_count": null,
528538
"id": "9e333843",
529539
"metadata": {
530-
"remove_code": "after:# Plot the data"
540+
"remove_code": "after:# Save the plot in a file"
531541
},
532542
"outputs": [],
533543
"source": [
@@ -543,6 +553,9 @@
543553
" fig, ax = plt.subplots()\n",
544554
"\n",
545555
" # Plot the data\n",
556+
" ax.plot(x, np.sin(x), 'C2')\n",
557+
" ax.set_xlabel('$x$')\n",
558+
" ax.set_ylabel(r'$\\sin(x)$ / a. u.')\n",
546559
"\n",
547560
" # Save the plot in a file\n"
548561
]

0 commit comments

Comments
 (0)