Skip to content

Commit

Permalink
deal with tables versus arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
weaverba137 committed Sep 13, 2024
1 parent 3ed0823 commit c5f6b23
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions py/desispec/scripts/zcatalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,14 +461,21 @@ def main(args=None):
desiutil.depend.mergedep(dependencies, zcat.meta)
if exp_fibermaps:
log.info('Stacking exposure fibermaps')
expfm_columns = ('TARGETID','PRIORITY','SUBPRIORITY','NIGHT','EXPID','MJD','TILEID','PETAL_LOC','DEVICE_LOC','LOCATION','FIBER','FIBERSTATUS','FIBERASSIGN_X','FIBERASSIGN_Y','LAMBDA_REF','NUM_ITER','FIBER_X','FIBER_Y','DELTA_X','DELTA_Y','FIBER_RA','FIBER_DEC','IN_COADD_B','IN_COADD_R','IN_COADD_Z')
for e in exp_fibermaps:
assert tuple(e.colnames) == expfm_columns
try:
#
# exp_fibermaps is normally a list of numpy arrays as returned by fitsio.
# np.hstack() is apparently best for concatenating those.
#
# However, if recoadd_fibermap is set, the exp_fibermaps are a list
# of astropy.table.Table, for which astropy.table.vstack is more appropriate.
#
expfm = np.hstack(exp_fibermaps)
except TypeError:
log.error(f'TypeError when stacking exposure fibermaps!')
expfm = None
try:
expfm = vstack(exp_fibermaps)
except TypeError:
log.error(f'TypeError when stacking exposure fibermaps!')
expfm = None
else:
expfm = None

Expand Down

0 comments on commit c5f6b23

Please sign in to comment.