Comments (3)
- I can reproduce problem with TESS SPOC 2 minute lightcurves on Windows, so it is not specific to Kepler Bonus lightcurves / Linux.
- the problem seems to be a recent regression. The older lightkurve
2.4.0
does not appear to have the memory leak
The problem exists for TESS SPOC lightcurves:
lightkurve 2.5.0dev
astropy 5.0.4
0 8.715249 12.326077
1 11.507044 17.704528
2 13.629003 19.827207
3 17.910356 24.108518
4 18.42802 24.631339
5 21.177316 27.380927
6 25.452262 31.656041
7 26.010972 32.214751
8 28.761221 34.965
9 33.035526 39.239305
10 33.597524 39.801303
...
100 221.514371 227.757565
101 224.226204 230.469398
102 228.460606 234.7038
103 230.504471 236.747665
104 233.216248 239.459442
105 237.450479 243.693673
...
146 318.471775 324.392998
147 318.974317 324.886945
148 321.538435 327.451063
149 324.656307 329.973692
150 325.023099 329.973692
But the slightly older lightkurve v2.4.0
does not have the problem:
lightkurve 2.4.0
astropy 5.0.4
0 6.542636 10.153735
1 7.216337 13.414637
2 7.222926 13.422954
3 9.420149 15.620135
4 7.856869 15.620135
...
119 40.648573 46.893591
120 36.930138 46.893591
121 39.122917 46.893591
...
197 35.755834 46.893591
198 36.766859 46.893591
199 7.098715 46.893591
...
from lightkurve.
PR #1299 seems to have introduced the problem.
Workarounds:
- Downgrade lightkurve to
v2.4.0
, or - if you use the source, you can change the few lines to use the old v2.4.0 logic
For
lightkurve/src/lightkurve/io/generic.py
Lines 37 to 39 in f8e8c16
Replace it with
else:
hdulist = fits.open(filename)
Essentially, it revert back to the old logic. The old logic has some issues. But I think they mostly manifest in edge cases.
I don't understand why the new logic cause memory leak though.
from lightkurve.
Confirmed that the memory leak indeed stems from the deecopy(hdulist)
in the PR.
A sample script that demonstrates the problem.
from glob import glob
import tracemalloc
import astropy
from astropy.io import fits
import lightkurve as lk
from copy import deepcopy
# import gc
# Show lk.read memory leak issues in
# https://github.com/lightkurve/lightkurve/issues/1388
print('lightkurve', lk.__version__)
print('astropy', astropy.__version__)
def read_lite(filename):
# simulate the logic in
# https://github.com/lightkurve/lightkurve/pull/1299
hdulist = None
with fits.open(filename) as hdulist:
hdulist = deepcopy(hdulist)
return hdulist
# files is a list of sample SPOC TESS lc
files = sorted(glob("spoc_samples/*_lc.fits"))
tracemalloc.start()
for i, f in enumerate(files[:]):
l = read_lite((f))
# print memory used so far in MB
a, b = tracemalloc.get_traced_memory()
print(i, a / 1e6, b / 1e6)
# del l
# gc.collect()
Similar memory leak:
lightkurve 2.5.0dev
astropy 5.0.4
0 2.450405 4.575374
1 4.578252 6.877436
2 6.697511 8.996654
3 8.81539 11.115467
4 10.934333 13.232662
...
145 297.996694 300.220553
146 300.038592 302.264887
147 302.08049 304.306785
148 304.122388 306.348683
149 306.164286 308.390581
from lightkurve.
Related Issues (20)
- Lightkurve failed to find data in sector 83 HOT 3
- `LightCurveCollection.stitch()` fails with `TableMergeError` when the collection has a mix of CDIPS and SPOC lightcurves
- "det_flux" error HOT 5
- `periodogram` missing from `__init__` file HOT 5
- .stitch() not working with LightCurveCollection HOT 3
- OSError in 'query_solar_system_objects' function HOT 1
- Multi-planet system, bls.to_periodogram trouble getting different bits of data which i need HOT 8
- Inconsistent amplitudes in stitched light curves HOT 3
- Dev / CI: Update poetry installation, as `pip`-based install is deprecated
- `lc.bin()` failed for normalized FoldedLightCurve with AttributeError: 'Quantity' object has no 'format' member HOT 1
- `lc.fold()` parameter `wrap_phase` does not accept plain float number when `normalize_phase=True` HOT 1
- `tpf.interact()` and `lc.interact_bls()`: handle bokeh deprecation of `circle()` starting v3.4.0
- Many functions on normalized FoldedLightCurve failed with `UnitConversionError`: `copy()`, `select_flux()`, `normalize()`, etc. HOT 2
- Slow looping when plotting the aperture over the TPF of saturated stars HOT 2
- `interact_sky()`: support querying ZTF data
- Reading files wtih io.tess.read_tess_lightcurve(url) is filling astropy's cache directory HOT 4
- Crash in "How to estimate a starβs mass and radius using asteroseismology" tutorial web page. HOT 1
- search_lightcurve() and download_all() return different author HOT 1
- compatibility with numpy v2.0 HOT 3
- Downloading certain K2 is not working HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lightkurve.