flightplotting 0.1.2__tar.gz → 0.1.3__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.
Files changed (22) hide show
  1. {flightplotting-0.1.2/flightplotting.egg-info → flightplotting-0.1.3}/PKG-INFO +1 -5
  2. flightplotting-0.1.3/flightplotting/__init__.py +4 -0
  3. {flightplotting-0.1.2 → flightplotting-0.1.3}/flightplotting/plots.py +31 -24
  4. {flightplotting-0.1.2 → flightplotting-0.1.3}/flightplotting/traces.py +17 -13
  5. {flightplotting-0.1.2 → flightplotting-0.1.3/flightplotting.egg-info}/PKG-INFO +1 -5
  6. flightplotting-0.1.3/flightplotting.egg-info/top_level.txt +1 -0
  7. {flightplotting-0.1.2 → flightplotting-0.1.3}/setup.cfg +1 -1
  8. flightplotting-0.1.2/flightplotting/__init__.py +0 -3
  9. flightplotting-0.1.2/flightplotting.egg-info/top_level.txt +0 -1
  10. {flightplotting-0.1.2 → flightplotting-0.1.3}/COPYING +0 -0
  11. {flightplotting-0.1.2 → flightplotting-0.1.3}/MANIFEST.in +0 -0
  12. {flightplotting-0.1.2 → flightplotting-0.1.3}/README.md +0 -0
  13. {flightplotting-0.1.2 → flightplotting-0.1.3}/flightplotting/data/ColdDraftF3APlane.obj +0 -0
  14. {flightplotting-0.1.2 → flightplotting-0.1.3}/flightplotting/data/__init__.py +0 -0
  15. {flightplotting-0.1.2 → flightplotting-0.1.3}/flightplotting/model.py +0 -0
  16. {flightplotting-0.1.2 → flightplotting-0.1.3}/flightplotting/templates.py +0 -0
  17. {flightplotting-0.1.2 → flightplotting-0.1.3}/flightplotting/titlerenderer.py +0 -0
  18. {flightplotting-0.1.2 → flightplotting-0.1.3}/flightplotting.egg-info/SOURCES.txt +0 -0
  19. {flightplotting-0.1.2 → flightplotting-0.1.3}/flightplotting.egg-info/dependency_links.txt +0 -0
  20. {flightplotting-0.1.2 → flightplotting-0.1.3}/flightplotting.egg-info/requires.txt +2 -2
  21. {flightplotting-0.1.2 → flightplotting-0.1.3}/setup.py +0 -0
  22. {flightplotting-0.1.2 → flightplotting-0.1.3}/tests/test_traces.py +0 -0
@@ -1,12 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flightplotting
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: Tools for Plotting Flight Data in Plotly
5
5
  Home-page: https://github.com/PyFlightCoach/FlightPlotting
6
6
  Author: Thomas David
7
7
  Author-email: thomasdavid0@gmail.com
8
- License: UNKNOWN
9
- Platform: UNKNOWN
10
8
  Description-Content-Type: text/markdown
11
9
  License-File: COPYING
12
10
 
@@ -14,5 +12,3 @@ License-File: COPYING
14
12
 
15
13
 
16
14
  This module contains utilities for plotting flight data using plotly
17
-
18
-
@@ -0,0 +1,4 @@
1
+
2
+
3
+ from flightplotting.plots import plotsec, plot_analysis, plotdtw, create_3d_plot
4
+ from flightplotting.traces import axestrace, trace3d, dtwtrace, vector, vectors
@@ -12,28 +12,41 @@ from flightplotting.traces import (
12
12
  control_inputs,
13
13
  cgtrace,
14
14
  ribbon,
15
- vectors
15
+ vectors,
16
+ axestrace
16
17
  )
17
18
 
18
19
  from flightanalysis import State, Manoeuvre
20
+ from geometry import Coord
19
21
  from flightplotting.model import obj, OBJ
22
+ from flightanalysis import State
20
23
  import numpy as np
24
+ from typing import List, Union
21
25
 
22
26
 
