Код, который я пытался использовать, выглядит следующим образом:< /p>
Код: Выделить всё
from astropy.io import fits
import matplotlib.pyplot as plt
from matplotlib.ticker import (MultipleLocator, AutoMinorLocator)
import matplotlib.ticker as ticker
hdulist = fits.open('./GalCat_lean-1.fits')
tbdata = hdulist[1].data
satellite_mask = tbdata['mass_halo'] == -1.0
sat_data = tbdata[satellite_mask]
central_mask = tbdata['mass_halo'] != -1.0
cen_data = tbdata[central_mask]
sat_z = sat_data.field(3)
cen_z = cen_data.field(3)
sat_masshalo = sat_data.field(0)
cen_masshalo = cen_data.field(0)
sat_Nsat = sat_data.field(6)
cen_Nsat = cen_data.field(6)
mass_halo = tbdata.field(0)
RA = tbdata.field(1)
Dec = tbdata.field(2)
z_spec = tbdata.field(3)
halo_id = tbdata.field(4)
dx = tbdata.field(5)
N_sat = tbdata.field(6)
mag = tbdata.field(7)
#Central Redshift histogram:
## set binwidth
binwidth = 0.01
hist1, bins, patches = plt.hist(cen_z, bins=np.arange(0., max(cen_z) + binwidth, binwidth), facecolor = 'blue')
plt.title('Central Redshift Histogram')
plt.xlabel("Redshift 'z'")
plt.ylabel("Population Density")
plt.show()
#Satellite Redshift histogram:
## set binwidth
binwidth = 0.01
hist2, bins, patches = plt.hist(sat_z, bins=np.arange(0., max(sat_z) + binwidth, binwidth), facecolor = 'red')
plt.title('Satellite Redshift Histogram')
plt.xlabel("Redshift 'z'")
plt.ylabel("Population Density")
plt.show()
#Satellite Total Histogram
binwidth = 0.01
hist3, bins, patches = plt.hist(z_spec, bins=np.arange(0., max(sat_z) + binwidth, binwidth), facecolor = 'green')
plt.title('Total Redshift Histogram')
plt.xlabel("Redshift 'z'")
plt.ylabel("Population Density")
plt.show()
plt.hist(hist2/hist3, bins, facecolor='green')
Код: Выделить всё
Central Galaxy Hist(https://i.sstatic.net/81XH1KTK.png)
Satellite Galaxy Hist(https://i.sstatic.net/zOTH7T65.png)
Total Galaxy Hist(https://i.sstatic.net/pzBT1bSf.png)
Satellite Fraction Hist(https://i.sstatic.net/GPekelaQ.png)
Подробнее здесь: https://stackoverflow.com/questions/788 ... on-another