def main():
    parser = argparse.ArgumentParser(description='Table generator')
    parser.add_argument('num', help=('Instance of the script to run; '
                                     'determines input a_b/v_s values. '
                                     'Value between 0-3'))

    args = parser.parse_args()
    idx = int(args.num)

    # vs/ab values to use in this instance
    vs_nodamp = VS_VALS_ALL[idx]
    abvals = AB_VALS_ALL[idx]

    # mu / eta2 / B0 grid settings
    mu_vals_nodamp = [0, 1./3, 1./2, 1, 1.5, 2]  # Following Sean
    n_B0_nodamp = 20

    mu_vals_damp = [1.]
    n_B0_damp = 50

    eta2_vals = [np.logspace(-2, -1, 25, base=10, endpoint=False),
                 np.logspace(-1, 1, 100, base=10, endpoint=False),
                 np.logspace(1, 2, 26, base=10, endpoint=True)]
    eta2_vals = np.sort(np.concatenate(eta2_vals))

    # Tycho settings (yes this is rather silly)
    snr_nodamp = snrcat.make_tycho()
    snr_nodamp.vs = vs_nodamp
    snr_damp = snrcat.make_tycho()

    kevs = TYCHO_KEVS
    data_min = TYCHO_DATA_MIN / 1.1
    data_max = TYCHO_DATA_MAX * 1.1

    # First make non-damped table
    fname_nodamp = '{}_gen_{}_grid_{}-{}-{}_vs-{:0.2e}.pkl'.format(snr_nodamp.name,
                    datetime.now().strftime('%Y-%m-%d'), len(mu_vals_nodamp),
                    len(eta2_vals), n_B0_nodamp, vs_nodamp)

    models.maketab(snr_nodamp, kevs, data_min, data_max,
                   mu_vals_nodamp, eta2_vals, n_B0_nodamp,
                   fname = fname_nodamp,
                   f_B0_init = 1.1, f_B0_step = 0.10,
                   idamp = False)

    # Then slew of damped tables
    for ab in abvals:

        fname_damp = '{}_gen_{}_grid_{}-{}-{}_ab-{:0.2e}.pkl'.format(snr_damp.name,
                     datetime.now().strftime('%Y-%m-%d'),
                     len(mu_vals_damp), len(eta2_vals), n_B0_damp, ab)

        models.maketab(snr_damp, kevs, data_min, data_max,
                       mu_vals_damp, eta2_vals, n_B0_damp,
                       fname = fname_damp,
                       f_B0_init = 1.1, f_B0_step = 0.10,
                       idamp = True, damp_ab = ab, damp_bmin = 5e-6)
def main():
    # Read shock velocity
    parser = argparse.ArgumentParser(description='Table generator')
    parser.add_argument('vs', help='Shock velocity (cm/s)')
    args = parser.parse_args()
    vs = float(args.vs)

    # Set SNR parameters
    snr = snrcat.make_tycho()
    snr.vs = vs

    # Set data
    kevs = TYCHO_KEVS
    data_min = TYCHO_DATA_MIN / 1.25
    data_max = TYCHO_DATA_MAX * 1.25

    # Set default grid
    eta2_vals_orig = np.logspace(-2, 2, 50, base=10)
    eta2_vals_orig = np.sort(np.append(eta2_vals_orig, np.linspace(0, 10, 50)))
    n_B0 = 20  # In practice, you'll usually get ~1.5 to 2x as many points
               # as code tries to achieve good spacing

    # Set rminarc for gridding (determined manually) (NEW LARGER VALUES)
    rminarc = [18.5, 15., 10.77, 10.77, 10.77]
    # approx ~ TYCHO_DATA_MAX * 1.25 * f_rminarc, f_rminarc = 1.25

    # ------------------------------------
    mu_vals = [1.5]
    eta2_vals = eta2_vals_orig[eta2_vals_orig > 15]
    fname = '{}_gen_2014-07-30_grid_6-100-20_vs-{:0.2e}_part2_mu-1.50.pkl'.format(
            snr.name, vs)

    models.maketab(snr, kevs, data_min, data_max, mu_vals, eta2_vals, n_B0,
                   rminarc = rminarc,
                   fname = fname,
                   f_rminarc = float('NaN'),  # Irrelevant, just being explicit
                   f_B0_init = 1.1,
                   f_B0_step = 0.10)

    # ------------------------------------
    mu_vals = [2]
    eta2_vals = eta2_vals_orig
    fname = '{}_gen_2014-07-30_grid_6-100-20_vs-{:0.2e}_part2_mu-2.00.pkl'.format(
            snr.name, vs)

    models.maketab(snr, kevs, data_min, data_max, mu_vals, eta2_vals, n_B0,
                   rminarc = rminarc,
                   fname = fname,
                   f_rminarc = float('NaN'),  # Irrelevant, just being explicit
                   f_B0_init = 1.1,
                   f_B0_step = 0.10)
