Chandra X-Ray Observatory
	(CXC)
Skip to the navigation links
Last modified: 26 October 2016

URL: http://cxc.harvard.edu/sherpa/convert/index.html

Command Comparison: Sherpa 3.4 vs. Sherpa 4.8


The table below provides the Sherpa 4.8 (Python) translation for a list of commonly used Sherpa 3.4 commands, to assist with your transition to the new syntax. See the Sherpa ahelp pages for detailed information on each Sherpa function.

To view complete Sherpa 3.4 and 4.8 Python scripts side-by-side for various 1-D and 2-D plotting and fitting scenarios, visit the Sherpa Gallery of Examples, which includes common Sherpa use cases.

[NOTE]
Note

The CXC is committed to helping Sherpa users transition to new the syntax as smoothly as possible. If you have existing Sherpa scripts or save files, submit them to us via the CXC Helpdesk and we will provide the Sherpa syntax to you.

Sherpa 3.4 Sherpa 4.8
ANALYSIS

set_analysis([id], quantity, [type, factor])

Assuming data set with given ID contains PHA data:

  • quantity - "energy", "wavelength", "channel", or "bin"
  • type - "rate", "counts"
  • factor - 0, 1, 2, ..., n
BACK load_bkg([id], arg, [use_errors, bkg_id])

Assuming data set with given ID contains PHA data:

arg - filename and path | PHACrate obj
BACKERRORS | BERRORS | BSTATERRORS get_staterror([id, filter, bkg_id])
get_error([id, filter, bkg_id])
BACKGROUND | BG set_bkg_model([id], model, [bkg_id])
BDCOUNTS calc_data_sum([lo, hi, id, bkg_id])
BEFLUX calc_energy_flux([lo, hi, id, bkg_id])
BGROUP group([id, bkg_id])
BMCOUNTS calc_model_sum([lo, hi, id, bkg_id])
BSYSERRORS Assuming data set with given ID contains PHA data:
get_syserror([id, filter, bkg_id])
BUNGROUP ungroup([id, bkg_id])
BYE | EXIT | QUIT Ctrl-D, exit
CLOSE TBD
COORD set_coord([id], coord)
COVARIANCE covar([id, otherids ... , pars])
CPLOT contour_data([id])
contour_model([id])
contour_fit([id])
contour_resid([id])
contour_ratio([id])
contour_psf([id])
contour_fit_resid([id])
contour_kernel([id]) or
contour(arg1, [id], arg2, [id], ...])

where arg* is one of "data", "model", "fit", "psf", "resid", or "ratio"
CREATE xsphabs.abs1
or
create_model_component("xsphabs", "abs1")
DATA arg - filename and path | PHACrate obj

load_arf([id], arg, [resp_id, bkg_id])
load_ascii([id], arg, [ncols, colkeys, dstype, sep, comment])
load_data([id], filename, [...])
load_image([id], arg, [coord])
load_pha([id], arg, [use_errors])
load_rmf([id], arf, [resp_id, bkg_id])
load_table([id], arg, [ncols, colkeys, dstype])
load_filter([id], filename, [bkg_id])
load_grouping([id], filename, [bkg_id])
load_quality([id], filename, [bkg_id])
load_staterror([id], filename, [bkg_id], [options])
load_syserror([id], filename, [bkg_id], [options])
DATASPACE dataspace1d(start, stop, [step, numbins, id, bkg_id, dstype])
dataspace2d(dims, [id, dstype])

dstype - Data1DInt, Data2D, Data2DInt, DataARF, DataIMG, DataPHA, or DataRMF
DCOUNTS calc_data_sum([lo, hi, id, bkg_id])
ECHO

IPython's logging mechanism is an option.

%logstart
...
%logstop
EFLUX calc_energy_flux([lo, hi, id, bkg_id])
EQWIDTH eqwidth(cont, cont+eline, [lo, hi], [id], [bkg_id])
ERASE clean()
ERRORS get_error([id, filter, bkg_id])
FAKEIT fake_pha(id, arf, rmf, exposure, [backscal, areascal, grouping, grouped, quality, bkg])
FEFFILE Not available
FEFPLOT Not available
FIT | RUN fit([id, otherids ..., outfile, clobber])
fit_bkg([id, otherids ..., outfile, clobber])
FLUX calc_photon_flux([lo, hi, id, bkg_id])
FREEZE freeze(list params or models)
FTEST calc_ftest(dof_1, stat_1, dof_2, stat_2)
GETX TBD
GETY TBD
GOODNESS calc_stat_info() / get_stat_info()

get_fit_results()

