ptycho / ptypy

Ptypy - main repository
Other
36 stars 16 forks source link

How to reinforce the experimentally measured amplitude of the probe in NFP #166

Open jcesardasilva opened 6 years ago

jcesardasilva commented 6 years ago

In near-field ptychography, I have the possibility to measure the intensity of the beam without the sample, so I can obtain the probe amplitude by the square root operation.

Given that in the Fourier update we replace the amplitude of the exit wave by the square root of the intensity, I am wondering how to replace (reinforce) the amplitude of the retrieved beam by the experimentally measured one at each iterations.

Is there such an implementation in any branch? If not so, where should (could) I think of putting it? or is someone thinking of doing so?

Thank you in advance.

pierrethibault commented 6 years ago

Hi Julio,

This is something that we planned from the beginning but never used, so the feature was somewhat hidden and not fully implemented. I have made a small change that I think will make it work as it should. The idea was never to have an input parameter to activate this, but to have an easy way to "rewire" the POD network to make it work.

What you need to do is:

  1. Make sure that you load your no-sample data along with the other diffraction frames. Give it any position - maybe the same as another view to avoid a wrong automatic reshaping of the object.
  2. Create the Ptycho object and run it until level 4.
  3. Access the POD related to your no-sample data, and set the attribute is_empty to True. This will have the effect of always returning an object view equal to np.ones.
  4. The other parameter you might want to tweak is POD.probe_weight, which is unity by default. It might make sent to make this larger (say, up to N if N is the total number of diffraction patterns) to increase the influence of this diffraction pattern with respect to the others. I am not sure if this is needed or good, so it would be good to explore.

I hope this works, and if it does could you please report back on your experience?

Thanks!

Pierre

P.S. @daurer here's someone else needing is_empty!

jcesardasilva commented 6 years ago

Thank you very much, Pierre. I tried to use it as you said and, indeed, the amplitude of the probe seems to be reinforced, but the results are less good than the ones not using the 'is_empty' approach. I don't discard the possibility I have not done properly, but for the tests I made, it appears to be better not to use 'is_empty'. I let you know if I do more tests.

Best regards, Julio

Le mar. 28 août 2018 à 22:31, Pierre Thibault notifications@github.com a écrit :

Hi Julio,

This is something that we planned from the beginning but never used, so the feature was somewhat hidden and not fully implemented. I have made a small change that I think will make it work as it should. The idea was never to have an input parameter to activate this, but to have an easy way to "rewire" the POD network to make it work.

What you need to do is:

  1. Make sure that you load your no-sample data along with the other diffraction frames. Give it any position - maybe the same as another view to avoid a wrong automatic reshaping of the object.
  2. Create the Ptycho object and run it until level 4.
  3. Access the POD related to your no-sample data, and set the attribute is_empty to True. This will have the effect of always returning an object view equal to np.ones.
  4. The other parameter you might want to tweak is POD.probe_weight, which is unity by default. It might make sent to make this larger (say, up to N if N is the total number of diffraction patterns) to increase the influence of this diffraction pattern with respect to the others. I am not sure if this is needed or good, so it would be good to explore.

I hope this works, and if it does could you please report back on your experience?

Thanks!

Pierre

P.S. @daurer https://github.com/daurer here's someone else needing is_empty!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ptycho/ptypy/issues/166#issuecomment-416730285, or mute the thread https://github.com/notifications/unsubscribe-auth/ALUrdK5xt4f_XsYGTYJG2Iz0ENNYFd8Dks5uVai9gaJpZM4WOeWd .

pierrethibault commented 6 years ago

Hi Julio, Thanks for the update. Is there any chance you could share a minimal example of how you did it? We could add this as an example in our documentation or in the templates.

bjoernenders commented 1 year ago

As the feature should be already there, this behavior needs to be documented/templated for 1.0 release