bennomeier / lecroyparser Goto Github PK
View Code? Open in Web Editor NEWA Python Module to parse LeCroy Binary Trace Files
License: MIT License
A Python Module to parse LeCroy Binary Trace Files
License: MIT License
On windows file paths can be given with \ instead of /, and the following lines in parseall fails:
https://github.com/bennomeier/leCroyParser/blob/master/lecroyparser/__init__.py#L45
I suggest adding a line before to do
path=path.replace('\\', '/')
I made a silly mistake, sorry.
Hi,
Could you publish the current version to PyPI?
Regards,
Jeroen
Hi, @bennomeier
I use your library to process pulsed oscillograms, so I need to use baseline correction. It is a slow operation, so I tried to save processing results of many files (up to 5000) to reusing it later, but pickle can not dump them because of ScopeData.file is a file handle and can not be pickled.
So, I must do
delattr(scopedata, " file")
before saving.
Can you fix it in your library?
I think, this can be helpful in the future.
Next to reading files, it would be nice to send raw binary data directly to the script. This can easily be done by splitting the function for parsing from the file reading.
My use case is a waveform retrieved using VXI11 with https://github.com/python-ivi/python-vxi11
What i did now is:
a=scope.ask_raw(str('C1:WF?').encode('utf-8'))
with open('test.bin', 'wb') as f:
f.write(a)
f.flush()
d=lecroyparser.ScopeData('test.bin')
But i'd like to skip the file writing/reading.
Hallo mr @bennomeier and mr @JeroenvO .
Why i can read .trc file. there's any error when executing the code. Or can you give me a sample of proper .trc file?
An error sample below.
Thank you.
RF
this code can be improved having the same shape for data.x and data.y.
If I have to plot I have to refer the 2 vector differently
import matplotlib as mpl
import matplotlib.pyplot as plt
import scipy.signal as sig
path = "./C2Trace00020.trc"
data = ScopeData(path, parseAll = True)
print(data)
x_plot = sig.decimate(data.x, 1000, n=None, ftype='fir', axis=-1, zero_phase=True)
y_plot = sig.decimate(data.y, 1000, n=None, ftype='fir', axis=-1, zero_phase=True)
plt.plot(x_plot)
plt.plot(y_plot[0,:])
plt.show()
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?
#convert the first 50 bytes to a string to find position of substring WAVEDESC
self.posWAVEDESC = fileContent[:50].decode("ascii",'ignore').index("WAVEDESC")
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.
Hello, thanks for this package!
I see that the triggerTime is rounded to 'centiseconds'.
Is there a reason why this is done?
Could there maybe be a setting to specify the precision when querying the trigger time, rather having it hard-coded to .2f in https://github.com/bennomeier/leCroyParser/blob/master/lecroyparser/__init__.py#L193 ?
Thanks!
Hi,
reading binary data with numpy fromstring is deprecated:
https://numpy.org/devdocs/reference/generated/numpy.fromstring.html
It should be changed to numpy.frombuffer.
I have noticed that the data file does not get closed after parsing has finished unless sparse is greater than zero. This is probably due to the following line being indented one level too much:
leCroyParser/lecroyparser/__init__.py
Line 134 in 1b94cdd
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.