About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2008

URL: http://cxc.harvard.edu/chips4.1/add_region.py.html
AHELP for ChIPS 4.1

add_region

Context: py.chips

Synopsis

Creates a region.

Syntax

add_region( [ChipsId,] sides, xx, yy, radius [,attributes])
add_region( [ChipsId,] xvals, yvals, [,attributes])

Description

  • ChipsId - an optional ChipsId structure containing values to modify the currency state for the command.
  • sides - the number of sides on a regular polygon (i.e. 3=triangle, 4=square, 5=pentagon, etc.)
  • xx,yy - the location of the center of the regular polygon; the current coordinate system is used if one is not specified.
  • radius - the distance from the center (xx,yy) of the regular polygon to the edge; the current coordinate system is used if one is not specified.
  • xvals, yvals - arrays of x and y coordinates to create a non-convex region from (xvals[0],yvals[0]) to (xpos[n], yvals[n]). Degenerate (self-intersecting) polygons are not supported.
  • attributes - optional parameters which allow the user to configure properties though a structure, list, or attribute string.

The add_region command creates a region whose attributes are specified by user preferences or in an attribute list. The new region becomes current by default; providing a ChipsId overrides the currency state.

Clipping

Regions displayed in data coordinates are clipped at the plot boundaries.

Customizing the Region

There are several attributes that control the region characteristics. The attributes can be set to the ChIPS defaults, values provided in the add_region command, or values from the user's preference file.

The attributes may also be modified with the set_region command at any time; see "ahelp set_region" and "ahelp setget" for more information.

The attributes associated with regions are:

Attribute Description Options Default
angle Angle at which the region is drawn -360.0:360.0 0.0
coordsys coordinate system for the region PIXEL, WINDOW_NORM, FRAME_NORM, PLOT_NORM, DATA see "ahelp coordsys"
depth Integer value indicating region depth see the Depth section of "ahelp chipsopt" 100
edge.color region edge color name or hex; see the Color section of "ahelp chipsopt" green
edge.style stipple pattern used to draw the region edges see the Line Style section of "ahelp chipsopt" chips_solid
edge.thickness Thickness of the region edge 0.5:10 1
fill.color region fill color name or hex; see the Color section of "ahelp chipsopt" green
fill.style Fill style for the region see the Fill Pattern section of "ahelp chipsopt" 0 (no fill)
opacity Opacity of the region fill 0.0:1.0 0.5
stem stem used for region id alphanumeric reg

Example 1

chips> add_region(6,.5,.5,.4)

Add a hexagon region in the current coordinate system.

Example 2

chips> settings = ChipsRegion()
chips> settings.fill.color = 'cyan'
chips> settings.fill.style = 1
chips> settings.edge.color= 'beige'
chips> add_region([40,70,70],[10,70,10],settings)

Populate the "settings" structure with the attribute values, then add a triangle with vertices at (40,10), (70,70), and (70,10)

Example 3

chips> add_region([.1,.5,.9],[.9,.2,.7],['edge.color', 'red',
'edge.style', 'shortdash'])

Create region with a red, dashed edge, specifying the attribute values in a list.

CHANGES IN CIAO 4.1

coordsys keyword added to attributes

The attribute "coordsys" sets the coordinate system when the object is created. ChipsIds still can be used to set coordinate systems. If a ChipsId and coordsys attribute are both provided, the coordsys value takes precedence.

Pattern fill options

The attribute "fill.style" replaces the "fill.visible" attribute. There are multiple fill styles available, instead of a boolean filled/not filled. A value of 0 (chips_nofill) is equivalent to fill.visible=0; a value of 1 (chips_solidfill) is equivalent to fill.visible=1 .

Default color not changing for printing

The histogram and region fill colors when set to default were not being changed from a display foreground color to a postscript foreground color.

Bugs

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

Last modified: December 2008



The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory.
60 Garden Street, Cambridge, MA 02138 USA.    Email: cxcweb@head.cfa.harvard.edu
Smithsonian Institution, Copyright © 1998-2004. All rights reserved.