コード例 #1
0
def add_commands(sample, hashstr, box, params, vary_shot_noise=True, cov='analytic',
                    use_temp_files=False, overwrite=False, kmin=1e-4, kmax=0.3):

    # unpack the tuple of hashstring 
    hashstr, p = hashstr

    # determine the params we are fitting
    if vary_shot_noise:
        params = params + ['N']
    params = " ".join(params)

    # filename of spectra we are fitting
    dirname = os.path.join(EBOSS_SPECTRA, 'mocks', 'ezmock', VERSION)
    filename = os.path.join(dirname, f'poles_zevoEZmock_{VERSION}_QSO-{sample}_{box:04d}-{hashstr}.json')

    # the effective redshift
    zeff = effective_redshifts[hashstr]

    # make the command
    command = f"eboss-qso-fit nlopt -f {filename} --vary {params} --stats P0 P2"
    command += f" -i {ITERATIONS} --kmin {kmin} --kmax {kmax} --cov {cov} --zeff {zeff} -p {p}"
    if use_temp_files:
        command += " --use-temp-files"
    if overwrite:
        command += " --overwrite"

    # and register it
    weighted = hashstr != "bba5aabfa6"
    tag = {'sample':sample, 'p':p, 'weighted':weighted, 'params':params, 'zbin':ZBINS[0]}
    RSDFitRunner.register(command, tag=tag)
コード例 #2
0
def add_commands(sample, vary_shot_noise=True, cov='analytic',
                  overwrite=False, kmin=1e-4, kmax=0.3):

    VERSION = 'v1.9f'
    HASHES = ['3e399248c3', '1f5e5a84d5', '6a332d6423', '1ec7564db2', '8b9aab839d']

    # determine the params we are fitting
    all_params = ['b1', 'sigma_fog']
    if vary_shot_noise:
        all_params += ['N']
    params = " ".join(all_params)

    dirname = os.path.join(EBOSS_SPECTRA, 'data', VERSION)
    for i, hashstr in enumerate(HASHES):

        # the data file
        filename = os.path.join(dirname, f'poles_eboss_{VERSION}-focal-QSO-{sample}-{hashstr}.json')

        # make the command
        command = f"eboss-qso-fit mcmc -f {filename} --vary {params} --stats P0 P2"
        command += f" -i {ITERATIONS} -w {WALKERS} --kmin {kmin} --kmax {kmax} --cov {cov}"
        if overwrite:
            command += " --overwrite"

        # register it
        tag = {'sample':sample, 'zbin':ZBINS[i]}
        RSDFitRunner.register(command, tag=tag)
コード例 #3
0
def add_commands(sample, p_values, vary_shot_noise=True, cov='analytic',
                 use_temp_files=False, overwrite=False, kmin=1e-4, kmax=0.3):

    # the p values to use
    data_p, theory_p = p_values

    # determine the params we are fitting
    all_params = ['b1', 'sigma_fog', 'f_nl']
    if vary_shot_noise:
        all_params += ['N']
    params = " ".join(all_params)

    # the effective redshift
    z_eff = effective_redshifts[data_p]

    # arguments for reading the data
    command = "eboss-qso-fit mcmc"
    command += f" --kind data --version {VERSION} --sample {sample} --ells 0"
    command += f" --z_eff {z_eff[0]}"
    command += f" --theory_p {theory_p} --kmin {kmin} --kmax {kmax}"
    if data_p is not None:
        command += f" --data_p {data_p}"

    # theory arguments
    command += f" --vary {params} -i {ITERATIONS} -w {NWALKERS} --cov {cov}"
    if use_temp_files:
        command += " --use-temp-files"
    if overwrite:
        command += " --overwrite"

    # and register it
    weighted = data_p is not None
    tag = {'sample': sample, 'p': theory_p,
           'weighted': weighted, 'zbin': ZBINS[0]}
    RSDFitRunner.register(command, tag=tag)
コード例 #4
0
def add_commands(sample,
                 hashstr,
                 params,
                 vary_shot_noise=True,
                 cov='analytic',
                 use_temp_files=False,
                 overwrite=False,
                 kmin=1e-4,
                 kmax=0.3):

    # determine the params we are fitting
    if vary_shot_noise:
        params = params + ['N']
    params = " ".join(params)

    dirname = os.path.join(EBOSS_SPECTRA, 'data', VERSION)
    filename = os.path.join(
        dirname, f'poles_eboss_{VERSION}-focal-QSO-{sample}-{hashstr}.json')

    # make the command
    command = f"eboss-qso-fit mcmc -f {filename} --vary {params} --stats P0 P2"
    command += f" -i {ITERATIONS} -w {NWALKERS} --kmin {kmin} --kmax {kmax} --cov {cov}"
    if use_temp_files:
        command += " --use-temp-files"
    if overwrite:
        command += " --overwrite"

    # and register it
    tag = {
        'sample': sample,
        'p': p[hashstr],
        'zbin': ZBINS[0],
        'params': params
    }
    RSDFitRunner.register(command, tag=tag)