get_fit_results().statval
get_fit_results().numpoints
get_fit_results().dof
get_fit_results().qval
get_fit_results().rstat
get_fit_results().nfev
get_fit_results().modelvals
get_fit_results().parnames
get_fit_results().parvals
GROUP group([id, bkg_id])
group_bins([id,] num [,bkg_id])
group_counts([id,] num [,bkg_id])
group_snr([id,] snr [,bkg_id])
group_adapt([id,] min [,bkg_id])
group_adapt_snr([id,] min [,bkg_id])
group_width([id,] num [,bkg_id])
IGNORE

Apply to all data sets:

Python CIAO 3.4
ignore(3, 5) IGNORE FILTER 3:5
ignore(3) IGNORE FILTER 3:
ignore(None, 5) IGNORE FILTER :5
ignore("4,8:,1:3") IGNORE FILTER 4, 8:, 1:3
ignore() IGNORE ALL

Apply to one data set:

Python CIAO 3.4
ignore_id(id, 3, 5) IGNORE id FILTER 3:5
ignore_id(id, 3, 5, bkg_id) IGNORE BACK bkg_id FILTER 3:5
ignore_id(id, 3) IGNORE id FILTER 3:
ignore_id(id, None, 5) IGNORE id FILTER :5
ignore_id(id, "4,8:,1:3") IGNORE id FILTER 4, 8:, 1:3
ignore_id(id) IGNORE id ALL

Exclude PHA channels with quality flags greater than 0:

Python CIAO 3.4
ignore_bad() IGNORE BAD
IMAGE image_data()
image_model()
image_model_component() / get_model_component_image()
image_source_component() / get_source_component_image()
image_fit()
image_psf()
image_ratio()
image_resid()
image_source()
image_kernel()
INSTRUMENT | RESPONSE load_rmf()
load_arf()
load_psf()
set_full_model()
INTEGRATE
INTERVAL-PROJECTION | INT-PROJ int_proj(param, [id, otherids, replot, min, max, nloop, delv, fac, log, overplot])

Print reg_proj parameters

print(get_int_proj())
INTERVAL-UNCERTAINTY | INT-UNC int_unc(param, [id, otherids, replot, min, max, nloop, delv, fac, log, overplot])

Print reg_unc parameters

print(get_int_unc())

JOURNAL

IPython provides a history mechanism and session logging.

LINK link()
LPLOT plot_arf([id, resp_id, replot, overplot])
plot_bkg([id, bkg_id, replot, overplot])
plot_bkg_chisqr([id, bkg_id, replot, overplot])
plot_bkg_delchi([id, bkg_id, replot, overplot])
plot_bkg_fit([id, bkg_id, replot, overplot])
plot_bkg_fit_delchi([id, bkg_id, replot, overplot])
plot_bkg_fit_resid([id, bkg_id, replot, overplot])
plot_bkg_model([id, bkg_id, replot, overplot])
plot_bkg_ratio([id, bkg_id, replot, overplot])
plot_bkg_resid([id, bkg_id, replot, overplot])
plot_bkg_source([id, lo, hi, bkg_id, replot, overplot])
plot_chisqr([id, replot, overplot])
plot_data([id, replot, overplot])
plot_delchi([id, replot, overplot])
plot_fit([id, replot, overplot])
plot_fit_delchi([id, replot, overplot])
plot_fit_resid([id, replot, overplot])
plot_model([id, replot, overplot])
plot_model_component([id], name [,replot, overplot])
plot_source_component([id], name [,replot, overplot])
plot_ratio([id, replot, overplot])
plot_resid([id, replot, overplot])
plot_source([id, lo, hi, replot, overplot])
plot_kernel([id, replot, overplot]) or

plot(arg1, [id], arg2, [id], ...)

where arg* is one of "arf","bkg","bkgchisqr", "bkgdelchi","bkgfit","bkgmodel","bkgratio", "bkgresid","bkgsource","chisqr","data","delchi", "fit","model","psf","ratio","resid","source"
MCOUNTS calc_model_sum([lo, hi, id, bkg_id])
METHOD | SEARCHMETHOD set_method(method_name)
MLR calc_mlr(delta_dof, delta_stat)
NOTICE

Apply to all data sets:

Python CIAO 3.4
notice(3, 5) NOTICE FILTER 3:5
notice(3) NOTICE FILTER 3:
notice(None, 5) NOTICE FILTER :5
notice("4,8:,1:3") NOTICE FILTER 4, 8:, 1:3
notice() NOTICE ALL

Apply to one data set:

Python CIAO 3.4
notice_id(id, 3, 5) NOTICE id FILTER 3:5
notice_id(id, 3) NOTICE id FILTER 3:
notice_id(id, None, 5) NOTICE id FILTER :5
notice_id(id, "4,8:,1:3") NOTICE id FILTER 4, 8:, 1:3
notice_id(id) NOTICE id ALL
OPEN image_open()
OPLOT plot_data(overplot=True)
PARAMPROMPT paramprompt()
PLOTY TBD
PROJECTION

