Skip to content

Instantly share code, notes, and snippets.

@zonca
Created October 11, 2012 16:51
Show Gist options
  • Select an option

  • Save zonca/3873810 to your computer and use it in GitHub Desktop.

Select an option

Save zonca/3873810 to your computer and use it in GitHub Desktop.
manual check on convoluted dipole
import numpy as np;import cPickle;from math import sin, cos, sqrt
dpcconv = np.load("dipole_27M_od100.npy")
dpcpnt = cPickle.load(open("pointing_DPC_LFI27M_100_DX9.pkl", 'rb'))
# sample 20000 of OD 100 LFI28S
p = 20000
scet = dpcpnt['sampleSCET'][p] # 1629538470557322
# relativistic add of:
# * array([-358207.23056827, 52584.17855399, -71298.55632771]), solar system v in Ecliptic
# * array([ 15365.93310211, 25552.08371841, -41.1044438 ]), sat vel from TOODI%planck%%satellite_velocity:2%
# with linear interpolation
#satvel = np.array([-342841.31190969, 78136.26503587, -71339.66371809])
# without interpolation
satvel=np.array([-342841.45634117, 78136.35515429, -71339.66220279])
satvel=np.array([-342841.31668029, 78136.24531505, -71339.6623914 ])
satvellen = np.linalg.norm(satvel)
unit_satvel = satvel/satvellen
#array([-0.9555319 , 0.21777327, -0.19883054])
xv = unit_satvel[0]; yv = unit_satvel[1]; zv = unit_satvel[2]
# ecliptic pointing dumped from the DPC
theta, phi, psi = dpcpnt['theta'][p], dpcpnt['phi'][p], dpcpnt['psi'][p]
# (2.0418090722029971, 4.0503768803711599, 1.0898327046766696)
x1 = cos(phi)*xv+sin(phi)*yv;
y1 = -sin(phi)*xv+cos(phi)*yv;
z1 = zv;
x2 = cos(theta)*x1-sin(theta)*z1;
y2 = y1;
z2 = sin(theta)*x1+cos(theta)*z1;
x3 = cos(psi)*x2+sin(psi)*y2;
y3 = -sin(psi)*x2+cos(psi)*y2;
z3 = z2;
#x3, y3, z3
#(-0.79213698076162264, -0.4004899513490765, 0.46057225554550629)
## LFI28S
#sx, sy, sz = 1.6633788116048607e-03,-6.6629002345089925e-04,9.9999839461297824e-01
## LFI27M
sx, sy, sz = 0.00155833450163,0.00064183510237,0.99999857981963
cosDir = (x3*sx+y3*sy+z3*sz); #0.45908013855376983
beta = satvellen/299792458.0 #0.0011968156493234777
gamma = 1./sqrt(1.-beta*beta)
TCMB = 2.725
manconv = (1./(gamma*(1. - beta*cosDir )) -1.)*TCMB
print "manconv[mK]:",manconv * 1e3 #1.4960788468
print "dpcconv[mK]:",dpcconv[p]*1e3 #1.496835981
print "diff[uK]:", (manconv - dpcconv[p])*1e6 #-0.757134200119
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment