Problem

Consider this CSV dataset containing the durations of a set of astrophysical events (T50 and T90), their corresponding 1-sigma uncertainties (T590err, T90err), the event IDs (Trigger) and the starting time of the events (T90Start) with respect to some reference time point. Read this data and make histograms of the duration distributions as measured by the column T90, which is reported in seconds, like the following plots. Explain the differences between the plots?

batse.t90.linear.linear.png

batse.logt90.log.linear.png

batse.logt90.log.log.png

batse.t90.log.log.png

Solution

Python

Here is a Python code that makes all of the histogram plots,

import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np

batse = pd.read_csv('batse.csv', sep=',', header=0)

sns.set()

fig, ax = plt.subplots()
plt.title('Full Batse Data Set', fontsize = 16)
ax.set_xlabel('$T_{90}$', fontsize = 14)
ax.set_ylabel('$dN/dT_{90})$', fontsize = 14)
n, x, _ = plt.hist( batse['T90']
                  #, bins = np.exp(np.linspace(.1, 500, 39))
                  , histtype = u'step'
                  , density = False
                  )
plt.tight_layout()
plt.savefig("batse.t90.linear.linear.png")

fig, ax = plt.subplots()
plt.title('Full Batse Data Set', fontsize = 16)
ax.set_xscale('log')
ax.set_yscale('linear')
ax.set_xlabel('$T_{90}$', fontsize = 14)
ax.set_ylabel('$dN/dlog(T_{90})$', fontsize = 14)
n, x, _ = plt.hist(batse['T90'], bins=np.exp(np.linspace(np.log(.1), np.log(500), 39)), histtype=u'step', density=False)
plt.tight_layout()
plt.savefig("batse.logt90.log.linear.png")

fig, ax = plt.subplots()
plt.title('Full Batse Data Set', fontsize = 16)
ax.set_xscale('log')
ax.set_yscale('log')
ax.set_xlabel('$T_{90}$', fontsize = 14)
ax.set_ylabel('$dN/dlog(T_{90})$', fontsize = 14)
n, x, _ = plt.hist(batse['T90'], bins=np.exp(np.linspace(np.log(.1), np.log(500), 39)), histtype=u'step', density=False)
plt.tight_layout()
plt.savefig("batse.logt90.log.log.png")

fig,ax2=plt.subplots()
ax2.set_xscale('log')
ax2.set_yscale('log')
ax2.set_xlabel('$T_{90}$', fontsize = 14)
ax2.set_ylabel('$dN/dT_{90}$', fontsize = 14)
bin_centers = 0.5*(x[1:]+x[:-1])
plt.step(bin_centers,np.divide(n,bin_centers))
plt.show()
plt.tight_layout()
plt.savefig("batse.t90.log.log.png")

Comments