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 2007

URL: http://cxc.harvard.edu/chips4.0/ChipsId.py.html
AHELP for ChIPS 4.0 chipsid Context: py.chips

Synopsis

The ChipsId structure is used to specify the currency state and coordinate system.

Description

The ChipsId object allows the user to set or modify the currency of ChIPS by specifying the ids of the windows, frames, plots, axes, curves, contours, histograms, labels, lines, points, and regions that the operation should affect. It also contains entries to specify coordinate systems and coordinate system ids. The ChipsId is optional and is generally the first parameter in the command.

A complete list of ChipsId members is available at the end of this document. They are set as:

      id = ChipsId()
      id.window = "all"
      id.curve = "crv1"
      id.coord_sys = PLOT_NORM
      

Object methods may be used to achieve the same results, e.g. id.set_window_id("all"). The available object methods, as well as convenience methods which operate on multiple members simultaneously, are listed at the end of this document.

When a ChipsId object is passed to a command, only the information relevant to the command is utilized. For instance, the window and frame ids may be used when changing the color of a frame background, but the curve id setting is ignored. Blank entries in the ChipsId resolve to the default determined by currency rules ("ahelp py.chips currency") .

Retrieving Object Ids

The ChipsId object also provides a means of retrieving the ids of objects created by add_<object> commands. If an add_curve call is made when no windows exist, a window, frame, plot, axes, and curve objects are all created. The appropriate entries in the input ChipsId object are populated with the object ids.

The id information may be accessed by printing the ChipsId or via the id accessor methods, e.g. id.get_window_id(). The ids are only set when a new instance of the object is added. If a curve is added to an existing plot, only the curve id will be updated in the ChipsId object.

Specifying Coordinate Systems

The coord_sys entry in the ChipsId is used to specify the coordinate system to use when adding objects. For instance, to add a label in plot normalized coordinates, set the coord_sys entry to PLOT_NORM and include the ChipsId object in the add_label call:

      id = ChipsId()
      id.coord_sys = PLOT_NORM
      add_label(id, .5, .5, 'mid')
      

Members of the ChipsId Object

Member Description
window window id to use to override currency, or the id of the last window created during an add of an object
frame frame id to use to override currency, or the id of the last frame created during an add of an object
plot plot id to use to override currency, or the id of the last plot created during an add of an object
axis axis id to use to override currency, or the id of the last axis created during an add of an object
xaxis x axis id to use to override currency, or the id of the last x axis created during an add of an object
yaxis y axis id to use to override currency, or the id of the last y axis created during an add of an object
curve curve id to use to override currency, or the id of the last curve created
contour contour id to use to override currency, or the id of the last contour created
histogram histogram id to use to override currency, or the id of the last histogram created
label label id to use to override currency, or the id of the last label created
line line id to use to override currency, or the id of the last line created
point point id to use to override currency, or the id of the last point created
region region id to use to override currency, or the id of the last region created
coord_sys coordinate system to use
coord id of data coordinate system to use

Object Methods

Method Description
clear resets all object id members to '' and coord_sys to COORD_NONE
set_all sets all object id members to all
set_window_id sets window id to specified value
reset_window_id sets window id to specified value, resets all other object id members to ''
get_window_id retrieves window id value
set_frame_id sets frame id to specified value
reset_frame_id sets frame id to specified value, leaves window id as is, and resets all other object id members to ''
get_frame_id retrieves frame id value
set_plot_id sets plot id to specified value
reset_plot_id sets plot id to specified value, leaves window and frame id as is, and resets all other object id members to ''
get_plot_id retrieves plot id value
set_axis_id sets axis id to the specified value
get_axis_id retrieves axis id value
set_xaxis_id sets x axis id to the specified value
get_xaxis_id retrieves the x axis id value
set_yaxis_id sets y axis id to the specified value
get_yaxis_id retrieves the y axis id value
set_curve_id sets curve id to the specified value
get_curve_id retrieves curve id value
set_contour_id sets contour id to the specified value
get_contour_id retrieves contour id value
set_histogram_id sets histogram id to the specified value
get_histogram_id retrieves histogram id value
set_label_id sets label id to the specified value
get_label_id retrieves label id value
set_line_id sets line id to the specified value
get_line_id retrieves line id value
set_point_id sets point id to the specified value
get_point_id retrieves point id value
set_region_id sets region id to the specified value
get_region_id retrieves region id value
set_coord_sys sets the coordinate system to the specified value
get_coord_sys retrieves the coordinate system value
set_coord_id sets data coord system id value
get_coord_id retrieves the data coordinate system id value

Example 1

chips> add_label(.5,.5,'Hello','id=a')
chips> add_label(.6,.7,'My','id=b')
chips> add_label(.7,.8,'Friend','id=c')
chips> id=ChipsId()
chips> id.set_label_id('b')
chips> set_label_font(id, 'greek')
chips> id.label='a'
chips> set_label_angle(id,45)

Use a ChipsId to modify the currency of labels in several ways.

Example 2

chips> id=ChipsId()
chips> add_curve(id,range(1,5),range(1,5))
chips> print(id)

Add a curve, using a ChipsId object to retrieve the ids of all the objects that are created.

Example 3

chips> add_axis(XY_AXIS,.5,-50,50)
chips> id=ChipsId()
chips> add_point(20,20)
chips> id.coord_sys = PIXEL
chips> add_point(id, 150,150)
chips> id.coord_sys = PLOT_NORM
chips> add_point(id,.9,.2)

Use the ChipsId Object to change the data system used for adding points from data coordinates to pixel coordinates, then to plot normalized coordinates.

Bugs

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

Last modified: December 2007



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.