Skip to content

Commit 290f41f

Browse files
More cleanup of memory maps
1 parent 988eac1 commit 290f41f

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

hendrics/efsearch.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -755,12 +755,15 @@ def plot_transient_search(results, gif_name=None):
755755
else:
756756
axf.set_xlim([xmin, xmax])
757757

758-
fig.canvas.draw()
759-
image = np.frombuffer(fig.canvas.buffer_rgba().cast("B"), dtype="uint8")
760-
image = image.reshape(fig.canvas.get_width_height()[::-1] + (4,))
758+
fig.canvas.draw()
759+
image = np.frombuffer(fig.canvas.buffer_rgba().cast("B"), dtype="uint8")
760+
image = image.reshape(fig.canvas.get_width_height()[::-1] + (4,))
761761

762762
plt.close(fig)
763763
all_images.append(image)
764+
765+
if hasattr(results.stats, "filename"):
766+
os.remove(results.stats.filename)
764767
vstack(max_stats_rows).write(result_name, overwrite=True)
765768

766769
imageio.v3.imwrite(gif_name, all_images, duration=1000.0)

0 commit comments

Comments
 (0)