Skip to content

BasicPSFPhotometry Flux Error #765

@mshemuni

Description

@mshemuni

I am so sorry if I am doing anything wrong but I couldn't find any solution.
Am I missing something? Why there is no Flux Error output in BasicPSFPhotometry?
I'm using it as:

from photutils.psf import BasicPSFPhotometry
from photutils.psf import DAOGroup
from photutils.psf import IntegratedGaussianPRF
from photutils.background import MMMBackground
from astropy.modeling.fitting import LevMarLSQFitter
from astropy.stats import gaussian_sigma_to_fwhm
from astropy.io import fits

from numpy import asarray as ar

from astropy.table import Table

import sep
import numpy as np
import matplotlib.pyplot as plt

sigma_psf = 2.0
daogroup = DAOGroup(2.0 * sigma_psf * gaussian_sigma_to_fwhm)
psf_model = IntegratedGaussianPRF(sigma=sigma_psf)
fitter = LevMarLSQFitter()
mmm_bkg = MMMBackground()

fits_name = "M11-002_ug05.new" # Fits file.

f = open("reg.txt", "r") #List of objects (x, y) for psf
ret = []
for i in f:
    ln = i.replace("\n", "")
    x, y = ln.split()
    ret.append(ar([float(x), float(y)]))
    
ret = ar(ret)

    
coords = Table(ret, names=('x_0', 'y_0')) #The coordinates Table


hdu = fits.open(fits_name)
data = hdu[0].data.astype(float)
data = data.astype(np.float64)
bkg = sep.Background(data)

data_sub = data - bkg
photometry = BasicPSFPhotometry(group_maker=daogroup, bkg_estimator=mmm_bkg,
                                psf_model=psf_model, fitter=LevMarLSQFitter(),
                                fitshape=(11,11))

sep_result_tab = photometry(image=data_sub, positions=coords)
sep_residual_image = photometry.get_residual_image()
plt.imshow(sep_residual_image)
plt.title('Residual')
plt.colorbar(orientation='horizontal', fraction=0.046, pad=0.04)


print(sep_result_tab)
print(sep_result_tab.colnames)

output:

    x_0         y_0     ...       x_0_unc             y_0_unc
----------- ----------- ... ------------------- -------------------
1204.716126 1239.988421 ...                 0.0                 0.0
1204.716126 1239.988421 ...                 0.0                 0.0
1204.716126 1239.988421 ...                 0.0                 0.0
1204.716126 1239.988421 ...                 0.0                 0.0
1204.716126 1239.988421 ...                 0.0                 0.0
1204.716126 1239.988421 ...                 0.0                 0.0
1067.828737 1179.550761 ... 0.17676775088595734 0.17638465154253274
877.4966182 1578.981829 ...                 0.0                 0.0
877.4966182 1578.981829 ...   63148.69207414864   63148.69207414864
1666.469246 903.3117743 ...  0.2755756356098592 0.27502723937193735
        ...         ... ...                 ...                 ...
669.5066207 808.0087334 ...                 0.0                 0.0
669.5066207 808.0087334 ...  105475.95751886825  105475.95751886825
617.6557483 498.7299395 ...  0.1983896640821896 0.19809203034034592
 551.207172 1199.130921 ... 0.31119025147669616  0.3112789537078123
 558.322849 1771.690153 ... 0.18369264561099935 0.18360679222498866
533.9896751  621.071204 ... 0.22331777224460114  0.2231522273125031
492.8749846 686.4277096 ...  0.1628240191531227  0.1630622208832614
460.9681137 676.2409719 ... 0.21381113026330384 0.21387790722841832
459.6336827 1087.464226 ... 0.16483372066804355 0.16510861489211362
432.8027083 1026.363884 ...  0.3543833336722678   0.353688461975709
300.1361837   1045.1551 ...  0.3549382517270927  0.3550791145324043
Length = 846 rows
['x_0', 'y_0', 'flux_0', 'id', 'group_id', 'x_fit', 'y_fit', 'flux_fit', 'flux_unc', 'x_0_unc', 'y_0_unc']

and there's nothing about error in columns.
If it's natural to not have any error column, how to calculate the error?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions