img = arch[0].data flux20 = hdr['FLUX20'] # Suma de cuentas en un apertura circular pos_ver = 650 pos_hor = 750 radius = 50 counts = 0.0 max_val = np.max(img) for ver in range(pos_ver-radius,pos_ver+radius+1): for hor in range(pos_hor-radius,pos_hor+radius+1): r2 = radius**2 if (ver-pos_ver)**2 + (hor-pos_hor)**2 <= r2: # Se suman las cuentas dentro de la apertura counts += img[ver][hor] if 0.98*r2 <= (ver-pos_ver)**2 + (hor-pos_hor)**2 <= 1.02*r2: # Se "pintan" los pixeles del borde para dibujar la apertura sobre la imagen img[ver][hor] = max_val # Fórmula mágica: F/F0 = counts/(10**8 * flux20) FF0 = counts / ( 10**8 * flux20 ) print "F/F0 = %f" % FF0 # Cálculo de magnitud mag = -2.5 * np.log10(FF0) print "Magnitud = %f" % mag # Ahora se grafica la imagen from fits_lib import plot_image title = "Magnitud Calculada = %f\nApertura Circular en (%d,%d) con radio = %d" % (mag,pos_ver,pos_hor,radius) plot_image(img,log_scale=True,title=title)
#!/usr/bin/env python # encoding: utf-8 # Este programa revisa el header y la matriz de datos correspondiente a los archivos m64.fits, m83.fits, fpC-005183-u2-0406.fit from fits_lib import plot_image, get_fits_matrix, get_fits_header, print_header hdr1 = get_fits_header('m64.fits') img1 = get_fits_matrix('m64.fits') print "\n>> ARCHIVO 1:\n" print_header(hdr1) plot_image(img1) hdr2 = get_fits_header('m83.fits') img2 = get_fits_matrix('m83.fits') print "\n>> ARCHIVO 2:\n" print_header(hdr2) plot_image(img2) hdr3 = get_fits_header('fpC-005183-u2-0406.fit') img3 = get_fits_matrix('fpC-005183-u2-0406.fit') print "\n>> ARCHIVO 3:\n" print_header(hdr3) plot_image(img3) plot_image(img3,log_scale=True)
__author__ = 'Sebastian' import metodos_t1 as mt import pyfits import numpy as np from flux20_lib import * from fits_lib import plot_image, get_fits_matrix, get_fits_header, print_header f1 = "out/blank.fits" f2 = "res/stellar.dat" f3 = "res/galaxy.dat" arch = pyfits.open(f1,mode="update") #mt.addStellarCatalog(arch,f2) mt.addGalaxyCatalog(arch,f3) arch.flush() arch.close() le = pyfits.open(f1) from fits_lib import plot_image blurred_img = le[0].data #blurred_img = mt.convolvePSF(le, 10) #blurred_img = mt.addNoise(le, 10000) #blurred_img = mt.addBackground(le,100) plot_image(blurred_img,log_scale=True,title=r'$\mathrm{\mathbb{Objetos\,del\,cat\acute{a}logo\,marcados\,con\,signo\,\plus}}$')
#!/usr/bin/env python # encoding: utf-8 # Este programa revisa el header y la matriz de datos correspondiente al archivo fpC-000756-r1-0205.fit from fits_lib import plot_image, get_fits_matrix, get_fits_header, print_header hdr1 = get_fits_header("fpC-000756-r1-0205.fit") img1 = get_fits_matrix("fpC-000756-r1-0205.fit") print "\n>> ARCHIVO 1:\n" print_header(hdr1) plot_image(img1) plot_image(img1, log_scale=True)