def analytic_ft(self, unit_x, unit_y): ''' Analytic fourier transform of a pixel aperture. Args: unit_x (`numpy.ndarray`): sample points in x axis. unit_y (`numpy.ndarray`): sample points in y axis. Returns: `numpy.ndarray`: 2D numpy array containing the analytic fourier transform. ''' xq, yq = np.meshgrid(unit_x, unit_y) return (sinc(xq * self.size_x / 1e3) * sinc(yq * self.size_y / 1e3)).astype(config.precision)
def generate_mtf(pixel_aperture=1, azimuth=0, num_samples=128): """Generate the 1D diffraction-limited MTF for a given pixel width and azimuth. Parameters ---------- pixel_aperture : `float` aperture of the pixel, microns. Pixel is assumed to be square azimuth : `float` azimuth to retrieve the MTF at, in degrees num_samples : `int` number of samples in the output array Returns ------- frequencies : `numpy.ndarray` unit axis, cy/mm mtf : `numpy.ndarray` MTF values (rel. 1.0). Notes ----- Azimuth is not actually implemented yet. """ pitch_unit = pixel_aperture / 1e3 normalized_frequencies = m.linspace(0, 2, num_samples) otf = m.sinc(normalized_frequencies) mtf = abs(otf) return normalized_frequencies / pitch_unit, mtf
def analytic_ft(self, unit_x, unit_y): """Analytic fourier transform of a pixel aperture. Parameters ---------- unit_x : `numpy.ndarray` sample points in x axis unit_y : `numpy.ndarray` sample points in y axis Returns ------- `numpy.ndarray` 2D numpy array containing the analytic fourier transform """ xq, yq = m.meshgrid(unit_x, unit_y) return (m.sinc(xq * self.width_x) * m.sinc(yq * self.width_y)).astype( config.precision)
def pixelaperture_analytic_otf(width_x, width_y, freq_x, freq_y): """Analytic MTF of a rectangular pixel aperture. Parameters ---------- width_x : `float` x diameter of the pixel, in microns width_y : `float` y diameter of the pixel, in microns freq_x : `numpy.ndarray` x spatial frequency, in cycles per micron freq_y : `numpy.ndarray` y spatial frequency, in cycles per micron Returns ------- `numpy.ndarray` MTF of the pixel aperture """ return m.sinc(freq_x * width_x) * m.sinc(freq_y * width_y)
def analytic_ft(self, unit_x, unit_y): """Analytic fourier transform of a slit. Parameters ---------- unit_x : `numpy.ndarray` sample points in x frequency axis unit_y : `numpy.ndarray` sample points in y frequency axis Returns ------- `numpy.ndarray` 2D numpy array containing the analytic fourier transform """ xq, yq = m.meshgrid(unit_x, unit_y) if self.width_x > 0 and self.width_y > 0: return (m.sinc(xq * self.width_x) + m.sinc(yq * self.width_y)).astype(config.precision) elif self.width_x > 0 and self.width_y is 0: return m.sinc(xq * self.width_x).astype(config.precision) else: return m.sinc(yq * self.width_y).astype(config.precision)