Writing out regions of AGC

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]:
ColDefs(
    name = 'AGCNUMBER'; format = 'J'
    name = 'WHICH'; format = '1A'
    name = 'RA'; format = 'E'; unit = 'deg'
    name = 'DEC'; format = 'E'; unit = 'deg'
    name = 'A100'; format = 'J'; unit = 'arcsec'
    name = 'B100'; format = 'J'; unit = 'arcsec'
    name = 'MAG10'; format = 'J'; unit = 'mag'
    name = 'INCCODE'; format = 'J'
    name = 'POSANG'; format = 'J'
    name = 'DESCRIPTION'; format = '8A'
    name = 'BSTEINTYPE'; format = 'J'
    name = 'VOPT'; format = 'J'; unit = 'km/s'
    name = 'VERR'; format = 'J'; unit = 'km/s'
    name = 'EXTRC3'; format = 'J'
    name = 'EXTDIRBE'; format = 'J'
    name = 'VSOURCE'; format = 'J'
    name = 'NGCIC'; format = '8A'
    name = 'FLUX100'; format = 'J'
    name = 'RMS100'; format = 'J'
    name = 'V21'; format = 'J'
    name = 'WIDTH'; format = 'J'
    name = 'WIDTHERR'; format = 'J'
    name = 'TELCODE'; format = '1A'
    name = 'DETCODE'; format = 'J'
    name = 'HISOURCE'; format = 'I'
    name = 'STATUSCODE'; format = 'I'
    name = 'SNRATIO'; format = 'I'
    name = 'IBANDQUAL'; format = 'I'
    name = 'IBANDSRC'; format = 'I'
    name = 'IRASFLAG'; format = 'I'
    name = 'ICLUSTER'; format = 'I'
    name = 'HIDATA'; format = 'I'
    name = 'IPOSITION'; format = 'I'
    name = 'IPALOMAR'; format = 'I'
    name = 'RC3FLAG'; format = 'I'
)

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()


Read in RA and Dec of RASSCALS phase space sample


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')

Write a file for each cluster


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)


NRGb004 8343.0
NRGs027 8683.0
NRGs038 9976.0
NRGs076 8988.0
NRGs090 10269.0
NRGs110 10470.0
NRGs117 9926.0
NRGb128 8306.0
NRGb155 6706.0
NRGb177 7279.0
NRGb226 7304.0
NRGb244 7245.0
NRGb247 7056.0
NRGs317 9208.0
Abell2063 10410.0

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])


6419

In [ ]: