Skip to content

Commit

Permalink
do not pass DR9 brick quantities when reading DR10 photometric catalogs
Browse files Browse the repository at this point in the history
  • Loading branch information
moustakas committed Feb 12, 2025
1 parent 9b4154a commit f293997
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
17 changes: 14 additions & 3 deletions py/fastspecfit/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,11 @@ def __init__(self, phot, cosmo, redux_dir=None, fphotodir=None, mapdir=None):
if fphotodir is None:
self.fphotoext = None
self.fphotodir = os.path.expandvars(os.environ.get('FPHOTO_DIR'))
self.fphotodir_default = True
else:
# parse the extension name, if any
fphotoext = None
self.fphotodir_default = False
photodir = os.path.dirname(fphotodir)
photobase = os.path.basename(fphotodir)
if '[' in photobase and ']' in photobase:
Expand Down Expand Up @@ -1413,9 +1415,18 @@ def _gather_photometry(self, specprod=None, alltiles=None):

legacysurveydr = self.phot.legacysurveydr

# targeting and Tractor columns to read from disk
tractor = gather_tractorphot(input_meta, columns=PHOTCOLS, legacysurveydir=self.fphotodir)

# targeting and Tractor columns to read from disk but need
# to be careful about passing DR9 values of BRICKNAME and
# BRICK_OBJID to the DR10 LEGACY_SURVEY_DIR
if self.fphotodir_default:
tractor = gather_tractorphot(input_meta, columns=PHOTCOLS, legacysurveydir=self.fphotodir)
else:
_input_meta = input_meta.copy()
for col in ['RELEASE', 'BRICKID', 'BRICK_OBJID', 'PHOTSYS']:
if col in _input_meta.colnames:
_input_meta.remove_column(col)
tractor = gather_tractorphot(_input_meta, columns=PHOTCOLS, legacysurveydir=self.fphotodir)

# DR9-specific stuff
if legacysurveydr.lower() == 'dr9' or legacysurveydr.lower() == 'dr10':
metas = []
Expand Down
2 changes: 2 additions & 0 deletions py/fastspecfit/qa.py
Original file line number Diff line number Diff line change
Expand Up @@ -768,6 +768,8 @@ def major_formatter(x, pos):
medmag = 0.0
sedmodel_abmag = np.zeros_like(templates.wave) + medmag
else:
#flam = sedmodel / FLUXNORM / CTools.massnorm
#np.savetxt('makani-sed.txt', np.array([[sedwave], [flam]]).squeeze().T)
factor = 10**(0.4 * 48.6) * sedwave**2 / (C_LIGHT * 1e13) / FLUXNORM / CTools.massnorm # [erg/s/cm2/A --> maggies]
sedmodel_abmag = -2.5*np.log10(sedmodel * factor)
sedax.plot(sedwave / 1e4, sedmodel_abmag, color='grey', # ='~tan'
Expand Down

0 comments on commit f293997

Please sign in to comment.