Closed MLhome2020 closed 3 years ago
Hi,
the problem with the ignore option is that it just silently drops that character from the string, and then the position of Wavedesc is off by one character. When the import filter tries to read in other stuff (referenced to that position) that then generates an error. I am not sure what the real encoding of the file is, but try "cp1252" (a list of possible encodings is here https://docs.python.org/3/library/codecs.html ).
Try this first and let me know, then we can have a look at the .sta file. I have just briefly looked at it with emacs, and it is using the same LeCroy_2_3 template, so hopefully we'll get it to work.
Hi,
At the moment I changed the code line as follow:
#convert the first 50 bytes to a string to find position of substring WAVEDESC
self.posWAVEDESC = fileContent[:50].decode("ascii","replace").index("WAVEDESC")
with this I could load all test files without problem!
A good thing to add is also the sampling points WaveArrayCount
string += "Channel: " + self.waveSource + "\n"
string += "WaveArrayCount: " + str(self.waveArrayCount) + "\n"
string += "Vertical Coupling: " + self.verticalCoupling + "\n"
A bit background info about the test files:
This files have been transferred per cable from the LeCroy oscilloscopes.
https://teledynelecroy.com/support/softwaredownload/activedso.aspx?capid=106
The waveform files for testing are received by help of the ActiveDSO to communicate over GPIB / Ethernet / LXi with the oscilloscope from LeCroy. So you have not to use as example the PyVISA.
The used function was written in Visual Basic for Application (I will translate this in the next days to a python code so I get same functionality)
Some key points of this code is:
Dim LeCroyMX44 As Object 'ActiveDSO object
Set LeCroyMX44 = CreateObject("LeCroy.ActiveDSOCtrl.1")
success = LeCroyMX44.MakeConnection(device1)
Call LeCroyMX44.SetRemoteLocal(1)
wavearray = LeCroyMX44.GetNativeWaveform("C1", 4000000, True, "ALL")
Open "C:/Test.trc" For Binary Access Write As #1
Put #1, , wavearray
Close #1
Interesting is to see that the waveform data files Channel C1 was received with same code as C2. In my opinion both files have to be same encoded.
Perhaps a better question is: What is stored in the first 12 bytes of the received binary LeCroy waveform data? Has python a better function to skip all bytes until the bytes Hex[57 41 56 45 44 45 53 43] representative for WAVEDESC is found?
PS: The encoding / decoding is a interesting thing.
I am closing this issue - the problem seems to be sovled. Many thanks for your input!
Hello
Is it possible to improve the LeCroy parser so it can also load the following attached LeCroyFiles? I tested you LeCroy Parser in python Jupyter it works for the first attached file C1pfn00087.trc
When I test it with the second file it throws an error. What do you think, to add the following: .decode with a property ‘ignore’ if the decode finds Bytes with decode error it ignores it?
The ignore was incorrect to solve the problem, and did generate a shift of 1
Now the Code works the next error seems to be self.verticalCoupling = verticalCouplingList[self.parseInt16(326)]
I attached the three LeCroy Files i did use for testing. It would be great to improve you Code so we can load many different LeCroy Files.
The .trc was a LeCroy 44MX The STA. are from a older LeCroy 9374TM scope.
LeCroy.zip