alercebroker / alerce_client

🐍 ALeRCE Python Client
https://alerce.readthedocs.io/en/latest/index.html
MIT License
7 stars 1 forks source link

[Bug] open_fits might require a "with" statement #18

Open ignacioreyes opened 2 years ago

ignacioreyes commented 2 years ago

Describe the bug Using astropy.io.fits in another project I notice that you have to close the files. https://github.com/alercebroker/alerce_client/blob/3ab5864646d18130649282abf0ce8e367360e09d/alerce/stamps.py#L121 might need refactoring, basically using "fits_open" with the "with" statement and memmap=False to have automatic file closing and avoiding the limit on open files. Doc. reference: https://docs.astropy.org/en/stable/io/fits/index.html#opening-a-fits-file