Skip to content

Commit

Permalink
Merge pull request #2014 from desihub/tilenight-cameras
Browse files Browse the repository at this point in the history
consider the --cameras option in desi_proc_tilenight
  • Loading branch information
sbailey committed Mar 10, 2023
2 parents 7848ed1 + f7ade05 commit cc81c8f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
10 changes: 9 additions & 1 deletion py/desispec/scripts/proc_tilenight.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ def main(args=None, comm=None):
if args.laststeps is not None:
keep &= np.isin(exptable['LASTSTEP'].astype(str), args.laststeps)

#- Camera superset from args.cameras; if None default to all
camera_superset = 'a0123456789'
if args.cameras is not None:
camera_superset = args.cameras

exptable = exptable[keep]

if len(exptable) == 0:
Expand All @@ -98,6 +103,7 @@ def main(args=None, comm=None):
prestd_camwords[expids[i]] = difference_camwords(camword,badcamword,suppress_logging=True)
else:
prestd_camwords[expids[i]] = camword
prestd_camwords[expids[i]] = camword_intersection([prestd_camwords[expids[i]],camera_superset])

laststep = str(exptable['LASTSTEP'][i]).lower()
if laststep in ('all', 'fluxcalib', 'skysub'):
Expand All @@ -107,10 +113,11 @@ def main(args=None, comm=None):
poststdstar_expids.append(expid)

joint_camwords = camword_union(list(prestd_camwords.values()), full_spectros_only=True)
joint_camwords = camword_intersection([joint_camwords, camera_superset])

poststd_camwords = dict()
for expid, camword in prestd_camwords.items():
poststd_camwords[expid] = camword_intersection([joint_camwords, camword])
poststd_camwords[expid] = camword_intersection([joint_camwords, camword, camera_superset])

#-------------------------------------------------------------------------
#- Create and submit a batch job if requested
Expand All @@ -126,6 +133,7 @@ def main(args=None, comm=None):
mpistdstars=args.mpistdstars,
use_specter=args.use_specter,
no_gpu=args.no_gpu,
cameras=camera_superset
)
err = 0
if not args.nosubmit:
Expand Down
8 changes: 6 additions & 2 deletions py/desispec/workflow/desi_proc_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ def create_desi_proc_batch_script(night, exp, cameras, jobdesc, queue, runtime=N

def create_desi_proc_tilenight_batch_script(night, exp, tileid, ncameras, queue, runtime=None, batch_opts=None,
system_name=None, mpistdstars=True, use_specter=False,
no_gpu=False,
no_gpu=False, cameras=None
):
"""
Generate a SLURM batch script to be submitted to the slurm scheduler to run desi_proc.
Expand All @@ -892,6 +892,7 @@ def create_desi_proc_tilenight_batch_script(night, exp, tileid, ncameras, queue,
mpistdstars: bool. Whether to use MPI for stdstar fitting.
use_specter: bool. Use classic specter instead of gpu_specter for extractions
no_gpu: bool. Do not use GPU even if available
cameras: str, must be camword.
Returns:
scriptfile: the full path name for the script written.
Expand Down Expand Up @@ -969,13 +970,16 @@ def create_desi_proc_tilenight_batch_script(night, exp, tileid, ncameras, queue,
cmd += f' -n {night}'
cmd += f' -t {tileid}'
cmd += f' --mpi'
if cameras is not None:
cmd += f' --cameras {cameras}'
else:
cmd += f' --cameras a0123456789'
if mpistdstars:
cmd += f' --mpistdstars'
if no_gpu:
cmd += f' --no-gpu'
elif use_specter:
cmd += f' --use-specter'

cmd += f' --timingfile {timingfile}'

fx.write(f'# running a tile-night\n')
Expand Down

0 comments on commit cc81c8f

Please sign in to comment.