SNR not computed in dynamic PSF?

I’m writing a Python script for Siril to calculate the optimal gain and exposure time for a specific subject.
I won’t go into details for now, but I would like to know if there’s a way to get the computed SNR from Siril.

I noticed that the value returned from get_image_stars() for SNR is 0.0, so I guess it is not computed.
The only way I can see it is by using the PSF/Photometry tool.

Alternatively, I can compute it for each star by implementing it in Python like this:

def compute_siril_SNR(I, sigma_bg, g, FWHM, half_fwhm_ratio, ri, re, Arcsec):

    r = FWHM * half_fwhm_ratio / (2 * Arcsec)  # aperture radius in px
    Ap = np.pi * r**2
    Np = np.pi * (re**2 - ri**2)  # number of pixels in the background annulus

    Noise = np.sqrt(I/g + Ap * sigma_bg**2 *(1 + Ap / Np))

    SNR = 10*np.log10(I / Noise)
    #SNR = I / Noise
    return SNR

where:

I=10**(-0.4 * star['Mag'])

and as sigma_bg I take the value of bgnoise returned from the stat command.

Now, the values I get are quite similar to the ones computed in Siril, but a bit underestimated.
If SNR computation is not supported by Siril commands, I will continue to use my Python implementation.
However, I have some doubts about the formula. For example, since bgnoise is the background standard deviation (computed over a large number of pixels, I suppose), should I use a large Np, making Ap/Np << 1?

Thanks!

Snr is only computed when doing aperture photometry which is not done with dynamic psf.

1 Like