Can spectrum object be lazy?
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 204
- Forks
- 135
- Avg merge
- 12h 55m
- Merged PRs (30d)
- 1
Description
I noticed that when I pass in a big flux array, it takes a while to create the Spectrum1D object. I am not even doing anything with it yet, just initializing it. Is it possible for it to be as lazy as possible? If so, is such performance tips documented somewhere?
Example usage
from astropy import units as u
from astropy.io import fits
from astropy.wcs import WCS
from specutils import Spectrum1D
filename = "ADP.2016-06-17T18_47_32.888.fits" # 3 GB, 2 extensions each (321, 315, 3682) float32
pf = fits.open(filename)
wcs = WCS(pf[1].header)
flux = pf[1].data << u.Unit(pf[1].header["BUNIT"]) # This is fast
sp = Spectrum1D(flux=flux, wcs=wcs) # Takes a long time
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Spectrum1D(flux=flux, wcs=wcs) construction shown in the issue and reproduce it using the linked 3 GB FITS example. Investigate which initialization steps account for the delay and review the jdaviz issue for related context; done means establishing whether lazy construction is feasible and documenting any supported performance guidance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100