|
| 1 | +"""simple_test_dataset.py -- Create a simple data set to test installation. |
| 2 | +
|
| 3 | +Basic SALT/Tripp standardization. |
| 4 | +""" |
| 5 | +import pickle |
| 6 | + |
| 7 | +import numpy as np |
| 8 | + |
| 9 | +np.random.seed(13048293) |
| 10 | + |
| 11 | +DATA_NAME = "simple" # default |
| 12 | +N_SNE = 300 |
| 13 | +# Tripp Coefficients |
| 14 | +COFF = [ |
| 15 | + -0.14, # alpha, note negative sign |
| 16 | + 3, # beta |
| 17 | +] |
| 18 | + |
| 19 | + |
| 20 | +# TRUE VALUES |
| 21 | +c_true = np.random.randn(N_SNE) * 0.1 |
| 22 | +x1_true = np.random.randn(N_SNE) |
| 23 | +mb_true = COFF[0] * x1_true + COFF[1] * c_true - 20 |
| 24 | + |
| 25 | + |
| 26 | +# OBSERVATIONAL |
| 27 | +x1_obs = x1_true + np.random.randn(N_SNE) * 0.3 |
| 28 | +c_obs = c_true + np.random.randn(N_SNE) * 0.04 |
| 29 | +mb_obs = mb_true + np.random.randn(N_SNE) * 0.10 |
| 30 | + |
| 31 | +# Don't use non-Gaussian parameters |
| 32 | +age_gaus_mean = np.zeros((0, N_SNE, 0)) |
| 33 | +age_gaus_std = np.zeros((0, N_SNE, 0)) |
| 34 | +age_gaus_A = np.zeros((0, N_SNE, 0)) |
| 35 | + |
| 36 | + |
| 37 | +pickle.dump( |
| 38 | + dict( # general properties |
| 39 | + n_sne=N_SNE, |
| 40 | + n_props=3, |
| 41 | + n_non_gaus_props=0, |
| 42 | + n_sn_set=1, |
| 43 | + sn_set_inds=[0] * N_SNE, |
| 44 | + # redshifts |
| 45 | + z_helio=[0.1] * N_SNE, |
| 46 | + z_CMB=[0.1] * N_SNE, |
| 47 | + # Gaussian defined properties |
| 48 | + obs_mBx1c=[[mb_obs[i], x1_obs[i], c_obs[i]] for i in range(N_SNE)], |
| 49 | + obs_mBx1c_cov=[ |
| 50 | + np.diag( |
| 51 | + [ |
| 52 | + 0.05 ** 2, |
| 53 | + 0.3 ** 2, |
| 54 | + 0.04 ** 2, |
| 55 | + ] |
| 56 | + ) |
| 57 | + ] |
| 58 | + * N_SNE, |
| 59 | + # Non-Gaussian properties, skip |
| 60 | + n_age_mix=0, |
| 61 | + age_gaus_mean=age_gaus_mean, |
| 62 | + age_gaus_std=age_gaus_std, |
| 63 | + age_gaus_A=age_gaus_A, |
| 64 | + # Other stuff that does not really need to change |
| 65 | + do_fullDint=0, |
| 66 | + outl_frac_prior_lnmean=-4.6, |
| 67 | + outl_frac_prior_lnwidth=1, |
| 68 | + lognormal_intr_prior=0, |
| 69 | + allow_alpha_S_N=0, |
| 70 | + ), |
| 71 | + open(f"test_{DATA_NAME}_{N_SNE}_obs.pkl", "wb"), |
| 72 | +) |
| 73 | +pickle.dump( |
| 74 | + {"x1": x1_true, "c": c_true, "mass": mass_true, "age": age_true, "mb": mb_true}, |
| 75 | + open(f"test_{DATA_NAME}_{N_SNE}_true.pkl", "wb"), |
| 76 | +) |
0 commit comments