Skip to content

Mf4 io #1289

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 53 commits into from
Apr 3, 2023
Merged

Mf4 io #1289

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
92ed3c1
add extra dependency
danielhrisca Feb 18, 2019
7b5902d
add mf4 io writer
danielhrisca Apr 18, 2019
1f5cdbc
update asammdf requirement
danielhrisca Apr 18, 2019
d06469e
changes after initial review
danielhrisca Apr 22, 2019
3ddf70e
simplify append call
danielhrisca Apr 22, 2019
29c3b7b
add MF4Reader class
danielhrisca Apr 22, 2019
1ad2c67
start testing
danielhrisca Apr 22, 2019
d0bffe5
passes tests
danielhrisca Apr 22, 2019
647f10b
update documentation
danielhrisca Apr 22, 2019
063d923
update docs and CI scripts
danielhrisca Apr 23, 2019
e2d72b9
retrigger build
danielhrisca Apr 25, 2019
6deee3a
update setup.py according to review
danielhrisca May 6, 2019
7e1ad4d
remove debug save file
danielhrisca May 6, 2019
b0553f2
changes after review
danielhrisca May 12, 2019
d86db31
updates after review
danielhrisca May 18, 2019
8560833
add cython requirement
danielhrisca Jul 10, 2019
5e41e42
fixes after review:
danielhrisca Sep 30, 2019
47eae9f
add MF4Writer and MF4Reader to logger and player modules
danielhrisca Sep 30, 2019
78cf8a9
reformat and change setup.py accordingly
felixdivo Sep 4, 2019
dbcbbfe
cleanup test file
felixdivo Sep 4, 2019
eb61a3a
cleanup docs
felixdivo Sep 4, 2019
b0d2460
cleanups and fix linter problems
felixdivo Sep 4, 2019
b051a03
re-add change to can.io.Logger; it somehow went lost while rebasing
felixdivo Oct 3, 2019
c0b9002
remove leftover __future__ import
felixdivo Oct 3, 2019
396761d
fix typing error in can.io's player.py and logger.py
driftregion Oct 6, 2019
3fea3cd
remove diff noise, remove deprecated appveyor CI
driftregion Apr 8, 2022
2ac9b3b
run black
driftregion Apr 8, 2022
c533d84
Fix import errors
driftregion Apr 8, 2022
4c333f7
add acquisition source needed by asammdf to extract bus logging
driftregion Apr 14, 2022
5ff902e
use correct source type, add md5 digest required by asammdf
driftregion Apr 14, 2022
812c02f
refactor test_extension_matching tests to use explicit extensions
driftregion May 18, 2022
632c8da
satiate mypy
driftregion May 27, 2022
1d931f7
update mf4 implementation
zariiii9003 Aug 7, 2022
5873e9e
fix AttributeError
zariiii9003 Aug 7, 2022
83253f1
format black
zariiii9003 Aug 7, 2022
4357f8b
refactoring
zariiii9003 Aug 7, 2022
43369fc
fix bugs and add direction support
zariiii9003 Aug 7, 2022
deb2fef
add timestamps to avoid ambiguity
zariiii9003 Aug 7, 2022
af09837
set allowed_timestamp_delta to 1e-4
zariiii9003 Aug 7, 2022
88e4430
read into BytesIO
zariiii9003 Aug 8, 2022
b83f2b3
Add restriction to docstring
zariiii9003 Aug 8, 2022
c3fd5ef
implement file_size
zariiii9003 Aug 10, 2022
0751b9d
constrain mf4 dependencies to pass CI tests
zariiii9003 Aug 10, 2022
8511e3e
format docstring
zariiii9003 Aug 11, 2022
a08f9dd
add mf4 extra
zariiii9003 Oct 10, 2022
8e84906
Update doc/listeners.rst
hardbyte Nov 14, 2022
83c670f
Remove platform specifiers for asammdf
hardbyte Nov 14, 2022
1b6f3af
Format code with black
hardbyte Nov 14, 2022
11a0982
Merge branch 'develop' into mf4-io
zariiii9003 Apr 2, 2023
da0c2c0
Merge branch 'develop' into mf4-io
zariiii9003 Apr 3, 2023
4896610
remove unnecessary parenthesis
zariiii9003 Apr 3, 2023
0bb19b8
install asammdf only for CPython <= 3.12
zariiii9003 Apr 3, 2023
b123e9b
fix NameError
zariiii9003 Apr 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[canalystii,gs_usb]
pip install -e .[canalystii,gs_usb,mf4]
pip install -r doc/doc-requirements.txt
- name: Build documentation
run: |
Expand Down
1 change: 1 addition & 0 deletions .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,4 @@ python:
extra_requirements:
- canalystii
- gs_usb
- mf4
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Features
- receiving, sending, and periodically sending messages
- normal and extended arbitration IDs
- `CAN FD <https://en.wikipedia.org/wiki/CAN_FD>`__ support
- many different loggers and readers supporting playback: ASC (CANalyzer format), BLF (Binary Logging Format by Vector), TRC, CSV, SQLite, and Canutils log
- many different loggers and readers supporting playback: ASC (CANalyzer format), BLF (Binary Logging Format by Vector), MF4 (Measurement Data Format v4 by ASAM), TRC, CSV, SQLite, and Canutils log
- efficient in-kernel or in-hardware filtering of messages on supported interfaces
- bus configuration reading from a file or from environment variables
- command line tools for working with CAN buses (see the `docs <https://python-can.readthedocs.io/en/stable/scripts.html>`__)
Expand Down
4 changes: 4 additions & 0 deletions can/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
"ModifiableCyclicTaskABC",
"Message",
"MessageSync",
"MF4Reader",
"MF4Writer",
"Notifier",
"Printer",
"RedirectReader",
Expand Down Expand Up @@ -94,6 +96,8 @@
Logger,
LogReader,
MessageSync,
MF4Reader,
MF4Writer,
Printer,
SizedRotatingLogger,
SqliteReader,
Expand Down
3 changes: 3 additions & 0 deletions can/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"Logger",
"LogReader",
"MessageSync",
"MF4Reader",
"MF4Writer",
"Printer",
"SizedRotatingLogger",
"SqliteReader",
Expand All @@ -36,6 +38,7 @@
from .blf import BLFReader, BLFWriter
from .canutils import CanutilsLogReader, CanutilsLogWriter
from .csv import CSVReader, CSVWriter
from .mf4 import MF4Reader, MF4Writer
from .printer import Printer
from .sqlite import SqliteReader, SqliteWriter
from .trc import TRCFileVersion, TRCReader, TRCWriter
18 changes: 13 additions & 5 deletions can/io/logger.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from .canutils import CanutilsLogWriter
from .csv import CSVWriter
from .generic import BaseIOHandler, FileIOMessageWriter, MessageWriter
from .mf4 import MF4Writer
from .printer import Printer
from .sqlite import SqliteWriter
from .trc import TRCWriter
Expand All @@ -38,6 +39,7 @@ class Logger(MessageWriter):
* .log :class:`can.CanutilsLogWriter`
* .trc :class:`can.TRCWriter`
* .txt :class:`can.Printer`
* .mf4 :class:`can.MF4Writer` (optional, depends on asammdf)

