Closed coclar closed 1 year ago
Ah, I am glad someone is on to this; is this the only problem? I was aware that psf_reduce must be broken after various changes I had made.
I will add it in later today after I have dealt with an urgent issue. I guess you have tested that the changes work?
With this fix a psf_reduce
call does at least run to completion, and the resulting light curve looks reasonable, but the counts uncertainties seem to be overestimated. Not sure if that is an issue with the script or with my reduction file though, looking into it!
one way to over-estimate uncertainties is if you don't subtract any bias an estimate variance from the usual read**2+counts/gain equation. I have never checked psf_reduce's uncertainties in the past
Are you still looking at the issue of uncertainties? It occurs to me that it might be better to wait until that is fixed (if there is an issue) before merging, as it will only require an additional merge later otherwise. I am not developing psf_reduce at the moment so there is no risk of complications developing meanwhile
I'm still looking into it. The bias has been subtracted in advance, and I get reasonable uncertainties if I use a normal reduce
instead of psf_reduce
, so I don't think it's that. The uncertainties come directly from the photutils.BasicPSFPhotometry
object used for fitting. I'll keep digging...
Okay, I think I understand what was going wrong. photutils.BasicPSFPhotometry
does a least-squares fit, and estimates the flux uncertainties using the variance of the residuals. In my reduce file the gfac
parameter (which determines the separation below which stars are jointly fit) was too low, so neighbouring stars were not being subtracted when calculating the residuals and the resulting variance was huge.
An additional problem is that there seems to have been some tracking issues in the observations I'm trying to reduce, so stars are noticeably elongated, and the circular PSF does not fit well. I've whipped up an elliptical version of the Moffat and Gaussian PSFs, but will need some time to get them to work reliably...
might not be tracking -- I don't know which data you are looking at, but I noticed some elongation on one night which I am pretty sure is the result of the NTT active optics. But it might not matter one way or the other.
This was hipercam+GTC data. It might not be tracking causing the elongation, but the tracking does also go haywire at some point, so hard to tell! In any case, it seems that elliptical PSF models might be useful for these cases, so I'll try to get this working and update the pull request.
that would be of general use I think.
psf_reduce.py no longer worked due to the
cmax
key not being included in the results dictionary returned byextractFlux()
. This fixes the issue by copying the relevant parts from reduce.py.