From 6e5bcd681df18ac4f3b8f2962f3341ab74b6cdd9 Mon Sep 17 00:00:00 2001 From: pupperemeritus Date: Mon, 18 Sep 2023 19:46:16 +0530 Subject: [PATCH] Reduced memory usage of EventList.from_lc() --- stingray/events.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stingray/events.py b/stingray/events.py index e94dae625..89bf76081 100644 --- a/stingray/events.py +++ b/stingray/events.py @@ -290,9 +290,9 @@ def from_lc(lc): """ # Multiply times by number of counts - times = [[i] * int(j) for i, j in zip(lc.time, lc.counts)] + times = ([i] * int(j) for i, j in zip(lc.time, lc.counts)) # Concatenate all lists - times = [i for j in times for i in j] + times = list(i for j in times for i in j) return EventList(time=times, gti=lc.gti)