Commit 18efebb9 authored by Leo Pound Singer's avatar Leo Pound Singer
Browse files

Fix inf handling bug in ligo-skymap-plot-airmass

parent 35379273
......@@ -5,7 +5,10 @@ Changelog
0.1.3 (unreleased)
- No changes yet.
- Fix a bug in ``ligo-skymap-plot-airmass`` that caused the airmass chart to be
blank if the lower and upper credible levels were always in opposite
hemispheres. The root cause was that ``plt.fill_between`` does not clip
infinities to the plot's data range.
0.1.2 (2019-02-28)
......@@ -44,6 +44,10 @@ def condition_secz(x):
return np.where(x <= 0, np.inf, x)
def clip_verylarge(x, max=1e300):
return np.clip(x, -max, max)
def main(args=None):
opts = parser().parse_args(args)
......@@ -111,7 +115,11 @@ def main(args=None):
cmap = plt.get_cmap()
for level, lo, hi in zip(levels, airmass[:nlevels], airmass[nlevels:]):
ax.fill_between(times.plot_date, lo, hi, color=cmap(level), zorder=2)
clip_verylarge(lo), # Clip infinities to large but finite values
clip_verylarge(hi), # because fill_between cannot handle inf
color=cmap(level), zorder=2)
[Patch(facecolor=cmap(level)) for level in levels],
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment