Last active
August 29, 2015 14:25
-
-
Save DougBurke/65dd0716afc061a03d63 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WARNING: imaging routines will not be available, | |
failed to import sherpa.image.ds9_backend due to | |
'RuntimeErr: DS9Win unusable: Could not find ds9 on your PATH' | |
WARNING: systematic errors were not found in file 'sherpa-test-data/sherpatest/ciao4.3/pha_intro/3c273.pi' | |
statistical errors were found in file 'sherpa-test-data/sherpatest/ciao4.3/pha_intro/3c273.pi' | |
but not used; to use them, re-read with use_errors=True | |
read ARF file sherpa-test-data/sherpatest/ciao4.3/pha_intro/3c273.arf | |
read RMF file sherpa-test-data/sherpatest/ciao4.3/pha_intro/3c273.rmf | |
WARNING: systematic errors were not found in file 'sherpa-test-data/sherpatest/ciao4.3/pha_intro/3c273_bg.pi' | |
statistical errors were found in file 'sherpa-test-data/sherpatest/ciao4.3/pha_intro/3c273_bg.pi' | |
but not used; to use them, re-read with use_errors=True | |
read background file sherpa-test-data/sherpatest/ciao4.3/pha_intro/3c273_bg.pi | |
Dataset = 1 | |
Method = levmar | |
Statistic = chi2gehrels | |
Initial fit statistic = 6.2879e+10 | |
Final fit statistic = 22.709 at function evaluation 240 | |
Data points = 44 | |
Degrees of freedom = 41 | |
Probability [Q-value] = 0.990831 | |
Reduced statistic = 0.553879 | |
Change in statistic = 6.2879e+10 | |
gal.nH 0.0211252 | |
pl.PhoIndex 2.0327 | |
pl.norm 0.000190923 | |
Dataset = 1 | |
Method = levmar | |
Statistic = chi2gehrels | |
Initial fit statistic = 22.709 | |
Final fit statistic = 22.1146 at function evaluation 13 | |
Data points = 44 | |
Degrees of freedom = 41 | |
Probability [Q-value] = 0.99301 | |
Reduced statistic = 0.539381 | |
Change in statistic = 0.594399 | |
gal.nH 0.0127615 | |
pl.PhoIndex 1.97286 | |
pl.norm 0.000182947 | |
Dataset = 1 | |
Method = levmar | |
Statistic = chi2gehrels | |
Initial fit statistic = 3.92655e+09 | |
Final fit statistic = 22.1146 at function evaluation 4 | |
Data points = 44 | |
Degrees of freedom = 43 | |
Probability [Q-value] = 0.996542 | |
Reduced statistic = 0.514294 | |
Change in statistic = 3.92655e+09 | |
cpflux.flux 0.00031493 | |
xscpflux.cpflux | |
Param Type Value Min Max Units | |
----- ---- ----- --- --- ----- | |
cpflux.emin linked 0.5 expr: cflux.emin keV | |
cpflux.emax linked 5 expr: cflux.emax keV | |
cpflux.flux thawed 0.00031493 0 1e+10 | |
Dataset = 1 | |
Method = levmar | |
Statistic = chi2gehrels | |
Initial fit statistic = 120.122 | |
Final fit statistic = 22.1146 at function evaluation 9 | |
Data points = 44 | |
Degrees of freedom = 43 | |
Probability [Q-value] = 0.996542 | |
Reduced statistic = 0.514294 | |
Change in statistic = 98.0072 | |
cflux.lg10Flux -12.1765 | |
xscflux.cflux | |
Param Type Value Min Max Units | |
----- ---- ----- --- --- ----- | |
cflux.emin frozen 0.5 0 1e+06 keV | |
cflux.emax frozen 5 0 1e+06 keV | |
cflux.lg10Flux thawed -12.1765 -100 100 cgs | |
Absorbed photon flux (0.5-5) = 0.000315006051356 | |
cpflux = 0.000314929784424 | |
Absorbed energy flux (0.5-5) = 6.66604873598e-13 | |
cflux = 6.65999820258e-13 | |
Dataset = 1 | |
Method = levmar | |
Statistic = chi2gehrels | |
Initial fit statistic = 22.3698 | |
Final fit statistic = 22.1146 at function evaluation 7 | |
Data points = 44 | |
Degrees of freedom = 43 | |
Probability [Q-value] = 0.996542 | |
Reduced statistic = 0.514294 | |
Change in statistic = 0.255171 | |
cflux.lg10Flux -12.1653 | |
cflux unabsorbed flux = 6.83489877041e-13 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sherpa.astro import ui | |
from sherpa.astro import xspec | |
ui.load_data('sherpa-test-data/sherpatest/ciao4.3/pha_intro/3c273.pi') | |
ui.subtract() | |
ui.notice(0.3, 7) | |
# fit a power-law | |
ui.set_source(ui.xsphabs.gal * ui.xspowerlaw.pl) | |
ui.fit() | |
ui.fit() | |
abspflux = ui.calc_photon_flux(0.5, 5) | |
abseflux = ui.calc_energy_flux(0.5, 5) | |
xspec.load_xscflux('cflux') | |
xspec.load_xscpflux('cpflux') | |
ui.freeze(gal, pl) | |
pl.norm = 1 | |
cflux.emin = 0.5 | |
cflux.emax = 5 | |
cpflux.emin = cflux.emin | |
cpflux.emax = cflux.emax | |
# get the particle flux (absorbed) | |
ui.set_source(cpflux(gal * pl)) | |
ui.fit() | |
print(cpflux) | |
abscpflux = cpflux.flux.val | |
# get the energy flux (absorbed) | |
ui.set_source(cflux(gal * pl)) | |
ui.fit() | |
print(cflux) | |
absceflux = 10**cflux.lg10flux.val | |
print("Absorbed photon flux (0.5-5) = {}".format(abspflux)) | |
print(" cpflux = {}".format(abscpflux)) | |
print("Absorbed energy flux (0.5-5) = {}".format(abseflux)) | |
print(" cflux = {}".format(absceflux)) | |
# Unabsorbed flux, energy | |
ui.set_source(gal * cflux(pl)) | |
ui.fit() | |
ceflux = 10**cflux.lg10flux.val | |
print("cflux unabsorbed flux = {}".format(ceflux)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sherpa.astro import ui | |
ui.load_data('sherpa-test-data/sherpatest/ciao4.3/pha_intro/3c273.pi') | |
ui.subtract() | |
ui.notice(0.3, 7) | |
# fit a power-law | |
ui.set_source(ui.xsphabs.gal * ui.xspowerlaw.pl) | |
ui.fit() | |
ui.fit() | |
abspflux = ui.calc_photon_flux(0.5, 5) | |
abseflux = ui.calc_energy_flux(0.5, 5) | |
#xspec.load_xscflux('cflux') | |
#xspec.load_xscpflux('cpflux') | |
ui.create_model_component('xscflux', 'cflux') | |
ui.set_source(ui.xscpflux.cpflux(gal * pl)) | |
ui.freeze(gal, pl) | |
pl.norm = 1 | |
cflux.emin = 0.5 | |
cflux.emax = 5 | |
cpflux.emin = cflux.emin | |
cpflux.emax = cflux.emax | |
# get the particle flux (absorbed) | |
##ui.set_source(cpflux(gal * pl)) | |
ui.fit() | |
print(cpflux) | |
abscpflux = cpflux.flux.val | |
# get the energy flux (absorbed) | |
ui.set_source(cflux(gal * pl)) | |
ui.fit() | |
print(cflux) | |
absceflux = 10**cflux.lg10flux.val | |
print("Absorbed photon flux (0.5-5) = {}".format(abspflux)) | |
print(" cpflux = {}".format(abscpflux)) | |
print("Absorbed energy flux (0.5-5) = {}".format(abseflux)) | |
print(" cflux = {}".format(absceflux)) | |
# Unabsorbed flux, energy | |
ui.set_source(gal * cflux(pl)) | |
ui.fit() | |
ceflux = 10**cflux.lg10flux.val | |
print("cflux unabsorbed flux = {}".format(ceflux)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Note that
example.py
will no-longer work, as of DougBurke/sherpa@36eff83 since theload_xsXXX()
routines have been removed as they are unnescessary.