Last modified: June 2019

URL: https://cxc.cfa.harvard.edu/sherpa/ahelp/get_instmap_weights.html
Jump to: Description · Examples · Bugs · See Also


AHELP for CIAO 4.16 Sherpa

get_instmap_weights

Context: contrib

Synopsis

Return the model spectrum in the form required by the spectrumfile parameter of mkinstmap

Syntax

get_instmap_weights( [id=None, fluxtype="photon"] )

Description

The get_instmap_weights() command turns the current model values into the form used for the spectrumfile parameter of the CIAO mkinstmap tool. The return value is an object with the following fields:

Field Value
id The dataset identifier.
modelexpr A string containing the model expression.
xlo The lower edge of each bin.
xhi The upper edge of each bin.
xmid The mid-point of each bin.
weight The weight for each bin.
fluxtype "photon" or "erg"; the instrument map is in units of cm^2 count / <fluxtype>.

Please see the Calculating Spectral Weights thread for further information on how to use this routine.

Loading the routine

The routine can be loaded into Sherpa by saying:

from sherpa_contrib.utils import *

Arguments

Name Default value Description
id None (which means use the value of get_default_id) Which dataset to use.
fluxtype "photon" The units for the instrument map are cm^2 count / <fluxtype>. The valid options for this argument are "photon" (the default) or "erg".

Examples

Example 1

sherpa> w = get_instmap_weights()
sherpa> print (w)
id = 1
modelexpr = (xsphabs.gal * xsmekal.clus)
xlo = Float32[47]
xhi = Float32[47]
xmid = Float32[47]
weight = Float32[47]
fluxtype = photon

Get the weights for the model values of the default dataset. The weights are appropriate for creating an instrument map in units of cm^2 count / photon and will sum to 1.

The weights can be plotted with Matplotlib, here as a curve:

sherpa> import matplotlib.pyplot as plt
sherpa> plt.plot(w.xmid, w.weight)

Example 2

sherpa> w = get_instmap_weights(fluxtype="erg")

In this case the weights are intended to create an instrument map in units of cm^2 count / erg and so will not sum to 1 (the individual weights will be large in this case, with values somewhere around 1e8, depending on the binning and spectral model chosen).


Bugs

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

See Also

confidence
get_conf, get_conf_results, get_covar, get_covar_opt, get_covar_results, get_covariance_results, get_int_proj, get_int_unc, get_proj, get_proj_opt, get_proj_results, get_projection_results, get_reg_proj, get_reg_unc
contrib
estimate_weighted_expmap, get_chart_spectrum, get_marx_spectrum, plot_instmap_weights, save_instmap_weights, sherpa_utils
data
get_areascal, get_arf, get_arf_plot, get_axes, get_backscal, get_bkg, get_bkg_arf, get_bkg_chisqr_plot, get_bkg_delchi_plot, get_bkg_fit_plot, get_bkg_model, get_bkg_model_plot, get_bkg_plot, get_bkg_ratio_plot, get_bkg_resid_plot, get_bkg_rmf, get_bkg_scale, get_bkg_source, get_bkg_source_plot, get_coord, get_counts, get_data, get_data_contour, get_data_contour_prefs, get_data_image, get_data_plot, get_data_plot_prefs, get_dep, get_dims, get_error, get_exposure, get_grouping, get_indep, get_quality, get_rmf, get_specresp, get_staterror, get_syserror
filtering
get_filter
fitting
calc_stat_info, get_stat_info
info
get_default_id, list_stats
methods
get_draws, get_iter_method_name, get_iter_method_opt, get_method, get_method_name, get_method_opt
modeling
get_model, get_model_component, get_model_component_image, get_model_component_plot, get_model_plot, get_num_par, get_num_par_frozen, get_num_par_thawed, get_order_plot, get_par, get_pileup_model, get_response, get_source, get_source_component_image, get_source_component_plot, get_source_contour, get_source_image, get_source_plot, image_source
plotting
get_split_plot
psfs
get_psf, get_psf_contour, get_psf_image, get_psf_plot
statistics
get_chisqr_plot, get_delchi_plot, get_prior, get_sampler, get_stat, get_stat_name
utilities
get_analysis, get_rate
visualization
image_getregion