From f4930af1babca9ceacc42aeeb727e882332041d7 Mon Sep 17 00:00:00 2001 From: Rongpu Zhou Date: Tue, 4 May 2021 15:31:10 -0700 Subject: [PATCH 1/5] Update cuts.py --- py/desitarget/cuts.py | 70 ++++++++++--------------------------------- 1 file changed, 15 insertions(+), 55 deletions(-) diff --git a/py/desitarget/cuts.py b/py/desitarget/cuts.py index b0e43b593..aa3df2ada 100644 --- a/py/desitarget/cuts.py +++ b/py/desitarget/cuts.py @@ -398,15 +398,14 @@ def isLRG(gflux=None, rflux=None, zflux=None, w1flux=None, w2flux=None, ) # ADM color-based selection of LRGs. - lrg, lrg_lowdens = isLRG_colors( + lrg = isLRG_colors( gflux=gflux, rflux=rflux, zflux=zflux, w1flux=w1flux, zfiberflux=zfiberflux, south=south, primary=primary ) lrg &= lrg_quality - lrg_lowdens &= lrg_quality - return lrg, lrg_lowdens + return lrg def notinLRG_mask(primary=None, rflux=None, zflux=None, w1flux=None, @@ -459,7 +458,6 @@ def isLRG_colors(gflux=None, rflux=None, zflux=None, w1flux=None, if primary is None: primary = np.ones_like(rflux, dtype='?') lrg = primary.copy() - lrg_lowdens = primary.copy() # lower density LRG selection # ADM to maintain backwards-compatibility with mocks. if zfiberflux is None: @@ -476,56 +474,24 @@ def isLRG_colors(gflux=None, rflux=None, zflux=None, w1flux=None, # Full SV3 selection if south: lrg &= zmag - w1mag > 0.8 * (rmag - zmag) - 0.6 # non-stellar cut - lrg &= zfibermag < 21.7 # faint limit - lrg &= ( - (gmag - rmag > 1.3) & ((gmag - rmag) > -1.55 * (rmag - w1mag)+3.13) - | (rmag - w1mag > 1.8) - ) # low-z cuts + lrg &= zfibermag < 21.6 # faint limit + lrg &= (gmag - w1mag > 2.9) | (rmag - w1mag > 1.8) # low-z cuts lrg &= ( - (rmag - w1mag > (w1mag - 17.26) * 1.8) - & (rmag - w1mag > (w1mag - 16.36) * 1.) - | (rmag - w1mag > 3.29) + ((rmag - w1mag > (w1mag - 17.14) * 1.8) + & (rmag - w1mag > (w1mag - 16.33) * 1.)) + | (rmag - w1mag > 3.33) ) # double sliding cuts and high-z extension else: lrg &= zmag - w1mag > 0.8 * (rmag - zmag) - 0.6 # non-stellar cut - lrg &= zfibermag < 21.72 # faint limit - lrg &= ( - (gmag - rmag > 1.34) & ((gmag - rmag) > -1.55 * (rmag - w1mag)+3.23) - | (rmag - w1mag > 1.8) - ) # low-z cuts + lrg &= zfibermag < 21.61 # faint limit + lrg &= (gmag - w1mag > 2.97) | (rmag - w1mag > 1.8) # low-z cuts lrg &= ( - (rmag - w1mag > (w1mag - 17.24) * 1.83) - & (rmag - w1mag > (w1mag - 16.33) * 1.) - | (rmag - w1mag > 3.39) + ((rmag - w1mag > (w1mag - 17.13) * 1.83) + & (rmag - w1mag > (w1mag - 16.31) * 1.)) + | (rmag - w1mag > 3.4) ) # double sliding cuts and high-z extension - # Selection of the lower density subset - if south: - lrg_lowdens &= zmag - w1mag > 0.8 * (rmag - zmag) - 0.6 # non-stellar cut - lrg_lowdens &= zfibermag < 21.7 # faint limit - lrg_lowdens &= ( - (gmag - rmag > 1.3) & ((gmag - rmag) > -1.55 * (rmag - w1mag)+3.13) - | (rmag - w1mag > 1.8) - ) # low-z cuts - lrg_lowdens &= ( - (rmag - w1mag > (w1mag - 17.07) * 1.8) - & (rmag - w1mag > (w1mag - 16.17) * 1.) - | (rmag - w1mag > 3.39) - ) # double sliding cuts and high-z extension - else: - lrg_lowdens &= zmag - w1mag > 0.8 * (rmag - zmag) - 0.6 # non-stellar cut - lrg_lowdens &= zfibermag < 21.72 # faint limit - lrg_lowdens &= ( - (gmag - rmag > 1.34) & ((gmag - rmag) > -1.55 * (rmag - w1mag)+3.23) - | (rmag - w1mag > 1.8) - ) # low-z cuts - lrg_lowdens &= ( - (rmag - w1mag > (w1mag - 17.05) * 1.83) - & (rmag - w1mag > (w1mag - 16.14) * 1.) - | (rmag - w1mag > 3.49) - ) # double sliding cuts and high-z extension - - return lrg, lrg_lowdens + return lrg def isELG(gflux=None, rflux=None, zflux=None, w1flux=None, w2flux=None, @@ -2458,7 +2424,7 @@ def set_target_bits(photsys_north, photsys_south, obs_rflux, # ADM initially set everything to arrays of False for LRG selection. # ADM zeroth element stores the northern targets bits (south=False). - lrg_classes = [[tcfalse, tcfalse], [tcfalse, tcfalse]] + lrg_classes = [tcfalse, tcfalse] if "LRG" in tcnames: for south in south_cuts: lrg_classes[int(south)] = isLRG( @@ -2469,13 +2435,10 @@ def set_target_bits(photsys_north, photsys_south, obs_rflux, gaiagmag=gaiagmag, zfibertotflux=zfibertotflux, maskbits=maskbits, south=south ) - lrg_north, lrg_lowdens_north = lrg_classes[0] - lrg_south, lrg_lowdens_south = lrg_classes[1] + lrg_north, lrg_south = lrg_classes # ADM combine LRG target bits for an LRG target based on any imaging. lrg = (lrg_north & photsys_north) | (lrg_south & photsys_south) - lrg_lowdens = ((lrg_lowdens_north & photsys_north) | - (lrg_lowdens_south & photsys_south)) # ADM initially set everything to arrays of False for ELG selection. # ADM zeroth element stores the northern targets bits (south=False). @@ -2686,7 +2649,6 @@ def set_target_bits(photsys_north, photsys_south, obs_rflux, # Construct the targetflag bits for DECaLS (i.e. South). desi_target = lrg_south * desi_mask.LRG_SOUTH - desi_target |= lrg_lowdens_south * desi_mask.LRG_LOWDENS_SOUTH desi_target |= elg_south * desi_mask.ELG_SOUTH desi_target |= elg_vlo_south * desi_mask.ELG_VLO_SOUTH desi_target |= elg_lop_south * desi_mask.ELG_LOP_SOUTH @@ -2694,7 +2656,6 @@ def set_target_bits(photsys_north, photsys_south, obs_rflux, # Construct the targetflag bits for MzLS and BASS (i.e. North). desi_target |= lrg_north * desi_mask.LRG_NORTH - desi_target |= lrg_lowdens_north * desi_mask.LRG_LOWDENS_NORTH desi_target |= elg_north * desi_mask.ELG_NORTH desi_target |= elg_vlo_north * desi_mask.ELG_VLO_NORTH desi_target |= elg_lop_north * desi_mask.ELG_LOP_NORTH @@ -2702,7 +2663,6 @@ def set_target_bits(photsys_north, photsys_south, obs_rflux, # Construct the targetflag bits combining north and south. desi_target |= lrg * desi_mask.LRG - desi_target |= lrg_lowdens * desi_mask.LRG_LOWDENS desi_target |= elg * desi_mask.ELG desi_target |= elg_vlo * desi_mask.ELG_VLO desi_target |= elg_lop * desi_mask.ELG_LOP From 6de6fb8918f4c006d434fd4462ec026acb039212 Mon Sep 17 00:00:00 2001 From: Rongpu Zhou Date: Tue, 4 May 2021 15:38:19 -0700 Subject: [PATCH 2/5] Add LRG updates in changes.rst --- doc/changes.rst | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/doc/changes.rst b/doc/changes.rst index 65c0bd375..0060f5ec5 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -25,6 +25,11 @@ desitarget Change Log to swap EDR3 proper motions/parallaxes for values in sweeps files. * New function and bin script to make QSO redshift catalogs [`PR #714`_]. * Incorporates functionality from QuasarNET and SQUEzE. +* Update the baseline LRG selection [`PR #723`_]. Changes from SV3 includes: + * Change the zfiber faint limit from 21.7 to 21.6 + * Change the low-z limit from z>0.3 to z>0.4 + * Change the overall density from 800/sq.deg. to 600/sq.deg. + * Remove the LRG_LOWDENS target bit .. _`PR #714`: https://github.com/desihub/desitarget/pull/714 .. _`PR #715`: https://github.com/desihub/desitarget/pull/715 @@ -32,6 +37,7 @@ desitarget Change Log .. _`PR #717`: https://github.com/desihub/desitarget/pull/717 .. _`PR #718`: https://github.com/desihub/desitarget/pull/718 .. _`PR #719`: https://github.com/desihub/desitarget/pull/719 +.. _`PR #723`: https://github.com/desihub/desitarget/pull/723 0.57.2 (2021-04-18) ------------------- From 719a55d30890200eeea14a0a3f2eb25b548678d9 Mon Sep 17 00:00:00 2001 From: Rongpu Zhou Date: Tue, 4 May 2021 15:40:38 -0700 Subject: [PATCH 3/5] Fix typo --- doc/changes.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/changes.rst b/doc/changes.rst index 0060f5ec5..ac2876e76 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -25,7 +25,7 @@ desitarget Change Log to swap EDR3 proper motions/parallaxes for values in sweeps files. * New function and bin script to make QSO redshift catalogs [`PR #714`_]. * Incorporates functionality from QuasarNET and SQUEzE. -* Update the baseline LRG selection [`PR #723`_]. Changes from SV3 includes: +* Update the baseline LRG selection [`PR #723`_]. Changes from SV3 include: * Change the zfiber faint limit from 21.7 to 21.6 * Change the low-z limit from z>0.3 to z>0.4 * Change the overall density from 800/sq.deg. to 600/sq.deg. From ebd8c5af35794eb203eab5e672f959ffed9a8de0 Mon Sep 17 00:00:00 2001 From: Rongpu Zhou Date: Tue, 4 May 2021 15:53:25 -0700 Subject: [PATCH 4/5] Update LRG tests in test_cuts.py --- py/desitarget/test/test_cuts.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/py/desitarget/test/test_cuts.py b/py/desitarget/test/test_cuts.py index 373a8e276..029de152a 100644 --- a/py/desitarget/test/test_cuts.py +++ b/py/desitarget/test/test_cuts.py @@ -153,13 +153,13 @@ def test_single_cuts(self): # ADM check for both defined fiberflux and fiberflux of None. for ff in zfiberflux, None: - lrg1, _ = cuts.isLRG(primary=primary, gflux=gflux, rflux=rflux, + lrg1 = cuts.isLRG(primary=primary, gflux=gflux, rflux=rflux, zflux=zflux, w1flux=w1flux, zfiberflux=ff, gnobs=gnobs, rnobs=rnobs, znobs=znobs, maskbits=maskbits, rfluxivar=rfluxivar, zfluxivar=zfluxivar, w1fluxivar=w1fluxivar, gaiagmag=gaiagmag, zfibertotflux=zfibertotflux) - lrg2, _ = cuts.isLRG(primary=None, gflux=gflux, rflux=rflux, + lrg2 = cuts.isLRG(primary=None, gflux=gflux, rflux=rflux, zflux=zflux, w1flux=w1flux, zfiberflux=ff, gnobs=gnobs, rnobs=rnobs, znobs=znobs, maskbits=maskbits, rfluxivar=rfluxivar, @@ -170,10 +170,10 @@ def test_single_cuts(self): # ADM check color selections alone work. Tripped us up once # ADM when the mocks called a missing isLRG_colors function. - lrg1, _ = cuts.isLRG_colors(primary=primary, gflux=gflux, + lrg1 = cuts.isLRG_colors(primary=primary, gflux=gflux, rflux=rflux, zflux=zflux, zfiberflux=ff, w1flux=w1flux, w2flux=w2flux) - lrg2, _ = cuts.isLRG_colors(primary=None, gflux=gflux, rflux=rflux, + lrg2 = cuts.isLRG_colors(primary=None, gflux=gflux, rflux=rflux, zflux=zflux, zfiberflux=ff, w1flux=w1flux, w2flux=w2flux) self.assertTrue(np.all(lrg1 == lrg2)) From ba760d6134c0f7da09c3543ea5db70f3589f430e Mon Sep 17 00:00:00 2001 From: Rongpu Zhou Date: Tue, 4 May 2021 16:14:30 -0700 Subject: [PATCH 5/5] Update documentation in cuts.py --- py/desitarget/cuts.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/py/desitarget/cuts.py b/py/desitarget/cuts.py index aa3df2ada..3b4021aba 100644 --- a/py/desitarget/cuts.py +++ b/py/desitarget/cuts.py @@ -381,7 +381,7 @@ def isLRG(gflux=None, rflux=None, zflux=None, w1flux=None, w2flux=None, Notes ----- - - Current version (03/31/21) is version 15 on `the SV3 wiki`_. + - Current version (05/04/21) is version 254 on `the wiki`_. - See :func:`~desitarget.cuts.set_target_bits` for other parameters. """ # ADM LRG targets.