19 KiB
19 KiB
In [22]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import linecache
from astropy.io import fits
In [30]:
fname = '/data101/bartlett/fsigma8/PV_data/Foundation_DR1/Foundation_DR1.FITRES.TEXT'
# Get header
columns = ['SN'] + linecache.getline(fname, 6).strip().split()[1:]
df = pd.read_csv(fname, sep="\s+", skipinitialspace=True, skiprows=7, names=columns)
zCMB = df['zCMB']
m = df['mB']
m_err = df['mBERR']
x1 = df['x1']
hyper_stretch_mu = np.median(x1)
hyper_stretch_sigma = (np.percentile(x1, 84) - np.percentile(x1, 16)) / 2
c = df['c']
hyper_c_mu = np.median(c)
hyper_c_sigma = (np.percentile(c, 84) - np.percentile(c, 16)) / 2
sigma_m = np.median(df['mBERR'])
sigma_stretch = np.median(df['x1ERR'])
sigma_c = np.median(df['cERR'])
print(sigma_m, sigma_stretch, sigma_c)
print(hyper_stretch_mu, hyper_stretch_sigma)
print(hyper_c_mu, hyper_c_sigma)
plt.figure()
speed_of_light = 299792 # km/s
mock_z = np.load('sn_z.npy')
mock_z /= speed_of_light
plt.hist(mock_z, bins=10, label='mock', histtype='step', density=True)
plt.hist(zCMB, bins=10, label='true', histtype='step', density=True)
plt.legend()
Out[30]:
In [23]:
# Open the FITS file
fname = '/data101/bartlett/fsigma8/PV_data/Foundation_DR1/kcor_PS1_none.fits'
with fits.open(fname) as hdul:
hdul.info() # Show summary of FITS file contents
In [ ]: