pyFAI icon indicating copy to clipboard operation
pyFAI copied to clipboard

Move fiber diffraction to another module

Open kif opened this issue 1 year ago • 3 comments

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 avatar Sep 19 '24 15:09 kif

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 avatar Sep 22 '24 15:09 kif

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 avatar Sep 25 '24 08:09 kif

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.

kif avatar Sep 25 '24 08:09 kif

Implemented, to be released as part of 2025.1

kif avatar Jan 06 '25 15:01 kif