indiflight-log-tools 0.3.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.
Files changed (34) hide show
  1. indiflight_log_tools-0.3.0/LICENSE +0 -0
  2. indiflight_log_tools-0.3.0/MANIFEST.in +2 -0
  3. indiflight_log_tools-0.3.0/PKG-INFO +80 -0
  4. indiflight_log_tools-0.3.0/README.md +58 -0
  5. indiflight_log_tools-0.3.0/indiflight_log_tools/__init__.py +17 -0
  6. indiflight_log_tools-0.3.0/indiflight_log_tools/blackbox-tools/src/blackbox_decode.c +1531 -0
  7. indiflight_log_tools-0.3.0/indiflight_log_tools/blackbox-tools/src/blackbox_fielddefs.c +32 -0
  8. indiflight_log_tools-0.3.0/indiflight_log_tools/blackbox-tools/src/blackbox_fielddefs.h +175 -0
  9. indiflight_log_tools-0.3.0/indiflight_log_tools/blackbox-tools/src/decoders.c +363 -0
  10. indiflight_log_tools-0.3.0/indiflight_log_tools/blackbox-tools/src/decoders.h +24 -0
  11. indiflight_log_tools-0.3.0/indiflight_log_tools/blackbox-tools/src/parser.c +1485 -0
  12. indiflight_log_tools-0.3.0/indiflight_log_tools/blackbox-tools/src/parser.h +235 -0
  13. indiflight_log_tools-0.3.0/indiflight_log_tools/blackbox-tools/src/platform.c +192 -0
  14. indiflight_log_tools-0.3.0/indiflight_log_tools/blackbox-tools/src/platform.h +79 -0
  15. indiflight_log_tools-0.3.0/indiflight_log_tools/blackbox-tools/src/stats.c +50 -0
  16. indiflight_log_tools-0.3.0/indiflight_log_tools/blackbox-tools/src/stats.h +17 -0
  17. indiflight_log_tools-0.3.0/indiflight_log_tools/blackbox-tools/src/stream.c +236 -0
  18. indiflight_log_tools-0.3.0/indiflight_log_tools/blackbox-tools/src/stream.h +49 -0
  19. indiflight_log_tools-0.3.0/indiflight_log_tools/blackbox-tools/src/tools.c +133 -0
  20. indiflight_log_tools-0.3.0/indiflight_log_tools/blackbox-tools/src/tools.h +42 -0
  21. indiflight_log_tools-0.3.0/indiflight_log_tools/blackbox-tools/src/units.c +101 -0
  22. indiflight_log_tools-0.3.0/indiflight_log_tools/blackbox-tools/src/units.h +61 -0
  23. indiflight_log_tools-0.3.0/indiflight_log_tools/cli.py +59 -0
  24. indiflight_log_tools-0.3.0/indiflight_log_tools/indiflight_log_importer.py +779 -0
  25. indiflight_log_tools-0.3.0/indiflight_log_tools/signal_tools.py +188 -0
  26. indiflight_log_tools-0.3.0/indiflight_log_tools.egg-info/PKG-INFO +80 -0
  27. indiflight_log_tools-0.3.0/indiflight_log_tools.egg-info/SOURCES.txt +32 -0
  28. indiflight_log_tools-0.3.0/indiflight_log_tools.egg-info/dependency_links.txt +1 -0
  29. indiflight_log_tools-0.3.0/indiflight_log_tools.egg-info/entry_points.txt +3 -0
  30. indiflight_log_tools-0.3.0/indiflight_log_tools.egg-info/requires.txt +8 -0
  31. indiflight_log_tools-0.3.0/indiflight_log_tools.egg-info/top_level.txt +1 -0
  32. indiflight_log_tools-0.3.0/pyproject.toml +60 -0
  33. indiflight_log_tools-0.3.0/setup.cfg +4 -0
  34. indiflight_log_tools-0.3.0/setup.py +66 -0