コード例 #5
0
def add_commands(box, sample):
    VERSION = 'v1.8e-no'
    HASHES = ['bba5aabfa6'] # no z-weights

    dirname = os.path.join(EBOSS_SPECTRA, 'mocks', 'ezmock', VERSION)
    for i, hashstr in enumerate(HASHES):
        filename = os.path.join(dirname, f'poles_zevoEZmock_{VERSION}_QSO-{sample}_{box:04d}-{hashstr}.json')
        command = f"eboss-qso-fit nlopt -f {filename} --vary b1 sigma_fog --stats P0 P2 -i 500"
        RSDFitRunner.register(command, tag={'sample':sample, 'zbin':ZBINS[i]})
コード例 #6
0
def add_commands(sample):
    VERSION = 'v1.8'
    HASHES = ['a34d7840d9', 'd96a267921', '89f0eee23b', 'f8a1e4e844']

    dirname = os.path.join(EBOSS_SPECTRA, 'data', VERSION)
    for i, hashstr in enumerate(HASHES):
        filename = os.path.join(dirname, f'poles_eboss_{VERSION}-QSO-{sample}-{hashstr}.json')
        command = f"eboss-qso-fit mcmc -f {filename} --vary b1 sigma_fog --stats P0 P2 -i 1000 -w 10"
        RSDFitRunner.register(command, tag={'sample':sample, 'zbin':ZBINS[i]})
コード例 #7
0
    for i, hashstr in enumerate(HASHES):

        # the data file
        filename = os.path.join(dirname, f'poles_eboss_{VERSION}-focal-QSO-{sample}-{hashstr}.json')

        # make the command
        command = f"eboss-qso-fit mcmc -f {filename} --vary {params} --stats P0 P2"
        command += f" -i {ITERATIONS} -w {WALKERS} --kmin {kmin} --kmax {kmax} --cov {cov}"
        if overwrite:
            command += " --overwrite"

        # register it
        tag = {'sample':sample, 'zbin':ZBINS[i]}
        RSDFitRunner.register(command, tag=tag)


if __name__ == '__main__':

    from argparse import ArgumentParser

    parser = ArgumentParser()
    parser.add_argument('--vary-shot-noise', choices=[0,1], type=int, required=True)
    parser.add_argument('--overwrite', action='store_true', default=False)
    parser.add_argument('--kmin', type=float, default=1e-4)
    parser.add_argument('--kmax', type=float, default=0.3)

    ns, args = parser.parse_known_args()

    add_commands(**vars(ns))
    RSDFitRunner.execute(args=args)
コード例 #8
0
#! /usr/bin/env python
from eboss_qso.fits import RSDFitRunner, parametrize
from eboss_qso import EBOSS_SPECTRA
import os
from argparse import Action

class BoxNumber(Action):
    def __call__(self, parser, namespace, box, option_string=None):
        add_commands(box=box)
        setattr(namespace, self.dest, box)

ZBINS = [(0.8, 2.2)]

@parametrize({'sample':['N', 'S']})
def add_commands(box, sample):
    VERSION = 'v1.8e-no'
    HASHES = ['bba5aabfa6'] # no z-weights

    dirname = os.path.join(EBOSS_SPECTRA, 'mocks', 'ezmock', VERSION)
    for i, hashstr in enumerate(HASHES):
        filename = os.path.join(dirname, f'poles_zevoEZmock_{VERSION}_QSO-{sample}_{box:04d}-{hashstr}.json')
        command = f"eboss-qso-fit nlopt -f {filename} --vary b1 sigma_fog --stats P0 P2 -i 500"
        RSDFitRunner.register(command, tag={'sample':sample, 'zbin':ZBINS[i]})


if __name__ == '__main__':

    # the box number
    RSDFitRunner.update_preparser('--box', required=True, type=int, action=BoxNumber)
    RSDFitRunner.execute()
コード例 #9
0
#! /usr/bin/env python
from eboss_qso.fits import RSDFitRunner, parametrize
from eboss_qso import EBOSS_SPECTRA
import os

ZBINS = [(0.9, 1.2), (1.2, 1.5), (1.5, 1.8), (1.8, 2.2)]

@parametrize({'sample':['N', 'S']})
def add_commands(sample):
    VERSION = 'v1.8'
    HASHES = ['a34d7840d9', 'd96a267921', '89f0eee23b', 'f8a1e4e844']

    dirname = os.path.join(EBOSS_SPECTRA, 'data', VERSION)
    for i, hashstr in enumerate(HASHES):
        filename = os.path.join(dirname, f'poles_eboss_{VERSION}-QSO-{sample}-{hashstr}.json')
        command = f"eboss-qso-fit mcmc -f {filename} --vary b1 sigma_fog --stats P0 P2 -i 1000 -w 10"
        RSDFitRunner.register(command, tag={'sample':sample, 'zbin':ZBINS[i]})


if __name__ == '__main__':
    add_commands()
    RSDFitRunner.execute()