CosmoStat / wf-psf

Data-driven wavefront-based PSF modelling framework.
MIT License
19 stars 9 forks source link

Explore a non-parametrical version of the wf-psf model #12

Closed tobias-liaudat closed 3 years ago

tobias-liaudat commented 3 years ago

Try out if we can add an additive non-parametric layer to the OPD.

Later we could see if it is worth to add a non-parametric layer at the pixel level so that it can cope with effects happening at the pixel level. Nevertheless, this would mean that we should have a dataset that include these effects.

How can we represent the variability of the PSF?

How to validate this approach?

tobias-liaudat commented 3 years ago

To Do

For this I might need to define a custom training. First optimise the parametric part with the non-parametric part set to zero. At this point initialise the non-parametric model to a non-zero value. Then fix the parametric part and optimise over the non-parametric part.

To consider:

Next step

After this done, the next step is to define a non-parametric model that does not have polynomial variation. This would imply that we need to handle the batch indexes. Depending on which indexes the batch uses we are going to optimise over certain columns of the A matrix (MCCD nomenclature).

tobias-liaudat commented 3 years ago

First results

Trying to model a complex dataset, Zernike order 45, with a lower number of Zernike polynomials. Both trained in 20 epochs.

Dataset z=45, model z=15

model_15_psfs model_15_mat

Dataset z=45, model z=45

model_45_psfs model_45_mat

Quantitative results

Model z order train RMSE test RMSE
15 2.7169e-04 2.5854e-04
45 2.0343e-04 2.0001e-04
tobias-liaudat commented 3 years ago

First results using a naive non-parametric model

Using polynomial variations right now for the eigenOPDs.

Details of the model: Parametric: Adam , lr=1e-2, epochs=20, 15 Zernike order, max polynomial variation degree is 2 Non-parametric: Adam , lr=1.0, epochs=100, max polynomial variation degree is 3

Details of the dataset: 45 Zernike order, max polynomial variation degree is 2

Quantitative

Model z order train RMSE test RMSE
15 2.7169e-04 2.5854e-04
45 2.0343e-04 2.0001e-04
15 + nonparam 9.5326e-05 9.3800e-05

Qualitative

Learned eigenOPDS

Screenshot 2021-02-01 at 12 04 27

Learned alpha matrix

Screenshot 2021-02-01 at 13 43 40

Loss function of parametric estimation

Screenshot 2021-02-01 at 13 49 51

Loss function of non-parametric estimation

Screenshot 2021-02-01 at 13 49 26
tobias-liaudat commented 3 years ago

Before closing this issue I'll share more plots to analyse the first results comparing:

It's interesting to see that:

All the plots are for one random test star.

OPD

OPDs

Zernike coefficients

zernike coefficients

OPD and PSFs

psf_1

psf_2

psf_3