File without changes
@@ -0,0 +1,2 @@
1
+ graft indiflight_log_tools/blackbox-tools/src
2
+ include LICENSE README.md
@@ -0,0 +1,80 @@
1
+ Metadata-Version: 2.4
2
+ Name: indiflight_log_tools
3
+ Version: 0.3.0
4
+ Summary: Import Indiflight BFL logs fast and in correct units.
5
+ Author-email: Till Blaha <t.m.blaha@tudelft.nl>
6
+ Project-URL: Repository, https://github.com/tudelft/indiflight
7
+ Classifier: Programming Language :: Python :: 3
8
+ Classifier: Programming Language :: C
9
+ Classifier: Operating System :: POSIX :: Linux
10
+ Classifier: Operating System :: MacOS
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: numpy>=1.24
15
+ Requires-Dist: pandas>=2.0
16
+ Requires-Dist: scipy>=1.10
17
+ Requires-Dist: matplotlib>=3.7
18
+ Requires-Dist: platformdirs>=3.0
19
+ Provides-Extra: rerun
20
+ Requires-Dist: rerun-sdk; extra == "rerun"
21
+ Dynamic: license-file
22
+
23
+
24
+
25
+ ## Installation
26
+
27
+ Once published on PyPI (prebuilt wheels for Linux x86_64/aarch64 and macOS,
28
+ any Python >= 3.10, no compiler needed):
29
+ ```
30
+ pip install indiflight_log_tools # add [rerun] for bfl2rerun
31
+ ```
32
+
33
+ From the git repo (compiles the C decoder, so needs `gcc`/`clang`):
34
+ ```
35
+ pip install "git+https://github.com/tudelft/indiflight#subdirectory=support/LogAnalysis/indiflight_log_tools"
36
+ ```
37
+
38
+ From a local checkout (`-e` for development):
39
+ ```
40
+ pip install -e support/LogAnalysis/indiflight_log_tools
41
+ ```
42
+
43
+ Test it
44
+ ```
45
+ cd ~/ # or anywhere else, but not the source folder
46
+ python -c "from indiflight_log_tools import IndiflightLog; print(IndiflightLog.LIBRARY_SO)"
47
+ ```
48
+
49
+ ### Releasing
50
+
51
+ Bump `version` in `pyproject.toml`, then push a tag `log-tools-v<version>`.
52
+ `.github/workflows/log-tools-wheels.yml` builds the wheels and uploads them to PyPI.
53
+
54
+ ## Usage
55
+
56
+ ```
57
+ from indiflight_log_tools import IndiflightLog
58
+
59
+ log = IndiflightLog("/path/to/log.bfl", logId=3) # if multiple logs in the same logfile, use this to select the one you want. default 1
60
+ log = IndiflightLog("/path/to/log.bfl", resetTime=False) # resetTime maintains the flight controller time as the time basis in the dataframe (default True)
61
+ log = IndiflightLog("/path/to/log.bfl", resetTime=False, timeRange=(1000, 3000)) # crop the data to timeRange (given in ms)
62
+
63
+ log.raw # pandas dataframe in raw units
64
+ log.data # pandas dataframe in SI units
65
+ log.modeToText(log.data["flightModeFlags"]) # convert flight mode flag(s) into human-readable format
66
+ log.flags # flight mode changes with timestamp
67
+ [(t, log.modeToText(x), log.modeToText(y)) for t, x, y in zip(log.flags["timeUs"], log.flags["enable"], log.flags["disable"])] # flight mode changes in human readable format
68
+
69
+ log.outputCsv("raw") # output raw data as csv, comparable to outputting from BB log explorer
70
+ log.outputCsv("si") # output SI data as csv
71
+ log.outputCsv("si", path="my/path/for/logOutput/") # output SI data into a specific path
72
+
73
+ log.addToRerun(name="BFL", clockOffsetSeconds=0.) # send data Rerun (does not do init, connect, etc. just adding data)
74
+ ```
75
+
76
+ There are also command line tools you can use after installing the wheel:
77
+ ```
78
+ $ bfl2csv --help # shorthand for the log.outputCsv() above
79
+ $ bfl2rerun --help # shorthand for the log.addToRerun() above
80
+ ```
@@ -0,0 +1,58 @@
1
+
2
+
3
+ ## Installation
4
+
5
+ Once published on PyPI (prebuilt wheels for Linux x86_64/aarch64 and macOS,
6
+ any Python >= 3.10, no compiler needed):
7
+ ```
8
+ pip install indiflight_log_tools # add [rerun] for bfl2rerun
9
+ ```
10
+
11
+ From the git repo (compiles the C decoder, so needs `gcc`/`clang`):
12
+ ```
13
+ pip install "git+https://github.com/tudelft/indiflight#subdirectory=support/LogAnalysis/indiflight_log_tools"
14
+ ```
15
+
16
+ From a local checkout (`-e` for development):
17
+ ```
18
+ pip install -e support/LogAnalysis/indiflight_log_tools
19
+ ```
20
+
21
+ Test it
22
+ ```
23
+ cd ~/ # or anywhere else, but not the source folder
24
+ python -c "from indiflight_log_tools import IndiflightLog; print(IndiflightLog.LIBRARY_SO)"
25
+ ```
26
+
27
+ ### Releasing
28
+
29
+ Bump `version` in `pyproject.toml`, then push a tag `log-tools-v<version>`.
30
+ `.github/workflows/log-tools-wheels.yml` builds the wheels and uploads them to PyPI.
31
+
32
+ ## Usage
33
+
34
+ ```
35
+ from indiflight_log_tools import IndiflightLog
36
+
37
+ log = IndiflightLog("/path/to/log.bfl", logId=3) # if multiple logs in the same logfile, use this to select the one you want. default 1
38
+ log = IndiflightLog("/path/to/log.bfl", resetTime=False) # resetTime maintains the flight controller time as the time basis in the dataframe (default True)
39
+ log = IndiflightLog("/path/to/log.bfl", resetTime=False, timeRange=(1000, 3000)) # crop the data to timeRange (given in ms)
40
+
41
+ log.raw # pandas dataframe in raw units
42
+ log.data # pandas dataframe in SI units
43
+ log.modeToText(log.data["flightModeFlags"]) # convert flight mode flag(s) into human-readable format
44
+ log.flags # flight mode changes with timestamp
45
+ [(t, log.modeToText(x), log.modeToText(y)) for t, x, y in zip(log.flags["timeUs"], log.flags["enable"], log.flags["disable"])] # flight mode changes in human readable format
46
+
47
+ log.outputCsv("raw") # output raw data as csv, comparable to outputting from BB log explorer
48
+ log.outputCsv("si") # output SI data as csv
49
+ log.outputCsv("si", path="my/path/for/logOutput/") # output SI data into a specific path
50
+
51
+ log.addToRerun(name="BFL", clockOffsetSeconds=0.) # send data Rerun (does not do init, connect, etc. just adding data)
52
+ ```
53
+
54
+ There are also command line tools you can use after installing the wheel:
55
+ ```
56
+ $ bfl2csv --help # shorthand for the log.outputCsv() above
57
+ $ bfl2rerun --help # shorthand for the log.addToRerun() above
58
+ ```
@@ -0,0 +1,17 @@
1
+ # Copyright 2024 Till Blaha (Delft University of Technology)
2
+ #
3
+ # This program is free software: you can redistribute it and/or modify it
4
+ # under the terms of the GNU General Public License as published by the Free
5
+ # Software Foundation, either version 3 of the License, or (at your option)
6
+ # any later version.
7
+ #
8
+ # This program is distributed in the hope that it will be useful, but WITHOUT
9
+ # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10
+ # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11
+ # more details.
12
+ #
13
+ # You should have received a copy of the GNU General Public License along
14
+ # with this program. If not, see <https://www.gnu.org/licenses/>.
15
+
16
+
17
+ from .indiflight_log_importer import IndiflightLog