23
- def plotsec(sec, scale=5, nmodels=0, fig=None, color="orange", obj: OBJ=obj, cg=False, width=None, height=None, show_axes=False, ribb: bool=False, tips: bool=True):
24
- text = ["{:.1f}".format(val) for val in sec.data.index]
27
+ def plotsec(secs: Union[State, list[State]], scale=5, nmodels=0, fig=None,
28
+ color: Union[str, list[str]]=None, obj: OBJ=obj, cg=False, width=None,
29
+ height=None, show_axes=False, ribb: bool=False, tips: bool=True, origin=False):
30
+
25
31
  traces = []
26
- if ribb:
27
- traces += ribbon(sec, scale * 1.85, color)
28
-
29
- if tips:
30
- traces += tiptrace(sec, scale * 1.85, text=text)
31
-
32
- if nmodels > 0:
33
- traces += meshes(nmodels, sec, color, obj.scale(scale))
34
32
 
35
- if cg:
36
- traces += cgtrace(sec, text=text)
33
+ if isinstance(secs, State):
34
+ secs = [secs]
35
+
36
+ for i, sec in enumerate(secs):
37
+ text = ["{:.1f}".format(val) for val in sec.data.index]
38
+ _color = color if not color is None else px.colors.qualitative.Plotly[i]
39
+ if ribb:
40
+ traces += ribbon(sec, scale * 1.85, _color)
41
+ if tips:
42
+ traces += tiptrace(sec, scale * 1.85, text=text)
43
+ if nmodels > 0:
44
+ traces += meshes(nmodels, sec, _color, obj.scale(scale))
45
+ if cg:
46
+ traces += cgtrace(sec, text=text, color=_color)
47
+
48
+ if origin:
49
+ traces += axestrace(Coord.zero(), 50)
37
50
 
38
51
  if fig is None:
39
52
 
