flightdata 0.2.12__tar.gz → 0.2.14__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.
- {flightdata-0.2.12/flightdata.egg-info → flightdata-0.2.14}/PKG-INFO +1 -1
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata/base/__init__.py +5 -2
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata/base/table.py +15 -10
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata/flight/flight.py +39 -14
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata/state.py +4 -8
- {flightdata-0.2.12 → flightdata-0.2.14/flightdata.egg-info}/PKG-INFO +1 -1
- {flightdata-0.2.12 → flightdata-0.2.14}/test/base/test_table.py +6 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/.github/workflows/publish_pypi.yml +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/.gitignore +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/.vscode/launch.json +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/.vscode/settings.json +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/LICENSE +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/README.md +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/examples/__init__.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/examples/axis_rates.ipynb +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/examples/data/__init__.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/examples/data/manual_F3A_F23_22_04_28_00000231.json +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/examples/data/manual_F3A_P23_22_05_31_00000350.json +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/examples/data/manual_F3A_P23_23_08_11_00000094.json +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/examples/flight_data.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/examples/flight_dynamics/00000150.json +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/examples/flight_dynamics/__init__.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/examples/flight_dynamics/box.f3a +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/examples/flight_dynamics/param_id.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/examples/state_analysis/__init__.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/examples/state_analysis/axes.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/examples/state_analysis/state_fill_plot.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata/__init__.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata/base/collection.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata/base/constructs.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata/base/labeling.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata/base/numpy_encoder.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata/coefficients.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata/environment/__init__.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata/environment/environment.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata/environment/wind.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata/flight/__init__.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata/flight/ardupilot.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata/flight/fields.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata/flight/parameters.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata/flow.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata/model/__init__.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata/model/aerodynamic.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata/model/thrust.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata/origin.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata/scripts/collect_logs.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata/scripts/flightline.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata.egg-info/SOURCES.txt +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata.egg-info/dependency_links.txt +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata.egg-info/entry_points.txt +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata.egg-info/requires.txt +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/flightdata.egg-info/top_level.txt +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/pyproject.toml +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/requirements-dev.txt +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/requirements.txt +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/setup.cfg +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/EmailedBox.f3a +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/__init__.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/base/__init__.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/base/test_base_constructs.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/conftest.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/data/make_inputs.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/data/manual_F3A_P23.json +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/data/p23.BIN +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/data/p23.json +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/data/p23_box.f3a +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/data/p23_fc.json +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/data/p23_flight.json +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/data/vtol_hover.bin +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/data/vtol_hover.json +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/test_environment/__init__.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/test_environment/test_environment.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/test_environment/test_environment_wind.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/test_fields.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/test_flight.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/test_model/__init__.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/test_model/test_model_coefficients.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/test_model/test_model_flow.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/test_origin.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/test_state/__init__.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/test_state/test_state.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/test_state/test_state_builders.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/test_state/test_state_conversions.py +0 -0
- {flightdata-0.2.12 → flightdata-0.2.14}/test/test_state/test_state_measurements.py +0 -0
|
@@ -135,19 +135,24 @@ class Table:
|
|
|
135
135
|
axis=0,
|
|
136
136
|
ignore_index=True
|
|
137
137
|
).set_index("t", drop=False))
|
|
138
|
-
|
|
138
|
+
|
|
139
|
+
def zero_index(self):
|
|
140
|
+
data = self.data.copy()
|
|
141
|
+
return self.__class__(data.set_index(data.index - data.index[0]))
|
|
142
|
+
|
|
139
143
|
@classmethod
|
|
140
|
-
def stack(Cls,
|
|
144
|
+
def stack(Cls, sts: list, overlap: int=1) -> Self:
|
|
141
145
|
"""Stack a list of Tables on top of each other.
|
|
142
|
-
The overlap is the number of rows to overlap between each
|
|
146
|
+
The overlap is the number of rows to overlap between each st
|
|
143
147
|
"""
|
|
144
|
-
|
|
148
|
+
t0 = sts[0].data.index[0]
|
|
149
|
+
sts = [st.zero_index() for st in sts]
|
|
145
150
|
if overlap > 0:
|
|
146
|
-
offsets = np.cumsum([0] + [
|
|
147
|
-
dfs = [
|
|
151
|
+
offsets = np.cumsum([0] + [s0.data.index[-overlap] for s0 in sts[:-1]])
|
|
152
|
+
dfs = [st.data.iloc[:-overlap] for st in sts[:-1]] + [sts[-1].data]
|
|
148
153
|
elif overlap == 0:
|
|
149
|
-
offsets = np.cumsum([0] + [sec.duration + sec.dt[-1] for sec in
|
|
150
|
-
dfs = [
|
|
154
|
+
offsets = np.cumsum([0] + [sec.duration + sec.dt[-1] for sec in sts[:-1]])
|
|
155
|
+
dfs = [st.data for st in sts]
|
|
151
156
|
else:
|
|
152
157
|
raise AttributeError("Overlap must be >= 0")
|
|
153
158
|
|
|
@@ -155,7 +160,7 @@ class Table:
|
|
|
155
160
|
df.index = np.array(df.index) - df.index[0] + offset
|
|
156
161
|
combo = pd.concat(dfs)
|
|
157
162
|
combo.index.name = "t"
|
|
158
|
-
|
|
163
|
+
combo.index = combo.index + t0
|
|
159
164
|
combo["t"] = combo.index
|
|
160
165
|
|
|
161
166
|
return Cls(combo)
|
|
@@ -379,7 +384,7 @@ class Table:
|
|
|
379
384
|
if max_bck + max_fwd + get_len(i) < min_len:
|
|
380
385
|
raise Exception(f'{row.iloc[0]},{row.iloc[1]} too short and cannot shorten adjacent labels further')
|
|
381
386
|
else:
|
|
382
|
-
_extend = (min_len - get_len(i)) / 2
|
|
387
|
+
_extend = int(np.ceil((min_len - get_len(i)) / 2))
|
|
383
388
|
ebck = min(max_bck, int(np.floor(_extend)))
|
|
384
389
|
efwd = min(max_fwd, int(np.floor(_extend))+1)
|
|
385
390
|
|
|
@@ -447,6 +447,27 @@ class Flight:
|
|
|
447
447
|
))
|
|
448
448
|
return dfs
|
|
449
449
|
|
|
450
|
+
@staticmethod
|
|
451
|
+
def parse_fcj_data(origin: Origin, df: pd.DataFrame):
|
|
452
|
+
df = Flight.build_cols(
|
|
453
|
+
time_actual = df['time']/1e6 + int(time()),
|
|
454
|
+
time_flight = df['time']/1e6,
|
|
455
|
+
attitude_roll = np.radians(df['r']),
|
|
456
|
+
attitude_pitch = np.radians(df['p']),
|
|
457
|
+
attitude_yaw = np.radians(df['yw']),
|
|
458
|
+
position_N = df['N'],
|
|
459
|
+
position_E = df['E'],
|
|
460
|
+
position_D = df['D'],
|
|
461
|
+
velocity_N = df['VN'],
|
|
462
|
+
velocity_E = df['VE'],
|
|
463
|
+
velocity_D = df['VD'],
|
|
464
|
+
wind_N = df['wN'] if 'wN' in df.columns else None,
|
|
465
|
+
wind_E = df['wE'] if 'wE' in df.columns else None,
|
|
466
|
+
)
|
|
467
|
+
|
|
468
|
+
return Flight(df.set_index('time_flight', drop=False), None, origin, 'position')
|
|
469
|
+
|
|
470
|
+
|
|
450
471
|
@staticmethod
|
|
451
472
|
def from_fc_json(fc_json: Union[str, dict, IO]) -> Self:
|
|
452
473
|
|
|
@@ -473,20 +494,24 @@ class Flight:
|
|
|
473
494
|
wind_N = df['wN'] if 'wN' in df.columns else None,
|
|
474
495
|
wind_E = df['wE'] if 'wE' in df.columns else None,
|
|
475
496
|
)
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
497
|
+
|
|
498
|
+
if 'parameters' in fc_json:
|
|
499
|
+
origin = Origin(
|
|
500
|
+
'fcj_origin',
|
|
501
|
+
GPS(
|
|
502
|
+
float(fc_json['parameters']['pilotLat']),
|
|
503
|
+
float(fc_json['parameters']['pilotLng']),
|
|
504
|
+
float(fc_json['parameters']['pilotAlt'])
|
|
505
|
+
).offset(-Point(
|
|
506
|
+
fc_json['parameters']['moveNorth'],
|
|
507
|
+
fc_json['parameters']['moveEast'],
|
|
508
|
+
0,
|
|
509
|
+
)),
|
|
510
|
+
0
|
|
511
|
+
)
|
|
512
|
+
else:
|
|
513
|
+
origin = Origin('dummy_origin', GPS(0,0,0), -np.pi/2)
|
|
514
|
+
|
|
490
515
|
return Flight(df.set_index('time_flight', drop=False), None, origin, 'position')#.remove_time_flutter()
|
|
491
516
|
|
|
492
517
|
def remove_time_flutter(self):
|
|
@@ -15,7 +15,6 @@ class State(Table):
|
|
|
15
15
|
SVar("vel", g.Point, ["u", "v", "w"] , lambda st: g.P0() if len(st)==1 else st.att.inverse().transform_point(st.pos.diff(st.dt))),
|
|
16
16
|
SVar("rvel", g.Point, ["p", "q", "r"] , lambda st: g.P0() if len(st)==1 else st.att.body_diff(st.dt)),
|
|
17
17
|
SVar("acc", g.Point, ["du", "dv", "dw"] , lambda st : g.P0() if len(st)==1 else st.att.inverse().transform_point(st.att.transform_point(st.vel).diff(st.dt) + g.PZ(9.81, len(st)))),
|
|
18
|
-
SVar("racc", g.Point, ["dp", "dq", "dr"] , lambda st: g.P0() if len(st)==1 else st.rvel.diff(st.dt)),
|
|
19
18
|
])
|
|
20
19
|
_construct_freq = 30
|
|
21
20
|
|
|
@@ -131,7 +130,7 @@ class State(Table):
|
|
|
131
130
|
from scipy.spatial.distance import euclidean
|
|
132
131
|
def get_brv(brv):
|
|
133
132
|
if mirror:
|
|
134
|
-
brv = brv.abs() * g.Point(1, 0, 1) + brv * g.Point(0, 1, 0 )
|
|
133
|
+
brv = g.Point(np.abs(brv.x), brv.y, np.abs(brv.z))#brv.abs() * g.Point(1, 0, 1) + brv * g.Point(0, 1, 0 )
|
|
135
134
|
return brv * weights
|
|
136
135
|
|
|
137
136
|
fl = get_brv(flown.rvel)
|
|
@@ -147,7 +146,7 @@ class State(Table):
|
|
|
147
146
|
|
|
148
147
|
return distance, State.copy_labels(template, flown, path, 3)
|
|
149
148
|
|
|
150
|
-
def splitter_labels(self: State, mans: List[dict], better_names: List[str]=None) -> State:
|
|
149
|
+
def splitter_labels(self: State, mans: List[dict], better_names: List[str]=None, target_col='manoeuvre') -> State:
|
|
151
150
|
"""label the manoeuvres in a State based on the flight coach splitter information
|
|
152
151
|
|
|
153
152
|
TODO this assumes the state only contains the dataset contained in the json
|
|
@@ -164,7 +163,7 @@ class State(Table):
|
|
|
164
163
|
takeoff = self.data.iloc[0:int(mans[0]["stop"])+1]
|
|
165
164
|
|
|
166
165
|
labels = [mans[0]["name"]]
|
|
167
|
-
labelled = [State(takeoff).label(
|
|
166
|
+
labelled = [State(takeoff).label(**{target_col:labels[0]})]
|
|
168
167
|
if better_names:
|
|
169
168
|
better_names.append('land')
|
|
170
169
|
|
|
@@ -179,7 +178,7 @@ class State(Table):
|
|
|
179
178
|
labelled.append(
|
|
180
179
|
State(
|
|
181
180
|
self.data.iloc[int(split_man["start"]):int(split_man["stop"])+1]
|
|
182
|
-
).label(
|
|
181
|
+
).label(**{target_col:name})
|
|
183
182
|
)
|
|
184
183
|
labels.append(split_man["name"])
|
|
185
184
|
|
|
@@ -233,7 +232,6 @@ class State(Table):
|
|
|
233
232
|
vel=q.transform_point(self.vel),
|
|
234
233
|
rvel=q.transform_point(self.rvel),
|
|
235
234
|
acc=q.transform_point(self.acc),
|
|
236
|
-
racc=q.transform_point(self.racc),
|
|
237
235
|
))
|
|
238
236
|
|
|
239
237
|
def scale(self: State, factor: float) -> State:
|
|
@@ -244,7 +242,6 @@ class State(Table):
|
|
|
244
242
|
vel=self.vel * factor,
|
|
245
243
|
rvel=self.rvel,
|
|
246
244
|
acc=self.acc * factor,
|
|
247
|
-
racc=self.racc,
|
|
248
245
|
))
|
|
249
246
|
|
|
250
247
|
def mirror_zy(self: State) -> State:
|
|
@@ -456,7 +453,6 @@ class State(Table):
|
|
|
456
453
|
vel=self.vel,
|
|
457
454
|
rvel=self.rvel,
|
|
458
455
|
acc=self.acc,
|
|
459
|
-
racc=self.racc,
|
|
460
456
|
))
|
|
461
457
|
|
|
462
458
|
def move_back(self:State, transform:g.Transformation) -> State:
|
|
@@ -74,6 +74,12 @@ def test_stack(tab_full):
|
|
|
74
74
|
assert len(tfn) == 2 * len(tab_full) - 1
|
|
75
75
|
|
|
76
76
|
|
|
77
|
+
tfn = Table.stack([tfn.label(manoeuvre='m1'),tfn.label(manoeuvre='m2')])
|
|
78
|
+
assert tfn.data.index.is_monotonic_increasing
|
|
79
|
+
tfn2 = Table.stack(list(tfn.split_labels().values()))
|
|
80
|
+
assert tfn.duration == tfn2.duration
|
|
81
|
+
|
|
82
|
+
|
|
77
83
|
def test_shift_multi(tab_full):
|
|
78
84
|
tabs = Table.stack([tab_full.label(element='e0'), tab_full.label(element='e1')], overlap=1).split_labels()
|
|
79
85
|
tb1, tb2 = Table.shift_multi(2, tabs['e0'], tabs['e1'])
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|