コード例 #1
0
    opts.input.name, distances=True)
npix = len(prob)
nside = hp.npix2nside(npix)

progress.update(-1, 'Preparing projection')

if opts.align_to is None or opts.input.name == opts.align_to.name:
    prob2, mu2, sigma2, norm2 = prob, mu, sigma, norm
else:
    (prob2, mu2, sigma2, norm2), _ = io.read_sky_map(
        opts.align_to.name, distances=True)
if opts.max_distance is None:
    max_distance = 2.5 * marginal_ppf(0.5, prob2, mu2, sigma2, norm2)
else:
    max_distance = opts.max_distance
R = np.ascontiguousarray(principal_axes(prob2, mu2, sigma2))

if opts.chain:
    chain = io.read_samples(opts.chain.name)
    chain = np.dot(R.T, (hp.ang2vec(
        0.5 * np.pi - chain['dec'], chain['ra'])
        * np.atleast_2d(chain['dist']).T).T)

fig = plt.figure(frameon=False)
n = 1 if opts.projection else 2
gs = gridspec.GridSpec(
    n, n, left=0.01, right=0.99, bottom=0.01, top=0.99,
    wspace=0.05, hspace=0.05)

imgwidth = int(opts.dpi * opts.figure_width / n)
s = np.linspace(-max_distance, max_distance, imgwidth)
コード例 #2
0
# Read input, determine input resolution.
progress.update(-1, 'Loading FITS file')
(prob, mu, sigma, norm), metadata = fits.read_sky_map(
    opts.input.name, distances=True)
npix = len(prob)
nside = hp.npix2nside(npix)

progress.update(-1, 'Preparing projection')

if opts.align_to is None:
    prob2, mu2, sigma2 = prob, mu, sigma
else:
    (prob2, mu2, sigma2, _), _ = fits.read_sky_map(
        opts.align_to.name, distances=True)
R = np.ascontiguousarray(principal_axes(prob2, mu2, sigma2))

if opts.chain:
    chain = np.recfromtxt(opts.chain, names=True)
    chain = np.dot(R.T, (hp.ang2vec(
        0.5 * np.pi - chain['dec'], chain['ra'])
        * np.atleast_2d(chain['dist']).T).T)

fig = plt.figure(frameon=False)
n = 1 if opts.projection else 2
gs = gridspec.GridSpec(
    n, n, left=0.01, right=0.99, bottom=0.01, top=0.99,
    wspace=0.05, hspace=0.05)

imgwidth = int(opts.dpi * opts.figure_width / n)
s = np.linspace(-opts.max_distance, opts.max_distance, imgwidth)
コード例 #3
0
from lalinference.bayestar.distance import (
    principal_axes, volume_render_kernel, marginal_distribution)
import healpy as hp
import numpy as np
import scipy.stats

# Read input, determine input resolution.
progress.update(-1, 'Loading FITS file')
(prob, mu, sigma, norm), metadataa = fits.read_sky_map(
    opts.input.name, distances=True)
npix = len(prob)
nside = hp.npix2nside(npix)

progress.update(-1, 'Preparing projection')

R = np.ascontiguousarray(principal_axes(prob, mu, sigma))

if opts.chain:
    chain = np.recfromtxt(opts.chain, names=True)
    chain = np.dot(R.T, (hp.ang2vec(
        0.5 * np.pi - chain['dec'], chain['ra'])
        * np.atleast_2d(chain['dist']).T).T)

fig = plt.figure(frameon=False)
n = 1 if opts.projection else 2
gs = gridspec.GridSpec(
    n, n, left=0.01, right=0.99, bottom=0.01, top=0.99,
    wspace=0.05, hspace=0.05)

imgwidth = int(opts.dpi * opts.figure_width / n)
s = np.linspace(-opts.max_distance, opts.max_distance, imgwidth)