Skip to content
Open
Changes from 1 commit
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
108 changes: 100 additions & 8 deletions tutorials/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,22 @@ These tutorials were designed with the goal of building intution and introduce s

### Setup using conda

1. Check that you have [conda](https://docs.conda.io/en/latest/) installed.
To do so, run
1. Check that you have [conda](https://docs.conda.io/en/latest/) installed.
To do so, run
```sh
conda list
```
2. Run
2. Run
```sh
./create_environment
```
to generate the environment and install the dependencies.
to generate the environment and install the dependencies.

1. `cd` into the [python](../python) directory.

### Setup using virtualenv

1. Check that [virtualenv](https://github.com/pyenv/pyenv) is installed, if not then run
1. Check that [virtualenv](https://github.com/pyenv/pyenv) is installed, if not then run
```sh
pip install virtualenv
```
Expand All @@ -42,10 +42,102 @@ pip install -r requirements.txt
## Starting the notebooks

1. Make sure the `albatross` virtual environment is activated.
2. `cd` into to the [tutorials](../tutorials) directory.
3. Run
2. `cd` into to the [tutorials](../tutorials) directory.
3. Run
```sh
jupyter notebook
```
to start up the IPython notebooks in your browser.
to start up the IPython notebooks in your browser.


## Launching the tutorials using Docker

Docker provides an isolated environment with all necessary dependencies pre-installed, making it the easiest way to get started with the Albatross tutorials without worrying about local Python environment conflicts.

### Prerequisites

1. Install [Docker](https://docs.docker.com/get-docker/) on your system
2. Ensure Docker is running by checking:

```sh
docker --version
```

### Step-by-step Docker setup

1. **Navigate to the albatross root directory**

```sh
cd /path/to/albatross
```

2. **Pull the Jupyter Data Science notebook image**

```sh
docker pull jupyter/datascience-notebook:latest
```

This image contains Jupyter Lab with popular data science libraries (numpy, pandas, matplotlib, scipy, etc.) pre-installed.

3. **Launch the Docker container**

```sh
docker run -ti -p 8888:8888 -v `pwd`:/home/jovyan jupyter/datascience-notebook:latest
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in a new commit of this PR. Thanks!

```

**Command breakdown:**
- `-ti`: Run in interactive mode with a TTY
- `-p 8888:8888`: Map port 8888 from container to host
- `-v \`pwd\`/albatross:/home/jovyan`: Mount the albatross directory into the container

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: the /albatross part here I think should be removed?
Also a question, is the jovyan the name of the users home directory in the Docker datascience-notebook?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, thanks!

- The container will start and display a URL with a token

4. **Access Jupyter Lab**

Copy the URL from the terminal output (it will look like `http://127.0.0.1:8888/lab?token=...`) and paste it into your browser, or simply go to [http://127.0.0.1:8888/lab](http://127.0.0.1:8888/lab) and enter the token when prompted.

5. **Install Albatross-specific requirements**

Once Jupyter Lab is open, click on the "Terminal" tile in the launcher to open a terminal, then run:

```bash
pip install -r python/requirements.txt
```

This installs additional packages required for the tutorials:
- `emcee`: MCMC sampling library
- `gpflow`: Gaussian Process library
- `pyproj`: Cartographic projections
- `seaborn`: Statistical visualization
- And other dependencies

6. **Start working with tutorials**

Navigate to the `tutorials/` folder in the file browser and open any of the available notebooks:
- `tutorial_1_one_dimension.ipynb` - Introduction to 1D Gaussian Processes
- `tutorial_2_maximum_likelihood_estimation.ipynb` - Parameter estimation
- `tutorial_3_one_dimension_sparse.ipynb` - Sparse GPs for scalability
- `tutorial_4_kalman_fliter_equivalent.ipynb` - Time series applications
- `tutorial_5_evaluating_uncertainty.ipynb` - Uncertainty quantification

### Troubleshooting

- **Port 8888 already in use**: If you get a port binding error, either stop the existing service using port 8888 or use a different port:

```sh
docker run -ti -p 8889:8888 -v `pwd`/albatross:/home/jovyan jupyter/datascience-notebook:latest

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Also remove /albatross from here

```

Then access via [http://127.0.0.1:8889/lab](http://127.0.0.1:8889/lab)

- **Permission issues**: On Linux/macOS, you might need to add your user to the docker group or run with `sudo`

- **Volume mounting issues**: Ensure you're running the command from the albatross root directory

### Stopping the container

To stop the container, press `Ctrl+C` in the terminal where Docker is running, or run:

```sh
docker ps # Find the container ID
docker stop <container_id>
```