flightplotting 0.2.10__tar.gz → 0.2.11__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.
- flightplotting-0.2.11/.github/workflows/publish_pypi.yml +26 -0
- flightplotting-0.2.11/MANIFEST.in +1 -0
- flightplotting-0.2.11/PKG-INFO +27 -0
- {flightplotting-0.2.10 → flightplotting-0.2.11}/README.md +2 -2
- flightplotting-0.2.11/pyproject.toml +31 -0
- {flightplotting-0.2.10/flightplotting → flightplotting-0.2.11/src/plotting}/__init__.py +2 -2
- flightplotting-0.2.11/src/plotting/model.py +90 -0
- {flightplotting-0.2.10/flightplotting → flightplotting-0.2.11/src/plotting}/plots.py +7 -4
- {flightplotting-0.2.10/flightplotting → flightplotting-0.2.11/src/plotting}/templates.py +20 -0
- {flightplotting-0.2.10/flightplotting → flightplotting-0.2.11/src/plotting}/traces.py +2 -2
- flightplotting-0.2.11/tests/data/__init__.py +0 -0
- {flightplotting-0.2.10 → flightplotting-0.2.11}/tests/test_plots.py +2 -2
- flightplotting-0.2.11/uv.lock +615 -0
- flightplotting-0.2.10/.github/workflows/publish_pypi.yml +0 -52
- flightplotting-0.2.10/MANIFEST.in +0 -1
- flightplotting-0.2.10/PKG-INFO +0 -30
- flightplotting-0.2.10/flightplotting/model.py +0 -63
- flightplotting-0.2.10/flightplotting.egg-info/PKG-INFO +0 -30
- flightplotting-0.2.10/flightplotting.egg-info/SOURCES.txt +0 -25
- flightplotting-0.2.10/flightplotting.egg-info/dependency_links.txt +0 -1
- flightplotting-0.2.10/flightplotting.egg-info/requires.txt +0 -6
- flightplotting-0.2.10/flightplotting.egg-info/top_level.txt +0 -1
- flightplotting-0.2.10/pyproject.toml +0 -21
- flightplotting-0.2.10/requirements.txt +0 -6
- flightplotting-0.2.10/setup.cfg +0 -4
- {flightplotting-0.2.10 → flightplotting-0.2.11}/.gitignore +0 -0
- {flightplotting-0.2.10 → flightplotting-0.2.11}/.vscode/settings.json +0 -0
- {flightplotting-0.2.10 → flightplotting-0.2.11}/COPYING +0 -0
- {flightplotting-0.2.10/flightplotting → flightplotting-0.2.11/src/plotting}/data/ColdDraftF3APlane.obj +0 -0
- {flightplotting-0.2.10/flightplotting → flightplotting-0.2.11/src/plotting}/data/__init__.py +0 -0
- /flightplotting-0.2.10/tests/__init__.py → /flightplotting-0.2.11/src/plotting/py.typed +0 -0
- {flightplotting-0.2.10/flightplotting → flightplotting-0.2.11/src/plotting}/titlerenderer.py +0 -0
- {flightplotting-0.2.10/tests/data → flightplotting-0.2.11/tests}/__init__.py +0 -0
- {flightplotting-0.2.10 → flightplotting-0.2.11}/tests/data/p23_flight.json +0 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
name: Publish to PyPI and TestPyPI
|
|
2
|
+
on:
|
|
3
|
+
push:
|
|
4
|
+
branches:
|
|
5
|
+
- 'main'
|
|
6
|
+
jobs:
|
|
7
|
+
build:
|
|
8
|
+
name: Build and publish distribution
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
steps:
|
|
11
|
+
- name: Checkout repo
|
|
12
|
+
uses: actions/checkout@v4
|
|
13
|
+
|
|
14
|
+
- name: Install uv
|
|
15
|
+
uses: astral-sh/setup-uv@v3
|
|
16
|
+
with:
|
|
17
|
+
enable-cache: true
|
|
18
|
+
cache-dependency-glob: uv.lock
|
|
19
|
+
- name: Set up Python
|
|
20
|
+
run: uv python install 3.12
|
|
21
|
+
|
|
22
|
+
- name: Build
|
|
23
|
+
run: uv build
|
|
24
|
+
|
|
25
|
+
- name: Publish to PyPI
|
|
26
|
+
run: uv publish -t ${{ secrets.PYPI_TOKEN }}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
include plotting/data/*.obj
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: flightplotting
|
|
3
|
+
Version: 0.2.11
|
|
4
|
+
Summary: Add your description here
|
|
5
|
+
Author-email: Thomas David <thomasdavid0@gmail.com>
|
|
6
|
+
Requires-Python: >=3.12
|
|
7
|
+
Requires-Dist: flightanalysis>=0.3.13
|
|
8
|
+
Requires-Dist: flightdata>=0.2.24
|
|
9
|
+
Requires-Dist: numpy>=2.1.3
|
|
10
|
+
Requires-Dist: pandas>=2.2.3
|
|
11
|
+
Requires-Dist: pfc-geometry
|
|
12
|
+
Requires-Dist: plotly>=5.24.1
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
# plotting
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
This module contains utilities for plotting flight data using plotly
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
pip install plotting
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
pip install -e .
|
|
27
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "flightplotting"
|
|
3
|
+
version="v0.2.11"
|
|
4
|
+
description = "Add your description here"
|
|
5
|
+
readme = "README.md"
|
|
6
|
+
authors = [{ name = "Thomas David", email = "thomasdavid0@gmail.com" }]
|
|
7
|
+
requires-python = ">=3.12"
|
|
8
|
+
dependencies = [
|
|
9
|
+
"flightanalysis>=0.3.13",
|
|
10
|
+
"flightdata>=0.2.24",
|
|
11
|
+
"numpy>=2.1.3",
|
|
12
|
+
"pandas>=2.2.3",
|
|
13
|
+
"pfc-geometry",
|
|
14
|
+
"plotly>=5.24.1",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
[build-system]
|
|
18
|
+
requires = ["hatchling"]
|
|
19
|
+
build-backend = "hatchling.build"
|
|
20
|
+
|
|
21
|
+
[tool.hatch.build.targets.wheel]
|
|
22
|
+
packages = ["src/plotting"]
|
|
23
|
+
|
|
24
|
+
[tool.uv.sources]
|
|
25
|
+
pfc-geometry = { path = "../geometry" , editable = true}
|
|
26
|
+
flightdata = { path = "../FlightData" , editable = true}
|
|
27
|
+
flightanalysis = { path = "../FlightAnalysis" , editable = true}
|
|
28
|
+
ardupilot_log_reader = { path = "../ArdupilotLogReader" , editable = true}
|
|
29
|
+
|
|
30
|
+
[dependency-groups]
|
|
31
|
+
dev = ["ardupilot_log_reader>=0.3.5", "pymavlink>=2.4.42", "pytest>=8.3.3"]
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from importlib.resources import files
|
|
3
|
+
|
|
4
|
+
import numpy as np
|
|
5
|
+
import numpy.typing as npt
|
|
6
|
+
import plotly.graph_objects as go
|
|
7
|
+
from geometry import Point, Quaternion, Transformation
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
@dataclass
|
|
11
|
+
class OBJ:
|
|
12
|
+
vertices: Point
|
|
13
|
+
faces: npt.NDArray
|
|
14
|
+
normals: npt.NDArray = None
|
|
15
|
+
|
|
16
|
+
@staticmethod
|
|
17
|
+
def from_obj_data(odata):
|
|
18
|
+
lines = odata.splitlines()
|
|
19
|
+
|
|
20
|
+
vertices = np.array(
|
|
21
|
+
[l.split(" ")[1:] for l in lines if l[:2] == "v "], dtype=float
|
|
22
|
+
)
|
|
23
|
+
normals = [l.split(" ")[1:] for l in lines if l[:3] == "vn "]
|
|
24
|
+
faces = (
|
|
25
|
+
np.array(
|
|
26
|
+
[
|
|
27
|
+
[fn.split("//")[0] for fn in l.split(" ")[1:]]
|
|
28
|
+
for l in lines
|
|
29
|
+
if l[:2] == "f "
|
|
30
|
+
],
|
|
31
|
+
dtype=int,
|
|
32
|
+
)
|
|
33
|
+
- 1
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
return OBJ(Point(vertices), faces, normals)
|
|
37
|
+
|
|
38
|
+
@staticmethod
|
|
39
|
+
def from_obj_file(file):
|
|
40
|
+
if isinstance(file, str):
|
|
41
|
+
file = open(file, encoding="utf-8")
|
|
42
|
+
obj_data = file.read()
|
|
43
|
+
return OBJ.from_obj_data(obj_data)
|
|
44
|
+
|
|
45
|
+
def transform(
|
|
46
|
+
self,
|
|
47
|
+
transformantion: Transformation = Transformation(
|
|
48
|
+
Point(0.75, 0, 0), Quaternion.from_euler(Point(np.pi, 0, -np.pi / 2))
|
|
49
|
+
),
|
|
50
|
+
):
|
|
51
|
+
return OBJ(transformantion.point(self.vertices), self.faces)
|
|
52
|
+
|
|
53
|
+
def scale(self, scale_factor):
|
|
54
|
+
return OBJ(self.vertices * scale_factor, self.faces)
|
|
55
|
+
|
|
56
|
+
def create_mesh(self, colour="orange", name: str = ""):
|
|
57
|
+
"""Generate a Mesh3d of my plane transformed by the requested transformation.
|
|
58
|
+
|
|
59
|
+
Args:
|
|
60
|
+
name (str, optional): The name of the series. Defaults to ''.
|
|
61
|
+
|
|
62
|
+
Returns:
|
|
63
|
+
go.Mesh3d: a plotly Mesh3d containing the model
|
|
64
|
+
"""
|
|
65
|
+
|
|
66
|
+
x, y, z = self.vertices.data[:, :3].T
|
|
67
|
+
I, J, K = self.faces.T
|
|
68
|
+
return go.Mesh3d(
|
|
69
|
+
x=x,
|
|
70
|
+
y=y,
|
|
71
|
+
z=z,
|
|
72
|
+
i=I,
|
|
73
|
+
j=J,
|
|
74
|
+
k=K,
|
|
75
|
+
name=name,
|
|
76
|
+
showscale=False,
|
|
77
|
+
hoverinfo="name",
|
|
78
|
+
color=colour,
|
|
79
|
+
) # vertexcolor=vertices[:, 3:], #the color codes must be triplets of floats in [0,1]!!
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
_obj_string = (
|
|
83
|
+
files("plotting.data").joinpath("ColdDraftF3APlane.obj").open("r").read()
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
obj = OBJ.from_obj_data(_obj_string).transform(
|
|
87
|
+
Transformation(
|
|
88
|
+
Point(0.75, 0, 0), Quaternion.from_euler(Point(np.pi, 0, -np.pi / 2))
|
|
89
|
+
)
|
|
90
|
+
)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import plotly.graph_objects as go
|
|
2
2
|
from plotly.subplots import make_subplots
|
|
3
3
|
import plotly.express as px
|
|
4
|
-
import
|
|
5
|
-
from
|
|
4
|
+
import plotting.templates
|
|
5
|
+
from plotting.traces import (
|
|
6
6
|
tiptrace,
|
|
7
7
|
meshes,
|
|
8
8
|
control_input_trace,
|
|
@@ -17,11 +17,12 @@ from flightplotting.traces import (
|
|
|
17
17
|
from flightdata import State
|
|
18
18
|
from flightdata.base.labeling import get_appended_id
|
|
19
19
|
from geometry import Coord
|
|
20
|
-
from
|
|
20
|
+
from plotting.model import obj
|
|
21
21
|
import numpy.typing as npt
|
|
22
22
|
import numpy as np
|
|
23
23
|
import pandas as pd
|
|
24
24
|
from typing import List, Union
|
|
25
|
+
from flightanalysis.scoring.box import Box
|
|
25
26
|
|
|
26
27
|
|
|
27
28
|
def plotsec(
|
|
@@ -135,7 +136,7 @@ def plotdtw(sec: State, manoeuvres: List[str], span=3, fig=None):
|
|
|
135
136
|
|
|
136
137
|
|
|
137
138
|
def plot_regions(
|
|
138
|
-
st: State, lab_cols: list[str], span=3, colours=None, fig=None, **kwargs
|
|
139
|
+
st: State, lab_cols: list[str], span=3, colours=None, fig=None, box:Box=None, **kwargs
|
|
139
140
|
):
|
|
140
141
|
colours = px.colors.qualitative.Plotly if colours is None else colours
|
|
141
142
|
lab_cols = [lab_cols] if isinstance(lab_cols, str) else lab_cols
|
|
@@ -174,6 +175,8 @@ def plot_regions(
|
|
|
174
175
|
if fig is None:
|
|
175
176
|
fig = go.Figure(layout=go.Layout(template="flight3d+judge_view"))
|
|
176
177
|
fig.add_traces(traces)
|
|
178
|
+
if box:
|
|
179
|
+
fig.add_traces(box.plot())
|
|
177
180
|
return fig
|
|
178
181
|
|
|
179
182
|
|
|
@@ -27,3 +27,23 @@ judges_view_template = go.layout.Template(layout=go.Layout(scene_camera=dict(
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
pio.templates["judge_view"] = judges_view_template
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
clean_paper_template = go.layout.Template(layout=go.Layout(
|
|
33
|
+
margin=dict(l=0, r=0, t=0, b=0),
|
|
34
|
+
scene=dict(
|
|
35
|
+
aspectmode='data',
|
|
36
|
+
xaxis = dict(visible=False),
|
|
37
|
+
yaxis = dict(visible=False),
|
|
38
|
+
zaxis =dict(visible=False)
|
|
39
|
+
),
|
|
40
|
+
legend=dict(
|
|
41
|
+
font=dict(size=20),
|
|
42
|
+
yanchor="top",
|
|
43
|
+
y=0.99,
|
|
44
|
+
xanchor="left",
|
|
45
|
+
x=0.01
|
|
46
|
+
)
|
|
47
|
+
))
|
|
48
|
+
|
|
49
|
+
pio.templates["clean_paper"] = judges_view_template
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import plotly.graph_objects as go
|
|
2
|
-
import
|
|
2
|
+
import plotting.templates
|
|
3
3
|
from geometry import Point, Coord, Transformation
|
|
4
4
|
import numpy as np
|
|
5
5
|
from plotly.colors import DEFAULT_PLOTLY_COLORS
|
|
6
6
|
from flightdata import State
|
|
7
|
-
from
|
|
7
|
+
from plotting.model import obj, OBJ
|
|
8
8
|
import plotly.express as px
|
|
9
9
|
|
|
10
10
|
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
from flightdata import Flight, State
|
|
2
2
|
from pytest import fixture
|
|
3
|
-
from
|
|
4
|
-
from
|
|
3
|
+
from plotting import plotsec
|
|
4
|
+
from plotting.traces import cgtrace
|
|
5
5
|
import plotly.graph_objects as go
|
|
6
6
|
|
|
7
7
|
@fixture
|