Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
Divya Singh
ligo.skymap
Commits
7788d219
Commit
7788d219
authored
May 16, 2019
by
Leo Pound Singer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Silence harmless Numpy invalid value warnings
parent
80799261
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
CHANGES.rst
CHANGES.rst
+4
-0
ligo/skymap/plot/allsky.py
ligo/skymap/plot/allsky.py
+13
-4
No files found.
CHANGES.rst
View file @
7788d219
...
...
@@ -18,6 +18,10 @@ Changelog
``astro wcs`` so that subclasses can be created using
``plt.axes(..., projection='astro wcs', header='...')``.
- Suppress Numpy warnings for HEALPix reprojection operations in WCS plots
because it is normal for invalid values to occur when transforming pixels
that lie outside of the projection.
0.1.7 (2019-04-24)
==================
...
...
ligo/skymap/plot/allsky.py
View file @
7788d219
...
...
@@ -281,15 +281,24 @@ class AutoScaledWCSAxes(WCSAxes):
nested
=
False
,
field
=
0
,
smooth
=
None
):
if
isinstance
(
data
,
np
.
ndarray
):
data
=
(
data
,
self
.
header
[
'RADESYS'
])
img
,
mask
=
reproject_from_healpix
(
data
,
self
.
header
,
hdu_in
=
hdu_in
,
order
=
order
,
nested
=
nested
,
field
=
field
)
# It's normal for reproject_from_healpix to produce some Numpy invalid
# value warnings for points that land outside the projection.
with
np
.
errstate
(
invalid
=
'ignore'
):
img
,
mask
=
reproject_from_healpix
(
data
,
self
.
header
,
hdu_in
=
hdu_in
,
order
=
order
,
nested
=
nested
,
field
=
field
)
img
=
np
.
ma
.
array
(
img
,
mask
=~
mask
.
astype
(
bool
))
if
smooth
is
not
None
:
pixsize
=
np
.
mean
(
np
.
abs
(
self
.
wcs
.
wcs
.
cdelt
))
*
u
.
deg
smooth
=
(
smooth
/
pixsize
).
to
(
u
.
dimensionless_unscaled
).
value
kernel
=
Gaussian2DKernel
(
smooth
)
img
=
convolve_fft
(
img
,
kernel
)
# Ignore divide by zero warnings for pixels that have no valid
# neighbors.
with
np
.
errstate
(
invalid
=
'ignore'
):
img
=
convolve_fft
(
img
,
kernel
)
return
img
def
contour_hpx
(
self
,
data
,
hdu_in
=
None
,
order
=
'bilinear'
,
nested
=
False
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment