Exemple #1
0
 def test_prepare_for_M3(self):
     '''Saves pointing array for comparing with M3'''
     read_exchange([self.chlfi], ods = [100], discard_flag = False,type='R')
     span = 56300
     obt = self.chlfi.f.obtx[:span]
     pnt = Pointing(obt, coord='E')
     vec = pnt.get(self.chlfi)
     np.save('vec_LFI28M_OD100_E',vec)
     np.save('obt_LFI28M_OD100_E',obt)
Exemple #2
0
    def test_pointing_vs_dpc(self):
        '''Check pointing against LFI DPC'''
        # pointing extracted from DPC trieste
        dpc=cPickle.load(open('/u/zonca/p/issues/pointing/pointing100_DPC.pkl'))
        i_dpc = dpc['sampleOBT'].searchsorted(106793429004442.0)
        thetadpc=dpc['theta'][i_dpc]
        phidpc=dpc['phi'][i_dpc]
        psidpc=dpc['psi'][i_dpc]
        dpc['psi'] = dpc['psi'][i_dpc:]
        dpc['theta'] = dpc['theta'][i_dpc:]
        dpc['phi'] = dpc['phi'][i_dpc:]
        dpc['sampleOBT'] = dpc['sampleOBT'][i_dpc:]/2**16
        dpc['name'] = 'dpc'

        read_exchange([self.chlfi], ods = [100], discard_flag = False,type='R')
        i_te = 697
        te = {'sampleOBT':self.chlfi.f.obtx[i_te:],'name':'te'}
        #pnt = Pointing(self.chlfi.f.obtx[697:698],coord='E')
        pnt = Pointing(te['sampleOBT'],coord='E', deaberration=False, wobble=False, horn_pointing=False)
        vec = pnt.get(self.chlfi)
        thetav, phiv, psiv = pnt.get_3ang(self.chlfi)
        te['theta'] = thetav
        te['phi'] = phiv
        theta, phi, psi = thetav[0], phiv[0], psiv[0]
        print('Theta DPC %f testenv %f' % (thetadpc, theta))
        print('Phi DPC %f testenv %f' % (phidpc, phi))
        span = 32.5 * 60 * 10
        for angle in ['theta','phi','diff_theta','diff_phi']:
            plt.figure()
            if angle.startswith('diff'):
                a = angle.split('_')[1]
                plt.plot(d['sampleOBT'][:span], dpc[a][:span]-te[a][:span],label=a.capitalize() + ' difference')
            else:
                for d in [dpc,te]:
                    plt.plot(d['sampleOBT'][:span], d[angle][:span], label=d['name'])
            plt.legend();plt.grid()
            plt.title(angle.capitalize().replace('_',' '))
            plt.xlabel('OBT')
            plt.ylabel('%s [rad]' % angle)
            plt.savefig('%s_dpc_te.png' % angle)
        assert abs(thetadpc - theta) < self.TOLERANCE
        assert abs(phidpc - phi) < self.TOLERANCE
        assert abs(psidpc - psi) < self.TOLERANCE
Exemple #3
0
 def run(self):
     print('Reading data')
     read_exchange(self.f.ch, ods = [self.od], discard_flag = False,type='C')
     obt_good = testBit(self.f.commonflag,0)==0
     print('Preparing pointing')
     self.pnt = DiskPointing(self.od, self.freq, folder=self.folder)
     self.hitmap = np.zeros(healpy.nside2npix(self.nside))
     for ch in self.f.ch: 
         print('Processing rad %s' % ch)
         #theta, phi = self.ecl2gal(*self.pnt.get_ang(ch))
         theta, phi = self.pnt.get_ang(ch)
         ch_good = obt_good & (ch.flagx == 0) & (ch.pair.flagx == 0)
         print('Flagged %.2f perc' % (100*(len(ch_good)-ch_good.sum())/len(ch_good)))
         if len(theta[ch_good]) > 0:
             ids = np.bincount(healpy.ang2pix(self.nside, theta[ch_good], phi[ch_good], nest=True))
             self.hitmap[:len(ids)] += ids
         else:
             print('Skip channel')
     print('Writing to file')
     cPickle.dump(self.hitmap, open('/project/projectdirs/planck/user/zonca/issues/hitmap/pkl/%d_%d.pkl' % (self.freq,self.od),'wb'),protocol=-1)
Exemple #4
0
#TO BE RUN ON THE PLANCK CLUSTER
from dipole import *
from testenv import M3dipole
from testenv.remix import read_exchange
import matplotlib.pyplot as plt
from planck.LFI import LFI
from planck.pointing import Pointing

l.basicConfig(level=l.DEBUG,format='%(asctime)s %(levelname)-8s %(message)s')
lfi = LFI()
ch = lfi['LFI28M']
TOLERANCE = 3e-5
'''Test vs LFI DPC dipole OD100 LFI28M'''
obtx = np.load('/u/zonca/p/testenv/dipdpc/obt.npy') / 2**16
dipx = np.load('/u/zonca/p/testenv/dipdpc/dip.npy')
read_exchange([ch], ods = [100], discard_flag = True, type='C')
span = 32.5 * 60 * 10
obt = ch.f.obtx[:span]
pnt = Pointing(obt,coord='G')
det_dir = pnt.get(ch)
np.save('obt_LFI28M_OD100',obt)
dip = Dipole(obt,K_CMB=False, type='total_classic',coord='G')
dipole = dip.get(ch, det_dir)
diprel = Dipole(obt,K_CMB=False, type='total',coord='G')
dipolerel = diprel.get(ch, det_dir)
i = obtx.searchsorted(ch.f.obtx[0])
m3dip = M3dipole.Dipole().get(ch, obt)
plt.figure()
plt.plot(obtx[i:i+span],dipx[i:i+span],label='dpc')
plt.plot(obt,dipole,'r',label='te')
plt.plot(obt,dipolerel,'m',label='terel')
Exemple #5
0
 def test_prepare_for_dipole(self):
     '''Saves pointing array for testing dipole generation'''
     read_exchange([self.chlfi], ods = [100], discard_flag = False,type='R')
     pnt = Pointing(self.chlfi.f.obtx,coord='G')
     vec = pnt.get(self.chlfi)
     np.save('vec_LFI28M_OD100_G',vec)