Any of these formats can be used with gzip compression by appending
the suffix .gz (e.g. filename.asc.gz). However, third-party tools might not
Expand All @@ -59,6 +61,7 @@ class Logger(MessageWriter):
".csv": CSVWriter,
".db": SqliteWriter,
".log": CanutilsLogWriter,
".mf4": MF4Writer,
".trc": TRCWriter,
".txt": Printer,
}
Expand All @@ -68,10 +71,12 @@ def __new__( # type: ignore
cls: Any, filename: Optional[StringPathLike], **kwargs: Any
) -> MessageWriter:
"""
:param filename: the filename/path of the file to write to,
may be a path-like object or None to
instantiate a :class:`~can.Printer`
:raises ValueError: if the filename's suffix is of an unknown file type
:param filename:
the filename/path of the file to write to,
may be a path-like object or None to
instantiate a :class:`~can.Printer`
:raises ValueError:
if the filename's suffix is of an unknown file type
"""
if filename is None:
return Printer(**kwargs)
Expand All @@ -92,7 +97,10 @@ def __new__( # type: ignore
suffix, file_or_filename = Logger.compress(filename, **kwargs)

try:
return Logger.message_writers[suffix](file=file_or_filename, **kwargs)
LoggerType = Logger.message_writers[suffix]
if LoggerType is None:
raise ValueError(f'failed to import logger for extension "{suffix}"')
return LoggerType(file=file_or_filename, **kwargs)
except KeyError:
raise ValueError(
f'No write support for this unknown log format "{suffix}"'
Expand Down
Loading