Skip to content

Commit

Permalink
fix typos; add docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Bailey authored and Stephen Bailey committed Sep 13, 2023
1 parent 82c7cec commit e1ae2a5
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions bin/desi_zcatalog
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,25 @@ def load_sv1_ivar_w12(hpix, targetids):
return targets

def _wrap_read_redrock(optdict):
"""read_redrock wrapper to expand dictionary of named args for multiprocessing"""
return read_redrock(**optdict)

def read_redrock(rrfile, group=None, recoadd_fibermap=False, minimal=False, pertile=False, counter=None):
"""
TODO: document
Read a Redrock file
Args:
rrfile (str): full path to redrock filename
Options:
group (str): add group-specific columns for cumulative, pernight, healpix
readcoadd_fibermap (bool): recoadd fibermap from spectra file in same dir
minimal (bool): only propagate minimal subet of columns
pertile (bool): input Redrock file is single tile (not healpix)
counter (tuple): (i,n) log loading ith file out of n
Returns (zcat, expfibermap) where zcat is a join of the redrock REDSHIFTS
catalog and the coadded FIBERMAP
"""
log = get_logger()
if counter is not None:
Expand Down Expand Up @@ -220,7 +234,7 @@ def read_redrock(rrfile, group=None, recoadd_fibermap=False, minimal=False, pert
elif group == 'pernight':
data.add_column(np.full(nrows, hdr['NIGHT'], dtype=np.int32),
index=icol, name='NIGHT')
elif args.group == 'cumulative':
elif group == 'cumulative':
if 'LASTNIGHT' not in data.colnames:
data.add_column(np.full(nrows, hdr['NIGHT'], dtype=np.int32),
index=icol, name='LASTNIGHT')
Expand Down Expand Up @@ -339,7 +353,7 @@ def main():

if args.program is not None:
keep = tiles['PROGRAM'] == args.program
tile = tiles[keep]
tiles = tiles[keep]
if len(tiles) == 0:
log.critical(f'No tiles kept after filtering by PROGRAM={args.program}')
sys.exit(1)
Expand Down

0 comments on commit e1ae2a5

Please sign in to comment.