pmelchior / scarlet2

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

Multi-Gaussian initialization / parameterization #49

Open pmelchior opened 2 months ago

pmelchior commented 2 months ago

PR #47 brings a single Gaussian morphology that is measured from the data in the largest box we deem safe. This approach and the multi-component capability from #44 allow for a more capable parameterization.

  1. Start with a small box, maybe 5x5
  2. Cut out the observations in that box: $I$
  3. Measure the average $F_e=\langle F\rangle$ over all the pixels at the edge. If the edge flux is close to noise limit or different from the peak flux: stop.
  4. Subtract avg. edge flux from the data in the box: $I \leftarrow I - F_e$
  5. Measure the integrated spectral flux $F$ and the moments of $I$.
  6. Define a GaussianMorphologyfrom these moments.
  7. Define an ArraySpectrum from $F / \mathrm{morph.sum()}$.
  8. Define a Source from the spectrum and morphology.
  9. Subtract the source model from the original observation. This amounts to removing a Gaussian excess from the inner box, leaving a flat-ish plateau in the center, with larger wings further out.
  10. Increase the box size by some amount, maybe +10 pixels, or such that the inner (elliptical) Gaussian is well contained.
  11. Go to step 2 and add the result as a new component to the inner source.

At the end of this procedure, deconvolve from the PSF as explained in #48.

This procedure creates a list of nested Gaussian components, each with its own spectrum, where the inner ones are piled on top of the outer ones. We should return this source with its multiple components because this is a totally valid parameterization of many complex galaxies. One could enforce that all components are centered at the same place, but I don't think we need to.

One could also flatten them into a free-form ArrayMorphology by computing the flux-weighted average morphology of all components.

SampsonML commented 2 months ago

Perhaps I am misunderstanding, for the fitting, do I not want to git a Gaussian morphology based on the deconvolution? I.e --> steps 1-5 identical -- >step 5.5: get the deconvolved moments from #48 --> proceed to step 6

Or, do you mean get the moments from the originally fitted Gaussian, then deconvolve those moments, then build a new Gaussian discarding the previous one made with steps 1-10?