Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting point for implementation of multislice ePIE #500

Merged
merged 14 commits into from
Dec 15, 2023
Merged

Conversation

daurer
Copy link
Contributor

@daurer daurer commented Aug 23, 2023

  • provides extra storage for slices
  • shows how use nearfield propagator inside the engine
  • tried to implement multislice ePIE with existing fourier/object/probe functions

@daurer daurer added 0.8 trieste-meeting-2023 Code contribution during dev meeting labels Aug 23, 2023
@daurer
Copy link
Contributor Author

daurer commented Aug 24, 2023

Next steps

  • Double check the implementation making sure it does what its supposed to do
  • Save additional containers (objects, probes, exits) into an output file, currently they are not saved into .ptyr file
  • Consider modes

@yiranlus
Copy link
Contributor

yiranlus commented Oct 24, 2023

I modified the update loop and now it works on two-slice moon flow sample. I also add the function to save the slice information into another file.

In the .ptyr file, I save the object function as the product of all the slices.

@daurer
Copy link
Contributor Author

daurer commented Oct 25, 2023

Thanks very much @yiranlus for those modifications. Do you have any actual multislice data (real or simulated) that you could further test this code with? We could also adapt the moonflower simulation code to create some fake data that actually originates from multiple slices...

@kahntm maybe you could also try it out with some of your multislice datasets and make modifications to the code if needed?

@kahntm
Copy link
Contributor

kahntm commented Oct 26, 2023

@kahntm maybe you could also try it out with some of your multislice datasets and make modifications to the code if needed?

I checked the implementation with some old published data and was able to recreate my result from back then. The implementation of multi-slice ePIE works both when used with one or two slices.

test_ePIE_multislice

@kahntm
Copy link
Contributor

kahntm commented Oct 31, 2023

Switched from the one pod per view assumption to multiple pods per view.
Required various for loops here and there. But essentially the same code.
Test on actual data looks like the modes are reasonable and slice separation still works.

Comment on lines 133 to 136
for name, pod in view.pods.items():
# Forward multislice, calculate exit waves
for i in range(self.p.number_of_slices-1):
# exit wave for this slice
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kahntm for expanding this code to use modes! Maybe switch these loops around? Shouldn't make any difference to the calculations but its more consistent with the backwards update further below.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Possible, but it would result in a 2nd loop over all pods in the view to update the the exit wave in the last slice and update the pods probe and object
image

Alternatively the loop would be extended one index further and and if i==self.p.number_of_slices-1 would need to be added within the inner loop

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think having a second loop over the pods should be fine. I doubt it would make much of a difference performance wise...

@@ -34,15 +34,15 @@ class ThreePIE(stochastic.EPIE):

[slice_thickness]
default = 1e-6
type = float
type = float, list, tuple
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

slice_thickness can be a single value or a list of values. When a single value is used, all the slices are assumed to have the same thickness.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Many thanks

@daurer daurer merged commit ae7cff6 into dev Dec 15, 2023
4 checks passed
@daurer daurer deleted the multi-slice-epie branch December 15, 2023 15:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
trieste-meeting-2023 Code contribution during dev meeting
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants