コード例 #1
0
ファイル: dr2_vs_ptf.py プロジェクト: kaylanb/thesis_code
import matplotlib.pyplot as plt
import numpy as np

import psql
import targets
import plots

#columns for dr2 and ptf data in psql db txt file
dr2_cols= range(10)
ptf_cols= range(10,17)
#loop over ptf50 to ptf200 dr2 matched files
a={}
for i in [50,100,150,200]:
    fn= '../truth_table_results/dr2_match_ptf%d.txt' % i
    dr2= psql.load_ofile(fn,dr2_cols) #data dictionary
    ptf= psql.load_ofile(fn,ptf_cols)
    a['p'+str(i)]={}
    a['p'+str(i)]['DR2']= targets.DECaLS(dr2, wise=False) #computes mags etc
    a['p'+str(i)]['PTF']= targets.PTF(ptf)
#plot
colors= plots.get_seaborn_colors()
#PTF r,g - DR2 r,g, all points same plot
fig,axes=plt.subplots(1,2,figsize=(12,8))
ax=axes.flatten()
plt.subplots_adjust(hspace=0.1,wspace=0.25)
#add pts
for cnt,key in enumerate(['p200','p150','p100','p50']):
    diff= a[key]['PTF'].data['rmag']- a[key]['DR2'].data['rmag']
    ax[0].scatter(a[key]['DR2'].data['rmag'], diff,c=colors[cnt],label=key[1:])
    diff= a[key]['PTF'].data['gmag']- a[key]['DR2'].data['gmag']
    ax[1].scatter(a[key]['DR2'].data['gmag'], diff,c=colors[cnt])
コード例 #2
0
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import os
import subprocess

import psql 
import targets
import plots

#load from \o psql dump
m_gal= psql.load_ofile('../truth_table_results/deep2_f2_matched_galaxy.txt',str_kws=['type'])
m_star= psql.load_ofile('../truth_table_results/deep2_f2_matched_star.txt',str_kws=['type'])
un_gal= psql.load_ofile('../truth_table_results/deep2_f2_unmatched_galaxy.txt')
un_star= psql.load_ofile('../truth_table_results/deep2_f2_unmatched_star.txt')
#matched have dr2 tractor catalog data, color cut 
targets.get_targets(m_gal)
targets.get_targets(m_star)

#base name for pngs
base= 'truth_v_dr2_'
#locations of matched, unmatched objects
kwargs=dict(s=50,facecolors='none',linewidths=2.)
plt.scatter(m_gal['dr2_ra'],m_gal['dr2_dec'],edgecolors='b',label='m_gal',marker='o',**kwargs)
plt.scatter(m_star['dr2_ra'],m_star['dr2_dec'],edgecolors='m',label='m_star',marker='*',**kwargs)
plt.scatter(un_gal['ra'],un_gal['dec'],edgecolors='g',label='un_gal',marker='o',**kwargs)
plt.scatter(un_star['ra'],un_star['dec'],edgecolors='y',label='un_star',marker='*',**kwargs)
plt.legend(loc=(1.01,0),scatterpoints=1)
plt.savefig('./'+base+'radec.png')
plt.close()
コード例 #3
0
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
import os
import subprocess

import psql
import targets
import plots

#load from \o psql dump
m_gal = psql.load_ofile('../truth_table_results/deep2_f2_matched_galaxy.txt',
                        str_kws=['type'])
m_star = psql.load_ofile('../truth_table_results/deep2_f2_matched_star.txt',
                         str_kws=['type'])
un_gal = psql.load_ofile(
    '../truth_table_results/deep2_f2_unmatched_galaxy.txt')
un_star = psql.load_ofile('../truth_table_results/deep2_f2_unmatched_star.txt')
#matched have dr2 tractor catalog data, color cut
targets.get_targets(m_gal)
targets.get_targets(m_star)

#base name for pngs
base = 'truth_v_dr2_'
#locations of matched, unmatched objects
kwargs = dict(s=50, facecolors='none', linewidths=2.)
plt.scatter(m_gal['dr2_ra'],
            m_gal['dr2_dec'],
            edgecolors='b',
            label='m_gal',
            marker='o',