Skip to content

Commit

Permalink
Add subpixels mode and keyword
Browse files Browse the repository at this point in the history
  • Loading branch information
larrybradley committed Oct 24, 2016
1 parent 3979607 commit 6de30dd
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions regions/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ def to_sky(self, wcs, mode='local', tolerance=None):
"""

@abc.abstractmethod
def to_mask(self, mode='center'):
def to_mask(self, mode='center', subpixels=5):
"""
Returns a mask for the aperture.
Parameters
----------
mode : { 'center' | 'any' | 'all' | 'exact' }
mode : { 'center' | 'any' | 'all' | 'exact' | 'subpixels'}
The following modes are available:
* ``'center'``: returns 1 for pixels where the center is in
the region, and 0 otherwise.
Expand All @@ -162,6 +162,16 @@ def to_mask(self, mode='center'):
the region, 0 otherwise.
* ``'exact'``: returns a value between 0 and 1 giving the
fractional level of overlap of the pixel with the region.
* ``'subpixels'``: A pixel is divided into subpixels and
the center of each subpixel is tested. Returns a
value between 0 and 1 giving the fractional level of
overlap of the subpixels with the region. With
``subpixels`` set to 1, this method is equivalent to
``'center'``.
subpixels : int, optional
For the ``'subpixel'`` mode, resample pixels by this factor
in each dimension. That is, each pixel is divided into
``subpixels ** 2`` subpixels.
Returns
-------
Expand Down

0 comments on commit 6de30dd

Please sign in to comment.