Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ models:
get_latest_training_material.ipynb
Contains a sumple bas git pull command to update the repository and pull all of the new materials onto the board.

bootcamp_utils:

Shared Python helper modules that are imported by the DPU-based session notebooks. Place this folder at the root of the repo so notebooks can import.

109 changes: 72 additions & 37 deletions bootcamp_sessions/PYNQ 101 - Intro to PYNQ/PYNQ101_intro_to_pynq.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Getting started with JupyterLab\n",
"\n",
"This notebook will introduce you to the JupyterLab interface. The goal of this session is to get you comfortable with talking to your new SOM board. You can get started by just reading the text here — but there are plenty of friendly helpers ready to help out too!"
]
"source": "<div style=\"background:linear-gradient(135deg,#ff6b35 0%,#7b2d8b 100%);padding:36px 32px;border-radius:16px;margin-bottom:24px;box-shadow:0 6px 24px rgba(0,0,0,0.18);\">\n<h1 style=\"color:white;font-size:2.2em;margin:0 0 8px 0;\">🐍 PYNQ 101: Intro to Python &amp; JupyterLab</h1>\n<p style=\"color:rgba(255,255,255,0.9);font-size:1.1em;margin:0 0 18px 0;\">Get started with Python programming and the JupyterLab environment</p>\n<div style=\"display:flex;gap:10px;flex-wrap:wrap;\"><span style=\"background:rgba(255,255,255,0.2);color:white;padding:6px 14px;border-radius:20px;font-size:0.9em;\">🐍 Python Basics</span><span style=\"background:rgba(255,255,255,0.2);color:white;padding:6px 14px;border-radius:20px;font-size:0.9em;\">📓 JupyterLab</span><span style=\"background:rgba(255,255,255,0.2);color:white;padding:6px 14px;border-radius:20px;font-size:0.9em;\">📊 Matplotlib</span><span style=\"background:rgba(255,255,255,0.2);color:white;padding:6px 14px;border-radius:20px;font-size:0.9em;\">🎮 Interactive</span></div>\n</div>\n\n<div style=\"background:#f3e5f5;border-left:6px solid #7b2d8b;border-radius:8px;padding:18px 22px;margin-bottom:20px;\">\n<strong style=\"color:#4a148c;font-size:1.05em;\">📋 In this notebook you will:</strong>\n<ul style=\"color:#4a148c;margin:10px 0 0 0;line-height:1.8;\"><li>Navigate the JupyterLab interface and run your first Python code</li><li>Work with variables, lists, loops, and if statements</li><li>Import and use Python libraries</li><li>Create matplotlib plots and display media in a notebook</li></ul>\n</div>"
},
{
"cell_type": "markdown",
Expand All @@ -26,13 +22,7 @@
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## JupyterLab\n",
"\n",
"**JupyterLab** is a next-generation web-based user interface for Project Jupyter. It enables you to work with documents and activities such as Jupyter notebooks, text editors, terminals and custom components in a flexible, integrated, and extensible manner. It is the interface that you are looking at right now. We will be using Jupyter notebooks through this bootcamp.\n",
"\n",
"A Jupyter notebook consists of cells that are used to write and run code or to record explanatory notes and comments. Notebooks are working documents that can be modified. It is always a good practice to save a copy of the original notebook before you start to edit. File-> Duplicate notebook lets you do this.\n"
]
"source": "<div style=\"background:linear-gradient(90deg,#0097a7 0%,#00bcd4 100%);border-radius:10px;padding:16px 24px;margin:8px 0 16px 0;box-shadow:0 3px 10px rgba(0,151,167,0.3);\">\n<h2 style=\"color:white;margin:0;font-size:1.4em;\">📓 Part 1 — JupyterLab</h2>\n<p style=\"color:rgba(255,255,255,0.85);margin:4px 0 0 0;font-size:0.95em;\">Get familiar with the notebook interface</p>\n</div>"
},
{
"cell_type": "markdown",
Expand All @@ -51,9 +41,7 @@
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Markdown basics"
]
"source": "<div style=\"background:linear-gradient(90deg,#0097a7 0%,#00bcd4 100%);border-radius:10px;padding:16px 24px;margin:8px 0 16px 0;box-shadow:0 3px 10px rgba(0,151,167,0.3);\">\n<h2 style=\"color:white;margin:0;font-size:1.4em;\">✏️ Part 2 — Markdown</h2>\n<p style=\"color:rgba(255,255,255,0.85);margin:4px 0 0 0;font-size:0.95em;\">Add formatted text and notes to your notebook</p>\n</div>"
},
{
"cell_type": "markdown",
Expand Down Expand Up @@ -87,15 +75,12 @@
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Running Python code\n",
"\n",
"You can type Python code into a Code Cell and execute it on the SOM board by running the cell — much like how we rendered Markdown previously.\n",
"\n",
"We'll focus just on reading and executing Python for now, so don't worry if you feel uncomfortable with writing your own quite yet.\n",
"\n",
"Let's start with a very simple example first. How about printing a string message?"
]
"source": "<div style=\"background:linear-gradient(90deg,#0097a7 0%,#00bcd4 100%);border-radius:10px;padding:16px 24px;margin:8px 0 16px 0;box-shadow:0 3px 10px rgba(0,151,167,0.3);\">\n<h2 style=\"color:white;margin:0;font-size:1.4em;\">🐍 Part 3 — Python Basics</h2>\n<p style=\"color:rgba(255,255,255,0.85);margin:4px 0 0 0;font-size:0.95em;\">Variables, lists, loops, and if statements</p>\n</div>"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "<div style=\"background:#e0f7fa;border-left:4px solid #0097a7;border-radius:6px;padding:10px 16px;color:#006064;\">\nRun your first Python print statement to say hello.\n</div>"
},
{
"cell_type": "code",
Expand All @@ -117,6 +102,11 @@
"We can write any Python code at all here. Let's try using a variable to store some data."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": "<div style=\"background:#ede7f6;border-left:4px solid #7b1fa2;border-radius:6px;padding:10px 16px;color:#4a148c;\">\nCreate a counter variable and print its starting value.\n</div>"
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -134,6 +124,11 @@
"Now we can use this `counter` value in future cells. Let's increase the counter value and then print it."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": "<div style=\"background:#e0f7fa;border-left:4px solid #0097a7;border-radius:6px;padding:10px 16px;color:#006064;\">\nIncrease the counter by one and print the new value.\n</div>"
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -155,6 +150,11 @@
"When working with more complicated data than single numbers, we can start to use Python structures like [lists](https://www.programiz.com/python-programming/list) and [dictionaries](https://www.programiz.com/python-programming/dictionary). Let's make a list of adjectives and a list of nouns."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": "<div style=\"background:#ede7f6;border-left:4px solid #7b1fa2;border-radius:6px;padding:10px 16px;color:#4a148c;\">\nCreate two lists of adjectives and nouns to use in a sentence.\n</div>"
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -172,6 +172,11 @@
"Now we can select words from each list by position. Be careful here — Python counts positions starting from 0! The first element is at position 0, the second is at position 1, etc."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": "<div style=\"background:#e0f7fa;border-left:4px solid #0097a7;border-radius:6px;padding:10px 16px;color:#006064;\">\nPrint specific words from the list using their index positions.\n</div>"
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -190,6 +195,11 @@
"Or we can even select multiple words:"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": "<div style=\"background:#e0f7fa;border-left:4px solid #0097a7;border-radius:6px;padding:10px 16px;color:#006064;\">\nPrint a slice of the adjectives list to get multiple items at once.\n</div>"
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -213,6 +223,11 @@
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": "<div style=\"background:#e0f7fa;border-left:4px solid #0097a7;border-radius:6px;padding:10px 16px;color:#006064;\">\nUse an if/else statement to check whether a condition is true or false.\n</div>"
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -236,6 +251,11 @@
"We can use a `for` loop to iterate over all of the elements in a list. In simpler terms, our temporary variable `number` takes on each value in the list, executing the statements within the loop once as each value. "
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": "<div style=\"background:#e0f7fa;border-left:4px solid #0097a7;border-radius:6px;padding:10px 16px;color:#006064;\">\nUse a for loop to repeat an action for each number in a list.\n</div>"
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -258,6 +278,11 @@
"Let's try it out."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": "<div style=\"background:#e0f7fa;border-left:4px solid #0097a7;border-radius:6px;padding:10px 16px;color:#006064;\">\nUse range() to loop through a sequence of numbers automatically.\n</div>"
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -272,11 +297,12 @@
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Using libraries\n",
"\n",
"Just for fun, let's combine a random pair of adjectives and nouns. For this, we need to import a Python library that can generate [random](https://docs.python.org/3/library/random.html) numbers. There are lots of existing Python modules like this available online — remember that you can import and use these for your own projects!"
]
"source": "<div style=\"background:linear-gradient(90deg,#0097a7 0%,#00bcd4 100%);border-radius:10px;padding:16px 24px;margin:8px 0 16px 0;box-shadow:0 3px 10px rgba(0,151,167,0.3);\">\n<h2 style=\"color:white;margin:0;font-size:1.4em;\">📦 Part 4 — Using Libraries</h2>\n<p style=\"color:rgba(255,255,255,0.85);margin:4px 0 0 0;font-size:0.95em;\">Import and use pre-built Python tools</p>\n</div>"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "<div style=\"background:#ede7f6;border-left:4px solid #7b1fa2;border-radius:6px;padding:10px 16px;color:#4a148c;\">\nCreate two lists of adjectives and nouns to use in a sentence.\n</div>"
},
{
"cell_type": "code",
Expand All @@ -299,6 +325,11 @@
"For any new library, we'll need to find out how to use it! We can look at the documentation from the notebook too. If you want to find out more about anything, just type `?` after it. For example, we used something called `random.randint` in the cell above. Let's find out what this does exactly."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": "<div style=\"background:#e0f7fa;border-left:4px solid #0097a7;border-radius:6px;padding:10px 16px;color:#006064;\">\nLook up the documentation for the random.randint function.\n</div>"
},
{
"cell_type": "code",
"execution_count": null,
Expand All @@ -320,13 +351,12 @@
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Displaying media\n",
"\n",
"So far we've only made Python output text. This is OK, but we can output much more interesting things in a notebook!\n",
"\n",
"For example, we can output YouTube videos!"
]
"source": "<div style=\"background:linear-gradient(90deg,#0097a7 0%,#00bcd4 100%);border-radius:10px;padding:16px 24px;margin:8px 0 16px 0;box-shadow:0 3px 10px rgba(0,151,167,0.3);\">\n<h2 style=\"color:white;margin:0;font-size:1.4em;\">🎬 Part 5 — Displaying Media</h2>\n<p style=\"color:rgba(255,255,255,0.85);margin:4px 0 0 0;font-size:0.95em;\">Show videos, images, and graphs in a notebook</p>\n</div>"
},
{
"cell_type": "markdown",
"metadata": {},
"source": "<div style=\"background:#e0f7fa;border-left:4px solid #0097a7;border-radius:6px;padding:10px 16px;color:#006064;\">\nDisplay an embedded YouTube video inside the notebook.\n</div>"
},
{
"cell_type": "code",
Expand All @@ -345,6 +375,11 @@
"Finally, we can show off some fancy plotting features using [`matplotlib`](https://matplotlib.org/gallery/index.html). This is quite advanced, so don't worry if the code is a little bit cryptic for now."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": "<div style=\"background:#e0f7fa;border-left:4px solid #0097a7;border-radius:6px;padding:10px 16px;color:#006064;\">\nUse numpy and matplotlib to plot a sine wave graph.\n</div>"
},
{
"cell_type": "code",
"execution_count": null,
Expand Down Expand Up @@ -439,4 +474,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
Loading