|AHELP for CIAO 4.9 Sherpa v1||
Load filter from a FITS table, FITS image, or ASCII file
load_filter( [id=1,] filename [,bkg_id], [ignore=False, ncols=2] )
The load_filter command reads filter information from a user-input file and assigns it to a 1-D or 2-D data set. For filtering 1-D data sets, the load_filter command reads a filter array from a FITS table file or column-based ASCII file and assigns it to a 1-D data set, specified by data set ID; the second column of the supplied table is read as the filter array. If the 'ignore' keyword argument is set to 'False' (default), an element in a filter array set to a value of 1 or greater marks a 'good' bin and an element set to less than 1 marks a 'bad' bin; the opposite holds if the ignore flag is set to 'True'. This is the equivalent of using the notice/ignore commands to apply a filter, e.g., 'notice(get_filter())'. To filter a data set explicitly with a filter array such as 'c=[0,0,1,1,0,1]', use the set_filter command, e.g., 'set_filter(c)'.
For assigning a 2-D filter to a 2-D data set, a FITS image containing 1s and 0s should be input to load_filter, to indicate which pixels should be ignored/noticed (turned off/on). The filter image should match the source image in shape and number of pixels. To apply the filter read from a FITS image to a 2-D data set, the ignore flag should be set to 'True' or 'False', depending on how the filter information should be used (if set to 'True', the pixels in the 2-D data set corresponding to those marked by 1s in the filter image will be ignored).
- 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 filter 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)
- ignore - True/False Boolean switch to indicate which elements in a filter array (or pixels in a filter image) should be used to filter the associated data set; default is False
- ncols - number of columns to read from a column-based filter file; default=2
sherpa> load_filter("filter.txt") sherpa> get_filter()
The load_filter command can be called with just a filename and path argument, in which case the filter is assigned to default data set id=1. Since the 'ignore' argument is set to 'False' by default, only the elements in the filter array containing values of 1 or greater will be retained in the corresponding places in the data set. Here, 'filter.txt' is read as a column-based ASCII table; two columns are read by default, and the second column of that table is defined as the filter array for data set 1. The get_filter function returns the x-axis elements of the data array with the assigned filter applied - i.e., missing the elements which were flagged as 'bad' by the filter array (set to less than 1).
sherpa> load_filter(2, "filter.fits")
In this case, 'filter.fits' is read as a FITS table; the second column of that table is defined as the filter array for data set 2.
sherpa> load_filter(4, "filter.dat")
The file 'filter.dat' is read as a column-based ASCII table; the second column of that table is defined as the filter array for data set 4.
sherpa> load_filter(4, "filter.dat", bkg_id=1)
The file 'filter.dat' is read as a column-based ASCII table; the second column of that table is defined as the filter array for the background associated with data set 4.
sherpa> load_filter("filter_image.fits", ignore=True)
The filter file 'filter_image.fits' is read as a FITS image. Pixels in image data set 1 corresponding to those with a value of 1 in the filter image are ignored in the analysis.
The filter file 'filter_image.fits' is read as a FITS image. Pixels in image data set 1 corresponding to those with a value of 0 in the filter image are ignored in the analysis, since the ignore flag is set to 'False' by default.
- copy_data, dataspace1d, dataspace2d, datastack, delete_data, fake, get_axes, get_bkg_plot, get_counts, get_data, get_data_plot, get_dep, get_dims, get_error, get_quality, get_specresp, get_staterror, get_syserror, group, load_arf, load_arrays, load_ascii, load_bkg, load_bkg_arf, load_bkg_rmf, load_data, load_grouping, 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_quality, ungroup, unpack_arf, unpack_arrays, unpack_ascii, unpack_bkg, unpack_data, unpack_image, unpack_pha, unpack_rmf, unpack_table
- get_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_template_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