pmelchior / scarlet2

Scarlet, all new and shiny
MIT License
12 stars 2 forks source link

DEIMOS for Gaussian initializations #48

Open pmelchior opened 2 months ago

pmelchior commented 2 months ago

The Gaussian morphology inits from #47 amount to determine the moments of the observed image distribution. That means the forward pass will convolved them with the PSF again. It would be better if we could initialize them at their preconvolved values. And it turns out this can be done (as I derived here). There's an analytic mapping between the moments of the convolved $\lbrace G^\star \rbrace$, the deconvolved $\lbrace G \rbrace$, and the PSF moments $\lbrace P \rbrace$, which I conveniently summarized in Table 1:

Screenshot 2024-04-05 at 16 26 57

In this the moments are defined as $\lbrace I \rbrace_{i,j} = \int d^2x I(x)x_1^i x_2^j$. So, these equations can be directly inverted analytically. Even better, I coded up the entire shebang in C++ a long time ago: https://github.com/pmelchior/shapelens/blob/32393c390c8f8dada5448f120fbcd6d8ecb74e84/src/DEIMOS.cc#L89-L126

So, we should port this to python and add it to the measure module that will be brought from scarlet1 as part of #47.

arunkannawadi commented 1 month ago

I coded this up in Python a few years ago and would be happy to upstream it here from https://github.com/arunkannawadi/deimos/blob/master/deimos.py

pmelchior commented 1 month ago

Thanks, Arun. Matt has already copied my C++ code here: https://github.com/pmelchior/scarlet2/pull/47/files#diff-a1637f4d5cd86bd6354e3b353be9295d36b9a02b172bab1aea5d34e8a25fae4eR194