Skip to content

Commit

Permalink
fixed bugs in how select_targets handled maglim; added a unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
geordie666 committed Mar 6, 2018
1 parent ae55f99 commit 63c6d4d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bin/select_targets
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ else:
targets = mask_targets(targets, inmaskfile=ns.mask, nside=nside)

if ns.skies:
maglim = [ float(ml) for ml in ns.maglim.split(',') ]
skies = select_skies(infiles,numproc=ns.numproc)
maglim = [ float(ml) for ml in ns.skymaglim.split(',') ]
log.info("sky magnitude limits set to {}".format(maglim))
skies = select_skies(infiles,numproc=ns.numproc,maglim=maglim)
ntargs = len(targets)
nskies = len(skies)
nobjs = ntargs + nskies
Expand Down
11 changes: 11 additions & 0 deletions py/desitarget/test/test_skies.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,17 @@ def test_generate_sky_positions_ellipse(self):
TEXP[...,i])
self.assertFalse(np.any(is_in))

def test_format_as_mask(self):
"""
Check that a set of input objects can be recast in the mask format
"""
#ADM format the input objects as a mask
mask = skies.format_as_mask(self.objs)

#ADM check the output mask has the necessary columns
for name in ['RA','DEC','TARGETID','IN_RADIUS','E1','E2','TYPE']:
self.assertTrue(name in mask.dtype.names)

def test_make_sky_targets_bits(self):
"""
Check that the output bit formatting from make_sky_targets is correct
Expand Down

0 comments on commit 63c6d4d

Please sign in to comment.