if not opts.projection: # Add scale bar, 1/4 width of the plot ax.plot([0.0625, 0.3125], [0.0625, 0.0625], color='black', linewidth=1, transform=ax.transAxes) ax.text(0.0625, 0.0625, '{0:g} Mpc'.format(0.5 * opts.max_distance), fontsize=8, transform=ax.transAxes, verticalalignment='bottom') # Create marginal distance plot. progress.update(-1, 'Plotting distance') gs1 = gridspec.GridSpecFromSubplotSpec(5, 5, gs[0, 1]) ax = fig.add_subplot(gs1[1:-1, 1:-1]) # Plot marginal distance distribution, integrated over the whole sky. d = np.linspace(0, opts.max_distance) ax.fill_between(d, marginal_pdf(d, prob, mu, sigma, norm), alpha=0.5, color=colors[0]) # Plot conditional distance distribution at true position # and mark true distance. for (ra, dec, dist), color in zip(opts.radecdist, colors[1:]): theta = 0.5*np.pi - np.deg2rad(dec) phi = np.deg2rad(ra) ipix = hp.ang2pix(nside, theta, phi) ax.fill_between(d, scipy.stats.norm( mu[ipix], sigma[ipix]).pdf(d) * norm[ipix] * np.square(d), alpha=0.5, color=color) ax.axvline(dist, color='black', linewidth=0.5) ax.plot( [dist], [-0.15], marker=truth_marker, markeredgecolor=color, markerfacecolor='none', markeredgewidth=1, clip_on=False,
ax.text(0.0625, 0.0625, '{0:d} Mpc'.format(int(np.round(0.5 * max_distance))), fontsize=8, transform=ax.transAxes, verticalalignment='bottom') # Create marginal distance plot. progress.update(-1, 'Plotting distance') gs1 = gridspec.GridSpecFromSubplotSpec(5, 5, gs[0, 1]) ax = fig.add_subplot(gs1[1:-1, 1:-1]) # Plot marginal distance distribution, integrated over the whole sky. d = np.linspace(0, max_distance) ax.fill_between(d, marginal_pdf(d, prob, mu, sigma, norm), alpha=0.5, color=colors[0]) # Plot conditional distance distribution at true position # and mark true distance. for (ra, dec, dist), color in zip(opts.radecdist, colors[1:]): theta = 0.5 * np.pi - np.deg2rad(dec) phi = np.deg2rad(ra) ipix = hp.ang2pix(nside, theta, phi) ax.fill_between(d, scipy.stats.norm(mu[ipix], sigma[ipix]).pdf(d) * norm[ipix] * np.square(d), alpha=0.5, color=color) ax.axvline(dist, color='black', linewidth=0.5)
if not opts.projection: # Add scale bar, 1/4 width of the plot ax.plot([0.0625, 0.3125], [0.0625, 0.0625], color='black', linewidth=1, transform=ax.transAxes) ax.text(0.0625, 0.0625, '{0:d} Mpc'.format(int(np.round(0.5 * max_distance))), fontsize=8, transform=ax.transAxes, verticalalignment='bottom') # Create marginal distance plot. progress.update(-1, 'Plotting distance') gs1 = gridspec.GridSpecFromSubplotSpec(5, 5, gs[0, 1]) ax = fig.add_subplot(gs1[1:-1, 1:-1]) # Plot marginal distance distribution, integrated over the whole sky. d = np.linspace(0, max_distance) ax.fill_between(d, marginal_pdf(d, prob, mu, sigma, norm), alpha=0.5, color=colors[0]) # Plot conditional distance distribution at true position # and mark true distance. for (ra, dec, dist), color in zip(opts.radecdist, colors[1:]): theta = 0.5*np.pi - np.deg2rad(dec) phi = np.deg2rad(ra) ipix = hp.ang2pix(nside, theta, phi) ax.fill_between(d, scipy.stats.norm( mu[ipix], sigma[ipix]).pdf(d) * norm[ipix] * np.square(d), alpha=0.5, color=color) ax.axvline(dist, color='black', linewidth=0.5) ax.plot( [dist], [-0.15], marker=truth_marker, markeredgecolor=color, markerfacecolor='none', markeredgewidth=1, clip_on=False,
[0.0625, 0.3125], [0.0625, 0.0625], color='black', linewidth=1, transform=ax.transAxes) ax.text( 0.0625, 0.0625, '{0:d} Mpc'.format(int(np.round(0.5 * max_distance))), fontsize=8, transform=ax.transAxes, verticalalignment='bottom') # Create marginal distance plot. progress.update(-1, 'Plotting distance') gs1 = gridspec.GridSpecFromSubplotSpec(5, 5, gs[0, 1]) ax = fig.add_subplot(gs1[1:-1, 1:-1]) # Plot marginal distance distribution, integrated over the whole sky. d = np.linspace(0, max_distance) ax.fill_between( d, marginal_pdf(d, prob, mu, sigma, norm), alpha=0.5, color=colors[0]) # Plot conditional distance distribution at true position # and mark true distance. for (ra, dec, dist), color in zip(opts.radecdist, colors[1:]): theta = 0.5*np.pi - np.deg2rad(dec) phi = np.deg2rad(ra) ipix = hp.ang2pix(nside, theta, phi) ax.fill_between(d, scipy.stats.norm( mu[ipix], sigma[ipix]).pdf(d) * norm[ipix] * np.square(d), alpha=0.5, color=color) ax.axvline(dist, color='black', linewidth=0.5) ax.plot( [dist], [-0.15], marker=truth_marker, markeredgecolor=color, markerfacecolor='none', markeredgewidth=1, clip_on=False, transform=transforms.blended_transform_factory(