In [2]:
import os
import warnings
import numpy as np
from sklearn.neighbors import BallTree
from astropy.io import fits as pf
import matplotlib.pyplot as plt
In [34]:
#Triton path to the data and random files
file1='../Data_Sets/Candidates_photoz_SpSh_shenzrange_tocluster.fits'
#Open the data with fits
data=pf.open(file1)[1].data
fdx = ((data.ra>=344.1) | (data.ra < 330))& (data.Ag<=0.21) & (data.zphotNW>=2.9) & (data.zphotNW<=5.4)
classification = (data.ypredBAG+data.ypredSVM+data.ypredRFC)
imag = 22.5-2.5*np.log10(data.iflux)
dx = ((data.zphotNW>=2.9) & (data.zphotNW<=5.4))& ((fdx) |(classification <2))# & (imag>20.2)
print np.shape(data[dx])
ra = data.ra[dx]
dec= data.dec[dx]
tbhdu=pf.BinTableHDU.from_columns([pf.Column(name='RA',format='D',array=ra),
pf.Column(name='DEC',format='D',array=dec)])
prihdr=pf.Header()
prihdr['COMMENT']="Catalog of high redshift quasars in the SpIES field with all cuts"
prihdu=pf.PrimaryHDU(header=prihdr)
hdulist = pf.HDUList([prihdu,tbhdu])
#hdulist=pf.HDUList(data[dx])
hdulist.writeto('../Data_Sets/Final_cutcand_pos.fits')
In [ ]: