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/convert_coordinate.sl.html
AHELP for ChIPS 4.0 convert_coordinate Context: sl.chips

Synopsis

Converts a point from one ChIPS coordinate system to another.

Syntax

convert_coordinate(point [,input coordinate] [,output coordinate]
[,axis]);

Description

  • point - the point to be converted. May be a single scalar value or a coordinate pair.
  • input coordinate - the coordinate system of the point to be converted; the current coordinate system is used if one is not specified.
  • output coordinate - the new coordinate system for the point; the current coordinate system is used if one is not specified.
  • axis - the associated axis of the point if a single scalar value is given, e.g. X_AXIS or Y_AXIS. This argument is ignored if the point is a pair of values.

The convert_coordinate command converts a point from one ChIPS coordinate system into another. The conversion can be performed between any coordinate systems which have been created. For example, the value of a point in data system coordinates can be converted to the data system from a different plot.

The input and output coordinate systems are specified as an enumerated type, a string, or a ChipsId. If no system is given, the current coordinate system is used.

The allowed enumerated types include PIXEL, WINDOW_NORM, FRAME_NORM, PLOT_NORM or DATA; see "ahelp sl.chips coordinates" for more information.

If a string is supplied, it should be the name of a data system. The command will look for the specified data system in the current plot. Alternatively, a ChipsId can be supplied to specify the coordinate system from any window, frame or plot.

The output of this command is the input point value(s) represented in the specified output coordinate system. If the input is a single value, a single value will be returned. Otherwise a coordinate pair will be returned.

Example 1

chips> add_window (360, 360, "pixels");
chips> print (convert_coordinate ([180,180], PIXEL, WINDOW_NORM));
chips> print (convert_coordinate ([.5,.5], WINDOW_NORM));

Add a window which is 360x360 pixels; the default coordinate system for a window is always pixels). Convert the point (180,180) pixels into window normalized coordinates; the result should be (.5,.5). Then convert (.5,.5) from window normalize coordinates into the current coordinate system.

Example 2

chips> id = ChipsId;
chips> add_curve (id,[1,2,6,7],[6,13,2,6],"line.color=green");
chips> split (2);
chips> current_plot ("plot2");
chips> x = [0:10];
chips> y = x^3;
chips> add_curve (x,y);
chips> x = convert_coordinate (6, id,DATA, X_AXIS);
chips> add_vline (x);

Create two plots each with its own curve. Convert the value "6", which is associated with the x-axis, from the data coordinates of the first plot to the data coordinates of the second plot. Store the returned value and use it to create a vertical line in the second plot.

Example 3

chips> add_curve ([1,2,6,7],[6,13,2,6],"line.color=cyan");
chips> pnt = convert_coordinate ([2,13], NULL, PLOT_NORM);
chips> id = ChipsId;
chips> id.coord_sys = PLOT_NORM;
chips> add_point (id, pnt[0], pnt[1], "color=red");
chips> limits (X_AXIS, 0,8);

Create a curve and use convert_coordinate to determine where the point (2,13) is in plot normalized coordinates. A NULL value was passed in for the input coordinate. This provided a means of not having to explicitly set the input coordinate. The input coordinate defaults to the current coordinate system, which is the current data coordinate system. Store the returned value and use it to create a point in 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.