Skip to content

Commit

Permalink
Merge pull request #2226 from desihub/rrmodel
Browse files Browse the repository at this point in the history
add rrdesi --model option to desi_zproc
  • Loading branch information
akremin authored Apr 26, 2024
2 parents 61f9d89 + 18b3535 commit 4f8da22
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions py/desispec/io/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ def findfile(filetype, night=None, expid=None, camera=None,
zcatalog = '{specprod_dir}/zcatalog-{specprod}.fits',
coadd_hp = '{specprod_dir}/healpix/{survey}/{faprogram}/{hpixdir}/coadd-{survey}-{faprogram}-{healpix}.fits',
rrdetails_hp = '{specprod_dir}/healpix/{survey}/{faprogram}/{hpixdir}/rrdetails-{survey}-{faprogram}-{healpix}.h5',
rrmodel_hp = '{specprod_dir}/healpix/{survey}/{faprogram}/{hpixdir}/rrmodel-{survey}-{faprogram}-{healpix}.fits',
spectra_hp = '{specprod_dir}/healpix/{survey}/{faprogram}/{hpixdir}/spectra-{survey}-{faprogram}-{healpix}.fits.gz',
redrock_hp = '{specprod_dir}/healpix/{survey}/{faprogram}/{hpixdir}/redrock-{survey}-{faprogram}-{healpix}.fits',
qso_mgii_hp='{specprod_dir}/healpix/{survey}/{faprogram}/{hpixdir}/qso_mgii-{survey}-{faprogram}-{healpix}.fits',
Expand All @@ -198,6 +199,7 @@ def findfile(filetype, night=None, expid=None, camera=None,
#
coadd_tile='{specprod_dir}/tiles/{groupname}/{tile:d}/{night}/coadd-{spectrograph:d}-{tile:d}-{nightprefix}{night}.fits',
rrdetails_tile='{specprod_dir}/tiles/{groupname}/{tile:d}/{night}/rrdetails-{spectrograph:d}-{tile:d}-{nightprefix}{night}.h5',
rrmodel_tile='{specprod_dir}/tiles/{groupname}/{tile:d}/{night}/rrmodel-{spectrograph:d}-{tile:d}-{nightprefix}{night}.fits',
spectra_tile='{specprod_dir}/tiles/{groupname}/{tile:d}/{night}/spectra-{spectrograph:d}-{tile:d}-{nightprefix}{night}.fits.gz',
redrock_tile='{specprod_dir}/tiles/{groupname}/{tile:d}/{night}/redrock-{spectrograph:d}-{tile:d}-{nightprefix}{night}.fits',
qso_mgii_tile='{specprod_dir}/tiles/{groupname}/{tile:d}/{night}/qso_mgii-{spectrograph:d}-{tile:d}-{nightprefix}{night}.fits',
Expand All @@ -208,6 +210,7 @@ def findfile(filetype, night=None, expid=None, camera=None,
#
coadd_single='{specprod_dir}/tiles/perexp/{tile:d}/{expid:08d}/coadd-{spectrograph:d}-{tile:d}-exp{expid:08d}.fits',
rrdetails_single='{specprod_dir}/tiles/perexp/{tile:d}/{expid:08d}/rrdetails-{spectrograph:d}-{tile:d}-exp{expid:08d}.h5',
rrmodel_single='{specprod_dir}/tiles/perexp/{tile:d}/{expid:08d}/rrmodel-{spectrograph:d}-{tile:d}-exp{expid:08d}.fits',
spectra_single='{specprod_dir}/tiles/perexp/{tile:d}/{expid:08d}/spectra-{spectrograph:d}-{tile:d}-exp{expid:08d}.fits.gz',
redrock_single='{specprod_dir}/tiles/perexp/{tile:d}/{expid:08d}/redrock-{spectrograph:d}-{tile:d}-exp{expid:08d}.fits',
qso_mgii_single='{specprod_dir}/tiles/perexp/{tile:d}/{expid:08d}/qso_mgii-{spectrograph:d}-{tile:d}-exp{expid:08d}.fits',
Expand Down Expand Up @@ -253,8 +256,8 @@ def findfile(filetype, night=None, expid=None, camera=None,

#- default group is "cumulative" for tile-based files
if groupname is None and tile is not None and filetype in (
'spectra', 'coadd', 'redrock', 'rrdetails', 'tileqa', 'tileqapng', 'zmtl',
'spectra_tile', 'coadd_tile', 'redrock_tile', 'rrdetails_tile',
'spectra', 'coadd', 'redrock', 'rrdetails', 'rrmodel', 'tileqa', 'tileqapng', 'zmtl',
'spectra_tile', 'coadd_tile', 'redrock_tile', 'rrdetails_tile', 'rrmodel_tile',
):
groupname = 'cumulative'

Expand Down
5 changes: 3 additions & 2 deletions py/desispec/scripts/zproc.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,10 @@ def main(args=None, comm=None):
coaddfile = findfile('coadd', **findfileopts)
rrfile = findfile('redrock', **findfileopts)
rdfile = findfile('rrdetails', **findfileopts)
rmfile = findfile('rrmodel', **findfileopts)
rrlog = findfile('redrock', logfile=True, **findfileopts)

cmd = f"rrdesi_mpi -i {coaddfile} -o {rrfile} -d {rdfile}"
cmd = f"rrdesi_mpi -i {coaddfile} -o {rrfile} -d {rdfile} --model {rmfile}"
if not args.no_gpu:
cmd += f' --gpu --max-gpuprocs {args.max_gpuprocs}'

Expand All @@ -574,7 +575,7 @@ def main(args=None, comm=None):
else:
with stdouterr_redirected(rrlog, comm=comm):
result, success = runcmd(desi.rrdesi, comm=comm, args=cmdargs,
inputs=[coaddfile], outputs=[rrfile, rdfile])
inputs=[coaddfile], outputs=[rrfile, rdfile, rmfile])

## Since all ranks running redrock, only count failure/success once
if rank == 0 and not success:
Expand Down

0 comments on commit 4f8da22

Please sign in to comment.