generated from erosita/uds
clean
This commit is contained in:
@@ -6,7 +6,7 @@ __copyright__ = "Space Research Institute (IKI)"
|
||||
from astropy.table import Table, Column
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import sys
|
||||
import sys, os
|
||||
from scipy.stats import norm
|
||||
|
||||
from ridge.utils import *
|
||||
@@ -16,15 +16,15 @@ from ridge.config import *
|
||||
scale = 1e-3
|
||||
nbins=30
|
||||
|
||||
fn="detcnts.E01.crabmodel.fits"
|
||||
fn="detcnts.A01.crabmodel.fits"
|
||||
dat = Table.read(proddir+fn, unit_parse_strict='silent')
|
||||
df1 = dat.to_pandas().sort_values(by=['REV'])
|
||||
|
||||
fn="detcnts.E14.crabmodel.fits"
|
||||
fn="detcnts.A02.crabmodel.fits"
|
||||
dat = Table.read(proddir+fn, unit_parse_strict='silent')
|
||||
df2 = dat.to_pandas().sort_values(by=['REV'])
|
||||
|
||||
fn="detcnts.E13.crabmodel.fits"
|
||||
fn="detcnts.A03.crabmodel.fits"
|
||||
dat = Table.read(proddir+fn, unit_parse_strict='silent')
|
||||
df3 = dat.to_pandas().sort_values(by=['REV'])
|
||||
|
||||
@@ -47,7 +47,7 @@ ax3.ticklabel_format(style='sci', axis='y', scilimits=(0,0))
|
||||
|
||||
data=(df1['B_EST']-df1['B_POLY'])/df1['B_POLY']*1000
|
||||
(mu, sg) = norm.fit(data)
|
||||
print(mu, sg)
|
||||
#print(mu, sg)
|
||||
ax1.set_title("25-60 keV, $\\sigma=${:.0f} mCrab".format(sg))
|
||||
n, bins, patches = ax1.hist(data, nbins, density=True, facecolor='green', alpha=0.75)
|
||||
y = norm.pdf(bins, mu, sg)
|
||||
@@ -60,7 +60,7 @@ ax1.grid(visible=True)
|
||||
|
||||
data=(df2['B_EST']-df2['B_POLY'])/df2['B_POLY']*1000
|
||||
(mu, sg) = norm.fit(data)
|
||||
print(mu, sg)
|
||||
#print(mu, sg)
|
||||
ax2.set_title("60-80 keV, $\\sigma=${:.0f} mCrab".format(sg))
|
||||
n, bins, patches = ax2.hist(data, nbins, density=True, facecolor='green', alpha=0.75)
|
||||
y = norm.pdf(bins, mu, sg)
|
||||
@@ -73,7 +73,7 @@ ax2.grid(visible=True)
|
||||
|
||||
data=(df3['B_EST']-df3['B_POLY'])/df3['B_POLY']*1000
|
||||
(mu, sg) = norm.fit(data)
|
||||
print(mu, sg)
|
||||
#print(mu, sg)
|
||||
ax3.set_title("80-200 keV, $\\sigma=${:.0f} mCrab".format(sg))
|
||||
n, bins, patches = ax3.hist(data, nbins, density=True, facecolor='green', alpha=0.75)
|
||||
# add a 'best fit' line
|
||||
@@ -95,5 +95,9 @@ plt.xlabel('Flux, mCrab',fontsize=14, fontweight='normal')
|
||||
#plt.xscale('linear')
|
||||
#plt.yscale('linear')
|
||||
|
||||
plt.savefig(proddir+'crabmodel_sys.png', bbox_inches='tight')
|
||||
if not os.path.exists(figdir):
|
||||
os.makedirs(figdir)
|
||||
filename=figdir+'crabmodel_sys.png'
|
||||
plt.savefig(filename, bbox_inches='tight')
|
||||
plt.close(fig)
|
||||
print("Result is saved as {}".format(filename))
|
||||
|
Reference in New Issue
Block a user