Last modified: December 2020

URL: https://cxc.cfa.harvard.edu/sherpa/ahelp/notice2d.html
AHELP for CIAO 4.13 Sherpa v1

notice2d

Context: filtering

Synopsis

Include a spatial region of all data sets.

Syntax

notice2d(val=None)

val - str, optional

Description

Select a spatial region to include in the fit. The filter is applied to all data sets.


Examples

Example 1

Include the data points that lie within a circle centered at 4324.5,3827.5 with a radius of 300:

>>> notice2d('circle(4324.5,3827.5,430)')

Example 2

Read in the filter from the file ds9.reg , using either:

>>> notice2d('ds9.reg')

or

>>> notice2d('region(ds9.reg)')

Example 3

Select those points that lie both within the rotated box and the annulus (i.e. an intersection of the two shapes):

>>> notice2d('rotbox(100,200,50,40,45)*annulus(120,190,20,60)')

Example 4

Select those points that lie within the rotated box or the annulus (i.e. a union of the two shapes):

>>> notice2d('rotbox(100,200,50,40,45)+annulus(120,190,20,60)')

Example 5

All existing spatial filters are removed:

>>> notice2d()

PARAMETERS

The parameter for this function is:

Parameter Definition
val A region specification as a string or the name of a file containing a region filter. The coordinates system of the filter is taken from the coordinate setting of the data sets ( `set_coord` ). If none , then all points are included.

Notes

The region syntax support is provided by the CIAO region library [1] , and supports the following shapes (the capitalized parts of the name indicate the minimum length of the name that is supported):

Name Arguments
RECTangle (xmin,ymin,xmax,ymax)
BOX (xcenter,ycenter,width,height)
BOX (xcenter,ycenter,width,height,angle)
ROTBOX (xcenter,ycenter,width,height,angle)
CIRcle (xcenter,ycenter,radius)
ANNULUS (xcenter,ycenter,iradius,oradius)
ELLipse (xcenter,ycenter,xradius,yradius,angle)
SECTor (xcenter,ycenter,minangle,maxangle)
PIE (xcenter,ycenter,iradius,oradius,minangle,maxangle)
POLYgon (x1,y1,x2,y2,x3,y3,...)
POInt (xcenter,ycenter)
REGION (file)
FIELD ()

Angles are measured in degrees from the X axis, with a positive value indicating a counter-clockwise direction.

Only simple polygons are supported, which means that a polygon can not intersect itself. The last point does not need to equal the first point (i.e. polygons are automatically closed if necessary).

The shapes can be combined using AND (intersection), OR (union), or NOT (negation):

intersection:

shape1()*shape2()
shape1()&shape2()

union:

shape1()+shape2()
shape1()|shape2()
shape1()shape2()

negation:

!shape1()
shape1()-shape2()
shape1()*!shape1()

The precedence uses the same rules as the mathematical operators + and * (with - replaced by *! ), so that:

circle(0,0,10)+rect(10,-10,20,10)-circle(10,0,10)

means that the second circle is only excluded from the rectangle, and not the first circle. To remove it from both shapes requires writing:

circle(0,0,10)-circle(10,0,10)+rect(10,-10,20,10)-circle(10,0,10)

A point is included if the center of the pixel lies within the region. The comparison is done using the selected coordinate system for the image, so a pixel may not have a width and height of 1.

References


Bugs

See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.

See Also

data
group, group_adapt, group_adapt_snr, group_bins, group_counts, group_snr, group_width
filtering
get_filter, ignore, ignore2d, ignore2d_id, ignore2d_image, ignore_bad, ignore_id, notice, notice2d_id, notice2d_image, notice_id, show_filter