This repository contains the exercises for each week of the 02462 Signals and Data course at DTU for autumn 2025.
Before beginning to use this environment, we recommend setting up a virtual environment using the below guide:
UV is the cooler, newer sibling to Pip. Getting started with it is pretty straightforward, whether you already use conda or not.
- Install UV:
- If you have conda, open a conda terminal and write
pipx install uv. If this does not work, enterpip install uv. If this does not work, continue to step 2 to 3. - If don't have conda, and are on Windows, open a powershell terminal and enter
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" - If you don't have conda and are on Linux/macOS, open a terminal and enter
curl -LsSf https://astral.sh/uv/install.sh | sh, if you do not have curl, enterwget -qO- https://astral.sh/uv/install.sh | sh- If you get an error with the MacOS operation above, install with Homebrew instead. Firstly, install Homebrew using
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"then runbrew install uv
- If you get an error with the MacOS operation above, install with Homebrew instead. Firstly, install Homebrew using
- If you have conda, open a conda terminal and write
- Clone the git repository:
- If you have git installed and are on windows, enter git bash prompt and enter
git clone https://github.com/02462-Signals-and-Data/Signals-and-Data-Autumn-2025-student.git - If you have git installed and are on Linux/macOS, enter a terminal and enter
git clone https://github.com/02462-Signals-and-Data/Signals-and-Data-Autumn-2025-student.git - If you do not have git installed, follow this guide to install git
- If you for some reason don't want to use git, click "Code" and "Download ZIP" and unzip in the location you want to run it from
- If you have git installed and are on windows, enter git bash prompt and enter
- Sync UV environment:
- Enter the terminal you used to install UV (likely powershell if windows, regular terminal otherwise)
- Navigate to the folder you copied the git repository to with
cdfollowed by the path to the folder - Enter
uv sync- this should install all necessary packages from the uv.lock file to a new folder called .venv
- Open Jupyter notebooks:
- To use jupyter notebook directly:
- Open a terminal with the copied git folder as the directory
- Write
uv run --with jupyter jupyter lab - This should open up a jupyter notebook instance with all the packages installed by UV
- Repeat this whenever you want to reopen jupyter notebook
- To use notebooks in vscode:
- Enter one of the week's exercises
- Press ctrl+shift+p to open up the command window
- Write "interpreter" and you should be able to see an option called "Python: Select Interpreter". Press enter.
- Navigate to "Enter Interpreter Path" and press enter.
- It will prompt you for a path to the .venv folder. You can copy this by right-clicking the .venv folder and pressing "Copy Path".
- Enter this copied path into the vs code prompt.
- Following this, whenever you run a cell in a notebook for the first time, you should see your .venv folder as an option, select this.
- If it does not prompt you automatically, enter the command window with ctrl+shift+p and write "Kernel". Select the option called "Notebook: Select Notebook Kernel".
- Click "select other kernels"
- Navigate to the interpreter that points to the .venv folder path
- If done correctly, VSCode will now automatically suggest the same kernel for future use.
- To use jupyter notebook directly:
- If you feel any packages are missing, you always install them with
uv add package-name, this will also add them to the pyproject.toml file present in the project. - Packages can be removed with
uv remove package-namefollowed byuv sync. Runninguv lock, reproduces the uv.lock file, and allows for you to export a 'snapshot' environment to potential collaborators. - The reason we recommend uv as opposed to pip, is to avoid the typical problems of package mismanagement that comes with machine learning when dictated by pip. Usually this comes in the form of pip correctly installing a version of a package with depdencies, and then overwriting those dependecies when installing the next package. UV fixes this by having the uv.lock file define a specific 'tree' of dependency resolution, and not allowing subdependency mismatches between packages specified in the pyproject.toml file
Here we require pip, so we assume you have conda or simliar program with access to pip installed
-
Follow step 2 above to clone the git repository
-
Make a new conda environment (not necessary, but HIGHLY recommended)
- Enter a conda prompt and write
conda create --name signals-and-data python=3.11 -y - Activate the new conda environment with
conda activate signals-and-data - Install the packages in the requirements.txt file with
pip install -r requirements.txt(make sure you are in the same folder as the requirements.txt file!)
- Enter a conda prompt and write
-
Open Jupyter notebooks:
- To use jupyter notebook directly:
- Open a conda terminal
- Ensure you have the correct virtual environment chosen by running
conda activate signals-and-data - Enter
jupyter notebookto open a jupyter notebook
- To use notebooks in vscode:
- Open any of of the week's exercises
- Enter ctrl+shift+p to enter the command window
- Write 'Python', you should see an option called "Python: Select enterpreter", choose this
- Under conda environments, you should be able to see one called 'signals-and-data' choose this
- When running a jupyter notebook cell, you should be prompted to select a kernel
- Click "select another kernel"
- Click "python environments"
- Choose the aforementioned newly created Python environment "signals-and-data"
- To use jupyter notebook directly:
- We assume you can install and remove packages using pip yourselves
- A warning, pip doesn't have a very good dependency solver, and you may run into issues where it wants to install one package that depends on a specific version of subdependency A, while later installing another package which depends on another version of subdependency A, this will cause pip to overwrite the version of subdependency A based on whatever package that requires it was installed last.
Don't do this. It's not just for funsies we setup virtual environments. Stuff will break so long as you have any other course than this.
Just setup the virtual environment
During the course, we will both upload new material durig the weeks, as well as occasionally update existing material. To access these new updates, simply navigate to your project repository, open a terminal and write:
git pull --rebase --autostash
This should automatically do the following:
- Stash your saved changes to the exercises
- Pull the remote changes while rebasing your version to be placed at the 'head' of the git history
- Apply your stashed changes on top of these pulled changes.
Warning: This might cause problems if we have pushed changes to an exercise after you have made changes to it. In this case our new changes will either be overwritten by your local changes, or simply 'coexist' with your changes, meaning some code blocks might not make sense any longer.
You are of course free to use your own methods of pulling and such, but using this method automatically stashes and reapplies your local changes. Meaning:
- Git doesn't complain about you not having commited or stashed your changes
- Git does not overwrite your precious changes to existing weeks (in case we change something in the previous weeks to fix and error, for example)
- HOWEVER in the case of 2. it might lead to merge conflicts and the like, as your local changes are applied willy-nilly on the remote changes.