Skip to content

Commit

Permalink
Merge pull request #9 from des-science/newmask-v2
Browse files Browse the repository at this point in the history
ENH cuts v2 for mdet
  • Loading branch information
beckermr authored Oct 12, 2022
2 parents db64c16 + 1164d4c commit 25009e9
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions des_y6utils/mdet.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@ def make_mdet_cuts(data, version, verbose=False):
"""
if str(version) == "1":
return _make_mdet_cuts_v1(data, verbose=verbose)
elif str(version) == "2":
return _make_mdet_cuts_v2(data, verbose=verbose)
else:
raise ValueError("the mdet cut version '%r' is not recognized!" % version)


def _make_mdet_cuts_raw_v1(d, verbose=False):
def _make_mdet_cuts_raw_v12(d, verbose=False):
"""The raw v1 cuts come from extensive analysis over summer 2022. They
reflect a first-pass at a consensus set of cuts.
Expand Down Expand Up @@ -122,7 +124,7 @@ def _make_mdet_cuts_raw_v1(d, verbose=False):

def _make_mdet_cuts_v1(d, verbose=False):

msk = _make_mdet_cuts_raw_v1(d, verbose=verbose)
msk = _make_mdet_cuts_raw_v12(d, verbose=verbose)

# apply the mask
hmap = _read_hsp_mask("y6-combined-hleda-gaiafull-hsmap16384-nomdet.fits")
Expand All @@ -134,6 +136,22 @@ def _make_mdet_cuts_v1(d, verbose=False):
return msk


def _make_mdet_cuts_v2(d, verbose=False):

msk = _make_mdet_cuts_raw_v12(d, verbose=verbose)

# apply the mask
hmap = _read_hsp_mask(
"y6-combined-hleda-gaiafull-des-stars-hsmap16384-nomdet-v2.fits"
)
in_footprint = hmap.get_values_pos(d["ra"], d["dec"], valid_mask=True)
msk &= in_footprint
if verbose:
print("did mask cuts", np.sum(msk))

return msk


def _compute_asinh_mags(flux, i):
"""This function and coefficients are from from Eli. Ask him.
Expand Down

0 comments on commit 25009e9

Please sign in to comment.