In [ ]:
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import gridspec
import os
from scipy.optimize import minimize
import clarsach
import pyxsis
%matplotlib inline
In [ ]:
DATA_DIR = os.environ['HOME'] + "/dev/clarsach/data"
mrk_dir = DATA_DIR + "/tgcat/obs_15477_tgid_4679/"
mrk_file_list = [mrk_dir + order for order in ['heg_1.pha', 'heg_-1.pha']]
In [ ]:
mrk421 = [pyxsis.Spectrum(ff) for ff in mrk_file_list]
In [ ]:
heg_stack = pyxsis.Spectrum(mrk_file_list[0])
pyxsis.stack_spectra(heg_stack, mrk421)
In [ ]:
fig = plt.figure(figsize=(12,4))
ax0 = plt.subplot(121)
pyxsis.plot_counts(ax0, heg_stack)
ax1 = plt.subplot(122)
for s in mrk421:
pyxsis.plot_counts(ax1, s, alpha=0.8)
In [ ]:
for s in mrk421:
print(s.exposure)
In [ ]:
print(heg_stack.exposure)
In [ ]:
## I'm going to group all my data just to make it easier to read
MC = 10.0
pyxsis.group_mincounts(mrk421[0], MC)
pyxsis.group_mincounts(mrk421[1], MC)
pyxsis.group_mincounts(heg_stack, MC)
In [ ]:
fig = plt.figure(figsize=(12,4))
ax0 = plt.subplot(121)
pyxsis.plot_unfold(ax0, heg_stack)
ax0.set_xscale('log')
ax0.set_yscale('log')
ax1 = plt.subplot(122)
for s in mrk421:
pyxsis.plot_unfold(ax1, s, alpha=0.8)
ax1.set_xscale('log')
ax1.set_yscale('log')
In [ ]:
## Just trying to make sure that nothing in the mrk421 spectra list changed
## The following calls should all return "False"
print(all(heg_stack.counts == mrk421[0].counts))
print(all(heg_stack.counts == mrk421[1].counts))
print(all(mrk421[0].counts == mrk421[1].counts))
In [ ]: