Skip to main content

shoeboxpy

DOI

shoeboxpy

Installation

pip install git+https://github.com/incebellipipo/shoeboxpy.git

Documentation

pip install -r requirements.docs.txt

To build the HTML documentation with version selectors, run:

.\docs\make.bat multiversion

By default, documentation is generated for the main or master branch plus tags matching v*. Set SMV_LATEST_VERSION before building to rename a different branch to latest.

Theory

The shoeboxpy package provides simulation models for vessels with 3 and 6 degrees of freedom (DOF). These models are based on rigid-body dynamics, including added mass, damping, Coriolis/centripetal effects, and restoring forces.

6-DOF Model

The 6-DOF model represents a rectangular "shoebox" vessel with the following states:

  • Position and orientation in the inertial frame: $\eta = [x, y, z, \phi, \theta, \psi]$
  • Velocities in the body frame: $\nu = [u, v, w, p, q, r]$

3-DOF Model

The 3-DOF model simplifies the dynamics to planar motion (surge, sway, yaw) with states:

  • Position and orientation in the inertial frame: $\eta = [x, y, \psi]$
  • Velocities in the body frame: $\nu = [u, v, r]$

Dynamics

Dynamics for both models are governed by:

$$ \begin{aligned} & \dot{\eta} = J(\eta)\nu\ & (M_{RB} + M_A)\dot{\nu} + (C_{RB}(\nu) + C_A(\nu))\nu + D\nu = \tau + \tau_{\mathrm{ext}} + g_{\mathrm{restoring}}(\eta) \end{aligned} $$

where:

  • $M_{RB}$ and $M_A$ are the rigid-body and added mass matrices.
  • $C_{RB}(\nu)$ and $C_A(\nu)$ are the Coriolis/centripetal matrices.
  • $D$ is the linear damping matrix.
  • $\tau$ and $\tau_{\mathrm{ext}}$ are control and external forces/moments.
  • $g_{\mathrm{restoring}}(\eta)$ represents restoring forces in roll and pitch.

Both models use a 4th-order Runge-Kutta method for numerical integration, allowing for accurate simulation of vessel dynamics under various forces and moments.

Read the theory for more details.

Example

Here is an example of how to use the shoeboxpy package to simulate a 6-DOF vessel:

import numpy as np
from shoeboxpy.model6dof import Shoebox
from shoeboxpy.animate import animate_history

# Initialize the shoebox model
shoebox = Shoebox(
    L=1.0,  # Length (m)
    B=0.3,  # Width (m)
    T=0.03,  # Height (m)
    eta0=np.array([0.0, 0.0, 0.0, 0.1, 0.1, 0.1]),  # Initial position and orientation
    nu0=np.zeros(6),  # Initial velocities
    GM_phi=0.2,  # Metacentric height in roll
    GM_theta=0.2,  # Metacentric height in pitch
)

# Simulate for 10 seconds with a time step of 0.01 seconds
dt = 0.01
eta_history = []
for _ in range(int(10 / dt)):
    shoebox.step(tau=np.array([1.0, 0.2, 0.0, 0.0, 0.0, 0.1]), dt=dt)  # Apply control forces
    eta_history.append(shoebox.get_states()[0])  # Store position and orientation

# Convert history to a NumPy array for analysis or visualization
eta_history = np.array(eta_history)

animate_history(eta_history, dt=dt, L=1.0, B=0.3, T=0.2)  # Animate the results

Metadata

Release files for shoeboxpy 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for shoeboxpy 1.0.0
File Size Uploaded Provenance Actions
shoeboxpy-1.0.0.tar.gz 235.1 kB With provenance Details for shoeboxpy-1.0.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for shoeboxpy 1.0.0
File Interpreter ABI Platform Actions
shoeboxpy-1.0.0-py3-none-any.whl Python 3 none any Details for shoeboxpy-1.0.0-py3-none-any.whl

Total release size: 261.5 kB

Release files / shoeboxpy-1.0.0.tar.gz

Download URL shoeboxpy-1.0.0.tar.gz
Size 235.1 kB
Tags Source
SHA-256 checksum
How to use checksums
bd719217bc3f120f24dd015f055f3ef0e4e6abf7a19dbe28213743c824071379
BLAKE2b-256 checksum
How to use checksums
45ea924b8376e20c4d1f67a92eeac07f423ecb8647c28879dca38ecc99300d32
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Release files / shoeboxpy-1.0.0-py3-none-any.whl

Download URL shoeboxpy-1.0.0-py3-none-any.whl
Size 26.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8170eb1385ee35924632a534a91868321af267c8c5cce9df9be4cffa06128a43
BLAKE2b-256 checksum
How to use checksums
c58135a220ec671b3de9c7209d9f36d601b2cbe5a733eadef8338192a7c730ef
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

Security for shoeboxpy 1.0.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for shoeboxpy-1.0.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page