ism3d.simuv.ft.uv_sample

ism3d.simuv.ft.uv_sample(plane, cell, uu, vv, dRA=0.0, dDec=0.0, PA=0, origin='upper', method='nufft', ik=5, saveuvgrid=False)[source]

#galario: scaled with fft-size

  • fourier transform of a model image

  • discretized uv sampling using MS uvw

dRA,dDec optionsare not implemented yet

method:
‘direct’: brutal force direct fourier transform using summing (slow, and only okay for a couple of point sources)

linear+accurate but slow

‘interp2d’: this is close to the method implemented in galario (in C or py_sampleImage.py)

howerver, galarios linear 2D interp method is problamtics for complicated structure or multiple offcenter-source (as the amp / phase surface is not smooth) see related disscussion: https://github.com/mtazzari/galario/pull/132#issuecomment-396703582 Although interpolae amp/phase is an working solution up to 1% for single simple source at center or offcenter For more cocmplicated source, the linear interpolation is insuffcient. The issue is fixed here by introducing high-order spline interpolation, but lose linearrity in XY-UV transform

‘interp2d_ph’: the algroithm used in galario (one should alway interp phase as for point sources)

this should give the same results as galario, just slower…

‘galario’: call galario python API interface (see the problem above)

currently, it will linear-interp amp and linear-interp phase. different from linear-interp real/imag

Some options to improve presion/accuracy

interpolate in UV (be careful) REAL/IMAG or AMP/PH (preferred)

low-order if amp/phase smooth high-order if amp/phase complicated.

direct FFT (expensive) oversampling UV grid (expensive)

disaeemble different objects (adjust input facet size) for performance and simplify UV-plane surface

the power pixel location within the input image determine the ripple in phase/real/imag

important note:

When using any interpolation-based method, for best precision/accurancy, it’s better to
  1. keep the source emission close to the input image pixel center and perform re-phasing (i.a. dRA/dDec) in UV to get the correct results In this way, the amp/phase is rather a smooth function, and interp2d will work best even at low-order (e.g. linear interp)

  2. it’s better to interpolate amp and phase rather than interpolate real/image especially when phase (therefore real/image, this is off-center case)

  3. (offset from image center) / (half image size) is roughly the sample step in one wrap

  4. The most critical thing:

    depress the phase change in the UV grid to make the “degridding” (i.a interpolate to discretc point) precise. also be careful about uv sampling beyond UV grid range. the phase change is determined by the source location in the fft-ready image. dRA,dDec could help to adjust as it phaseshift is more precise rathatan shifting object location in pixel image

Rule:

Imsize larger than twice of object size

For estimating effeciency:

if uv.size>im.size, then interpolating or nearest is likely faster