danielhrisca / asammdf

Fast Python reader and editor for ASAM MDF / MF4 (Measurement Data Format) files
GNU Lesser General Public License v3.0
655 stars 226 forks source link

Error when exporting mdf to pandas dataframe #1077

Closed bojan777 closed 2 months ago

bojan777 commented 2 months ago

Python version

Please run the following snippet and write the output here

'python=3.8.11 (default, Aug 6 2021, 09:57:55) [MSC v.1916 64 bit (AMD64)]' 'os=Windows-10-10.0.19045-SP0' 'numpy=1.22.4' 'asammdf=7.0.3'

Code

MDF version

3.20

Code snippet

mdf_obj = asammdf.MDF(files[1]) df = mdf_obj.to_dataframe()

Traceback

{ "name": "TypeError", "message": "'VariableNode' object is not callable", "stack": "--------------------------------------------------------------------------- TypeError Traceback (most recent call last) \Anaconda3\envs\HeatMaps\lib\site-packages\asammdf\blocks\v2_v3_blocks.py in convert(self, values) 1659 try: -> 1660 values = evaluate(self.formula) 1661 except:

\Anaconda3\envs\HeatMaps\lib\site-packages\ umexpr\ ecompiler.py in evaluate(ex, local_dict, global_dict, out, order, casting, **kwargs) 817 if expr_key not in _names_cache: --> 818 _names_cache[expr_key] = getExprNames(ex, context) 819 names, ex_uses_vml = _names_cache[expr_key]

\Anaconda3\envs\HeatMaps\lib\site-packages\ umexpr\ ecompiler.py in getExprNames(text, context) 708 def getExprNames(text, context): --> 709 ex = stringToExpression(text, {}, context) 710 ast = expressionToAST(ex)

\Anaconda3\envs\HeatMaps\lib\site-packages\ umexpr\ ecompiler.py in stringToExpression(s, types, context) 298 # now build the expression --> 299 ex = eval(c, names) 300 if expressions.isConstant(ex):

in TypeError: 'VariableNode' object is not callable During handling of the above exception, another exception occurred: TypeError Traceback (most recent call last) ~\\AppData\\Local\\Temp\\ipykernel_29516\\3693611070.py in ----> 1 df = mdf_obj.to_dataframe() \\Anaconda3\\envs\\HeatMaps\\lib\\site-packages\\asammdf\\mdf.py in to_dataframe(self, channels, raster, time_from_zero, empty_channels, keep_arrays, use_display_names, time_as_date, reduce_memory_usage, raw, ignore_value2text_conversions, use_interpolation, only_basenames, interpolate_outwards_with_nan, numeric_1D_only) 4105 for signal in signals: 4106 if signal.conversion: -> 4107 signal.samples = signal.conversion.convert(signal.samples) 4108 4109 for s_index, sig in enumerate(signals): \\Anaconda3\\envs\\HeatMaps\\lib\\site-packages\\asammdf\\blocks\\v2_v3_blocks.py in convert(self, values) 1660 values = evaluate(self.formula) 1661 except: -> 1662 values = evaluate3(self.formula) 1663 1664 return values \\Anaconda3\\envs\\HeatMaps\\lib\\site-packages\ umexpr\ ecompiler.py in evaluate(ex, local_dict, global_dict, out, order, casting, **kwargs) 816 expr_key = (ex, tuple(sorted(context.items()))) 817 if expr_key not in _names_cache: --> 818 _names_cache[expr_key] = getExprNames(ex, context) 819 names, ex_uses_vml = _names_cache[expr_key] 820 arguments = getArguments(names, local_dict, global_dict) \\Anaconda3\\envs\\HeatMaps\\lib\\site-packages\ umexpr\ ecompiler.py in getExprNames(text, context) 707 708 def getExprNames(text, context): --> 709 ex = stringToExpression(text, {}, context) 710 ast = expressionToAST(ex) 711 input_order = getInputOrder(ast, None) \\Anaconda3\\envs\\HeatMaps\\lib\\site-packages\ umexpr\ ecompiler.py in stringToExpression(s, types, context) 297 names.update(expressions.functions) 298 # now build the expression --> 299 ex = eval(c, names) 300 if expressions.isConstant(ex): 301 ex = expressions.ConstantNode(ex, expressions.getKind(ex)) in TypeError: 'VariableNode' object is not callable" } # Description I get the error "TypeError: 'VariableNode' object is not callable" when using MDF.to_dataframe(), i get the same error when using MDF.export() to csv or hdf5. Thanks for any help.
bojan777 commented 2 months ago

Fixed the issue by updating to asammdf 7.4.5