Ejemplo n.º 1
0
# Observation schedule
day = 23.934
cadence = 1.
nobs_per_epoch = 35                                                     # number of observations per epochs of 35h
epoch_duration = nobs_per_epoch * cadence
epoch_starts = [50*day, 120*day, 210*day, 280*day]                      # 4 epochs of observation; total of 140 data points

times = np.array([])                                                    # creating a time array for observations
for epoch_start in epoch_starts:
    epoch_times = np.linspace(epoch_start, epoch_start + epoch_duration, nobs_per_epoch)
    times = np.concatenate([times, epoch_times])
    
measurement_std = 0.001                                                 # standard deviation of measurements from truth

# 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
Ejemplo n.º 2
0
# DO NOT CHANGE THIS.
phi_orb = abs(5 * (np.pi / 3) + sol_phase)
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
Ejemplo n.º 3
0
# setting the orbital properties
p_rotation = 23.934
p_orbit = 365.256363 * 24.0
phi_orb = np.pi
phi_rot = np.pi
inclination = 0
obliquity = 0

times = 7

# Measurement uncertainty
measurement_std = 0.001

# Using a posterior instance to generate a light-curve
truth = IlluminationMapPosterior(times,
                                 np.zeros_like(times),
                                 measurement_std,
                                 nside=nside)
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.fix_params(true_params)
# p = np.concatenate([np.zeros(truth.nparams), simulated_map])
# kernel = truth.visibility_illumination_matrix(p)
# print(simulated_map)
Ejemplo n.º 4
0
def posterior_draw_4(draw):
    draw_lightcurve = truth_4.lightcurve(np.concatenate([[draw], sim_map]))
    return IlluminationMapPosterior(epoch_4,
                                    draw_lightcurve,
                                    measurement_std,
                                    nside=sim_nside)
Ejemplo n.º 5
0
# Observation schedule
day = 23.934
cadence = 1.
nobs_per_epoch = 35
epoch_duration = nobs_per_epoch * cadence

epoch_1 = np.linspace(50 * day, 50 * day + epoch_duration, nobs_per_epoch)
epoch_2 = np.linspace(120 * day, 120 * day + epoch_duration, nobs_per_epoch)
epoch_3 = np.linspace(210 * day, 210 * day + epoch_duration, nobs_per_epoch)
epoch_4 = np.linspace(280 * day, 280 * day + epoch_duration, nobs_per_epoch)

measurement_std = 0.001  #to increase eventually

truth_1 = IlluminationMapPosterior(epoch_1,
                                   np.zeros_like(epoch_1),
                                   measurement_std,
                                   nside=sim_nside)
truth_2 = IlluminationMapPosterior(epoch_2,
                                   np.zeros_like(epoch_2),
                                   measurement_std,
                                   nside=sim_nside)
truth_3 = IlluminationMapPosterior(epoch_3,
                                   np.zeros_like(epoch_3),
                                   measurement_std,
                                   nside=sim_nside)
truth_4 = IlluminationMapPosterior(epoch_4,
                                   np.zeros_like(epoch_4),
                                   measurement_std,
                                   nside=sim_nside)

true_params = {
Ejemplo n.º 6
0
                280 * day]  # 4 epochs, total of 140 data points

times = np.array([])
for epoch_start in epoch_starts:
    epoch_times = np.linspace(epoch_start, epoch_start + epoch_duration,
                              nobs_per_epoch)
    times = np.concatenate([times, epoch_times])

# Experimental error, can be increased if the effect of the uncertainty is investigated
# Accurate results were recovered for uncertainties up to 0.01
measurement_std = 0.001

# Posterior parameters
# Identical to posterior parameters in fit_emcee.py
truth = IlluminationMapPosterior(times,
                                 np.zeros_like(times),
                                 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
Ejemplo n.º 7
0
                                   sol_phase=sol_phase,
                                   times=times,
                                   nside=nside)
analytic_5 = analytic_lightcurve_2(colat=colat_5,
                                   lng=one_lng,
                                   w_rot=w_rot,
                                   w_orb=w_orb,
                                   obq=obliquity,
                                   i=inclination,
                                   sol_phase=sol_phase,
                                   times=times,
                                   nside=nside)

# Numeric solution
truth = IlluminationMapPosterior(times,
                                 np.zeros_like(times),
                                 measurement_std,
                                 nside=nside)
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(obl_orientation, low=0, high=2 * np.pi)
}

truth.fix_params(true_params)
p_1 = np.concatenate([np.zeros(truth.nparams), sim_map_1])
p_2 = np.concatenate([np.zeros(truth.nparams), sim_map_2])
p_3 = np.concatenate([np.zeros(truth.nparams), sim_map_3])
p_4 = np.concatenate([np.zeros(truth.nparams), sim_map_4])