Usamos un catálogo de galaxias identificadas en VVV en los tiles d010 y d0115 de Baravalle L.
Para saber donde estan ubicados los tiles usamos el mapa de VVV
En estos tiles encontraron 574 objetos con propiedades morfologicas, fotometricas y fotocromaticas propias de galaxias. 90 de los mismos han sido visualmente inspeccionados, y constituyen una muestra bona fide de galaxias en el VVV.
In [1]:
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from IPython.display import display
from astropy.io import ascii
from astropy.table import Table, Column
%matplotlib inline
In [2]:
from astroquery.irsa_dust import IrsaDust
Leo el catalogo de los restos del tile 010:
In [3]:
colnames = "ALPHA DELTA MAG_PSF_Ks MAGERR_PSF_Ks MAG_AUTO_Ks MAGERR_AUTO_Ks MAG_APER_Ks MAGERR_APER_Ks MAG_MODEL_Ks MAGERR_MODEL_Ks SPREAD_MODEL AMODEL_IMAGE BMODEL_IMAGE ELONGATION ELLIPTICITY A_IMAGE B_IMAGE KRON_RADIUS FLUX_RADIUS_02 FLUX_RADIUS_051 FLUX_RADIUS_08 SPHEROID_SERSICN CLASS_STAR MAG_PSF_H MAGERR_PSF_H MAG_AUTO_H MAGERR_AUTO_H MAG_APER_H MAGERR_APER_H MAG_PSF_J MAGERR_PSF_J MAG_AUTO_J MAGERR_AUTO_J MAG_APER_J MAGERR_APER_J C".split()
print colnames
In [4]:
d010 = ascii.read('./restos/RESTO_d010.cat', names=colnames)
In [5]:
d010
Out[5]:
Probamos la interfaz de IRSA dust extinction mediante tablas
In [54]:
coord_table = d010[['ALPHA', 'DELTA']]
rows_d010 = np.random.choice(len(coord_table), 20000)
submit_tab = coord_table[rows_d010]
submit_tab.add_column(Column(data=[2. for i in xrange(20000)], name='size'))
submit_tab.write('extinction_tab_d010.dat', format='ipac', names=['ra', 'dec', 'size'], overwrite=True)
Subimos la tabla creada en formato ipac para probar y funciona.
La cantidad de datos es enorme (750k filas) lo que nos obliga a adoptar otra estrategia.
In [10]:
from retrying import retry
@retry(stop_max_attempt_number=7)
def av(obj):
return IrsaDust.get_query_table(obj, section='ebv')['ext SandF mean']*3.1
def dered(row):
obj = str(row['ALPHA'])+' '+str(row['DELTA'])
av_SanF = av(obj)
AJ=0.28*av_SanF
AH=0.184*av_SanF
AKs=0.118*av_SanF
row['MAG_PSF_Ks_C']=row['MAG_PSF_Ks'] - AKs
row['MAG_APER_Ks_C']=row['MAG_APER_Ks'] - AKs
row['MAG_PSF_J_C']=row['MAG_PSF_J'] - AJ
row['MAG_APER_J_C']=row['MAG_APER_J'] - AJ
row['MAG_PSF_H_C']=row['MAG_PSF_H'] - AH
row['MAG_APER_H_C']=row['MAG_APER_H'] - AH
In [11]:
obj = str(test_table['ALPHA'][0])+' '+str(test_table['DELTA'][0])
av_SanF = IrsaDust.get_query_table(obj, section='ebv')['ext SandF mean']*3.1
Dejamos corriendo la correccion de la tablita.
In [12]:
from log_progress import log_progress
In [13]:
test_table = d010[0:200]
test_table['MAG_PSF_Ks_C'] = np.zeros(len(test_table))
test_table['MAG_APER_Ks_C'] = np.zeros(len(test_table))
test_table['MAG_PSF_J_C'] = np.zeros(len(test_table))
test_table['MAG_APER_J_C'] = np.zeros(len(test_table))
test_table['MAG_PSF_H_C'] = np.zeros(len(test_table))
test_table['MAG_APER_H_C'] = np.zeros(len(test_table))
%time for arow in log_progress(test_table, every=1): dered(arow)
In [14]:
test_table.write('corrected_resto_d010.dat', format='ipac')
Vemos que tarda demasiado en procesar tan solo 200 filas.
Es importante que sepamos que tarda mas
Finalmente en las celdas anteriores se seleccionaron 20000 objetos de muestra del tile d010 para realizar la correccion por extincion. Ahora se seleccionaran 20000 objetos mas del tile d115.
In [35]:
d115 = ascii.read('./restos/RESTO_d115.cat', names=colnames)
Abajo esta la celda usada para calcular los objetos para corregir. Pero ahora esta congelada para que no se sobreescriba el file.
In [57]:
d010 = ascii.read('./restos/RESTO_d010.cat', names=colnames)[rows_d010]
d115 = ascii.read('./restos/RESTO_d115.cat', names=colnames)[rows_d115]
In [75]:
exct_d010 = ascii.read('extinction_d010.tbl', format='ipac')
exct_d115 = ascii.read('extinction_d115.tbl', format='ipac')
La correccion es de la siguiente forma entonces:
In [71]:
d115['MAG_PSF_Ks_C']=d115['MAG_PSF_Ks'] - exct_d115['AV_SandF']*0.118
d115['MAG_APER_Ks_C']=d115['MAG_APER_Ks'] - exct_d115['AV_SandF']*0.118
In [72]:
d115['MAG_PSF_J_C']=d115['MAG_PSF_J'] - exct_d115['AV_SandF']*0.28
d115['MAG_APER_J_C']=d115['MAG_APER_J'] - exct_d115['AV_SandF']*0.28
In [73]:
d115['MAG_PSF_H_C']=d115['MAG_PSF_H'] - exct_d115['AV_SandF']*0.184
d115['MAG_APER_H_C']=d115['MAG_APER_H'] - exct_d115['AV_SandF']*0.184
Y para el tile d010
In [76]:
d010['MAG_PSF_Ks_C']=d010['MAG_PSF_Ks'] - exct_d010['AV_SandF']*0.118
d010['MAG_APER_Ks_C']=d010['MAG_APER_Ks'] - exct_d010['AV_SandF']*0.118
In [77]:
d010['MAG_PSF_J_C']=d010['MAG_PSF_J'] - exct_d010['AV_SandF']*0.28
d010['MAG_APER_J_C']=d010['MAG_APER_J'] - exct_d010['AV_SandF']*0.28
In [78]:
d010['MAG_PSF_H_C']=d010['MAG_PSF_H'] - exct_d010['AV_SandF']*0.184
d010['MAG_APER_H_C']=d010['MAG_APER_H'] - exct_d010['AV_SandF']*0.184
Ahora guardamos las tablas
In [79]:
d010.write('d010_resto.dat', format='ipac')
d115.write('d115_resto.dat', format='ipac')
In [ ]: