Skip to main content

turtlend

PyPI Python License: BSD-3-Clause Tests Docs Poetry DOI ORCID

A turtle that carries its own orthonormal frame through 3- or N-dimensional space.

turtlend provides three classes and depends only on NumPy:

  • TurtleND holds a position and an orthonormal frame in N dimensions. It moves along its heading and rotates in the plane of any two basis vectors.
  • Turtle3D is the three-dimensional turtle that TurtleND generalizes. It builds molecular geometry from bond lengths, bond angles and dihedral angles.
  • Vector3D is the vector class that Turtle3D uses, with helper functions for angles, dihedrals and distances.

Turtle3D began as C code written in 1990 and was ported to Python for proteusPy. TurtleND was written for WaveRider. Both packages carried their own copies of these modules. This package is the single source for both.

Install

pip install turtlend

turtlend requires Python 3.12 or 3.13.

Move a turtle in N dimensions

All angles are in degrees.

from turtlend import TurtleND

turtle = TurtleND(ndim=5)
turtle.move(1.0)             # along the heading, frame[0]
turtle.rotate(90.0, 0, 3)    # in the plane of basis vectors 0 and 3
turtle.move(1.0)

print(turtle.position)       # position in global coordinates
print(turtle.heading)        # frame[0]

In three or more dimensions, roll, pitch, yaw and turn are named cases of rotate and follow the Turtle3D conventions.

To convert a vector between the global frame and the turtle's frame, call to_local or to_global.

Record a path

To record each position the turtle visits, set recording to True:

turtle.recording = True
turtle.move(1.0)
turtle.turn(30.0)
turtle.move(1.0)

path = turtle.tape           # list of position arrays
turtle.reset_tape()

Add a dimension to a live turtle

expand_dim grows the position and the frame from N to N+1 dimensions and returns the index of the new axis. The existing basis vectors are unchanged.

axis = turtle.expand_dim(label="time")
turtle.orient_in_time(axis)  # heading becomes the negative unit vector of that axis

orient_in_time points the heading along the negative direction of the axis. To rotate the heading toward an arbitrary direction, call orient_toward.

Use the 3-D turtle

from turtlend import Turtle3D

turtle = Turtle3D()
turtle.move(1.53)
turtle.turn(109.5)
turtle.roll(60.0)

To place the turtle on a protein backbone, call orient_from_backbone with the N, CA, CB and C atom positions as NumPy arrays.

Develop

poetry install --with dev
poetry run pytest

Cite

The citation metadata is in CITATION.cff; GitHub renders it under "Cite this repository". The equivalent BibTeX entry is:

@software{suchanek2026turtlend,
  author  = {Suchanek, Eric G.},
  title   = {turtlend: Orthonormal-Frame Turtles in 3 and N Dimensions},
  version = {0.1.2},
  year    = {2026},
  url     = {https://github.com/Flux-Frontiers/turtlend},
  doi     = {10.5281/zenodo.22886555},
  license = {BSD-3-Clause}
}

The DOI is the Zenodo concept DOI, which always resolves to the newest archived release.

An article describing the approach and the algorithms is in articles/turtlend.tex, with a compiled PDF.

License

BSD-3-Clause. See LICENSE.

Metadata

Release files for turtlend 0.1.2

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

Source distribution (sdist)

Source distribution for turtlend 0.1.2
File Size Uploaded Provenance Actions
turtlend-0.1.2.tar.gz 17.4 kB With provenance Details for turtlend-0.1.2.tar.gz

Built distribution (wheel)

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

Total release size: 34.9 kB

Release files / turtlend-0.1.2.tar.gz

Download URL turtlend-0.1.2.tar.gz
Size 17.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d17408b93a43a6ebeb973c1d2108b8ee90fafcb8a437b527ce94096a6aa08b0f
BLAKE2b-256 checksum
How to use checksums
03941d9de420dff552d8eb3709d0c7d68972c7eaac39223d477ac49effce8ee6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 9, 2026.

Transparency log

Release files / turtlend-0.1.2-py3-none-any.whl

Download URL turtlend-0.1.2-py3-none-any.whl
Size 17.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2be9d28a5d0c48ebdc0c58dce61c2fd261702facd4e44e57efce028f82ccd808
BLAKE2b-256 checksum
How to use checksums
62cf1e9926d99d84e569c40f9bf52b0315811c4cc0a97eb1c4edecf5965a9f30
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 9, 2026.

Transparency log

Security for turtlend 0.1.2

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for turtlend-0.1.2.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 Nov 9, 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