I wrote this function to generate a Gaussian point spread function using Python, I wonder if my approach is correct or needs modification.
I wrote this function, but not sure if my approach is correct:
def generate_PSF(size, sigma):
"""
Generates a Gaussian Point Spread Function (PSF).
"""
x, y = np.meshgrid(np.linspace(-size/2, size/2, size), np.linspace(-size/2, size/2, size))
d = np.sqrt(x*x + y*y)
psf = np.exp(-d**2 / (2*sigma**2))
psf /= np.sum(psf) # Normalize the PSF
return psf
source https://stackoverflow.com/questions/76745253/generating-a-gaussian-point-spread-function-using-python
Comments
Post a Comment