Closed saket-agarwal closed 7 years ago
.HDR
, .TXT
, .X
, and .Z
)?Matthew, thanks for the prompt rresponse. I am using Agilents 35670A equipment and I get one sdf file(.dat)(please see attached) TRAC105.zip
Can you please post the code you're using to read the SDF (.dat
) file?
I am using the exact same code as your sdfascii.py file. do i need to change something with the code?
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?
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 "
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
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
Matthew, Were you able to figure out what am i doing wrong?
I figured it out. The keyerror was because i was using octave measurement type so it must be defined as one of the keys.
meas_hdr['meas_type'] = meas_type_decoder[coded_meas_type]
KeyError: 5