AdvancedPhotonSource / tike

Repository for ptychography software
http://tike.readthedocs.io
Other
29 stars 15 forks source link

API: Enable online reconstruction #206

Closed carterbox closed 2 years ago

carterbox commented 2 years ago

Purpose

Enable online reconstructions; i.e. checking the result without dumping everything from the GPU and adding additional data mid-reconstruction.

Approach

Pre-Merge Checklists

Submitter

Reviewer

carterbox commented 2 years ago

So I ran into a bug while using this API where it is unsafe to call Reconstruction.get_result() before the context is closed because it moves all the parameters back to the host in the middle of the reconstruction (side effects!). I need advice on how to handle this.

The user wants to get the PtychoParameters struct back in its entirety after closing the context, but they cannot be allowed to access it while the context is open. What about tracking whether the context is still open internally and raising an error if get_result() is called before the context is closed?

dgursoy commented 2 years ago

Is the context changing the parameters? If not, showing a duplicate when needed might be better than not allowing it when it is open.

carterbox commented 2 years ago

Yes. The parameters include both variable (the probe, scan position) and constant (hyperparams) parameters.

dgursoy commented 2 years ago

Then like in monitoring iterative algorithms, you can monitor the “states”, which can be pulled or broadcasted at regular intervals.

carterbox commented 1 year ago

Related to #148