import healpy as hp
import numpy as np
import matplotlib.pyplot as plt
from pysm3 import units as u
import pysm3 as pysm
%matplotlib inlinenp.random.seed(4)nside = 128dip = hp.synfast([0,1], lmax=1, nside=nside) * u.V/home/zonca/zonca/p/software/healpy/healpy/sphtfunc.py:438: FutureChangeWarning: The order of the input cl's will change in a future release.
Use new=True keyword to start using the new order.
See documentation of healpy.synalm.
category=FutureChangeWarning,
/home/zonca/zonca/p/software/healpy/healpy/sphtfunc.py:824: UserWarning: Sigma is 0.000000 arcmin (0.000000 rad)
sigma * 60 * 180 / np.pi, sigma
/home/zonca/zonca/p/software/healpy/healpy/sphtfunc.py:829: UserWarning: -> fwhm is 0.000000 arcmin
sigma * 60 * 180 / np.pi * (2.0 * np.sqrt(2.0 * np.log(2.0)))
hp.mollview(dip, unit=dip.unit)
We measure the sky with out broadband instrument, we assume we only measure the CMB solar dipole, initially the units are arbitrary, for example Volts of our instrument.
Next we calibrate on the solar dipole, which is known to be 3.3 mK.
calibration_factor = 2 * 3.3 * u.mK_CMB / (dip.max() - dip.min())calibration_factortheta, phi = hp.pix2ang(nside, np.arange(hp.nside2npix(nside)))dust_amplitude_V = 2 * u.V
dust_latitude = 20 * u.degdust = dust_amplitude_V * np.logical_and(theta > (90 * u.deg - dust_latitude).to_value(u.rad), theta < (90 * u.deg + dust_latitude).to_value(u.rad))hp.mollview(dip + dust, unit=dip.unit, title="CMB dipole + dust")
calibrated_dip = calibration_factor * dipFor a delta frequency it is straightforward to compute the temperature of the dust in any unit:
calibrated_dust_amplitude = dust_amplitude_V * calibration_factorcalibrated_dust_amplitudeFirst we simplify and consider a delta-frequency instrument at 300 GHz
center_frequency = 300 * u.GHzcalibrated_dust_amplitude.to(u.mK_RJ, equivalencies=u.cmb_equivalencies(center_frequency))calibrated_dust_amplitude.to(u.MJy/u.sr, equivalencies=u.cmb_equivalencies(center_frequency))Broadband instrument
Next we assume instead that we have a broadband instrument, of 20% bandwidth, with uniform response in power (Spectral radiance) in that range. For simplicity, we only take 4 points.
freq = [270, 290, 310, 330] * u.GHzweights = [1, 1, 1, 1]weights /= np.trapz(weights, freq)weightsThe instrument bandpass is defined in power so we can transform our signal in MJy/sr at the 4 reference frequencies, then integrate.
Dust model
Let’s assume for the dust a power-law model with a spectral index of 2 (more realistic models use a modified black body), i.e.:
$I_{dust}()= A_{dust}(_0)( )^2 $
in the case of a delta-bandpass, $A_{dust}(_0)$ would coincide with the measured value:
A_dust_delta_bandpass = calibrated_dust_amplitude.to(u.MJy/u.sr, equivalencies=u.cmb_equivalencies(center_frequency))A_dust_delta_bandpass${dust}()= A{dust}(_0)g() ( )^2 d$
${dust}()= A{dust}(_0)g() ( )^2 d$
I_dust_bandpass = A_dust_delta_bandpass * np.trapz(weights * (freq**2/center_frequency**2), freq)SR = u.MJy/u.srSR_to_K_CMB = ((1*SR).to(u.mK_CMB, equivalencies=u.cmb_equivalencies(freq)))/(1*SR)SR_to_K_CMBSR_to_K_CMB_bandpassintegrated = np.trapz(1/SR_to_K_CMB * weights, freq)A_dust_bandpass = calibrated_dust_amplitude * SR_to_K_CMB_bandpassintegrated / np.trapz(weights * (freq**2/center_frequency**2), freq)A_dust_bandpass(A_dust_bandpass / A_dust_delta_bandpass).to(u.pct)Crosscheck starting from the dust model
integrate the model over the bandpass in SR
A_dust_bandpass * np.trapz(weights * (freq**2/center_frequency**2), freq)Convert to
_ / SR_to_K_CMB_bandpassintegrated