generated from erosita/uds
106 lines
3.1 KiB
Python
Executable File
106 lines
3.1 KiB
Python
Executable File
#!/usr/bin/env python
|
|
|
|
__author__ = "Roman Krivonos"
|
|
__copyright__ = "Space Research Institute (IKI)"
|
|
|
|
from astropy.table import Table, Column
|
|
from matplotlib import ticker
|
|
import matplotlib.pyplot as plt
|
|
import sys, os
|
|
|
|
from ridge.utils import *
|
|
from ridge.config import *
|
|
|
|
|
|
scale = 100.0
|
|
|
|
fn="detcnts.A01.ALL.resid.galprof.fits"
|
|
dat = Table.read(profdir+fn)
|
|
df1 = dat.to_pandas().sort_values(by=['LON1'])
|
|
|
|
fn="detcnts.A02.ALL.resid.galprof.fits"
|
|
dat = Table.read(profdir+fn)
|
|
df2 = dat.to_pandas().sort_values(by=['LON1'])
|
|
|
|
fn="detcnts.A03.ALL.resid.galprof.fits"
|
|
dat = Table.read(profdir+fn)
|
|
df3 = dat.to_pandas().sort_values(by=['LON1'])
|
|
|
|
df_cobe = pd.read_csv('../data/cobe_ibis_resp_lon.dat', sep=' ', header=None)
|
|
print(df_cobe)
|
|
|
|
|
|
fig, (ax1, ax2, ax3) = plt.subplots(3, sharex=True, figsize=(9, 7), dpi=100)
|
|
#fig.suptitle('Vertically stacked subplots')
|
|
#plt.figure(figsize=(8, 6), dpi=80)
|
|
|
|
for axis in ['top','bottom','left','right']:
|
|
ax1.spines[axis].set_linewidth(1)
|
|
ax2.spines[axis].set_linewidth(1)
|
|
ax3.spines[axis].set_linewidth(1)
|
|
ax1.tick_params(axis="both", width=1, labelsize=14)
|
|
ax2.tick_params(axis="both", width=1, labelsize=14)
|
|
ax3.tick_params(axis="both", width=1, labelsize=14)
|
|
|
|
ax1.set_title("25-60 keV")
|
|
ax2.set_title("60-80 keV")
|
|
ax3.set_title("80-200 keV")
|
|
|
|
ax1.set_xlim(185,-185)
|
|
ax2.set_xlim(185,-185)
|
|
ax3.set_xlim(185,-185)
|
|
|
|
ax1.set_ylim(-0.3,1.6)
|
|
ax2.set_ylim(-0.3,1.)
|
|
ax3.set_ylim(-0.3,1.)
|
|
|
|
ax1.ticklabel_format(style='sci', axis='y', scilimits=(0,0))
|
|
ax2.ticklabel_format(style='sci', axis='y', scilimits=(0,0))
|
|
ax3.ticklabel_format(style='sci', axis='y', scilimits=(0,0))
|
|
|
|
ax1.xaxis.set_minor_locator(ticker.MultipleLocator(10))
|
|
ax2.xaxis.set_minor_locator(ticker.MultipleLocator(10))
|
|
ax3.xaxis.set_minor_locator(ticker.MultipleLocator(10))
|
|
|
|
ax1.yaxis.set_minor_locator(ticker.MultipleLocator(0.2))
|
|
ax2.yaxis.set_minor_locator(ticker.MultipleLocator(0.2))
|
|
ax3.yaxis.set_minor_locator(ticker.MultipleLocator(0.2))
|
|
|
|
lon=(df1['LON1']+df1['LON2'])/2
|
|
ax1.plot(df_cobe[0],df_cobe[2]/3, color='red', linewidth=4)
|
|
ax1.errorbar(lon, df1['GRXE_FLUX']/scale,
|
|
yerr=df1['GRXE_ERROR']/scale,
|
|
xerr=(df1['LON2']-df1['LON1'])/2,
|
|
fmt='o', color='black')
|
|
ax1.grid(visible=True)
|
|
|
|
lon=(df2['LON1']+df2['LON2'])/2
|
|
ax2.errorbar(lon, df2['GRXE_FLUX']/scale,
|
|
yerr=df2['GRXE_ERROR']/scale,
|
|
xerr=(df2['LON2']-df2['LON1'])/2,fmt='o' , color='black')
|
|
ax2.grid(visible=True)
|
|
|
|
lon=(df3['LON1']+df3['LON2'])/2
|
|
ax3.errorbar(lon, df3['GRXE_FLUX']/scale,
|
|
yerr=df3['GRXE_ERROR']/scale,
|
|
xerr=(df3['LON2']-df3['LON1'])/2, fmt='o' , color='black')
|
|
ax3.grid(visible=True)
|
|
|
|
#x = np.arange(-10, 10, 0.001)
|
|
#plot normal distribution with mean 0 and standard deviation 1
|
|
#plt.plot(x, norm.pdf(x, 0, 1), color='red', linewidth=2)
|
|
|
|
plt.xlabel('Galactic Longitude, deg.',fontsize=14, fontweight='normal')
|
|
ax2.set_ylabel('GRXE flux, x100 mCrab',fontsize=14, fontweight='normal')
|
|
|
|
#plt.xscale('linear')
|
|
#plt.yscale('linear')
|
|
|
|
if not os.path.exists(figdir):
|
|
os.makedirs(figdir)
|
|
|
|
filename=figdir+'galprof.png'
|
|
plt.savefig(filename, bbox_inches='tight')
|
|
plt.close(fig)
|
|
print("Result is saved as {}".format(filename))
|