Skip to content

Commit 0c9503a

Browse files
committed
updates to notebook
1 parent c4ad568 commit 0c9503a

File tree

1 file changed

+34
-19
lines changed

1 file changed

+34
-19
lines changed

python1_2025_workshop.ipynb

Lines changed: 34 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -299,16 +299,6 @@
299299
"- The print() function is used to display the result of type(greeting) on the screen."
300300
]
301301
},
302-
{
303-
"cell_type": "code",
304-
"execution_count": null,
305-
"id": "f5e8aa5d",
306-
"metadata": {},
307-
"outputs": [],
308-
"source": [
309-
"ç"
310-
]
311-
},
312302
{
313303
"cell_type": "code",
314304
"execution_count": null,
@@ -716,7 +706,7 @@
716706
},
717707
{
718708
"cell_type": "code",
719-
"execution_count": 51,
709+
"execution_count": null,
720710
"id": "5af768f4",
721711
"metadata": {},
722712
"outputs": [],
@@ -753,7 +743,7 @@
753743
"metadata": {},
754744
"outputs": [],
755745
"source": [
756-
"np.loadtxt(fname=\"inflammation-01.csv\", delimiter=\",\")"
746+
"np.loadtxt(fname=\"data/inflammation-01.csv\", delimiter=\",\")"
757747
]
758748
},
759749
{
@@ -784,7 +774,7 @@
784774
"metadata": {},
785775
"outputs": [],
786776
"source": [
787-
"data = np.loadtxt(fname=\"inflammation-01.csv\", delimiter=\",\")"
777+
"data = np.loadtxt(fname=\"data/inflammation-01.csv\", delimiter=\",\")"
788778
]
789779
},
790780
{
@@ -909,6 +899,14 @@
909899
"print(\"First value in data:\", data[0,0])"
910900
]
911901
},
902+
{
903+
"cell_type": "markdown",
904+
"id": "92bd2173",
905+
"metadata": {},
906+
"source": [
907+
"Let's look at a slice of the data"
908+
]
909+
},
912910
{
913911
"cell_type": "code",
914912
"execution_count": null,
@@ -1091,9 +1089,9 @@
10911089
"metadata": {},
10921090
"outputs": [],
10931091
"source": [
1094-
"plt.imshow(data, aspect='1', cmap='viridis')\n",
1092+
"plt.imshow(data, aspect='1', cmap='Spectral_r')\n",
10951093
"# aspect='1' This specifies the aspect ratio of the plot,\n",
1096-
"# cmap='viridis' This specifies the colormap to use, viridis is a sequencial colormap. \n",
1094+
"# cmap='Spectral_r' This specifies the colormap to use, viridis, and Spectral_r are sequencial colormaps. \n",
10971095
"# 'viridis' is a popular perceptually-uniform colormap that \n",
10981096
"# ranges from dark blue through green to yellow. It's colorblind-friendly and works well for scientific visualization\n",
10991097
"plt.colorbar(label=\"Inflammation Level\") # Adds a color legend\n",
@@ -1108,7 +1106,9 @@
11081106
"id": "3edcfe88",
11091107
"metadata": {},
11101108
"source": [
1111-
"Storing our average inflammations each day in a variable and then calling that variable in a matplotlib plot and show set of functions.\n"
1109+
"Storing our average inflammations each day in a variable and then calling that variable in a matplotlib plot and show set of functions.\n",
1110+
"\n",
1111+
"`plt.plot()` is a function from the matplotlib.pyplot module in Python, used to create line plots. It is one of the most commonly used plotting functions in Matplotlib.\n"
11121112
]
11131113
},
11141114
{
@@ -1118,11 +1118,24 @@
11181118
"metadata": {},
11191119
"outputs": [],
11201120
"source": [
1121+
"# Calculate the average inflammation per day across all patients\n",
11211122
"ave_inflammation = np.mean(data, axis=0)\n",
1123+
"\n",
1124+
"# Plot the average inflammation\n",
11221125
"plt.plot(ave_inflammation)\n",
1126+
"\n",
1127+
"# Display the plot\n",
11231128
"plt.show()"
11241129
]
11251130
},
1131+
{
1132+
"cell_type": "markdown",
1133+
"id": "896b5926",
1134+
"metadata": {},
1135+
"source": [
1136+
"Here we can see the generated line plot representation of the average inflammation per day across all patients"
1137+
]
1138+
},
11261139
{
11271140
"cell_type": "markdown",
11281141
"id": "390a3c8b",
@@ -1148,7 +1161,7 @@
11481161
"metadata": {},
11491162
"outputs": [],
11501163
"source": [
1151-
"print(sorted(glob.glob(\"inflammation*.csv\")))"
1164+
"print(sorted(glob.glob(\"data/inflammation*.csv\")))"
11521165
]
11531166
},
11541167
{
@@ -1166,10 +1179,12 @@
11661179
"metadata": {},
11671180
"outputs": [],
11681181
"source": [
1169-
"filenames = sorted(glob.glob(\"inflammation*.csv\"))\n",
1182+
"filenames = sorted(glob.glob(\"data/inflammation*.csv\"))\n",
11701183
"\n",
11711184
"for filename in filenames:\n",
11721185
" print(filename)\n",
1186+
" # Use NumPy's loadtxt function to load the CSV data from the file specified by 'filename'.\n",
1187+
" # The 'fname' parameter receives the filename and 'delimiter' is set to a comma since the file is CSV-formatted.\n",
11731188
" data = np.loadtxt(fname=filename, delimiter=\",\")\n",
11741189
" \n",
11751190
" ave_inflammation = np.mean(data, axis=0)\n",
@@ -1250,7 +1265,7 @@
12501265
},
12511266
{
12521267
"cell_type": "code",
1253-
"execution_count": 52,
1268+
"execution_count": null,
12541269
"id": "ec2af987",
12551270
"metadata": {},
12561271
"outputs": [],

0 commit comments

Comments
 (0)