Ejemplo n.º 3
0
def main():
    # Read damping length
    parser = argparse.ArgumentParser(description='Table generator')
    parser.add_argument('abvals',
                        help='Damping lengths (%% of shock radius)',
                        nargs='*')
    args = parser.parse_args()
    abvals = map(float, args.abvals)

    # Set SNR parameters
    snr = snrcat.make_tycho()

    # Set data
    kevs = TYCHO_KEVS
    data_min = TYCHO_DATA_MIN / 1.1
    data_max = TYCHO_DATA_MAX * 1.1

    # Set grid (values should be, preferably, sorted)
    mu_vals = [1.]
    eta2_vals = [
        np.logspace(-2, -1, 25, base=10, endpoint=False),
        np.logspace(-1, 1, 100, base=10, endpoint=False),
        np.logspace(1, 2, 26, base=10, endpoint=True)
    ]
    eta2_vals = np.sort(np.concatenate(eta2_vals))
    n_B0 = 50  # In practice, you'll usually get ~1.5 to 2x as many points
    # as code tries to achieve good spacing (esp. for small n_B0)

    for ab in abvals:

        # Set output filename base (end with .pkl)
        # Using custom name with damping length ab appended, for Tycho
        fname = '{}_gen_{}_grid_{}-{}-{}_ab-{:0.2e}_Bmin-2e-6.pkl'.format(
            snr.name,
            datetime.now().strftime('%Y-%m-%d'), len(mu_vals), len(eta2_vals),
            n_B0, ab)

        # Set a few other twiddle-ables here
        models.maketab(snr,
                       kevs,
                       data_min,
                       data_max,
                       mu_vals,
                       eta2_vals,
                       n_B0,
                       fname=fname,
                       f_B0_init=1.1,
                       f_B0_step=0.10,
                       idamp=True,
                       damp_ab=ab,
                       damp_bmin=2e-6)
Ejemplo n.º 4
0
def main():
    # Read shock velocity
    parser = argparse.ArgumentParser(description='Table generator')
    parser.add_argument('vs', help='Shock velocity (cm/s)')
    args = parser.parse_args()
    vs = float(args.vs)

    # Set SNR parameters
    snr = snrcat.make_tycho()
    snr.vs = vs

    # Set data
    kevs = TYCHO_KEVS
    data_min = TYCHO_DATA_MIN / 1.25
    data_max = TYCHO_DATA_MAX * 1.25

    # Set grid (values should be, preferably, sorted)
    mu_vals = [0, 1. / 3, 1. / 2, 1, 1.5, 2]  # Following Sean
    eta2_vals = np.logspace(-2, 3, 60, base=10)
    eta2_vals = np.sort(np.append(eta2_vals, np.linspace(0, 10, 50)))
    n_B0 = 20  # In practice, you'll usually get ~1.5 to 2x as many points
    # as code tries to achieve good spacing

    # Set rminarc for gridding (determined manually)
    rminarc = np.array([18.5, 15., 10.77, 10.77,
                        10.77])  # from 20140730 tycho pt. 2
    # approx ~ TYCHO_DATA_MAX * 1.25 * f_rminarc, f_rminarc = 1.25

    # Set output filename base (end with .pkl)
    # Using custom name with shock velocity appended, for Tycho
    fname = '{}_gen_{}_grid_{}-{}-{}_vs-{:0.2e}.pkl'.format(
        snr.name,
        datetime.now().strftime('%Y-%m-%d'), len(mu_vals), len(eta2_vals),
        n_B0, vs)

    # Set a few other twiddle-ables here
    models.maketab(snr,
                   kevs,
                   data_min,
                   data_max,
                   mu_vals,
                   eta2_vals,
                   n_B0,
                   fname=fname,
                   f_B0_init=1.1,
                   f_B0_step=0.10,
                   rminarc=rminarc)
