Skip to content

Patch a memory leak in TimeSeries.demodulate()

Duncan Macleod requested to merge github/fork/alurban/patch-demod into develop

Created by: alurban

@duncanmmacleod, this PR patches up a memory leak I discovered while helping @siddharth101 track 50 Hz lines at Livingston. The issue is in TimeSeries.demodulate(), which originally contained a call to the self.times object, a massive memory hog for long timeseries. The fix I've implemented here is to instead range over sample indices, breaking them up into slices of length stridesamp.

The following changes are also applied:

  • Change the reference time offset to self.t0, rather than GPS second 0
  • Mix with a local oscillator inside the for loop, to limit its size in memory
  • Replace use of __metadata_finalize__() with __array_finalize__ in constructing the output in memory
  • Minor refinement to the docstring
  • Tweak the worked example in the docstring

This fixes #973 (closed).

Merge request reports