silx-kit / pyFAI

Fast Azimuthal Integration in Python
Other
106 stars 95 forks source link

Move fiber diffraction to another module #2283

Open kif opened 1 month ago

kif commented 1 month ago

Fiber/grazing incidence is already 200 loc (line of code) in the AzimuthalIntegrator class and it is not really doing azimuthal integration. The PR https://github.com/silx-kit/pyFAI/pull/2282 will add 150 loc in addition.

AzimuthalIntegrator suffers chronically from the "god-object" antipattern. In the past, it has already been cut twice to separate the Geometry (using inheritance) and the Detector (using composition).

What about putting FiberIntegrator into another class inheriting from AzimuthalIntegrator, into another module ? This will require the modification of all the documentation on the one hand and to warn the (few) users on the other. Since the feature is fairly new but likely to be appreciated, this has to be ASAP to avoid breaking users' code.

kif commented 1 month ago

One needs to find a "clean" way to promote an instance, for example of "Geometry" into "AzimuthalIntegrator" or "FiberIntegrator" ... maybe with a promote method.

kif commented 1 month ago

Idea:

Create an integrators sub-module with azimuthal and surface modules holding AzimuthalIntegrator and SurfaceIntegrator. The pyFAI.azimuthalInetgrator modules becomes completely deprecated.

All integrator classes are exposed at the pyFAI.integrators

kif commented 1 month ago

Promotion

add a geo.promote(type) method could do a deep-copy of the Geometry (or PoniFile) instance in to an Integrator object (which inherits from Geometry)

Care should be taken about GeometryRefinement which inherits from AzimuthalIntegrator. The refactoring of this is part of pyFAI2 project.