Ejemplo n.º 5
0
def main():
    # Read shock velocity
    parser = argparse.ArgumentParser(description='Table generator')
    parser.add_argument('vs', help='Shock velocity (cm/s)')
    args = parser.parse_args()
    vs = float(args.vs)

    # Set SNR parameters
    snr = snrcat.make_tycho()
    snr.vs = vs

    # Set data
    kevs = TYCHO_KEVS
    data_min = TYCHO_DATA_MIN / 1.25
    data_max = TYCHO_DATA_MAX * 1.25

    # Set grid (values should be, preferably, sorted)
    mu_vals = [0, 1./3, 1./2, 1, 1.5, 2]  # Following Sean
    eta2_vals = np.logspace(-2, 2, 50, base=10)
    eta2_vals = np.sort(np.append(eta2_vals, np.linspace(0, 10, 50)))
    n_B0 = 20  # In practice, you'll usually get ~1.5 to 2x as many points
               # as code tries to achieve good spacing

    # Set rminarc for gridding (determined manually)
    rminarc = [18.5, 15., 10.77, 11.73, 9.1]
    # approx ~ TYCHO_DATA_MAX * 1.25 * f_rminarc, f_rminarc = 1.25

    # Set output filename base (end with .pkl)
    fname = '{}_gen_{}_grid_{}-{}-{}_vs-{:0.2e}.pkl'.format(snr.name,
            datetime.now().strftime('%Y-%m-%d'), len(mu_vals), len(eta2_vals),
            n_B0, vs)

    # Set a few other twiddle-ables here
    # See the docstring / code of models_all.maketab(...)
    models.maketab(snr, kevs, data_min, data_max, mu_vals, eta2_vals, n_B0,
                   rminarc = rminarc,
                   fname = fname,
                   f_rminarc = float('NaN'),  # Irrelevant, just being explicit
                   f_B0_init = 1.1,
                   f_B0_step = 0.10)
def main():
    # Read damping length
    parser = argparse.ArgumentParser(description='Table generator')
    parser.add_argument('abvals', help='Damping lengths (%% of shock radius)',
                        nargs='*')
    args = parser.parse_args()
    abvals = map(float, args.abvals)

    # Set SNR parameters
    snr = snrcat.make_tycho()

    # Set data
    kevs = TYCHO_KEVS
    data_min = TYCHO_DATA_MIN / 1.1
    data_max = TYCHO_DATA_MAX * 1.1

    # Set grid (values should be, preferably, sorted)
    mu_vals = [1.]
    eta2_vals = [np.logspace(-2, -1, 25, base=10, endpoint=False),
                 np.logspace(-1, 1, 100, base=10, endpoint=False),
                 np.logspace(1, 2, 26, base=10, endpoint=True)]
    eta2_vals = np.sort(np.concatenate(eta2_vals))
    n_B0 = 30  # In practice, you'll usually get ~1.5 to 2x as many points
               # as code tries to achieve good spacing (esp. for small n_B0)

    for ab in abvals:

        # Set output filename base (end with .pkl)
        # Using custom name with damping length ab appended, for Tycho
        fname = '{}_gen_{}_grid_{}-{}-{}_ab-{:0.2e}.pkl'.format(snr.name,
                datetime.now().strftime('%Y-%m-%d'),
                len(mu_vals), len(eta2_vals), n_B0, ab)

        # Set a few other twiddle-ables here
        models.maketab(snr, kevs, data_min, data_max,
                       mu_vals, eta2_vals, n_B0,
                       fname = fname,
                       f_B0_init = 1.1, f_B0_step = 0.10,
                       idamp = True, damp_ab = ab)
