Saturated stars cause a halo of light, and any stars that are inside this halo shouldn't be analyzed with this method.
We could do an investigation into how to build the halo shape of a saturated star, in order to remove it.
A good first approach might be to take the FFIs, identify the saturated stars, and come up with a data-driven approach to choose which pixels to remove/discount because they are in a halo.
We need a diagnostic for the source_mask and uncontaminated_source_mask, so that we can see if they are performing well. We need something like a quick panel of figures to show what these masks are cutting out, some simple graphs will be perfect.
At the moment there is a build_model and fit_model step. This is great. When we run fit_model, it is actually iterating. This is not what we want, we want a first step to build the model, which iterates to remove significant outliers, and then a second step which fits that model.
At the moment, build_machine selects which TPFs/sources to run on itself. It would be very useful to allow the user to specify their own mask, which would select which TPFs to build the model on. By doing this, we could pass in additional TPFs that we might want to train on. This would augment the masks that go on under the hood.
Possible use case:
We should pass in two copies of the same (uncontaminated) TPF, one original copy, and one copy where e.g. half the pixels have been removed (a test copy). We should train only on original copies, and then apply the model to both the copies. By comparing the resultant light curves, we'll be able to see how good our method is at returning the true flux.
I'm testing out psfmachine, and have come across the following issue. It looks like Gaia is not identifying all the targets in TPFs. This is a test of the 100 TPFs around K2-18.
You can see lots of TPFs aren't highlighted. I set a pretty tolerant magnitude limit (down to 20th magnitude) and they still aren't being found. This -could- be a bandpass problem, but I'm not sure. It seems like we might have to rely on both Gaia (for source positions and source identification) and the original mission input catalogs (for additional source identification) . This creates a bit of a nasty crossmatch problem.
I've been testing PSF machine on some K2 data. It seems like there is a problem with the model fit. I am using 100 TPFs, and psfmachine gives the following fit:
This is not a good fit to the data. It does this whether I use bin=True or bin=False.