questrail / sdfascii

Python module for reading SDF and ASCII files saved by HP/Agilent Dynamic Signal Analyzers
MIT License
3 stars 1 forks source link

please help with the error #7

Closed saket-agarwal closed 7 years ago

saket-agarwal commented 7 years ago

meas_hdr['meas_type'] = meas_type_decoder[coded_meas_type]

KeyError: 5

matthewrankin commented 7 years ago
saket-agarwal commented 7 years ago

Matthew, thanks for the prompt rresponse. I am using Agilents 35670A equipment and I get one sdf file(.dat)(please see attached) TRAC105.zip

matthewrankin commented 7 years ago

Can you please post the code you're using to read the SDF (.dat) file?

saket-agarwal commented 7 years ago

I am using the exact same code as your sdfascii.py file. do i need to change something with the code?

matthewrankin commented 7 years ago

I just wanted to confirm you're using read_sdf_file(sdf_filename). Also, what version of Python are you using? Is there any other code or error information you can provide to help debug this?

saket-agarwal commented 7 years ago

I am using python version 3.6. Below is the complete error.

runfile('C:/Users/saagarwa/Desktop/python_files/sdfascii.py', args='C:/Users/saagarwa/Desktop/python_files/TRAC105.DAT sdf', wdir='C:/Users/saagarwa/Desktop/python_files') Traceback (most recent call last):

File "", line 1, in runfile('C:/Users/saagarwa/Desktop/python_files/sdfascii.py', args='C:/Users/saagarwa/Desktop/python_files/TRAC105.DAT sdf', wdir='C:/Users/saagarwa/Desktop/python_files')

File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 880, in runfile execfile(filename, namespace)

File "C:\ProgramData\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Users/saagarwa/Desktop/python_files/sdfascii.py", line 608, in sdf_hdr, sdf_data = read_sdf_file(args.inputfile)

File "C:/Users/saagarwa/Desktop/python_files/sdfascii.py", line 451, in read_sdf_file sdf_file.read(meas_hdr_record_size))

File "C:/Users/saagarwa/Desktop/python_files/sdfascii.py", line 183, in _decode_sdf_meas_hdr meas_hdr['meas_type'] = meas_type_decoder[coded_meas_type]

KeyError: 5

saket-agarwal commented 7 years ago

Matthew, Were you able to figure out what am i doing wrong?

saket-agarwal commented 7 years ago

I figured it out. The keyerror was because i was using octave measurement type so it must be defined as one of the keys.