Chandra X-Ray Observatory
	(CXC)
Skip to the navigation links
Last modified: December 2013

URL: http://cxc.harvard.edu/sherpa/ahelp/get_bkg.html
Jump to: Description · Examples · Bugs · See Also


AHELP for CIAO 4.6 Sherpa v1

get_bkg

Context: data

Synopsis

Return the background data, ARF, RMF, or model.

Syntax

get_bkg( [id, bkg_id] )
get_bkg_arf( [id] )
get_bkg_rmf( [id] )
get_bkg_source( [id, bkg_id] )
get_bkg_model( [id, bkg_id] )

Description

The get_bkg functions return information characterizing a background associated with a source data set. The appropriate functions can be used to return the background data, ARF, RMF, or model data, which can be stored in a variable, printed to the screen, or used directly in another command (see the examples section).

  • id - the id of the dataset to use; if not given, uses the default dataset id (id=1 by default, see "ahelp get_default_id")
  • bkg_id - the id of the background to use, e.g. if more than one background is associated with the data; default is the first background data set loaded

get_bkg

The get_bkg() function returns a variable that grants access to all the information contained in a background associated with a source data set, by data ID and background ID. If no ID is given, then the first background loaded for the default data set is returned. The get_bkg() function can also be used to modify the details of a background data set, e.g. to change units from "energy" to "wavelength".

get_bkg_arf, get_bkg_rmf

The functions get_bkg_arf() and get_bkg_rmf() return the first ARF and RMF loaded for the default background of the specified data set ID. To retrieve another ARF or RMF, e.g. if multiple responses are associated with a given background, the get_arf() and get_rmf() commands should be used, which allow the user to specify the background and response IDs.

If the requested data does not exist (e.g. there is no background ARF or RMF loaded), the commands return "None".

get_bkg_source, get_bkg_model

Once a model has been assigned to a background associated with a data set, the get_bkg_source() function can be used to return the parameters and settings defining the unconvolved background model, by data ID and background ID.

The get_bkg_model() function returns the parameters and settings defining the convolved model associated with a background data set, by data ID and background ID.

Example 1

sherpa> back1=get_bkg()

This command retrieves the first background loaded for the default data set and stores it as "back1". The contents may be printed:

sherpa> print(back1)
name           = 3c273_bg.pi
channel        = Int32[1024]
counts         = Int32[1024]
staterror      = None
syserror       = None
bin_lo         = None
bin_hi         = None
grouping       = Int16[1024]
quality        = Int16[1024]
exposure       = 38564.6089269
backscal       = 1.87253514146e-05
areascal       = 1.0
grouped        = True
subtracted     = False
units          = energy
response_ids   = [1]
background_ids = []

Example 2

sherpa> print(get_bkg("src",2))
None

This command prints the second background associated with data set "src"; since there is only one background for that data set, it returns nothing.

Example 3

sherpa> fake_pha("faked", arf=get_arf(), rmf=get_rmf(), exposure=10000,
bkg=get_bkg())

In this context, get_bkg() is used to populate the 'bkg' option in fake_pha() (see "ahelp fake_pha" for more information).

Example 4

sherpa> b_arf=get_bkg_arf("src")
sherpa> b_rmf=get_bkg_rmf("src")

Here, the ARF and RMF for the first background loaded for data set "src" are stored to the variables b_arf and b_rmf, respectively. If multiple responses exist for the default background, the first ARF and RMF loaded for that background are returned.

Example 5

sherpa> get_bkg_source()
sherpa> get_bkg_source(1, 3)

When called with no arguments, get_bkg_source() returns the unconvolved background model associated with the first background loaded for the default data set. To return the unconvolved model for a background other than the default, e.g. if more than one is associated with a data set, then both the data ID and background ID must be specified.

sherpa>  print(get_bkg_source())
const1d.constant
   Param        Type          Value          Min          Max      Units
   -----        ----          -----          ---          ---      -----
   constant.c0  thawed            1            0  3.40282e+38         

sherpa>  print(get_bkg_source(1, 3))
const1d.constant3
   Param        Type          Value          Min          Max      Units
   -----        ----          -----          ---          ---      -----
   constant3.c0 thawed            1            0  3.40282e+38         

sherpa>  print(get_bkg_source(1, 3))
const1d.constant3
   Param        Type          Value          Min          Max      Units
   -----        ----          -----          ---          ---      -----
   constant3.c0 thawed            1            0  3.40282e+38         

Example 6

sherpa> get_bkg_model()
sherpa> get_bkg_model(1, 3)

When called with no arguments, get_bkg_model() returns the convolved background model associated with the first background loaded for the default data set. To return the convolved model for a background other than the default, e.g. if more than one is associated with a data set, then both the data ID and background ID must be specified.

sherpa>  print(get_bkg_model())
apply_rmf(apply_arf((56494.4943719 * const1d.constant)))
   Param        Type          Value          Min          Max      Units
   -----        ----          -----          ---          ---      -----
   constant.c0  thawed            1            0  3.40282e+38           

sherpa>  print(get_bkg_source(1, 3))
apply_rmf(apply_arf((56494.4943719 * const1d.constant3)))
   Param        Type          Value          Min          Max      Units
   -----        ----          -----          ---          ---      -----
   constant3.c0  thawed            1            0  3.40282e+38           

Bugs

See the bugs pages on the Sherpa website for an up-to-date listing of known bugs.

See Also

confidence
get_conf, get_covar, get_int_proj, get_int_unc, get_proj, get_reg_proj, get_reg_unc
contrib
get_chart_spectrum
data
get_areascal, get_arf, get_arf_plot, get_axes, get_backscal, get_bkg_plot, get_bkg_scale, get_coord, get_counts, get_data, get_data_plot, get_dep, get_dims, get_error, get_exposure, get_grouping, get_indep, get_quality, get_rmf, get_specresp, get_staterror, get_syserror, load_arf, load_bkg_arf, load_bkg_rmf, load_multi_arfs, load_multi_rmfs, load_rmf, set_arf, set_bkg, set_rmf, subtract, unpack_arf, unpack_rmf, unsubtract
filtering
get_filter
fitting
calc_stat_info, get_fit, get_stat_info
info
get_default_id, list_bkg_ids, list_response_ids, list_stats, show_bkg_model, show_bkg_source
methods
get_draws, get_iter_method_name, get_iter_method_opt, get_method
modeling
delete_bkg_model, get_model, get_model_component, get_model_component_image, get_model_component_plot, get_model_plot, get_num_par, get_order_plot, get_par, get_pileup_model, get_response, get_source, get_source_component_image, get_source_component_plot, image_source
plotting
get_split_plot, plot_arf, plot_bkg
psfs
get_kernel, get_psf
statistics
get_chisqr_plot, get_delchi_plot, get_prior, get_sampler, get_stat
utilities
get_analysis, get_rate
visualization
get_ratio, get_resid, image_getregion

Last modified: December 2013
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:   cxcweb@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2014. All rights reserved.