@@ -60,21 +73,15 @@ def plotsec(sec, scale=5, nmodels=0, fig=None, color="orange", obj: OBJ=obj, cg=
60
73
 
61
74
 
62
75
 
63
- def plotdtw(sec: State, manoeuvres, span=3):
76
+ def plotdtw(sec: State, manoeuvres: List[str], span=3):
64
77
  fig = go.Figure()
65
78
 
66
79
  traces = []#tiptrace(sec, span)
67
80
 
68
- for i, man in enumerate(manoeuvres):
69
- name = f"el {i}"
70
- if hasattr(man, 'name'):
71
- name=man.name
72
- elif hasattr(man, "uid"):
73
- name = man.uid
74
-
81
+ for i, name in enumerate(manoeuvres):
75
82
  try:
76
- seg = man.get_data(sec)
77
-
83
+ seg = sec.get_man_or_el(name)
84
+
78
85
  traces += ribbon(seg, span, px.colors.qualitative.Alphabet[i], name)
79
86
 
80
87
  traces.append(go.Scatter3d(
@@ -90,7 +97,7 @@ def plotdtw(sec: State, manoeuvres, span=3):
90
97
  print("no data for manoeuvre {}, {}".format(name, ex))
91
98
  fig = go.Figure(
92
99
  data=traces,
93
- layout=go.Layout(template="flight3d+judge_view")
100
+ layout=go.Layout(template="flight3d+judge_view"),
94
101
  )
95
102
 
96
103
  return fig
@@ -36,7 +36,10 @@ def meshes(npoints, seq: State, colour, obj: OBJ=obj):
36
36
  for st in sts:
37
37
  ms.append(obj.transform(Transformation(st.pos, st.att)).create_mesh(colour,f"{st.time.t[0]:.1f}"))
38
38
  return ms
39
- # return [obj.transform(Transformation(st.pos, st.att)).create_mesh(colour,f"{st.time.t[0]:.1f}") for st in seq[::step]]
39
+
40
+ def vector(origin, direction, **kwargs):
41
+ pdata = Point.concatenate([origin, origin+direction])
42
+ return trace3d(*pdata.data.T, **kwargs)
40
43
 
41
44
 
42
45
  def vectors(npoints: int, seq: State, vectors: Point, **kwargs):
@@ -44,7 +47,7 @@ def vectors(npoints: int, seq: State, vectors: Point, **kwargs):
44
47
  step = int(len(seq.data) / (npoints+1))
45
48
  for pos, wind in zip(seq.pos[::step], vectors[::step]):
46
49
  pdata = Point.concatenate([pos, pos+wind])
47
- trs.append(trace3d(*pdata.data.T, **kwargs))
50
+ trs.append(trace3d(*pdata.data.T, text=abs(vectors), **kwargs))
48
51
  return trs
49
52
 
50
53
 
@@ -182,13 +185,15 @@ def aoa_trace(sec, dash="dash", colours = px.colors.qualitative.Plotly):
182
185
  def axestrace(cid: Coord, length:float=20.0):
183
186
  ntraces = []
184
187
  colours = {"x":"red", "y":"blue", "z":"green"}
185
- for ax, col in zip([cid.x_axis, cid.y_axis, cid.z_axis], list("xyz")):
186
- axis = Point.concatenate([cid.origin, cid.origin + ax * length])
187
- ntraces.append(go.Scatter3d(
188
- x=axis.x, y=axis.y, z=axis.z, mode="lines",
189
- line=dict(color=colours[col]),
190
- name=col
191
- ))
188
+ for i, ci in enumerate(cid):
189
+ for ax, col in zip([ci.x_axis, ci.y_axis, ci.z_axis], list("xyz")):
190
+ axis = Point.concatenate([ci.origin, ci.origin + ax * length])
191
+ ntraces.append(go.Scatter3d(
192
+ x=axis.x, y=axis.y, z=axis.z, mode="lines",
193
+ line=dict(color=colours[col]),
194
+ name=col,
195
+ showlegend=True if i==0 else False
196
+ ))
192
197
 
193
198
  return ntraces
194
199
 
@@ -236,8 +241,8 @@ def ribbon(sec: State, span: float, color: str, name="none"):
236
241
 
237
242
  points = Point(_npinterzip(left.data, right.data))
238
243
 
239
- triids = np.array(range(len(points) - 2))
240
- _i = triids # 1 2 3 4 5
244
+
245
+ _i = np.array(range(len(points) - 2)) # 1 2 3 4 5
241
246
 
242
247
  _js = np.array(range(1, len(points), 2))
243
248
  _j = _npinterzip(_js, _js)[1:-1] # 1 3 3 4 4 5
@@ -249,7 +254,6 @@ def ribbon(sec: State, span: float, color: str, name="none"):
249
254
  return [go.Mesh3d(
250
255
  x=points.x, y=points.y, z=points.z, i=_i, j=_j, k=_k,
251
256
  intensitymode="cell",
252
- facecolor=np.full(len(triids), color),
253
- #hoverinfo=name,
257
+ facecolor=np.full(len(_i), color),
254
258
  name=name,
255
259
  )]
@@ -1,12 +1,10 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: flightplotting
3
- Version: 0.1.2
3
+ Version: 0.1.3
4
4
  Summary: Tools for Plotting Flight Data in Plotly
5
5
  Home-page: https://github.com/PyFlightCoach/FlightPlotting
6
6
  Author: Thomas David
7
7
  Author-email: thomasdavid0@gmail.com
8
- License: UNKNOWN
9
- Platform: UNKNOWN
10
8
  Description-Content-Type: text/markdown
11
9
  License-File: COPYING
12
10
 
@@ -14,5 +12,3 @@ License-File: COPYING
14
12
 
15
13
 
16
14
  This module contains utilities for plotting flight data using plotly
17
-
18
-
@@ -0,0 +1 @@
1
+ flightplotting
@@ -5,7 +5,7 @@ author_email = thomasdavid0@gmail.com
5
5
  description = Tools for Plotting Flight Data in Plotly
6
6
  long_description = file: README.md
7
7
  long_description_content_type = text/markdown
8
- version = 0.1.2
8
+ version = 0.1.3
9
9
  url = https://github.com/PyFlightCoach/FlightPlotting
10
10
 
11
11
  [options]
@@ -1,3 +0,0 @@
1
-
2
-
3
- from flightplotting.plots import plotsec, plot_analysis, plotdtw
File without changes
File without changes
@@ -1,5 +1,5 @@
1
- flightanalysis
1
+ setuptools
2
2
  flightdata
3
3
  pfc-geometry
4
+ flightanalysis
4
5
  plotly
5
- setuptools
File without changes