silx-kit / pyFAI

Fast Azimuthal Integration in Python
Other
104 stars 94 forks source link

[config] method to retrieve config object from a .poni object without creating a worker #2251

Open EdgarGF93 opened 2 weeks ago

EdgarGF93 commented 2 weeks ago

example:

from pyFAI.io.PoniFile import PoniFile
from pyFAI.io.integration_config import poni_to_config

poni_filename = "example.poni"
poni = PoniFile(poni_filename)
config = poni_to_config(poni)

equivalent method to

from pyFAI.worker import Worker
from pyFAI import load

ai = load(poni_filename)
worker = Worker(azimuthalIntegrator=ai)
config = worker.get_config()

to avoid instantiation of the worker

kif commented 2 weeks ago

Why don't you add this as an export method to PoniFile ?

class PoniFile:
[...]
    def as_integration_config(self):
        [...]
        return config
EdgarGF93 commented 2 weeks ago

We could do that, I was thinking about writing this method inside the worker module since it will contain all the possible keys for the worker (see #2252 )