Skip to content

Commit

Permalink
Merge pull request #2362 from kif/2361_diffmap_mask
Browse files Browse the repository at this point in the history
Handle diffmap mask as URL
  • Loading branch information
kif authored Jan 8, 2025
2 parents 5c9b4ec + f63caba commit 92e65c7
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 10 deletions.
3 changes: 2 additions & 1 deletion doc/source/publications.rst
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ Publications about pyFAI

* *Application of signal separation to diffraction image compression and serial crystallography*;
Jérôme Kieffer, Julien Orlans, Nicolas Coquelle, Samuel Debionne, Shibom Basu, Alejandro Homs, Gianluca Santonia and Daniele De Sanctis;
`Accepted 10.48550/arXiv.2411.09515>`_ in **J. Applied Crystallography** (2024), DOI:10.1107/S1600576724011038;
**Journal of Applied Crystallography** (2025) 58, https://doi.org/10.1107/S1600576724011038.
`Accepted <https://arxiv.org/abs/2411.09515>`_
In depth explainaion of sigma-clipping background assessment and error models.

The latest paper should be the cited in publications using pyFAI.
Expand Down
25 changes: 17 additions & 8 deletions src/pyFAI/diffmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
__contact__ = "[email protected]"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "13/12/2024"
__date__ = "19/12/2024"
__status__ = "development"
__docformat__ = 'restructuredtext'

Expand Down Expand Up @@ -291,18 +291,27 @@ def parse(self, sysargv=None, with_config=False):
config["input_data"] = [(i, None) for i in self.inputfiles]

if options.mask:
mask = urlparse(options.mask).path
urlmask = urlparse(options.mask)
elif ai.get("do_mask", False) or ai.get("mask_file", None):
urlmask = urlparse(ai.get("mask_file", None))
elif config.get("do_mask", False) or config.get("mask_file", None):
mask = urlparse(config.get("mask_file", None)).path
# compatibility with elder config files...
deprecated_warning("Config of mask no more top-level, but in ai config group", "mask_file", deprecated_since="2024.12.0")
urlmask = urlparse(config.get("mask_file", None))
else:
mask = ""
if os.path.isfile(mask):
logger.info("Reading Mask file from: %s", mask)
self.mask = os.path.abspath(mask)
urlmask = urlparse("")
if "::" in urlmask.path:
mask_filename, idx = urlmask.path.split("::", 1)
mask_filename = os.path.abspath(mask_filename)
urlmask = urlparse(f"fabio://{mask_filename}?slice={idx}")

if os.path.isfile(urlmask.path):
logger.info("Reading Mask file from: %s", urlmask.path)
self.mask = urlmask.geturl()
ai["mask_file"] = self.mask
ai["do_mask"] = True
else:
logger.warning("No such mask file %s", mask)
logger.warning("No such mask file %s", urlmask.path)
if options.poni:
if os.path.isfile(options.poni):
logger.info("Reading PONI file from: %s", options.poni)
Expand Down
2 changes: 1 addition & 1 deletion src/pyFAI/io/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
__contact__ = "[email protected]"
__license__ = "MIT"
__copyright__ = "European Synchrotron Radiation Facility, Grenoble, France"
__date__ = "11/12/2024"
__date__ = "19/12/2024"
__status__ = "development"


Expand Down

0 comments on commit 92e65c7

Please sign in to comment.