Link to column descriptions
column descriptions http://wise2.ipac.caltech.edu/docs/release/allwise/expsup/sec2_1a.html#ph_qual
In [1]:
from astroquery.irsa import Irsa
import astropy.units as u
import numpy as np
In [38]:
Irsa.ROW_LIMIT = 100000 # value of new row limit here.
# Irsa.query_region(catalog='wise_allsky_4band_p3as_psd',spatial='All-Sky')
table1 = Irsa.query_region("01h41m58.23s -46d33m57.4s", catalog='wise_allwise_p3as_psd', spatial='Box', width=1 * u.degree)
#add 1 degree = 4 min
table2 = Irsa.query_region("01h45m58.23s -46d33m57.4s", catalog='wise_allwise_p3as_psd', spatial='Box', width=1 * u.degree)
#subtract 1 degree = 4 min
table3 = Irsa.query_region("01h37m58.23s -46d33m57.4s", catalog='wise_allwise_p3as_psd', spatial='Box', width=1 * u.degree)
print len(table1),len(table2),len(table3)
In [69]:
from astropy.table import vstack
table = vstack([table1,table2,table3])
len(table)
Out[69]:
In [54]:
flags = []
for l1 in 'AB':
for l2 in 'AB':
for l3 in 'ABC':
for l4 in 'ABC':
flags.append(l1+l2+l3+l4)
In [70]:
from astropy.io import ascii
ascii.write(table, output='/Users/kelle/Desktop/wise.csv', delimiter=',')
In [3]:
from astropy.io import ascii
table = ascii.read('/Users/kelle/Desktop/wise.csv')
In [4]:
ph_qual = np.zeros(len(table)).astype(bool)
for flags in [l1+l2+l3+l4 for l1 in 'AB' for l2 in 'AB' for l3 in 'ABC' for l4 in 'ABC']: # same as cell above
ph_qual |= table["ph_qual"] == flags
print(sum(ph_qual))
In [5]:
good_data_index, = np.where( (table["cc_flags"]=='0000') & (table["ext_flg"]==0) & ph_qual)
len(good_data_index)
Out[5]:
In [6]:
good_data = table[good_data_index]
In [36]:
good_data.show_in_browser()
Out[36]:
Exercise 0
In [7]:
import matplotlib.pyplot as plt
import matplotlib
%pylab inline
In [23]:
w1 = good_data['w1mpro'].astype(float)
w2 = good_data['w2mpro'].astype(float)
w3 = good_data['w3mpro'].astype(float)
w4 = good_data['w4mpro'].astype(float)
In [24]:
plt.hist(w1)
plt.figure()
plt.hist(w2)
plt.figure()
plt.hist(w3)
plt.figure()
plt.hist(w4)
Out[24]:
In [ ]:
In [28]:
color1=w1-w2
plt.hist(color1)
Out[28]:
In [30]:
mean_color1 = np.mean(color1)
var_color1 = np.var(color1)
In [34]:
from scipy.stats import norm
In [31]:
def gaussian (x,mean,var):
return 1/np.sqrt(2*np.pi*var)*np.exp(-0.5*(x-mean)**2/var)
In [35]:
n,bins,bluh = plt.hist(color1,normed=True)
plt.plot(bins,gaussian(bins,mean_color1,var_color1))
plt.plot(bins,norm.pdf(bins,mean_color1,np.sqrt(var_color1)))
Out[35]:
In [37]:
color2=w1-w3
mean_color2 = np.mean(color2)
var_color2 = np.var(color2)
n,bins,bluh = plt.hist(color2,normed=True)
plt.plot(bins,norm.pdf(bins,mean_color2,np.sqrt(var_color2)))
Out[37]:
In [38]:
color3=w1-w4
mean_color3 = np.mean(color3)
var_color3 = np.var(color3)
n,bins,bluh = plt.hist(color3,normed=True)
plt.plot(bins,norm.pdf(bins,mean_color3,np.sqrt(var_color3)))
Out[38]:
In [ ]: