Skip to content

Commit

Permalink
update changes docs and fix code style
Browse files Browse the repository at this point in the history
  • Loading branch information
geordie666 committed Jun 20, 2019
1 parent cd41f70 commit 7052ced
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bin/supplement_skies
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ log = get_logger()

from argparse import ArgumentParser
ap = ArgumentParser(description='Generate supplemental sky locations using Gaia-G-band avoidance (for regions beyond the Legacy Surveys)')
ap.add_argument("dest",
ap.add_argument("dest",
help="Output supplemental sky targets file (e.g. /project/projectdirs/desi/target/catalogs/supp-skies-dr4-0.20.0.fits)")
ap.add_argument("--nskiespersqdeg",
help="Number of sky locations to generate per sq. deg. (don't pass to read the default from desimodel.io with a 4x margin)",
Expand Down
8 changes: 7 additions & 1 deletion doc/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ desitarget Change Log
0.30.1 (unreleased)
-------------------

* No changes yet.
* Add "supplemental" (outside-of-footprint) skies [`PR #510`_]:
* Randomly populates sky area beyond some minimum Dec and Galactic b.
* Then avoids all Gaia sources at some specified radius.
* Fixes a bug where :func:`geomask.hp_in_box` used geodesics for Dec.
* Dec cuts should be small circles, not geodesics.

.. _`PR #510`: https://github.com/desihub/desitarget/pull/510

0.30.0 (2019-05-30)
-------------------
Expand Down
7 changes: 4 additions & 3 deletions py/desitarget/cuts.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ def shift_photo_north_pure(gflux=None, rflux=None, zflux=None):

return gshift, rshift, zshift


def shift_photo_north(gflux=None, rflux=None, zflux=None):
"""Convert fluxes in the northern (BASS/MzLS) to the southern (DECaLS) system.
Expand Down Expand Up @@ -1091,7 +1092,7 @@ def isQSO_colors(gflux=None, rflux=None, zflux=None, w1flux=None, w2flux=None,
qso &= wflux * gflux > zflux * grzflux * 10**(-1.0/2.5) # (grz-W)>(g-z)-1.0

# Harder cut on stellar contamination
mainseq = rflux > gflux * 10**(0.20/2.5) # g-r>0.2
mainseq = rflux > gflux * 10**(0.20/2.5) # g-r>0.2

# Clip to avoid warnings from negative numbers raised to fractional powers.
rflux = rflux.clip(0)
Expand Down Expand Up @@ -1211,11 +1212,11 @@ def isQSO_randomforest(gflux=None, rflux=None, zflux=None, w1flux=None, w2flux=N
# Compute optimized proba cut
tmp_r_Reduced = r_Reduced[tmpReleaseOK]
pcut = np.where(tmp_r_Reduced > 20.8,
0.83 - (tmp_r_Reduced - 20.8) * 0.025, 0.83)
0.83 - (tmp_r_Reduced - 20.8) * 0.025, 0.83)
pcut[tmp_r_Reduced > 21.5] = 0.8125 - 0.15 * (tmp_r_Reduced[tmp_r_Reduced > 21.5] - 21.5)
pcut[tmp_r_Reduced > 22.3] = 0.6925 - 0.70 * (tmp_r_Reduced[tmp_r_Reduced > 22.3] - 22.3)
pcut_HighZ = np.where(tmp_r_Reduced > 20.5,
0.55 - (tmp_r_Reduced - 20.5) * 0.025, 0.55)
0.55 - (tmp_r_Reduced - 20.5) * 0.025, 0.55)

# Add rf proba test result to "qso" mask
qso[colorsReducedIndex[tmpReleaseOK]] = \
Expand Down
2 changes: 1 addition & 1 deletion py/desitarget/geomask.py
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ def hp_in_dec_range(nside, decmin, decmax, inclusive=True):

# ADM determine the pixels that touch the box.
pixring = hp.query_strip(nside, thetamin, thetamax,
inclusive=inclusive, nest=False)
inclusive=inclusive, nest=False)
pixnest = hp.ring2nest(nside, pixring)

return pixnest
Expand Down
2 changes: 1 addition & 1 deletion py/desitarget/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ def read_tractor(filename, header=False, columns=None):
kind = data[colname].dtype.kind
if kind == 'U' or kind == 'S':
data[colname] = np.char.rstrip(data[colname])

# ADM add the PHOTSYS column to unambiguously check whether we're using imaging
# ADM from the "North" or "South".
data = add_photsys(data)
Expand Down
3 changes: 2 additions & 1 deletion py/desitarget/skyfibers.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ def supplement_skies(nskiespersqdeg=None, numproc=16, gaiadir=None,
nskiespersqdeg = density_of_sky_fibers(margin=4)

# ADM determine the HEALPixel nside of the standard Gaia files.
anyfiles = find_gaia_files([0,0], radec=True)
anyfiles = find_gaia_files([0, 0], radec=True)
hdr = fitsio.read_header(anyfiles[0], "GAIAHPX")
nside = hdr["HPXNSIDE"]

Expand Down Expand Up @@ -844,6 +844,7 @@ def _get_supp(pix):
# ADM this is just to count pixels in _update_status.
npix = np.zeros((), dtype='i8')
t0 = time()

def _update_status(result):
"""wrapper function for the critical reduction operation,
that occurs on the main parallel process"""
Expand Down

0 comments on commit 7052ced

Please sign in to comment.