Exemple #1
0
        #slice a section of the total image around each source to carry out flux analysis. For this, the point cannot lie too close to the edge.
        if x > 100 and y > 100 and x < (len(data[0]) - 100) and y < (
                len(data) - 100):  #cuts off edge noise within 100 pixels
            index_y.append(y)
            index_x.append(x)
            data_set = data[int(y - 15):int(y + 15), int(x - 15):int(x + 15)]
            centre = np.array(
                [14.0, 14.0])  #the centre is fixed due to the sliced section
            i_tot_flux, N = circ_apt_flux(data_set, centre, apt_size)
            tot_flux.append(i_tot_flux)  #find individual total flux
            i_err_tot_flux = np.sqrt(i_tot_flux)
            err_tot_flux.append(
                i_err_tot_flux)  #individual error in total flux
            i_loc_backgrnd, Na = ann_ref(data_set, centre, apt_size, ann_size)
            loc_backgrnd.append(i_loc_backgrnd)  #individual background
            i_source_flux = flux(data_set, centre, apt_size, ann_size)
            source_flux.append(i_source_flux)  #individual source flux
            i_mag = header["MAGZPT"] - 2.5 * np.log10(i_source_flux)
            mag.append(i_mag)  #individual apparent magnitude
            i_m_err = np.sqrt((header["MAGZRR"])**2 + (25 /
                                                       (4 * np.log(10)**2)) *
                              ((i_tot_flux + i_loc_backgrnd / Na) /
                               (i_source_flux**2)))
            m_err.append(i_m_err)  #individual error in m

    catalogue = [
        index_x, index_y, tot_flux, err_tot_flux, source_flux, loc_backgrnd,
        mag, m_err
    ]
    zip(*catalogue
        )  #converts the catalogue into the right format to be saved as a csv
import numpy as np
from astropy.io import fits

hdulist = fits.open('A1_mosaic.fits')


header = hdulist[0].header
data = hdulist[0].data

hdulist.close()

from photometry import flux
data_small = data[1450:1500,1200:1230]
counts = flux(data_small)
m = header["MAGZPT"] -2.5*np.log10(counts)
print(m)