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

final_report #585

Open
kahntm opened this issue Sep 12, 2024 · 2 comments
Open

final_report #585

kahntm opened this issue Sep 12, 2024 · 2 comments

Comments

@kahntm
Copy link
Contributor

kahntm commented Sep 12, 2024

During the ptypy workshop we came up with the idea that ptypy should give a final report at the end of a reconstruction. Some metrics that are worth knowing about the reconstruction:

  • what was the probe size (probes are messy, so a metric or various metrics would need to be found and reported)
  • what was the average step size
  • using those numbers, what was the (linear / area) overlap in the sample plane
  • using those numbers, what was the oversampling in the detector plane
  • what do these photon error metrics mean
  • maps of which pixels are covered by how many views (how often do they get updated)
  • fluence map - how much of the total intensity ended up in each pixel of the object
  • just again saying there were X diffraction patterns of size N * M

Some of these things could be printed on the terminal at the end of the reconstruction.
All of these things could be added within the .ptyr file.

There was also a wish to have an FRC function implemented in the utils

@pierrethibault
Copy link
Member

pierrethibault commented Sep 19, 2024

Regarding the fluence map, here's a suggestion of code that could do it:

from ptypy import utils
def fluence_map(ptycho):
    """
    Compute fluence map(s) for all object storages and modes

    Parameters
    ----------
    ptycho : The Ptycho object instance to draw information from.
    """
 
    # Delete existing copy if it exists
    if 'Cfluence' in [c.ID for c in ptycho.obj.copies]:
        del ptycho.obj.owner._pool['C']['Cfluence']

    # Create copy of object container
    fmap = ptycho.obj.copy(ID='fluence', fill=0., dtype='real')

    # Loop through storages and add the probe intensities
    for sname, sobj in fmap.S.items():
        for v in sobj.views:
            if not v.active:
                continue
            for pid, pod in v.pods.items():
                sobj[v] += utils.abs2(pod.probe)
    return fmap

Not sure where to put it... Maybe as a Ptycho method?

@daurer
Copy link
Contributor

daurer commented Oct 31, 2024

Next step: Create a PR with dummy implementation of where these metrics and their calculations should be invoked. Also think about how to add the metrics to the .ptyr file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants