Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/monte-list' into mo…
Browse files Browse the repository at this point in the history
…nte-list
  • Loading branch information
moustakas committed Nov 19, 2024
2 parents 987a9f7 + af4321d commit c62d362
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions py/fastspecfit/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,7 @@ def read(self, photometry, fastphot=False, constrain_age=False):
dlum = self.cosmo.luminosity_distance(redshift)
dmod = self.cosmo.distance_modulus(redshift)
if constrain_age:
tuniv = self.universe_age(redshift)
tuniv = self.cosmo.universe_age(redshift)
else:
tuniv = np.full_like(redshift, 100.)

Expand Down Expand Up @@ -1097,7 +1097,6 @@ def read(self, photometry, fastphot=False, constrain_age=False):
'dmodulus': dmod[iobj],
'tuniv': tuniv[iobj],
'ebv': ebv[iobj],
'mw_transmission_fiberflux': mw_transmission_fiberflux[iobj, :],
'wave0': [spec.wave[cam] for cam in cams],
'flux0': [spec.flux[cam][iobj, :] for cam in cams],
'ivar0': [spec.ivar[cam][iobj, :] for cam in cams],
Expand All @@ -1109,6 +1108,9 @@ def read(self, photometry, fastphot=False, constrain_age=False):
'coadd_ivar': coadd_spec.ivar[coadd_cams][iobj, :],
'coadd_res': [Resolution(coadd_spec.resolution_data[coadd_cams][iobj, :])],
}
if mw_transmission_fiberflux is not None:
specdata.update({'mw_transmission_fiberflux': mw_transmission_fiberflux[iobj, :]})

alldata.append(specdata)

allmeta.append(meta)
Expand Down Expand Up @@ -1302,7 +1304,7 @@ def read_stacked(self, stackfiles, firsttarget=0, ntargets=None,
dlum = self.cosmo.luminosity_distance(redshift)
dmod = self.cosmo.distance_modulus(redshift)
if constrain_age:
tuniv = self.universe_age(redshift)
tuniv = self.cosmo.universe_age(redshift)
else:
tuniv = np.full_like(redshift, 100.)

Expand Down Expand Up @@ -1445,15 +1447,15 @@ def _gather_photometry(self, specprod=None, alltiles=None):
metas.append(meta)
else:
phot_tbl = Table(fitsio.read(self.fphotodir, ext=self.fphotoext, columns=PHOTCOLS))
log.info(f'Read {len(phot_tbl):,d} objects from {self.photodir}')
log.info(f'Read {len(phot_tbl):,d} objects from {self.fphotodir}')

metas = []
for meta in self.meta:
srt = geomask.match_to(phot_tbl[uniqueid_col], meta[uniqueid_col])
assert(np.all(meta[uniqueid_col] == phot_tbl[uniqueid_col][srt]))
if hasattr(self.phot, 'dropcols'):
meta.remove_columns(self.phot.dropcols)
for col in phot.colnames:
for col in phot_tbl.colnames:
meta[col] = phot_tbl[col][srt]
# placeholders (to be added in DESISpectra.read)
meta['EBV'] = np.zeros(shape=(1,), dtype='f4')
Expand Down

0 comments on commit c62d362

Please sign in to comment.