示例#1
0
phi_rot = abs(2 * np.pi - sol_phase)

# NUMERIC
true_params = {
    'log_orbital_period': np.log(p_orbit),
    'log_rotation_period': np.log(p_rotation),
    'logit_cos_inc': logit(np.cos(inclination)),
    'logit_cos_obl': logit(np.cos(obliquity)),
    'logit_phi_orb': logit(phi_orb, low=0, high=2 * np.pi),
    'logit_obl_orientation': logit(phi_rot, low=0, high=2 * np.pi)
}
truth = IlluminationMapPosterior(times,
                                 np.zeros_like(times),
                                 measurement_std,
                                 nside=nside)
truth.fix_params(true_params)
p = np.concatenate([np.zeros(truth.nparams), one_point_map])
numeric_lightcurve = truth.lightcurve(p)

run_times_analytic = np.array([])
run_times_numeric = np.array([])
nside_resolutions = np.array([1, 2, 4, 8])
print("Test:")
for i in np.nditer(nside_resolutions):
    nside = i
    whitenoise_relative_amp = 0.2
    length_scale = 30 * np.pi / 2
    albedo_mean = 0.5
    albedo_std = 0.2

    while True:
示例#2
0
                                   measurement_std,
                                   nside=sim_nside)

true_params = {
    'log_orbital_period': np.log(p_orbit),
    'logit_cos_inc': logit(np.cos(inclination)),
    'logit_cos_obl': logit(np.cos(obliquity)),
    'logit_phi_orb': logit(phi_orb, low=0, high=2 * np.pi),
    'logit_obl_orientation': logit(phi_rot, low=0, high=2 * np.pi),
    'mu': 0.5,
    'log_sigma': np.log(0.25),
    'logit_wn_rel_amp': logit(0.02),
    'logit_spatial_scale': logit(30. * np.pi / 180),
    'log_error_scale': np.log(1.)
}
truth_1.fix_params(true_params)
truth_2.fix_params(true_params)
truth_3.fix_params(true_params)
truth_4.fix_params(true_params)

p = np.concatenate([[np.log(day)], sim_map])
true_lightcurve_1 = truth_1.lightcurve(p)
true_lightcurve_2 = truth_2.lightcurve(p)
true_lightcurve_3 = truth_3.lightcurve(p)
true_lightcurve_4 = truth_4.lightcurve(p)

true_posterior_1 = IlluminationMapPosterior(epoch_1,
                                            true_lightcurve_1,
                                            measurement_std,
                                            nside=sim_nside)
true_posterior_2 = IlluminationMapPosterior(epoch_2,
示例#3
0
# Posterior parameters
truth = IlluminationMapPosterior(times, np.zeros_like(times), measurement_std, nside=sim_nside)
# Parameters for the gaussian process and the maps; same as those used in sim_map.py
# We fix all parameters except for the rotation period, and assume other parameters are known
true_params = {
    'log_orbital_period':np.log(p_orbit),   
    'logit_cos_inc':logit(np.cos(inclination)),
    'logit_cos_obl':logit(np.cos(obliquity)),
    'logit_phi_orb':logit(phi_orb, low=0, high=2*np.pi),
    'logit_obl_orientation':logit(phi_rot, low=0, high=2*np.pi),
    'mu':0.5,
    'log_sigma':np.log(0.25),
    'logit_wn_rel_amp':logit(0.02),
    'logit_spatial_scale':logit(30. * np.pi/180),
    'log_error_scale': np.log(1.)}
truth.fix_params(true_params)                                           # fixing the parameters with the measurements
p = np.concatenate([[np.log(day)], sim_map])                            # create an array with the map and the rotation period

# Generate and save a lightcurve
true_lightcurve = truth.lightcurve(p)                                   # lightcurve from known parameters, map and period
obs_lightcurve = true_lightcurve.copy()                                 # copy the lightcurve and add noise (below)
obs_lightcurve += truth.sigma_reflectance * np.random.randn(len(true_lightcurve))
np.savetxt('obs_lightcurve.csv', obs_lightcurve, delimiter=',')         # save the lightcurve with noise as a csv file

# Posterior from lightcurve
logpost = IlluminationMapPosterior(times, obs_lightcurve,               # posterior from lightcurve and parameters 
                                   measurement_std,
                                   nside=sim_nside)
fix = true_params.copy()
logpost.fix_params(fix)                                                 # fix the parameters to the true parameters
示例#4
0
                                 measurement_std,
                                 nside=sim_nside)

true_params = {
    'log_orbital_period': np.log(p_orbit),
    'logit_cos_inc': logit(np.cos(inclination)),
    'logit_cos_obl': logit(np.cos(obliquity)),
    'logit_phi_orb': logit(phi_orb, low=0, high=2 * np.pi),
    'logit_obl_orientation': logit(phi_rot, low=0, high=2 * np.pi),
    'mu': 0.5,
    'log_sigma': np.log(0.25),
    'logit_wn_rel_amp': logit(0.02),
    'logit_spatial_scale': logit(30. * np.pi / 180),
    'log_error_scale': np.log(1.)
}
truth.fix_params(true_params)  # fix the known parameters
p = np.concatenate([[np.log(day)],
                    sim_map])  # create a function with the map and the period

# Generate a lightcurve from the parameters
true_lightcurve = truth.lightcurve(
    p)  # lightcurve from parameters, map and period
obs_lightcurve = true_lightcurve.copy()  # copy the lightcurve and add noise
obs_lightcurve += truth.sigma_reflectance * np.random.randn(
    len(true_lightcurve))
np.savetxt('obs_lightcurve.csv', obs_lightcurve,
           delimiter=',')  # save the observed lightcurve as a text file

logpost = IlluminationMapPosterior(
    times,
    obs_lightcurve,  # posterior from parameters and times of observation