Open parthipan-ganeshaperumal opened 1 month ago
output always like this : conversion:<ChannelConversion (name: , unit: , comment: , formula: , referenced blocks: None, address: 0, fields: ['address:0', 'block_len:80', 'comment:', 'comment_addr:0', 'conversion_type:0', 'flags:0', 'formula:', "id:b'##CC'", 'inv_conv_addr:0', 'links_nr:4', 'max_phy_value:0', 'min_phy_value:0', 'name:', 'name_addr:0', 'precision:1', 'ref_param_nr:0', 'referenced_blocks:None', 'reserved0:0', 'unit:', 'unit_addr:0', 'val_param_nr:0'])>
but I expect convesion_type like that : {0:xx,1:yy,2:xxx} under conversion type attribute
You probably need to setup the correct dict keys like the example shows https://github.com/danielhrisca/asammdf/blob/1585aa9e8c2519fd9a57ddef5fd5fc68ea6af63b/examples/mf4_demo.py#L90
For my case : input look like 'conversion_type': 'lookup_dict', 'lookup_dict': [[0, 'FALSE'], [1, 'TRUE']]}
but received out like conversion=<ChannelConversion (name: , unit: , comment: , formula: , referenced blocks: None, address: 0, fields: ['address:0', 'block_len:80', 'comment:', 'comment_addr:0', 'conversion_type:0', 'flags:0', 'formula:', "id:b'##CC'", 'inv_conv_addr:0', 'links_nr:4', 'max_phy_value:0', 'min_phy_value:0', 'name:', 'name_addr:0', 'precision:1', 'ref_param_nr:0', 'referenced_blocks:None', 'reserved0:0', 'unit:', 'unit_addr:0', 'val_param_nr:0'])>
Like I said, you need to follow the dict key naming. This will not work with any doct that you throw at it
Do you wanna align like this {'val_0': 0, 'val_1': 1, 'text_0': 'FALSE', 'text_1': 'TRUE'}
I would also add the default
key for unmapped values
Basically those approach worked but while extracting mdf4 files converstion automatically applied on values in array (np.array) values of concerned signal.. for example : {'val_0': 0, 'val_1': 1, 'text_0': 'FALSE', 'text_1': 'TRUE', 'default': b'default key'} after applied on mdf4 file ...then try to extract information conversion type automatically applied on 0 to False and 1 to True (in np.array).. how to make conversion type visible in attribute level instead of applied on data ???
Call get or select with raw=True
Call get or select with raw=True
Yes, it worked with proper data but converstion type based information missed and giving as attribute info like this : conversion:{"dict":{}m "type":7} instead of {'val_0': 0, 'val_1': 1, 'text_0': 'FALSE', 'text_1': 'TRUE'} or {0:True, 1:False} ... how to fix
print(ch.conversion)
before building below mdf file with converstion value :
enter conversion:{'val_0': 0, 'val_1': 1, 'val_2': 2, 'val_3': 3, 'val_4': 4, 'val_5': 5, 'val_6': 6, 'val_7': 7, 'val_8': 8, 'text_0': 'EmiCtrl', 'text_1': 'PartialFC', 'text_2': 'EmiOSC', 'text_3': 'EmiHeat', 'text_4': 'EmiGpf', 'text_5': 'Diagnostics (SwiftLamOffs)', 'text_6': 'ProtExh', 'text_7': 'ProtIgn', 'text_8': 'Debug', 'default': b'default key'}
after try to view the file via below:
1.mdf = asammdf.MDF('particular.mf4') 2.signals = mdf.select(["rVcLamTar_D_LamSrc"])
signal(as below):
[<Signal rVcLamTar_D_LamSrc: samples=[b'EmiCtrl' b'EmiCtrl' b'EmiCtrl' ... b'EmiGpf' b'EmiGpf' b'EmiGpf'] timestamps=[ -5.05789961 -5.0478505 -5.03780139 ... 1384.68072007 1384.69071935 1384.70076962] invalidation_bits=None unit="-" conversion=None source=SignalSource(name='Python', path='Python', comment='', source_type=4, bus_type=0) comment="Lambda source" mastermeta="('time', 1)" raw=False display_name= attachment=()> ]
conclusion : converstion type applied on samples but conversion comes as None so here my query : I don't wanna apply conversion_type on samples but i just wanna see the converstion information in conversion ... how to do this?
Call get or select with raw=True
asammdf based signal.append functionality doesn't handle conversion type:
Example :not possible to add this conversion as part of signal if conversion attribute of signal : {0:xx,1:yy,2:xxx} output : it seeting defualt None or conversion_type=0 if pass above dict values Kindly make fix on this?