significant_times = np.atleast_2d(all_spot_times).T[significance_cutoff & ignore_high_latitudes] significant_amps = np.atleast_2d(all_amps).T[significance_cutoff & ignore_high_latitudes] significant_latitudes_errors = np.ones_like(significant_latitudes) * 6 initp_hat11 = np.array([0.3, 19, 3.5, 3.5, 180+80]) #times_mid_point = significant_times.ptp()/2 + significant_times.min() # times_mid_point = significant_times[len(significant_times)//2] # first_half_lats = significant_latitudes[significant_times < times_mid_point] # first_half_lats_errs = significant_latitudes_errors[significant_times < times_mid_point] # second_half_lats = significant_latitudes[significant_times > times_mid_point] # second_half_lats_errs = significant_latitudes_errors[significant_times > times_mid_point] samples_hat11_1, bestp_hat11_1 = run_emcee(initp_hat11, significant_latitudes, significant_latitudes_errors, #n_steps=10, burnin=5) n_steps=2000, burnin=1000) # samples_hat11_2, bestp_hat11_2 = run_emcee(initp_hat11, second_half_lats, # second_half_lats_errs, # #n_steps=10, burnin=5) # n_steps=2000, burnin=1000) hat11_1_errors_upper = np.diff(np.percentile(samples_hat11_1, [50, 84], axis=0), axis=0).T hat11_1_errors_lower = np.diff(np.percentile(samples_hat11_1, [50, 16], axis=0), axis=0).T # hat11_2_errors_upper = np.diff(np.percentile(samples_hat11_2, [50, 84], axis=0), axis=0).T # hat11_2_errors_lower = np.diff(np.percentile(samples_hat11_2, [50, 16], axis=0), axis=0).T np.save('fit_outputs/hat11_1_bestps.npy', bestp_hat11_1)
from fit_utils import run_emcee, model initp_sun = np.array([0.5, 16, 3.5, 3.5, 180 + 80]) # for i in range(len(year_bins)): start = Time(datetime.datetime(year_bins[i], 1, 1)) end = start + 4 * u.year in_time_bin = (table["jd"] > start.jd) & (table["jd"] < end.jd) solar_lats = table["latitude_day_1"][in_time_bin] solar_lats_error = np.ones_like(table["latitude_day_1"][in_time_bin]) print("begin mcmc {0}".format(i)) samples_i, bestp_i = run_emcee(initp_sun, solar_lats, solar_lats_error, n_steps=2000, burnin=1000) plt.figure() plt.hist(solar_lats, 30, normed=True, alpha=0.5, histtype="stepfilled", color="k") plt.plot(test_lats, model(bestp_i, test_lats), ls="--", lw=2) plt.legend(loc="upper left") plt.xlabel("Latitude $\ell$ [deg]", fontsize=15) plt.ylabel("$p(\ell)$", fontsize=18) plt.savefig("plots/{0:03d}_hist.png".format(i), bbox_inches="tight") plt.close() fig = corner.corner(samples_i, labels=labels) fig.savefig("plots/{0:03d}_triangle.png".format(i), bbox_inches="tight") # plt.show() plt.close()