|AHELP for CIAO 4.5 ChIPS v1||
Converts a point from one ChIPS coordinate system to another.
convert_coordinate(point [,input coordinate] [,output coordinate] [,axis])
- 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 coordsys" 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.
Keywords can be used in the argument list as a method of not setting arguments which come earlier in the argument list. For example, "convert_coordinate ((5,6), out_coord=PLOT_NORM)" specifies that the output should be in plot normalized coordinates and that input is the in current coordinate system (the default setting).
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.
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.
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 = np.arange (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.
chips> add_curve ([1,2,6,7],[6,13,2,6],'line.color=cyan') chips> pnt = convert_coordinate ((2,13), out_coord=PLOT_NORM) chips> id = ChipsId () chips> id.coord_sys = PLOT_NORM chips> add_point (id, pnt, pnt, '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. The keyword out_coord was used in order to bypass having to 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.
See the bugs pages on the ChIPS website for an up-to-date listing of known bugs.