bennomeier / leCroyParser

A Python Module to parse LeCroy Binary Trace Files
MIT License
12 stars 8 forks source link

data.x is a vector and data.y is a matrix #2

Closed tinix84 closed 4 years ago

tinix84 commented 4 years ago

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()    
bennomeier commented 4 years ago

Hi tinix84,

this is indeed intended since there is a parseAll option (which you have set to True in your code). This will put the trace of the first channel into y[0], the second channel into y[1], and so on.

If you always import only one channel this would not be needed but I prefer to keep this functionality.

Note that data.x is the time array, so typically you would use plt.plot(data.x, data.y[0])