conf([id, otherids ..., param])

PROMPT Not available
READ arg - filename and path | PHACrate obj

load_arf([id], arg, [resp_id, bkg_id])
load_ascii([id], arg, [ncols, colkeys, dstype, sep, comment])
load_data([id], filename, [...])
load_image([id], arg, [coord])
load_pha([id], arg, [use_errors])
load_rmf([id], arf, [resp_id, bkg_id])
load_table([id], arg, [ncols, colkeys, dstype])
RECORD fit(outfile=<filename>, clobber=True)
REGION-PROJECTION | REG-PROJ reg_proj(param_1, param_2, [id, otherids, replot, min, max, nloop, delv, fac, log, sigma, levels, overplot])

Print reg_proj parameters

print(get_reg_proj())

REGION-UNCERTAINTY | REG-UNC reg_unc(param_1, param_2, [id, otherids, replot, min, max, nloop, delv, fac, log, sigma, levels, overplot])

Print reg_unc parameters

print(get_reg_unc())
RENAME
gauss1d.modelb
modelB = modelb
RESET reset(get_model())

reset(p1)
RESPONSE | INSTRUMENT load_rmf()
load_arf()
load_psf()
SAVE save([filename]) --> produces binary file
restore([filename])

save_all([outfile, clobber]) --> produces text file
execfile(filename) or %run filename

script([filename, clobber]) --> produces text (log) file
execfile(filename) or %run filename
SEARCHMETHOD | METHOD set_method(method_name)
SETBACK Assuming data set with given ID contains PHA data:

set_counts([id], val, [bkg_id])
set_exposure([id], exptime, [bkg_id])
set_backscal([id], backscale, [bkg_id])
set_areascal([id], area, [bkg_id])
SETDATA Assuming data set with given ID contains PHA data:

set_counts([id], val, [bkg_id])
set_exposure([id], exptime, [bkg_id])
set_backscal([id], backscale, [bkg_id])
set_areascal([id], area, [bkg_id])
SHOW Show session objects

show_all([id, outfile, clobber])
show_data([id, outfile, clobber])
show_covar([outfile, clobber])
show_filter([id, outfile, clobber])
show_method([outfile, clobber])
show_model([id, outfile, clobber])
show_proj([outfile, clobber])
show_source([id, outfile, clobber])
show_stat([outfile, clobber])
show_psf([id, outfile, clobber])
show_kernel([id, outfile, clobber])
show_bkg([id, bkg_id, outfile, clobber])
show_bkg_source([id, bkg_id, outfile, clobber])
show_bkg_model([id, bkg_id, outfile, clobber])

List session state info

list_bkg_ids()
list_data_ids()
list_methods()
list_model_components()
list_model_ids()
list_models()
list_response_ids()
list_stats()
SOURCE | SRC set_source(expression)
set_full_model(experession)
SPLOT Not available
STATISTIC set_stat(stat_name)

calc_stat([id, otherids ...])
calc_chisqr([id, otherids ...])
SUBTRACT subtract([id])
STATERRORS get_staterror([id, filter, bkg_id])
set_staterror([id], val, [fractional,] [bkg_id])
SYSERRORS get_syserror([id, filter, bkg_id])
set_syserror([id], val, [fractional,] [bkg_id])
THAW thaw(list params or model)
TRUNCATE TBD
UNCERTAINTY

Not available. Try covariance or conf.

UNGROUP ungroup([id, bkg_id])
UNLINK unlink(param)
UNSUBTRACT unsubtract([id])
USE Execute a script:
execfile(filename)

Restore a previous Sherpa session
restore([filename])
VERSION import sherpa
sherpa.__version__
WRITE save_arrays(filename, args, [fields,ascii,clobber])
save_delchi([id], filename, [bkg_id,ascii,clobber])
save_error([id], filename, [bkg_id,ascii,clobber])
save_filter([id], filename, [bkg_id,ascii,clobber])
save_grouping([id], filename, [bkg_id,ascii,clobber])
save_model([id], filename, [bkg_id,ascii,clobber])
save_quality([id], filename, [bkg_id,ascii,clobber])
save_resid([id], filename, [bkg_id,ascii,clobber])
save_source([id], filename, [bkg_id,ascii,clobber])
XSPEC ABUNDAN set_xsabund(name)
get_xsabund()
XSPEC XSECT set_xsxsect(name)
get_xsxsect()

Last modified: 26 October 2016
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:   cxchelp@head.cfa.harvard.edu Smithsonian Institution, Copyright © 1998-2017. All rights reserved.