Underwater Systems

The course provides an extensive foundation in oceanic engineering, covering both theoretical concepts and practical applications.

It is part of the Master Degree in Robotics and Automation Engineering, University of Pisa, Italy

Teaching semester: Spring 2024

Language of instruction: Italian and English

Course coordinators:

Riccardo Costanzi and Andrea Munafo

Facts

  • Version: 1
  • Credits: 6
  • Study level: Master’s degree level

How to use

You can open and run each notebook in any order your prefer depending on your interest.

Installation Instructions

This repository’s notebooks are designed for Python 3.10 and depend on several Python libraries:

  • numpy
  • pandas
  • matplotlib
For a quick guide on setting up an Anaconda environment, refer to the 00_Getting_started_with_Python_and_Jupyter_Notebook.ipynb

notebook.

Troubleshooting

In case you encounter the following error:

ModuleNotFoundError: No module named 'underwater_systems'

It indicates that the underwater_system package is missing. To install it, execute the following command in your terminal, ideally from the root directory of this repository:

pip install -e '.[dev]'

Explanation of the command components: - -e: Stands for “editable”, allowing you to modify and immediately utilize the package during development. - .: Targets the current directory, implying the package is installed from here. - [dev]: Specifies additional “development” dependencies, which are required for tasks like documentation and testing, but not for the package’s core functionality.


Automating Jupyter Book PDF Generation with Images

Overview

The build_jupyterbook_with_images.py script automates the process of including images in the PDF version of your Jupyter Book. It copies an ‘images’ directory to the appropriate location within the Jupyter Book build directory and then executes the build process.

Prerequisites

  • Python 3.x installed.
  • Jupyter Book and its dependencies are installed.
  • pyppeteer

Structure Assumptions

  • The script is located in the bin directory at the project root.
  • The images folder, which contains the images to be included in the PDF, is at the project root.
  • The Jupyter notebooks are in a directory named nbs at the project root.

Usage Instructions

  1. Navigate to the bin directory where the script is located.

  2. Run the script using Python:

    python bin/build_jupyterbook_with_images.py
  3. The script will copy the images folder to the Jupyter Book build directory and then start the build process for the PDF version of your Jupyter Book.

  4. Upon successful execution, the script will output a confirmation message. If any issues occur, error messages will be displayed.

Fix for pyppeteer.errors.TimeoutError

If you encounter a timeout error (pyppeteer.errors.TimeoutError: Navigation Timeout Exceeded: 30000 ms exceeded) when building your Jupyter Book, a simple fix can be applied.

Steps to Apply the Fix

  1. Locate the pdf.py file in your Jupyter Book or pyppeteer environment.

  2. Open pdf.py and navigate to line 50.

  3. Modify the line from:

    await page.goto(f"file:///{html_file}", {"waitUntil": ["networkidle2"]})

    to:

    await page.goto(f"file:///{html_file}", {"timeout": 0, "waitUntil": ["networkidle2"]})

This change sets the timeout to zero, effectively removing the timeout limit, and allows the page to load completely before proceeding, which can resolve the timeout issue encountered during the PDF generation process.


Acknowledgements and references

  • Relevant textbooks and resources used to prepare these notebooks are reported in 00_Syllabus.ipynb

Frequently Asked Questions (FAQ)