astropy / astropy/regions

Sky region should wrap at map edges

Open
#150 7 comments 0 reactions 0 assignees View on GitHub
feature-request question wishlist
Dominant language
Python
Stars
65
Forks
64
Avg merge
2d 13h
Merged PRs (30d)
4

Description

Hi all,

First of all, many thanks for the good work!

I am experiencing an issue when trying to plot a CircleSkyRegion at a map edge in Aitoff projection. I followed the issue [#76](https://github.com/astropy/regions/issues/76) to properly project a circle on the sky in this projection.

My test displays a polygon which is filled across the whole longitude band, but empty where it is expected to be filled. I attach here a plot illustrating this, as well as a minimal working example:
![mwe](https://user-images.githubusercontent.com/5399958/30940785-a52054ee-a3e2-11e7-9bc2-0d9f76cef9ec.png)
```
#!/bin/env python
import matplotlib.pyplot as plt
import astropy.coordinates as c
import astropy.units as u
from gammapy.maps import WcsMapND
from regions import CircleSkyRegion

fig = plt.figure()
m = WcsMapND.create(binsz=1.0, width=(360., 180.), skydir=(0.0, 0.0),
coordsys='GAL', proj='AIT')
m.fill_poisson(1.0)
wcs = m.geom.wcs
ax = fig.add_subplot(111, projection=wcs)
ax.imshow(m.data, cmap='plasma', alpha=0.2)

center = c.SkyCoord(l=180.2*u.degree, b=61.*u.degree, frame='galactic')
rad = 20.0*u.degree
region = CircleSkyRegion(center=center, radius=c.Angle(rad))
region.to_pixel(wcs=wcs, mode='full').plot(ax, color='green')

plt.show()
```
Is there a known workaround ?

Many thanks in advance.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the supplied minimal example, focusing on CircleSkyRegion.to_pixel(wcs=wcs, mode='full') and the Aitoff projection at the longitude map edge. Reproduce the filled polygon spanning the longitude band, then inspect the resulting plotting behavior. Done means the circle is filled only in its expected regions while wrapping correctly across the map edge.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data-visualization
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.