turtlend 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- turtlend-0.1.0/LICENSE +29 -0
- turtlend-0.1.0/PKG-INFO +125 -0
- turtlend-0.1.0/README.md +99 -0
- turtlend-0.1.0/pyproject.toml +99 -0
- turtlend-0.1.0/src/turtlend/__init__.py +43 -0
- turtlend-0.1.0/src/turtlend/py.typed +0 -0
- turtlend-0.1.0/src/turtlend/turtle3D.py +678 -0
- turtlend-0.1.0/src/turtlend/turtleND.py +517 -0
- turtlend-0.1.0/src/turtlend/vector3D.py +365 -0
turtlend-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
BSD 3-Clause License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026, Eric G. Suchanek, PhD
|
|
4
|
+
All rights reserved.
|
|
5
|
+
|
|
6
|
+
Redistribution and use in source and binary forms, with or without
|
|
7
|
+
modification, are permitted provided that the following conditions are met:
|
|
8
|
+
|
|
9
|
+
1. Redistributions of source code must retain the above copyright notice, this
|
|
10
|
+
list of conditions and the following disclaimer.
|
|
11
|
+
|
|
12
|
+
2. Redistributions in binary form must reproduce the above copyright notice,
|
|
13
|
+
this list of conditions and the following disclaimer in the documentation
|
|
14
|
+
and/or other materials provided with the distribution.
|
|
15
|
+
|
|
16
|
+
3. Neither the name of the copyright holder nor the names of its
|
|
17
|
+
contributors may be used to endorse or promote products derived from
|
|
18
|
+
this software without specific prior written permission.
|
|
19
|
+
|
|
20
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
21
|
+
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
22
|
+
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
23
|
+
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
24
|
+
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
25
|
+
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
26
|
+
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
27
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
28
|
+
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
29
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
turtlend-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: turtlend
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A turtle that carries its own orthonormal frame through 3- or N-dimensional space
|
|
5
|
+
License-Expression: BSD-3-Clause
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: turtle,turtle-geometry,coordinate-frame,givens-rotation,n-dimensional,manifold,embedding,molecular-modeling
|
|
8
|
+
Author: Eric G. Suchanek, PhD
|
|
9
|
+
Author-email: suchanek@flux-frontiers.com
|
|
10
|
+
Requires-Python: >=3.12,<3.14
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Science/Research
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Topic :: Scientific/Engineering :: Mathematics
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
18
|
+
Classifier: Typing :: Typed
|
|
19
|
+
Requires-Dist: numpy (>=1.26)
|
|
20
|
+
Project-URL: Documentation, https://flux-frontiers.github.io/turtlend/
|
|
21
|
+
Project-URL: Homepage, https://github.com/Flux-Frontiers/turtlend
|
|
22
|
+
Project-URL: Issues, https://github.com/Flux-Frontiers/turtlend/issues
|
|
23
|
+
Project-URL: Repository, https://github.com/Flux-Frontiers/turtlend
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
|
|
26
|
+
# turtlend
|
|
27
|
+
|
|
28
|
+
A turtle that carries its own orthonormal frame through 3- or N-dimensional space.
|
|
29
|
+
|
|
30
|
+
`turtlend` provides three classes and depends only on NumPy:
|
|
31
|
+
|
|
32
|
+
- `TurtleND` holds a position and an orthonormal frame in N dimensions. It moves
|
|
33
|
+
along its heading and rotates in the plane of any two basis vectors.
|
|
34
|
+
- `Turtle3D` is the three-dimensional turtle that `TurtleND` generalizes. It
|
|
35
|
+
builds molecular geometry from bond lengths, bond angles and dihedral angles.
|
|
36
|
+
- `Vector3D` is the vector class that `Turtle3D` uses, with helper functions
|
|
37
|
+
for angles, dihedrals and distances.
|
|
38
|
+
|
|
39
|
+
`Turtle3D` began as C code written in 1990 and was ported to Python for
|
|
40
|
+
[proteusPy](https://github.com/suchanek/proteusPy). `TurtleND` was written for
|
|
41
|
+
[WaveRider](https://github.com/Flux-Frontiers/waverider). Both packages carried
|
|
42
|
+
their own copies of these modules. This package is the single source for both.
|
|
43
|
+
|
|
44
|
+
## Install
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
pip install turtlend
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
`turtlend` requires Python 3.12 or 3.13.
|
|
51
|
+
|
|
52
|
+
## Move a turtle in N dimensions
|
|
53
|
+
|
|
54
|
+
All angles are in degrees.
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
from turtlend import TurtleND
|
|
58
|
+
|
|
59
|
+
turtle = TurtleND(ndim=5)
|
|
60
|
+
turtle.move(1.0) # along the heading, frame[0]
|
|
61
|
+
turtle.rotate(90.0, 0, 3) # in the plane of basis vectors 0 and 3
|
|
62
|
+
turtle.move(1.0)
|
|
63
|
+
|
|
64
|
+
print(turtle.position) # position in global coordinates
|
|
65
|
+
print(turtle.heading) # frame[0]
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
In three or more dimensions, `roll`, `pitch`, `yaw` and `turn` are named cases
|
|
69
|
+
of `rotate` and follow the `Turtle3D` conventions.
|
|
70
|
+
|
|
71
|
+
To convert a vector between the global frame and the turtle's frame, call
|
|
72
|
+
`to_local` or `to_global`.
|
|
73
|
+
|
|
74
|
+
## Record a path
|
|
75
|
+
|
|
76
|
+
To record each position the turtle visits, set `recording` to `True`:
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
turtle.recording = True
|
|
80
|
+
turtle.move(1.0)
|
|
81
|
+
turtle.turn(30.0)
|
|
82
|
+
turtle.move(1.0)
|
|
83
|
+
|
|
84
|
+
path = turtle.tape # list of position arrays
|
|
85
|
+
turtle.reset_tape()
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Add a dimension to a live turtle
|
|
89
|
+
|
|
90
|
+
`expand_dim` grows the position and the frame from N to N+1 dimensions and
|
|
91
|
+
returns the index of the new axis. The existing basis vectors are unchanged.
|
|
92
|
+
|
|
93
|
+
```python
|
|
94
|
+
axis = turtle.expand_dim(label="time")
|
|
95
|
+
turtle.orient_in_time(axis) # heading becomes the negative unit vector of that axis
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
`orient_in_time` points the heading along the negative direction of the axis.
|
|
99
|
+
To rotate the heading toward an arbitrary direction, call `orient_toward`.
|
|
100
|
+
|
|
101
|
+
## Use the 3-D turtle
|
|
102
|
+
|
|
103
|
+
```python
|
|
104
|
+
from turtlend import Turtle3D
|
|
105
|
+
|
|
106
|
+
turtle = Turtle3D()
|
|
107
|
+
turtle.move(1.53)
|
|
108
|
+
turtle.turn(109.5)
|
|
109
|
+
turtle.roll(60.0)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
To place the turtle on a protein backbone, call `orient_from_backbone` with
|
|
113
|
+
the N, CA, CB and C atom positions as NumPy arrays.
|
|
114
|
+
|
|
115
|
+
## Develop
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
poetry install --with dev
|
|
119
|
+
poetry run pytest
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## License
|
|
123
|
+
|
|
124
|
+
BSD-3-Clause. See [LICENSE](LICENSE).
|
|
125
|
+
|
turtlend-0.1.0/README.md
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# turtlend
|
|
2
|
+
|
|
3
|
+
A turtle that carries its own orthonormal frame through 3- or N-dimensional space.
|
|
4
|
+
|
|
5
|
+
`turtlend` provides three classes and depends only on NumPy:
|
|
6
|
+
|
|
7
|
+
- `TurtleND` holds a position and an orthonormal frame in N dimensions. It moves
|
|
8
|
+
along its heading and rotates in the plane of any two basis vectors.
|
|
9
|
+
- `Turtle3D` is the three-dimensional turtle that `TurtleND` generalizes. It
|
|
10
|
+
builds molecular geometry from bond lengths, bond angles and dihedral angles.
|
|
11
|
+
- `Vector3D` is the vector class that `Turtle3D` uses, with helper functions
|
|
12
|
+
for angles, dihedrals and distances.
|
|
13
|
+
|
|
14
|
+
`Turtle3D` began as C code written in 1990 and was ported to Python for
|
|
15
|
+
[proteusPy](https://github.com/suchanek/proteusPy). `TurtleND` was written for
|
|
16
|
+
[WaveRider](https://github.com/Flux-Frontiers/waverider). Both packages carried
|
|
17
|
+
their own copies of these modules. This package is the single source for both.
|
|
18
|
+
|
|
19
|
+
## Install
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install turtlend
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
`turtlend` requires Python 3.12 or 3.13.
|
|
26
|
+
|
|
27
|
+
## Move a turtle in N dimensions
|
|
28
|
+
|
|
29
|
+
All angles are in degrees.
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from turtlend import TurtleND
|
|
33
|
+
|
|
34
|
+
turtle = TurtleND(ndim=5)
|
|
35
|
+
turtle.move(1.0) # along the heading, frame[0]
|
|
36
|
+
turtle.rotate(90.0, 0, 3) # in the plane of basis vectors 0 and 3
|
|
37
|
+
turtle.move(1.0)
|
|
38
|
+
|
|
39
|
+
print(turtle.position) # position in global coordinates
|
|
40
|
+
print(turtle.heading) # frame[0]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
In three or more dimensions, `roll`, `pitch`, `yaw` and `turn` are named cases
|
|
44
|
+
of `rotate` and follow the `Turtle3D` conventions.
|
|
45
|
+
|
|
46
|
+
To convert a vector between the global frame and the turtle's frame, call
|
|
47
|
+
`to_local` or `to_global`.
|
|
48
|
+
|
|
49
|
+
## Record a path
|
|
50
|
+
|
|
51
|
+
To record each position the turtle visits, set `recording` to `True`:
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
turtle.recording = True
|
|
55
|
+
turtle.move(1.0)
|
|
56
|
+
turtle.turn(30.0)
|
|
57
|
+
turtle.move(1.0)
|
|
58
|
+
|
|
59
|
+
path = turtle.tape # list of position arrays
|
|
60
|
+
turtle.reset_tape()
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Add a dimension to a live turtle
|
|
64
|
+
|
|
65
|
+
`expand_dim` grows the position and the frame from N to N+1 dimensions and
|
|
66
|
+
returns the index of the new axis. The existing basis vectors are unchanged.
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
axis = turtle.expand_dim(label="time")
|
|
70
|
+
turtle.orient_in_time(axis) # heading becomes the negative unit vector of that axis
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
`orient_in_time` points the heading along the negative direction of the axis.
|
|
74
|
+
To rotate the heading toward an arbitrary direction, call `orient_toward`.
|
|
75
|
+
|
|
76
|
+
## Use the 3-D turtle
|
|
77
|
+
|
|
78
|
+
```python
|
|
79
|
+
from turtlend import Turtle3D
|
|
80
|
+
|
|
81
|
+
turtle = Turtle3D()
|
|
82
|
+
turtle.move(1.53)
|
|
83
|
+
turtle.turn(109.5)
|
|
84
|
+
turtle.roll(60.0)
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
To place the turtle on a protein backbone, call `orient_from_backbone` with
|
|
88
|
+
the N, CA, CB and C atom positions as NumPy arrays.
|
|
89
|
+
|
|
90
|
+
## Develop
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
poetry install --with dev
|
|
94
|
+
poetry run pytest
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## License
|
|
98
|
+
|
|
99
|
+
BSD-3-Clause. See [LICENSE](LICENSE).
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
# pyproject.toml -- turtlend package configuration
|
|
2
|
+
#
|
|
3
|
+
# Author: Eric G. Suchanek, PhD
|
|
4
|
+
#
|
|
5
|
+
# Install
|
|
6
|
+
# -------
|
|
7
|
+
# poetry install --with dev package + test and lint tooling
|
|
8
|
+
# poetry install --with docs + mkdocs, to build the Pages site
|
|
9
|
+
# pip install -e . package only
|
|
10
|
+
#
|
|
11
|
+
# Run tests
|
|
12
|
+
# ---------
|
|
13
|
+
# poetry install --with dev prerequisite
|
|
14
|
+
# pytest uses [tool.pytest.ini_options]
|
|
15
|
+
|
|
16
|
+
[build-system]
|
|
17
|
+
requires = ["poetry-core>=2.0.0"]
|
|
18
|
+
build-backend = "poetry.core.masonry.api"
|
|
19
|
+
|
|
20
|
+
[tool.poetry]
|
|
21
|
+
packages = [{ include = "turtlend", from = "src" }]
|
|
22
|
+
|
|
23
|
+
[project]
|
|
24
|
+
name = "turtlend"
|
|
25
|
+
version = "0.1.0"
|
|
26
|
+
description = "A turtle that carries its own orthonormal frame through 3- or N-dimensional space"
|
|
27
|
+
readme = "README.md"
|
|
28
|
+
license = "BSD-3-Clause"
|
|
29
|
+
license-files = ["LICENSE"]
|
|
30
|
+
authors = [{ name = "Eric G. Suchanek, PhD", email = "suchanek@flux-frontiers.com" }]
|
|
31
|
+
keywords = [
|
|
32
|
+
"turtle",
|
|
33
|
+
"turtle-geometry",
|
|
34
|
+
"coordinate-frame",
|
|
35
|
+
"givens-rotation",
|
|
36
|
+
"n-dimensional",
|
|
37
|
+
"manifold",
|
|
38
|
+
"embedding",
|
|
39
|
+
"molecular-modeling",
|
|
40
|
+
]
|
|
41
|
+
classifiers = [
|
|
42
|
+
"Development Status :: 4 - Beta",
|
|
43
|
+
"Intended Audience :: Science/Research",
|
|
44
|
+
"Intended Audience :: Developers",
|
|
45
|
+
"Topic :: Scientific/Engineering :: Mathematics",
|
|
46
|
+
"Programming Language :: Python :: 3",
|
|
47
|
+
"Programming Language :: Python :: 3.12",
|
|
48
|
+
"Programming Language :: Python :: 3.13",
|
|
49
|
+
"Typing :: Typed",
|
|
50
|
+
]
|
|
51
|
+
requires-python = ">=3.12,<3.14"
|
|
52
|
+
|
|
53
|
+
# numpy is the whole runtime. waverider and proteusPy both depend on this
|
|
54
|
+
# package, so anything added here lands in both of their locks.
|
|
55
|
+
dependencies = ["numpy>=1.26"]
|
|
56
|
+
|
|
57
|
+
[project.urls]
|
|
58
|
+
Homepage = "https://github.com/Flux-Frontiers/turtlend"
|
|
59
|
+
Repository = "https://github.com/Flux-Frontiers/turtlend"
|
|
60
|
+
Documentation = "https://flux-frontiers.github.io/turtlend/"
|
|
61
|
+
Issues = "https://github.com/Flux-Frontiers/turtlend/issues"
|
|
62
|
+
|
|
63
|
+
[tool.poetry.group.dev]
|
|
64
|
+
optional = true
|
|
65
|
+
|
|
66
|
+
[tool.poetry.group.dev.dependencies]
|
|
67
|
+
pytest = ">=9.0.3"
|
|
68
|
+
pytest-cov = ">=5.0"
|
|
69
|
+
ruff = ">=0.15"
|
|
70
|
+
ty = ">=0.0.41"
|
|
71
|
+
pre-commit = ">=4.5.1"
|
|
72
|
+
|
|
73
|
+
[tool.poetry.group.docs]
|
|
74
|
+
optional = true
|
|
75
|
+
|
|
76
|
+
[tool.poetry.group.docs.dependencies]
|
|
77
|
+
mkdocs-material = ">=9.5"
|
|
78
|
+
mkdocstrings = { version = ">=0.26", extras = ["python"] }
|
|
79
|
+
|
|
80
|
+
[tool.pytest.ini_options]
|
|
81
|
+
testpaths = ["tests"]
|
|
82
|
+
addopts = "-q --cov=turtlend --cov-report=term-missing --cov-fail-under=80"
|
|
83
|
+
|
|
84
|
+
[tool.ruff]
|
|
85
|
+
line-length = 100
|
|
86
|
+
target-version = "py312"
|
|
87
|
+
|
|
88
|
+
[tool.ruff.lint]
|
|
89
|
+
select = ["E", "F", "I", "W", "UP", "B"]
|
|
90
|
+
ignore = ["E501"]
|
|
91
|
+
|
|
92
|
+
[tool.ruff.lint.per-file-ignores]
|
|
93
|
+
# Turtle3D.new() takes Vector3D defaults. It normalizes them into new vectors
|
|
94
|
+
# and never mutates or stores the defaults, so the shared instances are safe.
|
|
95
|
+
"src/turtlend/turtle3D.py" = ["B008"]
|
|
96
|
+
|
|
97
|
+
[tool.pycodekg]
|
|
98
|
+
exclude = ["tests"]
|
|
99
|
+
include = ["src"]
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""
|
|
2
|
+
turtlend: a turtle that carries its own coordinate frame, in 3 or N dimensions.
|
|
3
|
+
|
|
4
|
+
``TurtleND`` holds a position and an orthonormal frame in N-dimensional space.
|
|
5
|
+
It moves along its heading and rotates in the plane of any two basis vectors.
|
|
6
|
+
``Turtle3D`` is the three-dimensional original it generalizes, and ``Vector3D``
|
|
7
|
+
is the vector class ``Turtle3D`` is built on.
|
|
8
|
+
|
|
9
|
+
Author: Eric G. Suchanek, PhD
|
|
10
|
+
Affiliation: Flux-Frontiers, https://github.com/Flux-Frontiers
|
|
11
|
+
License: BSD-3-Clause
|
|
12
|
+
"""
|
|
13
|
+
|
|
14
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
15
|
+
|
|
16
|
+
from .turtle3D import ORIENT_BACKBONE, ORIENT_SIDECHAIN, Turtle3D
|
|
17
|
+
from .turtleND import TurtleND
|
|
18
|
+
from .vector3D import (
|
|
19
|
+
Vector3D,
|
|
20
|
+
calc_angle,
|
|
21
|
+
calc_dihedral,
|
|
22
|
+
calculate_bond_angle,
|
|
23
|
+
distance3d,
|
|
24
|
+
rms_difference,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
try:
|
|
28
|
+
__version__ = version("turtlend")
|
|
29
|
+
except PackageNotFoundError:
|
|
30
|
+
__version__ = "0.0.0"
|
|
31
|
+
|
|
32
|
+
__all__ = [
|
|
33
|
+
"ORIENT_BACKBONE",
|
|
34
|
+
"ORIENT_SIDECHAIN",
|
|
35
|
+
"Turtle3D",
|
|
36
|
+
"TurtleND",
|
|
37
|
+
"Vector3D",
|
|
38
|
+
"calc_angle",
|
|
39
|
+
"calc_dihedral",
|
|
40
|
+
"calculate_bond_angle",
|
|
41
|
+
"distance3d",
|
|
42
|
+
"rms_difference",
|
|
43
|
+
]
|
|
File without changes
|