-
Notifications
You must be signed in to change notification settings - Fork 0
/
chip_b_rms.py
66 lines (36 loc) · 929 Bytes
/
chip_b_rms.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# -*- coding: utf-8 -*-
"""
Created on Thu Jun 18 12:09:05 2015
@author: david
"""
import numpy as np
import healpy as hp
from astropy.io import fits
import matplotlib.pyplot as plt
from IPython.utils.data import flatten
has=fits.open('/home/dweisberger/haslam_masked.fits')
ham=has[1].data.field(0)
flh=flatten(ham)
fha=np.array(flh)
Y = fha
free=fits.open('/home/dweisberger/freefree_mask.fits')
fre=free[1].data.field(0)
fra=flatten(fre)
ffa=np.array(fra)
Z = ffa
chip=fits.open('/home/dweisberger/chipass_masked.fits')
chi=chip[1].data.field(0)
chf=flatten(chi)
cfa=np.array(chf)
X = cfa
Xc = X.clip(0)
Yc = Y.clip(0)
Zc = Z.clip(0)
A = np.array([Yc, Zc, [1]*len(Xc)]).transpose()
a, b, mean = np.linalg.lstsq(A, Xc)[0]
b_array = np.linspace(0,.003,100)
rms_array = []
for d in b_array:
r = Xc - 0.039857512377487227*Yc - d*Zc
rms= np.sqrt(np.mean(r**2))
rms_array.append(rms)