Loading [MathJax]/extensions/tex2jax.js
LSST Applications g0fba68d861+8796f1c9dc,g16d25e1f1b+33607d666a,g1ec0fe41b4+3ea9d11450,g1f759649c2+c17b94a1fc,g1fd858c14a+aebb9fd029,g2440f9efcc+8c5ae1fdc5,g35bb328faa+8c5ae1fdc5,g4d2262a081+5c8a4756fc,g53246c7159+8c5ae1fdc5,g56a49b3a55+5716f32fb1,g60b5630c4e+c17b94a1fc,g67b6fd64d1+3fc8cb0b9e,g78460c75b0+7e33a9eb6d,g786e29fd12+668abc6043,g8352419a5c+8c5ae1fdc5,g8852436030+e9e4df222f,g89139ef638+3fc8cb0b9e,g94187f82dc+c17b94a1fc,g989de1cb63+3fc8cb0b9e,g9ccd5d7f00+3d609152fb,g9d31334357+c17b94a1fc,g9f33ca652e+22d663a365,gabe3b4be73+8856018cbb,gabf8522325+977d9fabaf,gb1101e3267+3a8cf60186,gb89ab40317+3fc8cb0b9e,gc0af124501+acb716b74f,gcf25f946ba+e9e4df222f,gd6cbbdb0b4+1cc2750d2e,gd794735e4e+a4897207cf,gdb1c4ca869+be65c9c1d7,gde0f65d7ad+ff043aacb0,ge278dab8ac+6b863515ed,ge410e46f29+3fc8cb0b9e,gf35d7ec915+97dd712d81,gf5e32f922b+8c5ae1fdc5,gf618743f1b+c364d39d5f,gf67bdafdda+3fc8cb0b9e,w.2025.17
LSST Data Management Base Package
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
lsst.scarlet.lite.measure Namespace Reference

Functions

float calculate_snr (Image images, Image variance, np.ndarray psfs, tuple[int, int] center)
 

Function Documentation

◆ calculate_snr()

float lsst.scarlet.lite.measure.calculate_snr ( Image images,
Image variance,
np.ndarray psfs,
tuple[int, int] center )
Calculate the signal to noise for a point source

This is done by weighting the image with the PSF in each band
and dividing by the PSF weighted variance.

Parameters
----------
images:
    The 3D (bands, y, x) image containing the data.
variance:
    The variance of `images`.
psfs:
    The PSF in each band.
center:
    The center of the signal.

Returns
-------
snr:
    The signal to noise of the source.

Definition at line 30 of file measure.py.

35) -> float:
36 """Calculate the signal to noise for a point source
37
38 This is done by weighting the image with the PSF in each band
39 and dividing by the PSF weighted variance.
40
41 Parameters
42 ----------
43 images:
44 The 3D (bands, y, x) image containing the data.
45 variance:
46 The variance of `images`.
47 psfs:
48 The PSF in each band.
49 center:
50 The center of the signal.
51
52 Returns
53 -------
54 snr:
55 The signal to noise of the source.
56 """
57 py = psfs.shape[1] // 2
58 px = psfs.shape[2] // 2
59 bbox = Box(psfs[0].shape, origin=(-py + center[0], -px + center[1]))
60 overlap = images.bbox & bbox
61 noise = variance[overlap].data
62 img = images[overlap].data
63 _psfs = Image(psfs, bands=images.bands, yx0=cast(tuple[int, int], bbox.origin))[overlap].data
64 numerator = img * _psfs
65 denominator = (_psfs * noise) * _psfs
66 return np.sum(numerator) / np.sqrt(np.sum(denominator))