示例#1
0
def test_thermodynamic_temperature():
    nu = 143 * u.GHz
    tb = 0.0026320518775281975 * u.K
    np.testing.assert_almost_equal(
        tb.value, (1 * u.MJy/u.sr).to_value(
            u.K, equivalencies=u.thermodynamic_temperature(nu, T_cmb=2.7255 * u.K)))
    np.testing.assert_almost_equal(
        1.0, tb.to_value(
            u.MJy / u.sr, equivalencies=u.thermodynamic_temperature(nu, T_cmb=2.7255 * u.K)))
def test_thermodynamic_temperature():
    nu = 143 * u.GHz
    tb = 0.0026320518775281975 * u.K
    np.testing.assert_almost_equal(
        tb.value, (1 * u.MJy/u.sr).to_value(
            u.K, equivalencies=u.thermodynamic_temperature(nu, T_cmb=2.7255 * u.K)))
    np.testing.assert_almost_equal(
        1.0, tb.to_value(
            u.MJy / u.sr, equivalencies=u.thermodynamic_temperature(nu, T_cmb=2.7255 * u.K)))
示例#3
0
def test_thermodynamic_temperature():
    nu = 143 * u.GHz
    tb = 0.0026320501262630277 * u.K
    eq = u.thermodynamic_temperature(nu, T_cmb=2.7255 * u.K)
    np.testing.assert_almost_equal(
        tb.value, (1 * (u.MJy / u.sr)).to_value(u.K, equivalencies=eq))
    np.testing.assert_almost_equal(
        1.0, tb.to_value(u.MJy / u.sr, equivalencies=eq))
示例#4
0
from pixell import enmap, enplot, utils
import matplotlib.pyplot as pl
import numpy as np
from astropy.convolution import convolve, Gaussian2DKernel
from astropy import units as u
from astropy.cosmology import Planck15

# 3deg by 3deg map with 0.5 arcmin pixels, so 360 by 360 pixels
m = np.zeros((360, 360)) * u.mJy / u.sr
# Inject a fake source with 200 mJy, because this is a delta model, the flux density per solid angle will be 200 mJy / (area of each pixel)
m[180, 180] = 200 / np.radians(0.5 / 60.0)**2 * u.mJy / u.sr

# this is to transform Jy/(solid angle) to thermo kelvin
equiv = u.thermodynamic_temperature(90 * u.GHz, Planck15.Tcmb0)
m2 = m.to(u.uK, equivalencies=equiv)

# I will convolve the image with a gaussian beam of 2 arcmin FWHM. The sigma of that gaussian is 2/2.355. Because astropy works with kernels in pixel space, we divide by 0.5 arcmin per pixel
sigma = 2.0 / 2.355 / 0.5
print('The sigma of the gauss kernel is ', sigma, ' pixels')

kernel = Gaussian2DKernel(sigma)
m_conv = convolve(m2, kernel)
# make sure the convolution conserves the mean of the map
print('Is the mean conserved by the convolution ? ', np.sum(m2),
      np.sum(m_conv))

pl.imshow(m_conv[160:200, 160:200], vmin=0.0, vmax=3000)
pl.colorbar()
#pl.show()

# Now I load an enmap map that is 3deg by 3deg with 0.5 arcmin per pixel, and I replace its values with the values on m_conv