Skip to content

Commit

Permalink
Merge 45d9f7d into 8a6aee0
Browse files Browse the repository at this point in the history
  • Loading branch information
geordie666 committed Jul 21, 2019
2 parents 8a6aee0 + 45d9f7d commit e25a1e2
Show file tree
Hide file tree
Showing 11 changed files with 181 additions and 90 deletions.
14 changes: 12 additions & 2 deletions bin/select_randoms
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,18 @@ ap.add_argument("--aprad", type=float,
help="Radius of aperture in arcsec in which to generate sky background flux levels (defaults to 0.75; the DESI fiber radius)",
default=0.75)


ns = ap.parse_args()
# ADM build the list of command line arguments as
# ADM bundlefiles potentially needs to know about them.
extra = " --numproc {}".format(ns.numproc)
nsdict = vars(ns)
for nskey in "noresolve", "aprad":
if isinstance(nsdict[nskey], bool):
if nsdict[nskey]:
extra += " --{}".format(nskey)
else:
extra += " --{} {}".format(nskey, nsdict[nskey])

# ADM parse the list of HEALPixels in which to run.
pixlist = ns.healpixels
if pixlist is not None:
Expand Down Expand Up @@ -92,7 +102,7 @@ if not 'dr5' in ns.surveydir and not 'dr6' in ns.surveydir:
hdr[record] = rmhdr['_record_map'][record]

randoms = select_randoms(ns.surveydir, density=ns.density, numproc=ns.numproc,
nside=ns.nside, pixlist=pixlist, aprad=ns.aprad,
nside=ns.nside, pixlist=pixlist, aprad=ns.aprad, extra=extra,
bundlebricks=ns.bundlebricks, brickspersec=ns.brickspersec,
dustdir=ns.dustdir, resolverands=not(ns.noresolve))

Expand Down
17 changes: 14 additions & 3 deletions bin/select_sv_targets
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,18 @@ ap.add_argument('--radecrad',
default=None)
ap.add_argument("--noresolve", action='store_true',
help="Do NOT resolve into northern targets in northern regions and southern targets in southern regions")
ap.add_argument("--nomaskbits", action='store_true',
help="Do NOT apply information in MASKBITS column to target classes")


ns = ap.parse_args()
# ADM build the list of command line arguments as
# ADM bundlefiles potentially needs to know about them.
extra = " --numproc {}".format(ns.numproc)
nsdict = vars(ns)
for nskey in "noresolve", "nomaskbits":
if nsdict[nskey]:
extra += " --{}".format(nskey)

infiles = io.list_sweepfiles(ns.sweepdir)
if ns.sweepdir2 is not None:
Expand Down Expand Up @@ -118,15 +127,17 @@ for i, inlist in enumerate(inlists):
tcnames = _parse_tcnames(tcstring=ns.tcnames, add_all=False)

targets = select_targets(infiles, numproc=ns.numproc,
nside=ns.nside, pixlist=pixlist,
nside=ns.nside, pixlist=pixlist, extra=extra,
bundlefiles=ns.bundlefiles, filespersec=ns.filespersec,
radecbox=inlists[0], radecrad=inlists[1],
tcnames=tcnames, survey=survey, resolvetargs=not(ns.noresolve))
tcnames=tcnames, survey=survey,
resolvetargs=not(ns.noresolve), mask=not(ns.nomaskbits))
if ns.mask:
targets = mask_targets(targets, inmaskfile=ns.mask, nside=nside)

if ns.bundlefiles is None:
io.write_targets(ns.dest, targets, indir=ns.sweepdir, indir2=ns.sweepdir2,
survey=survey, nsidefile=ns.nside, hpxlist=pixlist,
qso_selection=survey, nside=nside, resolve=not(ns.noresolve))
qso_selection=survey, nside=nside,
resolve=not(ns.noresolve), maskbits=not(ns.nomaskbits))
log.info('{} targets written to {}...t={:.1f}s'.format(len(targets), ns.dest, time()-start))
20 changes: 16 additions & 4 deletions bin/select_targets
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,17 @@ ap.add_argument('--radecrad',
default=None)
ap.add_argument("--noresolve", action='store_true',
help="Do NOT resolve into northern targets in northern regions and southern targets in southern regions")
ap.add_argument("--nomaskbits", action='store_true',
help="Do NOT apply information in MASKBITS column to target classes")

ns = ap.parse_args()
# ADM build the list of command line arguments as
# ADM bundlefiles potentially needs to know about them.
extra = " --numproc {}".format(ns.numproc)
nsdict = vars(ns)
for nskey in "noresolve", "nomaskbits":
if nsdict[nskey]:
extra += " --{}".format(nskey)

infiles = io.list_sweepfiles(ns.sweepdir)
if ns.sweepdir2 is not None:
Expand Down Expand Up @@ -114,17 +123,20 @@ else:
targets = select_targets(infiles, numproc=ns.numproc,
qso_selection=ns.qsoselection, gaiamatch=ns.gaiamatch,
sandbox=ns.sandbox, FoMthresh=ns.FoMthresh, Method=ns.Method,
nside=ns.nside, pixlist=pixlist,
nside=ns.nside, pixlist=pixlist, extra=extra,
bundlefiles=ns.bundlefiles, filespersec=ns.filespersec,
radecbox=inlists[0], radecrad=inlists[1],
tcnames=tcnames, survey='main', resolvetargs=not(ns.noresolve))
tcnames=tcnames, survey='main',
resolvetargs=not(ns.noresolve), mask=not(ns.nomaskbits)
)
if ns.mask:
targets = mask_targets(targets, inmaskfile=ns.mask, nside=nside)

