np.save('fit_outputs/hat11_1_bestps.npy', bestp_hat11_1) np.save('fit_outputs/hat11_1_error_upper.npy', hat11_1_errors_upper) np.save('fit_outputs/hat11_1_error_lower.npy', hat11_1_errors_lower) # np.save('fit_outputs/hat11_2_bestps.npy', bestp_hat11_2) # np.save('fit_outputs/hat11_2_error_upper.npy', hat11_2_errors_upper) # np.save('fit_outputs/hat11_2_error_lower.npy', hat11_2_errors_lower) import corner test_lats = np.linspace(-60, 60, 500) plt.figure() plt.hist(significant_latitudes, 30, normed=True, alpha=0.5, histtype='stepfilled', color='k') plt.plot(test_lats, model(bestp_hat11_1, 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/hat11_1_hist.png', bbox_inches='tight') plt.close() fig = corner.corner(samples_hat11_1, labels=labels) fig.savefig('plots/hat11_1_triangle.png', bbox_inches='tight') #plt.show() plt.close() # plt.figure() # plt.hist(second_half_lats, 30, normed=True, # alpha=0.5, histtype='stepfilled', color='k')
# 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() mt_wilson_bestps = np.median(samples_i, axis=0) mt_wilson_error_upper = np.diff(np.percentile(samples_i, [50, 84], axis=0), axis=0) mt_wilson_error_lower = np.diff(np.percentile(samples_i, [50, 16], axis=0), axis=0)