Chandra X-Ray Observatory
Skip to the navigation links
Last modified: December 2010

Jump to: Description · Examples · See Also

AHELP for CIAO 4.3 Sherpa v1


Context: data


Load a grouping scheme from a FITS table or ASCII file


load_grouping( [id=1], filename, [bkg_id] )


The load_grouping command reads an array of grouping flags from a FITS table file or column-based ASCII file and assigns it to a PHA data set, specified by data set ID. The second column of the supplied table is read as the grouping array, which must be the same length as the input data set. An array element set to 1 marks the beginning of a group and an element set to -1 marks subsequent members of that group. Use the get_grouping command to view the grouping scheme associated with a data set, and the set_grouping command to apply the grouping to a data set.

  • id - the id of the data set to use; if not given, uses the default dataset id (id=1 by default, see "ahelp get_default_id")
  • filename - name of FITS table file or column-based ASCII file containing a grouping array in the second column
  • bkd_id - the id of the background data set to use (e.g., bkg_id=1 represents the first background data set loaded in association with the source data set specified in the 'id' argument)

Example 1

sherpa> load_grouping("grouping.txt")

The load_grouping command can be called with just a filename and path argument, in which case the grouping scheme is assigned to data set id=1. Here, 'grouping.txt' is read as a column-based ASCII table; the second column of that table is defined as the group array for data set 1. The set_grouping function is used to actually apply the grouping scheme to data set 1, using the array which is returned by the get_grouping function. The set_grouping and get_grouping functions require that the data set in question be a PHA data set.

sherpa> load_pha("3c273.pi")
sherpa> load_grouping("grouping.txt")
sherpa> get_grouping(1)

array([1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1,..., -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1])

sherpa> set_grouping(1, get_grouping())

Example 2

sherpa> load_grouping("grouping.fits")

In this case, 'grouping.fits' is read as a FITS table; the second column of that table is defined as the group array for data set 1.

Example 3

sherpa> load_grouping(2, "grouping.dat")

The file 'grouping.dat' is read as a column-based ASCII table; the second column of that table is defined as the group array for data set 2.

Example 4

sherpa> load_grouping(2, "grouping.dat", bkg_id=1)

The file 'grouping.dat' is read as a column-based ASCII table; the second column of that table is defined as the group array for the background associated with data set 2.

See Also

copy_data, dataspace1d, dataspace2d, delete_data, fake, get_axes, get_bkg_plot, get_counts, get_data, get_data_plot, get_dep, get_dims, get_error, get_grouping, get_quality, get_specresp, get_staterror, get_syserror, group_sherpa, load_arf, load_arrays, load_ascii, load_bkg, load_bkg_arf, load_bkg_rmf, load_data, load_image, load_multi_arfs, load_multi_rmfs, load_pha, load_quality, load_rmf, load_staterror, load_syserror, load_table, pack_image, pack_pha, pack_table, set_data, set_grouping, set_quality, ungroup, unpack_arf, unpack_arrays, unpack_ascii, unpack_bkg, unpack_data, unpack_image, unpack_pha, unpack_rmf, unpack_table
get_filter, load_filter, set_filter
get_default_id, list_bkg_ids, list_data_ids, list_response_ids
add_model, add_user_pars, clean, load_table_model, load_user_model, save_model, save_source
plot_data, set_xlinear, set_xlog, set_ylinear, set_ylog
save_arrays, save_data, save_delchi, save_error, save_filter, save_grouping, save_image, save_pha, save_quality, save_resid, save_staterror, save_syserror, save_table
calc_data_sum, calc_data_sum2d, calc_ftest, calc_kcorr, calc_mlr, calc_model_sum2d, calc_source_sum2d, get_rate
contour, contour_data, contour_ratio, get_ratio, get_resid, histogram1d, histogram2d, image_data, rebin

Last modified: December 2010
Smithsonian Institute Smithsonian Institute

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