want to create a file for each cluster that contains AGC galaxies in a fixed radial and redshift cut around the cluster.
DR < 3 deg (what we have used in the past, bigger than R200 by a lot)
delta v < 4000 km/s (big enough to include +/- 3 sigma for coma)
I have a program that does this already, but for the Local Cluster Survey sample.
In [1]:
import numpy as np
from matplotlib import pyplot as plt
from astropy.io import fits
%matplotlib inline
# read in AGC catalog
agcfile='/Users/rfinn/research/AGC/agcnorthminus1.fits'
agc=fits.getdata(agcfile)
agc.columns
Out[1]:
In [2]:
# create a figure of Dec vs RA for AGC galaxies
plt.figure()
plt.plot(agc.RA,agc.DEC,'k.',markersize=1,alpha=.1)
plt.xlabel('RA (deg)')
plt.ylabel('Dec (deg)')
plt.show()
In [3]:
infile=open('sample.dat','r')
ra=[]
dec=[]
vr=[]
name=[]
for line in infile:
#print line
t=line.split()
name.append(t[0])
ra.append(float(t[1]))
dec.append(float(t[2]))
vr.append(float(t[3]))
# convert the lists into an array
ra=np.array(ra,'f')
dec=np.array(dec,'f')
vr=np.array(vr,'f')
In [4]:
# make an array that that combines the AGC optical recession velocity and HI recession velocity
# if optical vr exists, use that
# if optical vr is unknown, use the HI recession velocity
agcvr=agc.VOPT*(agc.VOPT > 0) + agc.V21*(agc.VOPT == 0)
for i in range(len(name)):
print name[i],vr[i]
keepflag = (np.sqrt((ra[i] - agc.RA)**2 + (dec[i]-agc.DEC)**2) < 3.) & (abs(vr[i] - agcvr) < 4000.)
outfile=name[i]+'_AGC.fits'
fits.writeto(outfile,agc[keepflag],clobber=True)
In [5]:
plt.figure()
plt.plot(agc.VOPT,agc.V21,'bo')
plt.xlabel('AGC optical velocity')
plt.ylabel('HI recession velocity')
plt.axis([0,12000,0,12000])
plt.figure()
plt.hist(agcvr,bins=np.arange(0,12000,500),normed=True)
plt.hist(agcvr[keepflag],bins=np.arange(0,12000,500),color='r',normed=True)
print min(agcvr[keepflag])
In [ ]: