Open keflavich opened 3 days ago
I'm also not sure that works, since make_model_image
uses _fit_model_params
, but that doesn't exist for the PSFPhotometry
instances I'm playing with.
with latest photutils, should be:
phot = PSFPhotometry()
result = phot(data)
bad = result['flux_fit'] <= 0
result = result[~bad]
phot._fit_model_params = phot._fit_model_params[~bad]
Quoting @larrybradley from https://github.com/astropy/photutils/pull/1800#issuecomment-2200314737:
To exclude negative peaks you should bound the flux parameter on the input psf_model, e.g, psf_model.flux.min = 0.
Fitted PSF photometry fluxes can go negative.
Can we include a mechanism to reject them using public methods?
Right now, you can reject them, but it requires modifying a private method. You need this if you're interested in using the residual image or model image. Example: