Example #1
0
    def __init__(self, nside=256, kind='IQU', absolute=False,
                 temperature=2.7255, summer=False):
        """
        Parameters
        ----------
        nside : int, optional
            The Healpix scene's nside.
        kind : 'I', 'QU' or 'IQU', optional
            The sky kind: 'I' for intensity-only, 'QU' for Q and U maps,
            and 'IQU' for intensity plus QU maps.
        absolute : boolean, optional
            If true, the scene pixel values include the CMB background and the
            fluctuations in units of Kelvin, otherwise it only represents the
            fluctuations, in microKelvin.
        temperature : float, optional
            The CMB temperature used to convert a temperature fluctuation into
            power fluctuation (if absolute is False). The default value is
            taken from Fixsen et al. 2009.
        summer : boolean, optional
            If true, Dome C summer weather conditions are assumed for the
            atmosphere.

        """
        if summer:
            self.atmosphere = Atmosphere(233., 0.05, 1.)
        else:
            self.atmosphere = Atmosphere(200., 0.015, 1.)
        SceneHealpixCMB.__init__(self, nside, kind=kind, absolute=absolute,
                                 temperature=temperature)
Example #2
0
def test():
    np.random.seed(0)
    scene = SceneHealpixCMB(256, kind='IQU')
    acq = PlanckAcquisition(150, scene, true_sky=SKY)
    obs = acq.get_observation()
    invNtt = acq.get_invntt_operator()
    chi2_red = np.sum((obs - SKY) * invNtt(obs - SKY) / SKY.size)
    assert abs(chi2_red - 1) <= 0.001
Example #3
0
    def __init__(self, d):
        """
        Parameters
        ----------
        nside : int, optional
            The Healpix scene's nside.
        kind : 'I', 'QU' or 'IQU', optional
            The sky kind: 'I' for intensity-only, 'QU' for Q and U maps,
            and 'IQU' for intensity plus QU maps.
        absolute : boolean, optional
            If true, the scene pixel values include the CMB background and the
            fluctuations in units of Kelvin, otherwise it only represents the
            fluctuations, in microKelvin.
        temperature : float, optional
            The CMB temperature used to convert a temperature fluctuation into
            power fluctuation (if absolute is False). The default value is
            taken from Fixsen et al. 2009.
        summer : boolean, optional
            If true, Dome C summer weather conditions are assumed for the
            atmosphere.

        """
        nside = d['nside']
        kind = d['kind']
        absolute = d['absolute']
        temperature = d['temperature']
        summer = d['summer']

        if summer:
            self.atmosphere = Atmosphere(233., 0.05, 1.)
        else:
            self.atmosphere = Atmosphere(200., 0.015, 1.)
        SceneHealpixCMB.__init__(self,
                                 nside,
                                 kind=kind,
                                 absolute=absolute,
                                 temperature=temperature)
Example #4
0
def write(on, off, r, nside, idet, theta_max=45, syb_f=None, NPOINTS=1):
    path = '/home/fincardona/Qubic/spatial_extension/maps/mono'
    scene = SceneHealpixCMB(nside, kind='I')
    grid = np.concatenate([np.linspace(cut_on, cut_off, res) 
                           for cut_on, cut_off, res in zip(on, off, r)])
    for nu in grid:
        q = MyQubicInstrument(
            filter_nu=nu, filter_relative_bandwidth=1/nu, 
            synthbeam_dtype=float, synthbeam_fraction=syb_f)
        sb = q.get_synthbeam(scene, idet, theta_max, NPOINTS=NPOINTS)
        sb_direct_ga = q.direct_convolution(
            scene, idet, theta_max, NPOINTS=NPOINTS)
        write_map(
            '%s/interfero/sb_nside{}_nu{:.3e}_idet{}_tmax{}_Npoints{}.fits'.
            format(nside, nu, idet, theta_max, NPOINTS) % path, 
            np.sum(sb, axis=0))
        write_map(
            '%s/direct_conv/dc_nside{}_nu{:.3e}_idet{}_tmax{}_sybf{}_Npoints{}.fits'.format(nside, nu, idet, theta_max, syb_f, 
            NPOINTS) % path, np.sum(sb_direct_ga, axis=0))
Example #5
0
def write(on, off, r, nside, idet, theta_max=45, syb_f=None):
    path = '/home/fincardona/Qubic/Compare_poly/maps/mono'
    scene = SceneHealpixCMB(nside, kind='I')
    grid = np.concatenate([
        np.linspace(cut_on, cut_off, res)
        for cut_on, cut_off, res in zip(on, off, r)
    ])
    sb = np.empty(12 * nside**2)
    for nu in grid:
        q = MyQubicInstrument(filter_nu=nu,
                              filter_relative_bandwidth=1 / nu,
                              synthbeam_dtype=float,
                              synthbeam_fraction=syb_f)
        sb = q.get_synthbeam(scene, idet, theta_max)
        sb_direct_ga = q.direct_convolution(scene, idet, theta_max)
        write_map(
            '%s/interfero/sb_nside{}_nu{:.3e}_idet{}_tmax{}.fits'.format(
                nside, nu, idet, theta_max) % path, sb)
        write_map(
            '%s/direct_conv/dc_nside{}_nu{:.3e}_idet{}_tmax{}_sybf{}.fits'.
            format(nside, nu, idet, theta_max, syb_f) % path, sb_direct_ga)
Example #6
0
    def __init__(self, d):
        """
        Parameters
        ----------
        nside : int, optional
            The Healpix scene's nside.
        kind : 'I', 'QU' or 'IQU', optional
            The sky kind: 'I' for intensity-only, 'QU' for Q and U maps,
            and 'IQU' for intensity plus QU maps.
        absolute : boolean, optional
            If true, the scene pixel values include the CMB background and the
            fluctuations in units of Kelvin, otherwise it only represents the
            fluctuations, in microKelvin.
        temperature : float, optional
            The CMB temperature used to convert a temperature fluctuation into
            power fluctuation (if absolute is False). The default value is
            taken from Fixsen et al. 2009.
        summer : boolean, optional
            If true, Dome C summer weather conditions are assumed for the
            atmosphere.

        """
        nside = d['nside']
        kind = d['kind']
        absolute = d['absolute']
        temperature = d['temperature']
        summer = d['summer']

        #################### Atmosphere emissivity - from JCH analysis of LLAMA site-testing data #############
        #### Atmosphere Temprature
        if d['TemperatureAtmosphere150'] is None:
            d['TemperatureAtmosphere150'] = 270.
        if d['TemperatureAtmosphere220'] is None:
            d['TemperatureAtmosphere220'] = 270.
        fT = scipy.interpolate.interp1d(
            [150., 220.],
            [d['TemperatureAtmosphere150'], d['TemperatureAtmosphere220']],
            fill_value="extrapolate")

        #### Atmosphere Emissivity
        if d['EmissivityAtmosphere150'] is None:
            d['EmissivityAtmosphere150'] = 0.081
        if d['EmissivityAtmosphere220'] is None:
            d['EmissivityAtmosphere220'] = 0.138
        fE = scipy.interpolate.interp1d(
            [150., 220.],
            [d['EmissivityAtmosphere150'], d['EmissivityAtmosphere220']],
            fill_value="extrapolate")

        self.atmosphere = Atmosphere(fT(d['filter_nu'] / 1e9),
                                     fE(d['filter_nu'] / 1e9), 1.)
        ########################################################################################################

        ################### Old code - Very wrong - Assumes an optimistic Dome C !!! ###########################
        # if summer:
        #     self.atmosphere = Atmosphere(233., 0.05, 1.)
        # else:
        #     self.atmosphere = Atmosphere(200., 0.015, 1.)
        ########################################################################################################

        SceneHealpixCMB.__init__(self,
                                 nside,
                                 kind=kind,
                                 absolute=absolute,
                                 temperature=temperature)
Example #7
0
    syb_ref = q.get_synthbeam(scene, idet, theta_max=theta_max)
    syb_ga = q.direct_convolution(scene, idet, theta_max=theta_max)
    return syb_ref, syb_ga

def deltaEoverE(fwhm150, scene, nu, idet, theta_max, syb_f):
    syb_ref, syb_ga = sybs(fwhm150, scene, nu, idet, theta_max, syb_f)
    return (np.sum(syb_ref) - np.sum(syb_ga)) / np.sum(syb_ref)

def residuals(fwhm150, scene, nu, idet, theta_max, syb_f):
    syb_ref, syb_ga = sybs(fwhm150, scene, nu, idet, theta_max, syb_f)
    syb_ref /= np.sum(syb_ref)
    syb_ga /= np.sum(syb_ga)
    return np.sum((syb_ref - syb_ga)**2)

nside = 1024   
scene = SceneHealpixCMB(nside, kind='I') 

nu = 150e9     #fixed
syb_f = 1      #fixed

det = np.arange(0, 992)

t_max = [30, 60] 

bounds = [0.37, 0.39]

fwhm150 = np.zeros((len(t_max), 2)) 
bar = progress_bar(len(det))
for idet in det:
    for j, theta_max in enumerate(t_max):
        fwhm150_energy = sp.optimize.brentq(