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 [ ]:
UNIT = 'keV'
In [ ]:
DATA_DIR = os.environ['HOME'] + "/dev/clarsach/data"
mrk_dir = DATA_DIR + "/tgcat/obs_15477_tgid_4679/"
mrk_heg1_file = mrk_dir + "heg_1.pha"
In [ ]:
mrk421 = pyxsis.Spectrum(mrk_heg1_file, telescope='HETG')
In [ ]:
ax = plt.subplot(111)
pyxsis.plot_unfold(ax, mrk421, xunit=UNIT)
plt.loglog()
In [ ]:
mrk421.notice_values(1.0, 8.0, unit=UNIT)
In [ ]:
lo, hi, mid, cts = mrk421.bin_counts()
In [ ]:
ax = plt.subplot(111)
pyxsis.plot_unfold(ax, mrk421, xunit=UNIT)
plt.loglog()
In [ ]:
mrk421.notice_all()
In [ ]:
pyxsis.group_channels(mrk421, 5)
In [ ]:
mrk421.binning
In [ ]:
len(mrk421.counts) / 5
In [ ]:
%%time
test_lo, test_hi, test_counts = mrk421._parse_binning()
In [ ]:
plt.step(test_lo, test_counts)
In [ ]:
ax = plt.subplot(111)
pyxsis.plot_counts(ax, mrk421, xunit=UNIT)
In [ ]:
ax = plt.subplot(111)
pyxsis.plot_unfold(ax, mrk421, xunit=UNIT)
plt.loglog()
In [ ]:
mrk421.reset_binning()
ax = plt.subplot(111)
pyxsis.plot_unfold(ax, mrk421, xunit=UNIT)
plt.loglog()
In [ ]:
pyxsis.group_mincounts(mrk421, 10)
In [ ]:
%%time
test_lo, test_hi, test_counts = mrk421._parse_binning()
In [ ]:
all(test_counts >= 10)
In [ ]:
ax = plt.subplot(111)
pyxsis.plot_counts(ax, mrk421, xunit=UNIT)
In [ ]:
ax = plt.subplot(111)
pyxsis.plot_unfold(ax, mrk421, xunit=UNIT)
plt.loglog()
In [ ]:
mrk421.notice_values(1.0, 8.0, unit='keV')
In [ ]:
ax = plt.subplot(111)
pyxsis.plot_unfold(ax, mrk421, xunit=UNIT)
plt.loglog()
In [ ]:
mrk421.notice_values(1.0, 15.0, unit=UNIT)
ax = plt.subplot(111)
pyxsis.plot_unfold(ax, mrk421, xunit=UNIT)
plt.semilogy()
In [ ]: