astrorama / SourceXtractorPlusPlus

SourceXtractor++, the next generation SExtractor
https://astrorama.github.io/SourceXtractorPlusPlus/
GNU Lesser General Public License v3.0
72 stars 9 forks source link

More flexible priors #531

Open rgavazzi opened 1 year ago

rgavazzi commented 1 year ago

Trying to limit the number of faulty low snr fits for sources near a brighter one (leading to large and elongated sources most often). I've played with priors on the source size (for single Sersic fit), but I think I've reached the limits of flexibility of the built-in priors in the code. So, I was wondering if it could be possible to improve the simple Gaussian that could apply to more than one free parameter at a time. It could take the form of a lambda function, right?

add_prior( lambda x,y : myfunction(x,y), freepar1, freepar2 ) ??? Bearing in mind how this term is added to the likelihood term (or chi2).

My current understanding is that the penalty is -2*log( prior_pdf(x) )... which is equivalent to (x-xm)^2 / sigma_x^2 for Gaussian.

the example above would do the job for 2 coupled parameters but ideally the possibility to use an array of free parameters (and assuming myfunction( x::array ) would quite often matrix multiply x with a covariance matrix xT C^-1 x ).