-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathplot_table.py
More file actions
32 lines (25 loc) · 849 Bytes
/
plot_table.py
File metadata and controls
32 lines (25 loc) · 849 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import asciitable
dat = asciitable.read('fermi_agn.dat')
redshift = dat['redshift']
flux = dat['photon_flux']
gamma = dat['spectral_index']
# Select rows that have a measured redshift
with_z = redshift != -999
figure(1)
semilogx(flux, gamma, '.b', label='All')
semilogx(flux[with_z], gamma[with_z], 'or', label='With Z')
legend(numpoints=1)
grid()
xlabel('Flux (photon/cm$^2$/s)')
ylabel('Spectral index $\Gamma$')
# Select low- and high-z samples
lowz = with_z & (redshift < 0.8)
highz = with_z & (redshift >= 0.8)
figure(2)
bins = arange(1.2, 3.0, 0.1)
hist(gamma[lowz], bins, color='b', alpha=0.5, label='z < 0.8')
hist(gamma[highz], bins, color='r', alpha=0.5, label='z > 0.8')
xlabel('Spectral index $\Gamma$')
title('$\Gamma$ for low-z and high-z samples')
legend(loc='upper left')
asciitable.write(dat[with_z], 'fermi_agn_with_z.dat')