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 2006

URL: http://cxc.harvard.edu/ciao3.4/set_axes.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 set_axes Context: sherpa

Synopsis

Module functions for creating new source or background dataspaces.

Syntax

Integer_Type set_axes([Integer_Type,]Struct_Type|Array_Type)
Integer_Type set_baxes([Integer_Type,]Struct_Type|Array_Type)

Success/Error Return Values: 1/0

Arguments:

(1) Dataset number (default 1)

(2) A structure containing fields that define a 1-D dataspace, or

(2) An array that defines a 1-D dataspace, or

(2) An array of N structures containing fields that define an N-D
dataspace, or

(2) An array of N arrays that define an N-D dataspace.

Note that if only one argument is provided, it is assumed to be one of
the quantities listed for argument 2, and the dataset is assumed to be
dataset 1.

Description

The set_axes function is the equivalent of Sherpa's DATASPACE command. (The function set_baxes, used to set up dataspaces for background datasets, has no Sherpa command analogue.) A ``dataspace'' is an N-dimensional grid representing the independent variables of a dataset (e.g., the x values in y = f(x)).

A given axis may be defined using an array, or a structure; the former are appropriate for unbinned data entry, while structures are appropriate for either unbinned or binned data entry (the equivalent of DATASPACE HISTOGRAM). The structures must contain fields named lo and hi (for binned dataspaces), or mid (for unbinned dataspaces). These fields point to numeric arrays. (set_axes can thus process the structures output by get_axes. Note that the array lengths of the lo and hi fields of each input structure must be equal (though they may vary from axis to axis; e.g., to define a 512 x 1024 binned dataspace).

The set_axes functions should be used with care, as it instructs Sherpa to replace any dataset previously input with the same dataset number, with the new dataspace.

See the related Sherpa command DATASPACE for more information.

Example 1

Create a new 1-D dataspace:

sherpa> DATA spec.dat
sherpa> str = get_axes(1)
sherpa> print(str)
axistype         =  Channels
axisunits        =  unknown
lo               =  NULL
hi               =  NULL
mid              =  Float_Type[100]
sherpa> theaxis = @(foo[0].mid)
sherpa> () = set_axes(1,theaxis)

In this example, the user takes a dataset and ends up replacing the read-in counts with zeroes. In the first step, unbinned ASCII data are read in. Because they are unbinned, get_axes returns a structure for which only the mid field is non-NULL. (There are no lower and upper bin boundaries.) The array pointed to by str.mid is then copied (the `@' sign denotes a total copy of array contents), and used to define a new dataspace via set_axes.

Example 2

Create a new binned 2-D dataspace:

sherpa> variable a0 = struct{lo,hi}
sherpa> a0.lo = [1:1024]
sherpa> a0.hi = [2:1025]
sherpa> variable a1 = struct{lo,hi}
sherpa> a1.lo = [1:1024]
sherpa> a1.hi = [2:1025]
sherpa> a = Struct_Type[2]
sherpa> a[0] = a0
sherpa> a[1] = a1
sherpa> set_axes(1,a)
1

In this example, the user creates two structures which are minimally sufficient for setting up a binned dataspace (such a structure must have fields lo and hi, and it could have more fields, but these are ignored). Arrays are defined for each of the structure fields, such that the first bin has lower and upper bin boundaries 1 and 2, the second bin 2 and 3, etc. An array of structures a is then defined, and sent to Sherpa via set_axes. The call returns 1, indicating that Sherpa successfully set up a 1024 x 1024 dataspace.

Bugs

See the Sherpa bug pages online for an up-to-date listing of known bugs.

Hardcopy (PDF): A4 | Letter
Last modified: December 2006



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.