Closed dkirkby closed 9 years ago
This PR is supposed to fix #86 and #67, and is designed to take advantage of the new speclite.combine module.
@dcunning11235 @dmargala Do either of you have time to check this PR today?
taking a look now...
Here are examples of stacking sky using the new options with the new speclite package, for reference:
# Stack spec-lite sky spectra
spec_sky = None
for row in sky_table:
filename = finder.get_spec_path(plate=row['PLATE'], mjd=row['MJD'], fiber=row['FIBER'], lite=True)
spectrum = bossdata.spec.SpecFile(mirror.get(filename))
data = spectrum.get_valid_data(include_sky=True, use_ivar=True, fiducial_grid=True)
spec_sky = speclite.accumulate(spec_sky, data, data_out=spec_sky, join='wavelength',
add=('flux', 'sky'), weight='ivar')
# Stack spectra from a plate file
plate_sky = None
filename = finder.get_plate_spec_path(plate=6641, mjd=56383)
plate = bossdata.plate.PlateFile(mirror.get(filename))
plate_data = plate.get_valid_data(sky_table['FIBER'], include_sky=True, use_ivar=True, fiducial_grid=True)
for data in plate_data:
plate_sky = speclite.accumulate(plate_sky, data, data_out=plate_sky, join='wavelength',
add=('flux', 'sky'), weight='ivar')
This is an update to
get_valid_data
in SpecFile, PlateFile and FrameFile. The new options are:The last option only applies to the coadd of a (non-lite) SpecFile and does not apply at all to a FrameFile.