-
Notifications
You must be signed in to change notification settings - Fork 659
ASCII Reader/Writer enhancements #820
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
Conversation
Co-Authored-By: pierreluctg <pierreluctg@gmail.com>
Codecov Report
@@ Coverage Diff @@
## develop #820 +/- ##
===========================================
+ Coverage 69.81% 69.95% +0.13%
===========================================
Files 70 70
Lines 6603 6640 +37
===========================================
+ Hits 4610 4645 +35
- Misses 1993 1995 +2 |
Co-Authored-By: pierreluctg <pierreluctg@gmail.com>
Co-Authored-By: pierreluctg <pierreluctg@gmail.com>
Co-Authored-By: pierreluctg <pierreluctg@gmail.com>
| self._converted_base = self._check_base(base) | ||
| self.date = None | ||
| self.timestamps_format = None | ||
| self.internal_events_logged = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't seem to be used anywhere. It seems to just indicate the presence of the following line:
internal events logged
Can you help me understand why this needs to be exposed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@karlding The line can be either "internal events logged" or "no internal events logged". It may be useful in the future as we add support for more kinds of frames/events in the AscReader.
| _, base, _, timestamp_format = line.split() | ||
| except ValueError: | ||
| raise Exception("Unsupported header string format: {}".format(line)) | ||
| self.base = base |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The __init__ takes a given base, whereas here right after that we're potentially overwriting it. What happens if the constructor specified hex, but the file is dec?
If you were intending to use this value from the .asc to validate, I don't think you should've overwritten self.base on this line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@karlding In both the current and previous implementations, we were ignoring the base passed on to the constructor and using the base defined in the ASCII logs file to parse all the messages. It seems accurate to set base to the value actually used during parsing so I think overwriting it is fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, if the idea is for the ASCReader to parse the value from the file, then we should probably just deprecate those parameters in __init__ and raise a DeprecationWarning or something.
I don't have access to Vector's tools so I can't check, but are there cases where an ASC file is considered valid but it doesn't specify a base?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps the only use case I can think of is when we have a logs file split across two ASCII files. Not completely sure if the header is present in files other than the first file. If the intention is perhaps to read only the second file, then having a manually specified base can be useful. Your call.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's just leave this for now then. If someone has a use case for this, we can revisit it at that point.
|
Out of curiosity, do you have a sample file with some of the missing functionality that the current samples don't have? For example, I don't think the current ASC has any examples of error frames (and I think RTR frames? not sure if there's anything else). If so, could you include them? It would be nice to have specific tests for each type of frame using "golden files" to test parsing 🙂 |
felixdivo
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. I didn't test against an actual file though.
|
@karlding Added some examples for CAN / CANFD error, remote frames, etc to the current ASC logs file. |
|
Thanks for adding the additional frames! I think it might make test-writing easier if we split out the different frames into their own separate files, similar to what exists for the BLF format? That way we can also write tests that check that the parser is working by asserting on the type of frame that is converted to a |
Will look at BLF and replicate here. |
karlding
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding the extra tests!
Changes
Time analysis for both new & old implementations
We tested with an ASCII logs file with ~ 7 million messages (both classic CAN & FD) across 8 channels.
Old implementation: Took an average of 128 seconds across 3 runs
New implementation: Took an average of 117 seconds across 3 runs