-
-
Notifications
You must be signed in to change notification settings - Fork 545
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
Implement Conversion Classes #563
Conversation
Pull Request Test Coverage Report for Build 4985412034
💛 - Coveralls |
cantools/database/can/conversion.py
Outdated
|
||
return LinearConversion(scale=scale, offset=offset, is_float=is_float) | ||
|
||
return NamedSignalConversion(scale=scale, offset=offset, choices=choices) |
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.
hm. we possibly might need an NamedSignalIntegerConversion
because it is possible to define scaling factor of 1 and an integer offset with some named values (alternatively, all conversion classes could either return integers or floats)
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.
NamedSignalConversion calls the factory internally, so it always uses the correct conversion anyway
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.
I support this and would like to get it merged as soon as it is ready...
Here's the performance with of this PR :
Measured with python 3.11 on a i7-11850H |
interesting. I suppose the much better encoding performance is due to "inverse choice dictionaries"? the few performance regressions in your results are quite acceptable IMO... |
96c35a1
to
122f94c
Compare
@andlaus rebase is done |
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.
I'm a big fan of this change and would also like to see it merged soon! It certainly makes the implementation of my piecewise linear conversion significantly simpler, thanks!
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.
LGTM
Followup to the discussion in #537
The tests pass and i don't see any performance regression yet.
@andlaus @1atabey1 This is still in draft stage, but i'd like to hear your opinion.
Open points:
Signal
andBaseConversion
classes. At the very least, theSignal
attributes should be converted to properties, which point to the attributes ofSignal.conversion