Пример #1
0
def reconstructor(map_size, sep, root_dir):
    """ Reconstruct the patch epsilon values for different frequencies."""
    from hades.params import BICEP
    a = BICEP()
    import numpy as np

    # Load good ids
    goodFile = root_dir + '%sdeg%sGoodIDs.npy' % (map_size, sep)
    goodIDs = np.load(goodFile)

    freqs = np.arange(50, 500, 50)
    sig = np.zeros(len(freqs))
    meanA = np.zeros(len(freqs))
    for fi, f in enumerate(freqs):
        # Load data
        inDir = root_dir + 'BatchData/f%s_ms%s_s%s_fw%s_np%s_d%s/' % (
            f, map_size, sep, a.FWHM, a.noise_power, a.delensing_fraction)
        eps = []
        A_err = []
        A = []
        eps_err = []
        eps_MC = []
        for i in range(len(goodIDs)):
            dat = np.load(inDir + '%s.npy' % i)
            A.append(dat[0][0])
            A_err.append(dat[0][2])
            eps.append(dat[5][0])
            eps_err.append(dat[5][2])
            eps_MC.append(dat[7][5])
        A = np.array(A)
        A_err = np.array(A_err)
        eps = np.array(eps)
        eps_err = np.array(eps_err)
        patch_eps = np.sum(eps / eps_err**2.) / np.sum(eps_err**-2.)
        patch_eps_MC = []
        eps_MC = np.array(eps_MC)
        for j in range(len(eps_MC[0])):
            this_MC = [e[j] for e in eps_MC]
            patch_eps_MC.append(
                np.sum(this_MC / eps_err**2.) / np.sum(eps_err**-2.))
        patch_eps_MC = np.array(patch_eps_MC)
        mu = np.mean(patch_eps_MC, axis=0)
        std = np.std(patch_eps_MC, axis=0)
        sig[fi] = (patch_eps - mu) / std
        meanA[fi] = np.sum(A / A_err**2.) / np.sum(1. / A_err**2.)

    return freqs, sig, meanA
Пример #2
0
if __name__ == '__main__':
    reMake = True  # whether to remake previously created data

    from flipper import *
    from flipperPol import *

    import healpy
    import sys
    sys.path.append('/data/ohep2/EngelenTools/')

    sys.path.append('/data/ohep2/hades/')
    from hades.params import BICEP
    a = BICEP()
    from hades.padded_debiased_wrap import padded_wrap
    from hades.batchI2 import I_strength

    import aveTools
    import numpy as np
    p = flipperDict.flipperDict()
    p.read_from_file(sys.argv[1])

    Ra0Array = p['Ra0Array']
    Ra1Array = p['Ra1Array']
    Dec0Array = p['Dec0Array']
    Dec1Array = p['Dec1Array']
    buffer = p['buffer']

    if p['mapWidthsDeg'] != a.sep:
        raise Exception('Inconsistent separation/map width size')
    import os
    if not os.path.exists(p['mapDir']):
Пример #3
0
import numpy as np
from hades.params import BICEP

b = BICEP()


def create_data(NoisePowerLists=b.NoisePowerLists,
                setting=b.ComparisonSetting):
    """ Script to compute KK estimated anisotropies for the BICEP field using different noise_powers or FWHM.
	Powers are defined in NoisePowerLists. (in microK-arcmin)
	Setting input defines whether to compare 'FWHM' or 'noise_power'
	
	Output is .npy files in NoiseAnalysis subfolder.
	"""
    import os

    if setting == 'noise_power':
        Initial = str(b.noise_power)
        comp_list = b.NoisePowerLists
    elif setting == 'FWHM':
        Initial = str(b.FWHM)
        comp_list = b.FWHM_lists
    else:
        raise Exception('Setting must be noise_power or FWHM')

    # Iterate over list
    for n in range(len(comp_list)):

        ## First edit parameter file to change the noise power
        with open('hades/params.py', 'r') as f:
            filedata = f.read()