There will be maintenance performed on git.ligo.org, chat.ligo.org, containers.lig.org, and docs.ligo.org starting at 9am PDT on Tuesday 18th August 2020. There will be an extremely small period of downtime at the start of the maintenance window as various services are restarted. Please address any comments, questions, or concerns to computing-help@igwn.org.

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

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

parent 35379273
Pipeline #51669 passed with stages
in 11 minutes and 52 seconds
......@@ -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)
ax.fill_between(
times.plot_date,
clip_verylarge(lo), # Clip infinities to large but finite values
clip_verylarge(hi), # because fill_between cannot handle inf
color=cmap(level), zorder=2)
ax.legend(
[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