Ejemplo n.º 7
0
def main():
    # Read shock velocity
    parser = argparse.ArgumentParser(description='Table generator')
    parser.add_argument('vs', help='Shock velocity (cm/s)')
    args = parser.parse_args()
    vs = float(args.vs)

    # Set SNR parameters
    snr = snrcat.make_tycho()
    snr.vs = vs

    # Set data
    kevs = TYCHO_KEVS
    data_min = TYCHO_DATA_MIN / 1.25
    data_max = TYCHO_DATA_MAX * 1.25

    # Set default grid
    eta2_vals_orig = np.logspace(-2, 2, 50, base=10)
    eta2_vals_orig = np.sort(np.append(eta2_vals_orig, np.linspace(0, 10, 50)))
    n_B0 = 20  # In practice, you'll usually get ~1.5 to 2x as many points
    # as code tries to achieve good spacing

    # Set rminarc for gridding (determined manually) (NEW LARGER VALUES)
    rminarc = [18.5, 15., 10.77, 10.77, 10.77]
    # approx ~ TYCHO_DATA_MAX * 1.25 * f_rminarc, f_rminarc = 1.25

    # ------------------------------------
    mu_vals = [1.5]
    eta2_vals = eta2_vals_orig[eta2_vals_orig > 15]
    fname = '{}_gen_2014-07-30_grid_6-100-20_vs-{:0.2e}_part2_mu-1.50.pkl'.format(
        snr.name, vs)

    models.maketab(
        snr,
        kevs,
        data_min,
        data_max,
        mu_vals,
        eta2_vals,
        n_B0,
        rminarc=rminarc,
        fname=fname,
        f_rminarc=float('NaN'),  # Irrelevant, just being explicit
        f_B0_init=1.1,
        f_B0_step=0.10)

    # ------------------------------------
    mu_vals = [2]
    eta2_vals = eta2_vals_orig
    fname = '{}_gen_2014-07-30_grid_6-100-20_vs-{:0.2e}_part2_mu-2.00.pkl'.format(
        snr.name, vs)

    models.maketab(
        snr,
        kevs,
        data_min,
        data_max,
        mu_vals,
        eta2_vals,
        n_B0,
        rminarc=rminarc,
        fname=fname,
        f_rminarc=float('NaN'),  # Irrelevant, just being explicit
        f_B0_init=1.1,
        f_B0_step=0.10)
def main():
    parser = argparse.ArgumentParser(description='Table generator')
    parser.add_argument('num',
                        help=('Instance of the script to run; '
                              'determines input a_b/v_s values. '
                              'Value between 0-3'))

    args = parser.parse_args()
    idx = int(args.num)

    # vs/ab values to use in this instance
    vs_nodamp = VS_VALS_ALL[idx]
    abvals = AB_VALS_ALL[idx]

    # mu / eta2 / B0 grid settings
    mu_vals_nodamp = [0, 1. / 3, 1. / 2, 1, 1.5, 2]  # Following Sean
    n_B0_nodamp = 20

    mu_vals_damp = [1.]
    n_B0_damp = 50

    eta2_vals = [
        np.logspace(-2, -1, 25, base=10, endpoint=False),
        np.logspace(-1, 1, 100, base=10, endpoint=False),
        np.logspace(1, 2, 26, base=10, endpoint=True)
    ]
    eta2_vals = np.sort(np.concatenate(eta2_vals))

    # Tycho settings (yes this is rather silly)
    snr_nodamp = snrcat.make_tycho()
    snr_nodamp.vs = vs_nodamp
    snr_damp = snrcat.make_tycho()

    kevs = TYCHO_KEVS
    data_min = TYCHO_DATA_MIN / 1.1
    data_max = TYCHO_DATA_MAX * 1.1

    # First make non-damped table
    fname_nodamp = '{}_gen_{}_grid_{}-{}-{}_vs-{:0.2e}.pkl'.format(
        snr_nodamp.name,
        datetime.now().strftime('%Y-%m-%d'), len(mu_vals_nodamp),
        len(eta2_vals), n_B0_nodamp, vs_nodamp)

    models.maketab(snr_nodamp,
                   kevs,
                   data_min,
                   data_max,
                   mu_vals_nodamp,
                   eta2_vals,
                   n_B0_nodamp,
                   fname=fname_nodamp,
                   f_B0_init=1.1,
                   f_B0_step=0.10,
                   idamp=False)

    # Then slew of damped tables
    for ab in abvals:

        fname_damp = '{}_gen_{}_grid_{}-{}-{}_ab-{:0.2e}.pkl'.format(
            snr_damp.name,
            datetime.now().strftime('%Y-%m-%d'), len(mu_vals_damp),
            len(eta2_vals), n_B0_damp, ab)

        models.maketab(snr_damp,
                       kevs,
                       data_min,
                       data_max,
                       mu_vals_damp,
                       eta2_vals,
                       n_B0_damp,
                       fname=fname_damp,
                       f_B0_init=1.1,
                       f_B0_step=0.10,
                       idamp=True,
                       damp_ab=ab,
                       damp_bmin=5e-6)