labels = [r"$M_{\rm 1, i}\ (M_{\odot})$", r"$M_{\rm 2, i}\ (M_{\odot})$", r"$a_{\rm i}\ (R_{\odot})$", \ r"$e_{\rm i}$", r"$v_{\rm k, i}\ ({\rm km}\ {\rm s}^{-1})$", r"$\theta_{\rm k}\ ({\rm rad.})$", \ r"$\phi_{\rm k}\ ({\rm rad.})$", r"$\alpha_{\rm i}\ ({\rm deg.})$", \ r"$\delta_{\rm i}\ ({\rm deg.}) $", r"$t_{\rm i}\ ({\rm Myr})$"] hist2d_kwargs = {"plot_datapoints" : False} fig = corner.corner(sampler.flatchain, fig=fig, labels=labels, max_n_ticks=4, **hist2d_kwargs) ra_out = sampler.flatchain.T[7] dec_out = sampler.flatchain.T[8] gs = gridspec.GridSpec(2, 2, width_ratios=[3,2], height_ratios=[2,3] ) smc_plot, ax1 = sf_history.get_SMC_plot_polar(50, fig_in=fig, gs=gs[1], ra_dist=ra_out, dec_dist=dec_out, ra=ra_J0045, dec=dec_J0045, xgrid_density=6) ax1.set_position([0.55, 0.55, 0.3, 0.3]) # gs = gridspec.GridSpec(2, 2, # width_ratios=[3,2], # height_ratios=[2,3] # ) # # ax1 = plt.subplot(gs[1]) # ax1.scatter(np.random.randint(5, size=20), np.random.randint(2, size=20))
plt.savefig('../figures/sys2_chains.pdf', rasterized=True) # Likelihood as a function of each parametersplt.rc('font', size=8) fig, ax = plt.subplots(2,5, figsize=(14,6)) labels = [r"$M_1$", r"$M_2$", r"$A$", r"$e$", r"$v_k$", r"$\theta$", r"$\phi$", r"$\alpha_{\rm b}$", r"$\delta_{\rm b}$", r"$t_{\rm b}$"] for i in np.arange(10): a = np.int(i/5) b = i%5 corner.hist2d(sampler.chain[:,:,i], sampler.lnprobability, ax=ax[a,b], bins=20) ax[a,b].set_xlabel(labels[i]) plt.tight_layout() plt.savefig('../figures/sys2_likelihoods.pdf') # Corner plot plt.rc('font', size=18) labels = [r"$M_1$", r"$M_2$", r"$A$", r"$e$", r"$v_k$", r"$\theta$", r"$\phi$", r"$\alpha_{\rm b}$", r"$\delta_{\rm b}$", r"$t_{\rm b}$"] truths = [M1_true, M2_true, A_true, ecc_true, v_k_true, theta_true, phi_true, ra_true, dec_true, t_b_true] fig = corner.corner(sampler.flatchain, labels=labels, truths=truths) ax2 = plt.subplot2grid((5,5), (0,3), colspan=2, rowspan=2) ra_out = sampler.flatchain.T[7] dec_out = sampler.flatchain.T[8] ra_obs = 15.9 dec_obs = -72.25 sf_history.get_SMC_plot_polar(50, ra_dist=ra_out, dec_dist=dec_out, ra=ra_obs, dec=dec_obs) plt.savefig('../figures/sys2_corner.pdf')
#plt.subplot(1,2,1) #sf_history.get_SMC_plot(42.0) #plt.scatter(ra_J0045, dec_J0045, marker="*", s=20, color='r') #plt_kwargs = {'colors':'k'} #density_contour.density_contour(ra_out, dec_out, nbins_x=25, nbins_y=25, **plt_kwargs) #plt.xlim(18.0, 9.0) #plt.ylim(-74.0, -71.5) #plt.tight_layout() #plt.savefig('../figures/J0045_dist_birth_location.pdf') # Better birth distribution plot plt.figure(figsize=(8,8)) ra_out = sampler.flatchain.T[7] dec_out = sampler.flatchain.T[8] sf_history.get_SMC_plot_polar(50, ra_dist=ra_out, dec_dist=dec_out, ra=ra_J0045, dec=dec_J0045) plt.savefig('../figures/J0045_dist_birth_location.pdf') # MCMC vs. population synthesis plot plt.figure(figsize=(6,15)) # Orbital period plt.subplot(4,1,1) corner.hist2d(sampler.flatchain.T[0], sampler.flatchain.T[1]) plt.scatter(init_params_J0045["M1"], init_params_J0045["M2"], color='r') plt.xlabel(r"$M_1$", size=16) plt.ylabel(r"$M_2$", size=16) plt.xlim(8.5, 12.0) plt.ylim(3.0, 4.5)
truths = [M1_true, M2_true, A_true, ecc_true, v_k_true, theta_true, phi_true, ra_true, dec_true, t_b_true] hist2d_kwargs = {"plot_datapoints" : False} fig = corner.corner(sampler.flatchain, fig=fig, labels=labels, truths=truths, max_n_ticks=4, **hist2d_kwargs) #ax2 = plt.subplot2grid((5,5), (0,3), colspan=2, rowspan=2) ra_out = sampler.flatchain.T[7] dec_out = sampler.flatchain.T[8] ra_obs = 13.5 dec_obs = -72.63 gs = gridspec.GridSpec(2, 2, width_ratios=[3,2], height_ratios=[2,3] ) sf_history.get_SMC_plot_polar(22, fig_in=fig, gs=gs[1], ra_dist=ra_out, dec_dist=dec_out, ra=ra_obs, dec=dec_obs, xwidth=0.5, ywidth=0.5, xgrid_density=6) # Shift axis labels for i in np.arange(10): ax[i,0].yaxis.set_label_coords(-0.5, 0.5) ax[9,i].xaxis.set_label_coords(0.5, -0.5) # Set declination ticks ax[9,8].set_xticks([-72.9, -72.7, -72.5]) ax[9,8].set_xticklabels(["-72.9", "-72.7", "-72.5"]) for i in np.arange(8): ax[8,i].set_yticks([-72.9, -72.7, -72.5]) ax[8,0].set_yticklabels(["-72.9", "-72.7", "-72.5"])
r"$\phi_{\rm k}\ ({\rm rad.})$", r"$\alpha_{\rm i}\ ({\rm deg.})$", \ r"$\delta_{\rm i}\ ({\rm deg.}) $", r"$t_{\rm i}\ ({\rm Myr})$"] truths = [M1_true, M2_true, A_true, ecc_true, v_k_true, theta_true, phi_true, ra_true, dec_true, t_b_true] hist2d_kwargs = {"plot_datapoints" : False} fig = corner.corner(sampler.flatchain, fig=fig, labels=labels, truths=truths, max_n_ticks=4, **hist2d_kwargs) #ax2 = plt.subplot2grid((5,5), (0,3), colspan=2, rowspan=2) ra_out = sampler.flatchain.T[7] dec_out = sampler.flatchain.T[8] ra_obs = 15.9 dec_obs = -72.25 gs = gridspec.GridSpec(2, 2, width_ratios=[3,2], height_ratios=[2,3] ) sf_history.get_SMC_plot_polar(50, fig_in=fig, gs=gs[1], ra_dist=ra_out, dec_dist=dec_out, ra=ra_obs, dec=dec_obs, xcenter=-0.7, ycenter=17.8, xwidth=0.5, ywidth=0.5, xgrid_density=6) # Shift axis labels for i in np.arange(10): ax[i,0].yaxis.set_label_coords(-0.5, 0.5) ax[9,i].xaxis.set_label_coords(0.5, -0.5) # Set declination ticks ax[9,8].set_xticks([-72.2, -72.1]) ax[9,8].set_xticklabels(["-72.2", "-72.1"]) for i in np.arange(8): ax[8,i].set_yticks([-72.2, -72.1]) ax[8,0].set_yticklabels(["-72.2", "-72.1"]) # Set theta ticks
plt.savefig('../figures/smc_population_HMXB.pdf') plt.rc('font', size=10) # Birth location # fig, host = plt.subplots(figsize=(5,5)) # sf_history.get_SMC_plot(30.0) # plt_kwargs = {'colors':'k'} # density_contour.density_contour(sampler.flatchain.T[7], sampler.flatchain.T[8], nbins_x=40, nbins_y=40, **plt_kwargs) # plt.tight_layout() plt.figure(figsize=(4,4)) sf_history.get_SMC_plot_polar(40.0, ra_dist=sampler.flatchain.T[7], dec_dist=sampler.flatchain.T[8], dist_bins=60, xwidth=3.0, ywidth=3.0) plt.tight_layout() plt.savefig('../figures/smc_population_ra_dec.pdf') # Current location # fig, host = plt.subplots(figsize=(5,5)) # sf_history.get_SMC_plot(30.0) # plt_kwargs = {'colors':'k'} # density_contour.density_contour(HMXB[0], HMXB[1], nbins_x=40, nbins_y=40, **plt_kwargs) # plt.tight_layout() fig, ax = plt.subplots(2, 1, figsize=(4.5,7)) #plt.figure(figsize=(5,5)) ax[0].set_xticks([])