Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion doc/source/usage/tutorial/Parallelization/MultiGPU.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"version": "3.13.1"
}
},
"nbformat": 4,
Expand Down
51 changes: 27 additions & 24 deletions src/pyFAI/app/calib2.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
__contact__ = "[email protected]"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "10/11/2025"
__date__ = "21/11/2025"
__status__ = "production"

import os
Expand All @@ -37,11 +37,13 @@
from argparse import ArgumentParser

import logging
import pyFAI.resources
import pyFAI.calibrant
import pyFAI.detectors
import pyFAI.io.image
from pyFAI.io.ponifile import PoniFile
from .. import resources
from .. import calibrant
from .. import detectors
from ..io import image
from ..io.ponifile import PoniFile
from .. import version as pyFAI_version, date as pyFAI_date
from .. import units as pyFAI_units

logging.basicConfig(level=logging.INFO)
logging.captureWarnings(True)
Expand Down Expand Up @@ -85,7 +87,7 @@ def configure_parser_arguments(parser):
parser.add_argument("-w", "--wavelength", dest="wavelength", type=float,
help="wavelength of the X-Ray beam in Angstrom.", default=None)
parser.add_argument("-e", "--energy", dest="energy", type=float,
help="energy of the X-Ray beam in keV (hc=%skeV.A)." % pyFAI.units.hc, default=None)
help="energy of the X-Ray beam in keV (hc=%skeV.A)." % pyFAI_units.hc, default=None)
parser.add_argument("-P", "--polarization", dest="polarization_factor",
type=float, default=None,
help="polarization factor, from -1 (vertical) to +1 (horizontal)," +
Expand Down Expand Up @@ -251,7 +253,7 @@ def configure_parser_arguments(parser):
You will need to provide a calibrant or a "d-spacing" file containing the
spacing of Miller plans in Angstrom (in decreasing order).
%s or search in the American Mineralogist database:
http://rruff.geo.arizona.edu/AMS/amcsd.php""" % str(pyFAI.calibrant.ALL_CALIBRANTS)
http://rruff.geo.arizona.edu/AMS/amcsd.php""" % str(calibrant.ALL_CALIBRANTS)

epilog = """The output of this program is a "PONI" file containing the
detector description and the 6 refined parameters (distance, center, rotation)
Expand Down Expand Up @@ -294,7 +296,7 @@ def parse_options():
"""
usage = "pyFAI-calib2 [options] input_image.edf"
parser = ArgumentParser(usage=usage, description=description, epilog=epilog)
version = "calibration from pyFAI version %s: %s" % (pyFAI.version, pyFAI.date)
version = "calibration from pyFAI version %s: %s" % (pyFAI_version, pyFAI_date)
parser.add_argument("-V", "--version", action='version', version=version)
configure_parser_arguments(parser)

Expand Down Expand Up @@ -333,10 +335,10 @@ def setup_model(model, options):
if options.spacing:
calibrant = None
try:
if options.spacing in pyFAI.calibrant.CALIBRANT_FACTORY:
calibrant = pyFAI.calibrant.CALIBRANT_FACTORY(options.spacing)
if options.spacing in calibrant.CALIBRANT_FACTORY:
calibrant = calibrant.CALIBRANT_FACTORY(options.spacing)
elif os.path.isfile(options.spacing):
calibrant = pyFAI.calibrant.Calibrant(options.spacing)
calibrant = calibrant.Calibrant(options.spacing)
else:
logger.error("No such Calibrant / d-Spacing file: %s", options.spacing)
except Exception as e:
Expand Down Expand Up @@ -366,15 +368,15 @@ def setup_model(model, options):
displayExceptionBox("Error while loading the detector", e)
elif options.pixel:
pixel_size = parse_pixel_size(options.pixel)
detector = pyFAI.detectors.Detector(pixel1=pixel_size[0], pixel2=pixel_size[0])
detector = detectors.Detector(pixel1=pixel_size[0], pixel2=pixel_size[0])
else:
detector = None

if options.spline:
try:
if detector is None:
detector = pyFAI.detectors.Detector(splinefile=options.spline)
elif detector.__class__ is pyFAI.detectors.Detector or detector.HAVE_TAPER:
detector = detectors.Detector(splinefile=options.spline)
elif detector.__class__ is detectors.Detector or detector.HAVE_TAPER:
detector.splinefile = options.spline
else:
logger.warning("Spline file not supported with this kind of detector. Argument ignored.")
Expand Down Expand Up @@ -414,7 +416,7 @@ def setup_model(model, options):

if options.mask:
try:
data = pyFAI.io.image.read_image_data(options.mask)
data = image.read_image_data(options.mask)
except Exception as e:
displayExceptionBox("Error while loading the mask", e)
else:
Expand All @@ -427,7 +429,7 @@ def setup_model(model, options):
elif len(args) == 1:
image_file = args[0]
try:
data = pyFAI.io.image.read_image_data(image_file)
data = image.read_image_data(image_file)
except Exception as e:
displayExceptionBox("Error while loading the image", e)
else:
Expand Down Expand Up @@ -517,7 +519,7 @@ def setup_model(model, options):

# Integration
if options.unit:
unit = pyFAI.units.to_unit(options.unit)
unit = pyFAI_units.to_unit(options.unit)
integrationSettingsModel.radialUnit().setValue(unit)

if options.outfile:
Expand All @@ -536,7 +538,7 @@ def setup_model(model, options):
logger.error("background option not supported")
if options.dark:
try:
data = pyFAI.io.image.read_image_data(options.dark)
data = image.read_image_data(options.dark)
except Exception as e:
displayExceptionBox("Error while loading the dark current image", e)
else:
Expand All @@ -546,7 +548,7 @@ def setup_model(model, options):
image_model.setSynchronized(True)
if options.flat:
try:
data = pyFAI.io.image.read_image_data(options.flat)
data = image.read_image_data(options.flat)
except Exception as e:
displayExceptionBox("Error while loading the flat-field image", e)
else:
Expand Down Expand Up @@ -616,16 +618,16 @@ def main():

# Make sure matplotlib is loaded first by silx
import silx.gui.utils.matplotlib
from pyFAI.gui.CalibrationWindow import CalibrationWindow
from pyFAI.gui.CalibrationContext import CalibrationContext
from ..gui.CalibrationWindow import CalibrationWindow
from ..gui.CalibrationContext import CalibrationContext

sys.excepthook = logUncaughtExceptions
if options.qtargs is None:
qtArgs = []
else:
qtArgs = options.qtargs.split()
app = qt.QApplication(qtArgs)
pyFAI.resources.silx_integration()
resources.silx_integration()

settings = qt.QSettings(qt.QSettings.IniFormat,
qt.QSettings.UserScope,
Expand All @@ -641,7 +643,8 @@ def main():
window.setVisible(True)
window.setAttribute(qt.Qt.WA_DeleteOnClose, True)

result = app.exec_()
result = app.exec()

context.saveSettings()

# remove ending warnings relative to QTimer
Expand Down
5 changes: 3 additions & 2 deletions src/pyFAI/app/diff_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
__contact__ = "[email protected]"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "07/10/2025"
__date__ = "21/11/2025"
__satus__ = "Production"

import sys
Expand Down Expand Up @@ -70,7 +70,8 @@ def main(args=None):
window.set_config(config)
# window.restore()
window.show()
sys.exit(app.exec_())
result = app.exec()
sys.exit(result)
del context
else:
dt.configure_worker(config.ai)
Expand Down
8 changes: 4 additions & 4 deletions src/pyFAI/app/drawmask.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@
__contact__ = "[email protected]"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "07/10/2025"
__date__ = "21/11/2025"
__satus__ = "Production"

import os
import sys
import numpy
from argparse import ArgumentParser
import fabio
Expand Down Expand Up @@ -182,12 +183,11 @@ def main(args=None):
window.setOutputFile(outfile)

print("Your mask-file will be saved into %s" % (outfile))

app.exec_()
result = app.exec()

mask = window.getSelectionMask()
postProcessId21(processFile, mask)

sys.exit(result)

if __name__ == "__main__":
main()
8 changes: 4 additions & 4 deletions src/pyFAI/app/integrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
__contact__ = "[email protected]"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "07/10/2025"
__date__ = "21/11/2025"
__satus__ = "production"

import sys
Expand Down Expand Up @@ -109,7 +109,7 @@ def processData(config=None):

dialog.setFileMode(qt.QFileDialog.ExistingFiles)
moveCenterTo(dialog, center)
result = dialog.exec_()
result = dialog.exec()
if not result:
return
input_data = [str(i) for i in dialog.selectedFiles()]
Expand Down Expand Up @@ -138,7 +138,7 @@ def run(self):
qtProcess = QtProcess()
qtProcess.start()

result = dialog.exec_()
result = dialog.exec()
if result:
qt.QMessageBox.information(dialog,
"Integration",
Expand All @@ -153,7 +153,7 @@ def run(self):
window.batchProcessRequested.connect(validateConfig)
window.show()

result = app.exec_()
result = app.exec()
context.saveSettings()
return result

Expand Down
15 changes: 5 additions & 10 deletions src/pyFAI/containers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,29 +26,24 @@

"""Module containing holder classes, like returned objects."""

__author__ = "Valentin Valls"
__authors__ = ["Valentin Valls", "Jérôme Kieffer"]
__contact__ = "[email protected]"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "02/10/2025"
__date__ = "17/11/2025"
__status__ = "development"

import sys
import copy
import logging
import warnings
from dataclasses import dataclass as _dataclass, fields as fields, asdict as asdict
from typing import NamedTuple
from enum import IntEnum
from .utils.decorators import deprecated_warning
from dataclasses import fields, asdict # noqa
import numpy
from numpy.typing import ArrayLike
from .utils.dataclasses import dataclass, case_insensitive_dataclass # noqa
from .utils.decorators import deprecated_warning

# User defined dataclasses
if sys.version_info >= (3, 10):
dataclass = _dataclass(slots=True)
else:
dataclass = _dataclass

logger = logging.getLogger(__name__)

Expand Down
2 changes: 1 addition & 1 deletion src/pyFAI/geometry/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -2171,7 +2171,7 @@ def make_headers(self, type_="list"):
"""
res = None
if type_ == "dict":
res = self.getPyFAI()
res = self.get_config()
else: # type_ == "list":
f2d = self.getFit2D()
res = [
Expand Down
4 changes: 2 additions & 2 deletions src/pyFAI/gui/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8
# /*##########################################################################
#
# Copyright (C) 2016-2018 European Synchrotron Radiation Facility
# Copyright (C) 2016-2025 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand All @@ -26,4 +26,4 @@

__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__license__ = "MIT"
__date__ = "06/03/2018"
__date__ = "21/11/2025"
10 changes: 5 additions & 5 deletions src/pyFAI/gui/dialog/DetectorSelectorDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

__authors__ = ["Valentin Valls", "Jérôme Kieffer"]
__license__ = "MIT"
__date__ = "30/10/2025"
__date__ = "21/11/2025"

import os
import logging
Expand Down Expand Up @@ -216,7 +216,7 @@ def setSensorConfig(self, sensor: SensorConfig | None = None):
with block_signals(self._detectorSensorThickness):
if index < 0:
self._detectorSensorThickness.addItem(
f"{1e6 * sensor.thickness:4.0f}" if sensor.thickness else "",
f"{1e6 * sensor.thickness:4.0f}" if sensor.thickness else "",
userData=sensor.thickness
)
index = self._detectorSensorThickness.findData(sensor.thickness)
Expand All @@ -226,7 +226,7 @@ def setSensorConfig(self, sensor: SensorConfig | None = None):
with block_signals(self._detectorSensorMaterials):
if index < 0:
self._detectorSensorMaterials.addItem(
sensor.material.name if sensor.material else "",
sensor.material.name if sensor.material else "",
userData=sensor.material
)
index = self._detectorSensorMaterials.findData(sensor.material)
Expand Down Expand Up @@ -339,7 +339,7 @@ def createSplineDialog(self, title, previousFile):
def loadSplineFile(self):
previousFile = self.__splineFile.value()
dialog = self.createSplineDialog("Load spline image", previousFile=previousFile)
result = dialog.exec_()
result = (dialog).exec()
if not result:
return
filename = dialog.selectedFiles()[0]
Expand Down Expand Up @@ -410,7 +410,7 @@ def __loadDetectorFormFile(self):
dialog = self.createFileDialog(
"Load detector from HDF5 file", previousFile=previousFile
)
result = dialog.exec_()
result = (dialog).exec()
if not result:
return
filename = dialog.selectedFiles()[0]
Expand Down
8 changes: 4 additions & 4 deletions src/pyFAI/gui/dialog/MessageBox.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# coding: utf-8
# /*##########################################################################
#
# Copyright (C) 2016-2018 European Synchrotron Radiation Facility
# Copyright (C) 2016-2025 European Synchrotron Radiation Facility
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
Expand All @@ -23,9 +23,9 @@
#
# ###########################################################################*/

__authors__ = ["V. Valls"]
__authors__ = ["V. Valls", "Jérôme Kieffer"]
__license__ = "MIT"
__date__ = "16/10/2020"
__date__ = "21/11/2025"

import logging
import sys
Expand Down Expand Up @@ -72,4 +72,4 @@ def exception(parent, title, exc_info, logger=None):
msg.setDetailedText(detailed)

msg.raise_()
msg.exec_()
(msg).exec()
Loading