03-15-2021 07:51 AM
I'm trying to read a series of .isf files generated in a field measurement by a TekTronix Oscilloscope (don't know the exact model, but I can figure it out). According to the user manual provided by TekTronix, the .isf file follows a binary coding pattern, big endian, and that´s how I'm trying to read it.
From 18 files, I am able to decode 11 of them successfully, but in 7 of them I'm facing a strange behaviour, probably related to the endiannes of the files. In these 7 files it seems like the coding mixes big and little endianness, so the file is read incorrectly.
Since the TekTronix software is capable of reading all the files correctly and I don't have experience handling binary data, it seems like I'm possibly missing something, but I couldn't find anything online about files with mixed coding.
I attached an example that describes the problem and 2 .isf files: TEK00000.isf is read incorrectly and TEK00001 is read correctly.
Solved! Go to Solution.
03-15-2021 03:36 PM
@danielargolo wrote:
I'm trying to read a series of .isf files generated in a field measurement by a TekTronix Oscilloscope (don't know the exact model, but I can figure it out). According to the user manual provided by TekTronix, the .isf file follows a binary coding pattern, big endian, and that´s how I'm trying to read it.
From 18 files, I am able to decode 11 of them successfully, but in 7 of them I'm facing a strange behaviour, probably related to the endiannes of the files. In these 7 files it seems like the coding mixes big and little endianness, so the file is read incorrectly.
Since the TekTronix software is capable of reading all the files correctly and I don't have experience handling binary data, it seems like I'm possibly missing something, but I couldn't find anything online about files with mixed coding.
I attached an example that describes the problem and 2 .isf files: TEK00000.isf is read incorrectly and TEK00001 is read correctly.
Why do you believe it is the file that is "strange" and not your code? It is somewhat of an absurd conclusion to be drawn that some files correctly follow the format but some of them don't. There is a 99% probability that you aren't decoding it correctly. Unfortunately, I can't open your example because I don't have LV2019 at work. Perhaps you aren't taking into account the number of bytes for each sample?
03-15-2021 03:55 PM
Thinking a bit about it. Can these values go negative? Unfortunately, I can't see your code, but maybe you should be interpreting the bytes as i16 not u16?
03-15-2021 04:12 PM
@billko wrote:
Thinking a bit about it. Can these values go negative? Unfortunately, I can't see your code, but maybe you should be interpreting the bytes as i16 not u16?
Yes, this is probably your issue. The BN_Fmt of your file is "RI" which means the format of your 16-bit word is "signed integer". You are most likely decoding as unsigned.
03-15-2021 04:13 PM
This actually looks like fun to parse. I think I'll make a library for it.
03-15-2021 04:14 PM
Yeah, you are absolutely right, my code is the one with the strange behaviour, especially because, like I said, the TekTronix software reads all the files correctly.
To give some context, the measurements are from damped pulses that can go negative, and I'm interpreting the data as I16. I saved my code for LV2014 so that you can take a look.
03-15-2021 04:30 PM
The example I attached is pretty instructive because the second file is unparsed correctly using big endian coding.
But in the first file it seems like until the 3167 sample, everything is coded as big endian. From this sample on, everything (I don't know for sure if it's everything, actually) is coded in little endian. So if I decode the file with little endian byte order, from de 3167 sample on the file is decoded correctly.
To ilustrate, I attached a picture that shows the original waveform, as decoded by the TekTronix software, and the two waveforms decoded with big/little endian.
03-15-2021 04:36 PM
A cursory look says you are doing it right, from what I see in the programming manual (I have this instrument). I'll take a deeper dive next.
03-15-2021 04:38 PM
@danielargolo wrote:
The example I attached is pretty instructive because the second file is unparsed correctly using big endian coding.
But in the first file it seems like until the 3167 sample, everything is coded as big endian. From this sample on, everything (I don't know for sure if it's everything, actually) is coded in little endian. So if I decode the file with little endian byte order, from de 3167 sample on the file is decoded correctly.
To ilustrate, I attached a picture that shows the original waveform, as decoded by the TekTronix software, and the two waveforms decoded with big/little endian.
I can see why you went down the path you are going. There must be something in the header that we are not taking into account.
03-15-2021 04:53 PM
Frustratingly, I don't see anything that you did incorrectly.