MemoryError while plotting large oscilloscope files on Ubuntu

后端 未结 2 1339
广开言路
广开言路 2021-01-25 12:42

I am trying to read large oscilloscope .trc files and plot them. Plotting one file works but as soon as I put the script into a loop, trying to plot all files (1 fi

相关标签:
2条回答
  • 2021-01-25 13:07

    It took quite some time but I managed to get the MemoryError under control. Not only had I to put gc.collect() at the end of each loop but also plt.close(). Only then the Errors would stop. Sorry for the confusion. I learned a lot from this.

    0 讨论(0)
  • 2021-01-25 13:17

    Oh, wow, I couldn't see the wood for the trees, as they say. You're attempting to plot way too many data points (i.e. 100000002, i think that's about 4km length of paper printed at 600dpi), which can be resolved either by sampling:

    sampling=100
    srx, sry = pd.Series(datX[::sampling] * 1000), pd.Series(datY[::sampling] * 1000)
    

    or by selectively studying specific ranges:

    srx, sry = pd.Series(datX[0:50000] * 1000), pd.Series(datY[0:50000] * 1000)
    

    or a combination of both.

    0 讨论(0)
提交回复
热议问题