3D Phasing with a fixed support fails

Phasing with a fixed support (i.e. no support update) fails.

While phasing simulated data with a support (it was just a check-up when phasing highly symmetrical data), I surprisingly obtained bad results (and so did @bellec).

In order to investigate, I made a notebook (/scisoft/clatlan/dev/testing/pynx_fixed_support_bug/fixed_support_bug.ipynb) which phases a (not particularly symmetrical) simulated dataset.

In the notebook, a cdi object is initialised with a support generated from the \mathcal{F}^{-1} of a simulated nanocrystal. (I employed pynx.scattering submodule)

cdi = CDI(
    iobs=np.abs(np.fft.fftshift(scattering_amp))**2,
    support=np.fft.fftshift(support)
)

cdi = InitObjRandom() * cdi
cdi = ScaleObj(method="I") * cdi

ShowCDI() * cdi

Here is what the initial cdi object looks like: image

Then we just perform ER and HIO and we can see that HIO (and RAAR actually) supports for direct space constraints seem to be different from those of ER. In ER, it seems fine. As for HIO, the reconstructed amplitude is flipped.

cdi = ER() ** 2 * cdi
ShowCDI() * cdi

cdi = HIO() ** 10 * cdi
ShowCDI() * cdi

image image

If we run HIO and RAAR and update the support, we converge on the right support but flipped.

cdi = HIO() ** 500 * cdi
ShowCDI() * cdi

cdi = RAAR() ** 500 * cdi
ShowCDI() * cdi

cdi = SupportUpdate() * cdi
ShowCDI() * cdi

image

To see that we now have a flipped reconstruction (it's not the twin image) we can plot the original object: image and the reconstruction: image

Therefore, in a phasing routine, fixing the support fails.

Also note that this was conducted with pynx 2023. In pynx 2024, the bug seems different, see the initialisation plot: image

After some support update and with pynx 2024 the phasing finally converged on the right result...

So to wrap up: In any case we provide the support as the initial guess

  • pynx 2023:
    • without support update, no convergence at all if using HIO and RAAR. If we use ER it works.
    • with support update, HIO and RAAR converge but on the flipped reconstruction.
  • pynx 2024: Weird initialisation
    • without support update, it does not converge.
    • with support update It converges on the right reconstruction
Edited by Clement Atlan