# This is based on http://cxc.harvard.edu/sherpa/faq/no_model.html
# Load MEG -1
load_data('meg_-1.pha.gz')
# Assume model which is just a constant=1
set_source(polynom1d.truespec)
truespec=1.
# Now get the deconvolved plot
energy=get_ratio_plot().x # keV
photon=get_ratio_plot().y # ph/s/cm2/keV
photonerr=get_ratio_plot().yerr
# Save it.
save_arrays("Flux_meg-1.dat",[energy,photon,photonerr],["keV","FLUX","FLUXerr"],ascii=True)
# Clear variables so we can do MEG +1
clear()
# Same for MEG+1
load_data('meg_1.pha.gz')
set_source(polynom1d.truespec)
truespec=1.
energy=get_ratio_plot().x # keV
photon=get_ratio_plot().y # ph/s/cm2/keV
photonerr=get_ratio_plot().yerr
save_arrays("Flux_meg+1.dat",[energy,photon,photonerr],["keV","FLUX","FLUXerr"],ascii=True)
#!/bin/bash
# Load all the chandra data processing tools.
#ciao
# Note this script must already have run ciao
# For each subdirectory, run the sherpa script to extract flux spectra.
for onedir in $(ls -d */); do
cd $onedir
echo $onedir
sherpa -b ../SherpaExtractMEGFlux.py
cd ..
done