qt3uw / qt3-utils

Data Acquisition for Confocal Microscope and Spin Control Experiments
https://sites.google.com/uw.edu/qt3-lab/projects
BSD 3-Clause "New" or "Revised" License
3 stars 6 forks source link

qt3scope - unbound cache error matplotlib.animation #93

Open gadamc opened 1 year ago

gadamc commented 1 year ago

When installing and running qt3scope on the QDL in B069, a warning was reported to the console at startup. The warning was issued for line 161 of oscilloscope.py and mentioned "did not pass explicit save_count"

However, qt3scope seemed to work as expected.

NnguyenHTommy commented 1 year ago

Similarly, when installing and running qt3scope on the SiV microscope in B065, a warning was reported: C:\Users\SiV Microscope\anaconda3\envs\qt3-producers\lib\site-packages\applications\oscilloscope.py:161: UserWarning: frames=<bound method RateCounterBase.yield_count_rate of <qt3utils.datagenerators.daqsamplers.NiDaqDigitalInputRateCounter object at 0x000001C4EC494190>> which we can infer the length of, did not pass an explicit save_count and passed cache_frame_data=True. To avoid a possibly unbounded cache, frame data caching has been disabled. To suppress this warning either pass cache_frame_data=False or save_count=MAX_FRAMES. self.animation = animation.FuncAnimation(self.view.scope_view.fig,

vasilisniaouris commented 1 year ago

I have observed the same error on our big-magnet set-up in B069. For clarification, the only time it is used internally in matplotlib/lib/matplotlib/animation.FuncAnimation is around line 1760, where each generated frame data sequence (generated via the yield count rate method in our case) is stored internally in FuncAnimation._save_seq.

The warning is removed by passing a cache_frame_data=False to the animation.FrameAnimation function call. I believe that disabling the caching functionality is beneficial to animation speed, since we do not require to store any of the data as of now.