wavefront.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:slitSpectrographBlind 作者: aasensio 项目源码 文件源码
def psf(aperture, wavefront, overfill=1):
  """
  Transform an aperture and the wavefront to a PSF

  Args:
      aperture (TYPE): aperture
      wavefront (TYPE): wavefront
      overfill (int, optional): number of extra pixels

  Returns:
      real: PSF
  """
  npix = len(wavefront)
  nbig = npix*overfill

  wfbig = numpy.zeros((nbig,nbig),dtype='d')

  half = (nbig - npix)/2
  wfbig[half:half+npix,half:half+npix] = wavefront

  illum = numpy.zeros((nbig,nbig),dtype='d')
  illum[half:half+npix,half:half+npix] = aperture

  phase = numpy.exp(wfbig*(0.+1.j))
  input = illum*phase

  ft = numpy.fft.fft2(input)
  powft = numpy.real(numpy.conj(ft)*ft)

  sorted = numpy.zeros((nbig,nbig),dtype='d')
  sorted[:nbig/2,:nbig/2] = powft[nbig/2:,nbig/2:]
  sorted[:nbig/2,nbig/2:] = powft[nbig/2:,:nbig/2]
  sorted[nbig/2:,:nbig/2] = powft[:nbig/2,nbig/2:]
  sorted[nbig/2:,nbig/2:] = powft[:nbig/2,:nbig/2]

  crop =  sorted[half:half+npix,half:half+npix]

  fluxrat = numpy.sum(crop)/numpy.sum(sorted)
  # print("Cropped PSF has %.2f%% of the flux" % (100*fluxrat))

  return crop
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号