if ns.bundlefiles is None:
# ADM only write out a targeting file if it's non-zero.
if len(targets) > 0:
io.write_targets(ns.dest, targets, resolve=not(ns.noresolve), indir=ns.sweepdir,
indir2=ns.sweepdir2, survey="main", nsidefile=ns.nside, hpxlist=pixlist,
io.write_targets(ns.dest, targets, resolve=not(ns.noresolve), maskbits=not(ns.nomaskbits),
indir=ns.sweepdir, indir2=ns.sweepdir2,
survey="main", nsidefile=ns.nside, hpxlist=pixlist,
qso_selection=ns.qsoselection, sandboxcuts=ns.sandbox, nside=nside)
log.info('{} targets written to {}...t={:.1f}s'.format(len(targets), ns.dest, time()-start))
11 changes: 7 additions & 4 deletions doc/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ desitarget Change Log
0.31.2 (unreleased)
-------------------

* Add ELG/LRG/QSO/STD selections for commissioning [`PR #519`_].
* Add full set of columns to supplemental skies file [`PR #518`_]
* Fix some corner cases when reading HEALPixel-split files [`PR #518`_]
* Deprecate ``BRIGHTSTARINBLOB`` use ``MASKBITS`` instead [`PR #521`_].
* Extra options/care when making/vetting bundling scripts [`PR #521`_].
* Add ELG/LRG/QSO/STD selection cuts for commissioning [`PR #519`_].
* Add full set of columns to supplemental skies file [`PR #518`_].
* Fix some corner cases when reading HEALPixel-split files [`PR #518`_].

.. _`PR #518`: https://github.com/desihub/desitarget/pull/518
.. _`PR #519`: https://github.com/desihub/desitarget/pull/519
.. _`PR #521`: https://github.com/desihub/desitarget/pull/521

0.31.1 (2019-07-05)
-------------------
Expand All @@ -22,7 +25,7 @@ desitarget Change Log
0.31.0 (2019-06-30)
-------------------

* MASKBITS of BAILOUT for randoms when no file is found [`PR #515`_].
* ``MASKBITS`` of ``BAILOUT`` for randoms when no file is found [`PR #515`_].
* Near-trivial fix for an unintended change to the isELG API introduced in `PR
#513`_ [`PR #514`_].
* Preliminary ELG cuts for DR8 imaging for main and SV [`PR #513`_].
Expand Down
16 changes: 9 additions & 7 deletions py/desitarget/cmx/cmx_cuts.py
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ def isLRG_colors(gflux=None, rflux=None, zflux=None, w1flux=None,


def isSV0_QSO(gflux=None, rflux=None, zflux=None, w1flux=None, w2flux=None,
objtype=None, release=None, dchisq=None, brightstarinblob=None,
objtype=None, release=None, dchisq=None, maskbits=None,
primary=None):
"""Early SV QSO target class using random forest. Returns a boolean array.
Expand Down Expand Up @@ -573,8 +573,11 @@ def isSV0_QSO(gflux=None, rflux=None, zflux=None, w1flux=None, w2flux=None,
morph2 = dcs < 0.02
preSelection &= _psflike(objtype) | morph2

# CAC Reject objects flagged inside a blob.
preSelection &= ~brightstarinblob
# ADM Reject objects in masks.
# ADM BRIGHT BAILOUT GALAXY CLUSTER (1, 10, 12, 13) bits not set.
if maskbits is not None:
for bit in [1, 10, 12, 13]:
preSelection &= ((maskbits & 2**bit) == 0)

# "qso" mask initialized to "preSelection" mask
qso = np.copy(preSelection)
Expand Down Expand Up @@ -1026,9 +1029,8 @@ def apply_cuts(objects, cmxdir=None):
gnobs, rnobs, znobs, gfracflux, rfracflux, zfracflux, \
gfracmasked, rfracmasked, zfracmasked, \
gfracin, rfracin, zfracin, gallmask, rallmask, zallmask, \
gsnr, rsnr, zsnr, w1snr, w2snr, \
dchisq, deltaChi2, brightstarinblob, maskbits = \
_prepare_optical_wise(objects, colnames=colnames)
gsnr, rsnr, zsnr, w1snr, w2snr, dchisq, deltaChi2, maskbits = \
_prepare_optical_wise(objects)

# ADM in addition, cmx needs ra and dec.
ra, dec = objects["RA"], objects["DEC"]
Expand Down Expand Up @@ -1133,7 +1135,7 @@ def apply_cuts(objects, cmxdir=None):
sv0_qso = isSV0_QSO(
primary=primary, zflux=zflux, rflux=rflux, gflux=gflux,
w1flux=w1flux, w2flux=w2flux, objtype=objtype,
dchisq=dchisq, brightstarinblob=brightstarinblob
dchisq=dchisq, maskbits=maskbits
)

# ADM run the STD target types for both faint and bright.
Expand Down

0 comments on commit e25a1e2

Please sign in to comment.