| AHELP for CIAO 4.5 Sherpa v1 | save_source |
Context: modeling |
Synopsis
Save the unconvolved source model to a FITS table or ASCII file
Syntax
save_source( [id=1], filename, [bkg_id=1,ascii=False,clobber=False] )
Description
The save_source() function saves the data arrays which define an unconvolved source model to a FITS table or ASCII file; the arrays are written as columns XLO, XHI, and SOURCE. 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 unconvolved 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).
- id - the id of the data set to which the unconvolved model has been assigned; if not given, uses the default data set id (id=1 by default, see "ahelp get_default_id")
- filename - name of outfile
- 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)
- ascii - outfile format specification; True to save outfile in ASCII format, False for FITS, default=False
- clobber - clobber outfile; default=False (do not clobber if file exists)
Example 1
sherpa> save_source("source.fits")The save_source() function can be called with just a filename, in which case all the default arguments will be used. In this example, the unconvolved model array associated with data set id=1 is written to the FITS table 'source.fits'.
Example 2
sherpa> save_source(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 FITS default setting). The unconvolved model array assigned to data set id=2 is written to the text file 'sources.txt'.
Example 3
sherpa> save_source(2,"source.fits", bkg_id=1, clobber=True)
The unconvolved 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
- contrib
- save_chart_spectrum
- data
- dataspace1d, dataspace2d, 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
- filtering
- load_filter
- info
- get_default_id, list_bkg_ids, list_data_ids, list_model_ids, show_bkg_model, show_bkg_source
- modeling
- 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, integrate1d, link, load_table_model, load_template_model, load_user_model, normal_sample, reset, save_model, 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
- plotting
- get_lrt_plot, get_lrt_results, get_pvalue_plot, get_pvalue_results, plot_cdf, plot_lrt, plot_model, plot_model_component, plot_pdf, plot_pvalue, plot_scatter, plot_source, plot_source_component, plot_trace
- psfs
- delete_psf, load_conv
- saving
- 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
- statistics
- load_user_stat
- utilities
- calc_chisqr, calc_energy_flux, calc_model_sum, calc_photon_flux, calc_source_sum, calc_stat, eqwidth
- visualization
- contour_model, contour_ratio, contour_resid, get_ratio, get_resid

![[Sherpa Logo]](../imgs/sherpa_logo_navbar.gif)