Last modified: December 2013

Jump to: Description · Examples · See Also

AHELP for CIAO 4.11 Sherpa v1


Context: modeling


Save the convolved source model to a FITS table or ASCII file


save_model( [id=1], filename, [bkg_id=1,ascii=False,clobber=False] )


The save_model() function saves the 1D or 2D data arrays which define a convolved source model to a FITS table or ASCII file; the arrays are written as columns XLO, XHI, and MODEL. Note that the ASCII option is not supported for 2-dimensional source models, so the optional parameter 'ascii' should be set to 'False' in this case.

The convolved source model used is the one which has been assigned to the data set set specified in the 'id' argument (or the 'bkg_id' argument in the case of a background data set, in which case 'id' must also be specified). The convolved model is computed with the instrument response files (ARF, RMF) loaded in association with the source data set. The models will respect any data filters in place, and models from associated PHA spectra will also respect the data grouping settings.


Example 1

sherpa> save_model("source.fits")

The save_model() function can be called with just a filename, in which case all the default arguments will be used. In this example, the convolved model array associated with data set id=1 is written to the FITS table 'source.fits'.

Example 2

sherpa> save_model(2, "source.txt", ascii=True)

Here, the optional 'ascii' argument is set to True in order to produce an outfile in ASCII format (overriding the default setting ascii=False). The convolved model array assigned to data set id=2 is written to the text file 'sources.txt'.

Example 3

sherpa> save_model(2,"source.fits", bkg_id=1, clobber=True)

The convolved source model associated with the first background data set loaded for source data set 2 is written to FITS file source.fits (note the 'ascii' parameter default is False).

See Also

save_chart_spectrum, save_marx_spectrum
dataspace1d, dataspace2d, datastack, fake, get_bkg_plot, 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, unpack_arf, unpack_arrays, unpack_ascii, unpack_bkg, unpack_data, unpack_image, unpack_pha, unpack_rmf, unpack_table
get_default_id, list_bkg_ids, list_data_ids, list_model_ids, show_bkg_model, show_bkg_source
add_model, add_user_pars, clean, create_model_component, delete_bkg_model, delete_model, delete_model_component, get_model, get_model_autoassign_func, 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_source, get_source_component_image, get_source_component_plot, image_model, image_model_component, image_source, image_source_component, integrate, link, load_table_model, load_template_model, load_user_model, normal_sample, reset, save_source, set_bkg_model, set_full_model, set_model_autoassign_func, set_pileup_model, set_source, set_xsabund, set_xscosmo, set_xsxsect, set_xsxset, t_sample, uniform_sample
get_lrt_plot, get_lrt_results, get_pvalue_plot, get_pvalue_results, plot_cdf, plot_model, plot_model_component, plot_pdf, plot_pvalue, plot_scatter, plot_source, plot_source_component, plot_trace
delete_psf, load_conv
restore, save, save_all, 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, script
calc_chisqr, calc_energy_flux, calc_model_sum, calc_photon_flux, calc_source_sum, calc_stat, eqwidth
contour_model, contour_ratio, contour_resid, get_ratio, get_resid