''' reads a preprocessed catalog and computes tzav for it. Writes a file with the numpy array Written by: P. Gallardo. ''' import numpy as np # noqa from iskay import catalogTools # noqa from iskay import pairwiser # noqa #look in parent directory df = catalogTools.preProcessedCat(directory='../ApPhotoResults').df sigma_z = 0.01 dT = df.dT.values z = df.z.values tzav = pairwiser.get_tzav(dT, z, sigma_z) np.savez('tzav_allCat', tzav)
from iskay import catalogTools import matplotlib.pyplot as plt from iskay import pairwiser import numpy as np import scipy.stats fnames = [ "params_disjoint_bin_lum_gt_04p3_and_06p1_jk.ini", "params_disjoint_bin_lum_gt_06p1_and_07p9_jk.ini", "params_lum_gt_07p9_jk.ini" ] for j in range(len(fnames)): fname = fnames[j] p = paramTools.params(fname) df = catalogTools.preProcessedCat(howMany=None, query=p.CAT_QUERY).df dT = df.dT.values z = df.z.values tzav = pairwiser.get_tzav_fast(dT, z, p.SIGMA_Z) dT_ksz = dT - tzav mean, std = np.mean(dT_ksz), np.std(dT_ksz) plt.figure(figsize=[8, 4.5]) plt.hist(dT_ksz, normed=True, histtype='step', color='black', lw=2, bins=200)
def test_preProcessedCat_howMany(): howMany = 14 directory = os.path.join(testPath, 'data_toTestAPI', 'ApPhotoResults') pattern = 'testPreprocessedCat_*.csv' df = catalogTools.preProcessedCat(pattern, directory, howMany=howMany).df assert howMany == len(df.ra.values)
def test_preProcessedCat_sortBy(): sortby = 'ra' directory = os.path.join(testPath, 'data_toTestAPI', 'ApPhotoResults') pattern = 'testPreprocessedCat_*.csv' df = catalogTools.preProcessedCat(pattern, directory, sortBy=sortby).df assert (df.ra.values.max() == df.ra.values[0])
def test_preProcessedCat_query(): query = 'ra>20.0' directory = os.path.join(testPath, 'data_toTestAPI', 'ApPhotoResults') pattern = 'testPreprocessedCat_*.csv' df = catalogTools.preProcessedCat(pattern, directory, query=query).df assert np.all(df.ra.values > 20)
def test_preProcessedCat(): directory = os.path.join(testPath, 'data_toTestAPI', 'ApPhotoResults') pattern = 'testPreprocessedCat_*.csv' cat = catalogTools.preProcessedCat(pattern, directory) assert len(cat.df) > 1