ptycho / ptypy

Ptypy - main repository
Other
37 stars 16 forks source link

final_report #585

Open kahntm opened 1 month ago

kahntm commented 1 month ago

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:

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 commented 1 month ago

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 commented 1 week ago

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.