Skip to content

Py fai matchup sept2026 - #3

Open
jonwright wants to merge 2 commits into
mainfrom
pyFAI_matchup_Sept2026
Open

Py fai matchup sept2026#3
jonwright wants to merge 2 commits into
mainfrom
pyFAI_matchup_Sept2026

Conversation

@jonwright

Copy link
Copy Markdown
Owner

No description provided.

jonwright and others added 2 commits September 8, 2026 16:41
fitpksEiger_pyFAI_2026.9.0.dev0+1e06043e4.ipynb reproduces the ImageD11 fit from
fitpksEiger.ipynb unchanged (one intentional fix, marked inline with
`# FIXED !!!!`: the pyFAI spatial file now uses pyFAI's own 0-to-1 pixel-corner
convention rather than the original -0.5/+0.5 one), then adds a full independent
cross-check: conversion of the converged geometry to a pyFAI PONI via
pyFAI.geometry.imaged11, a peak-by-peak ImageD11-vs-pyFAI tth comparison, and a
third check via integrate2d directly on the raw image with proper exclusion of
bins contaminated by masked/gap pixels or the detector edge.

To reproduce, beyond what fitpksEiger.ipynb / moduleSpatialPeakSearch.ipynb
already need:

- pyFAI must be built from source, not installed from a release: the
  ImageD11<->pyFAI conversion (pyFAI.geometry.imaged11) only exists on the
  as-yet-unmerged kif/doc_calib_ID11 branch of silx-kit/pyFAI, commit 1e06043e4
  ("upgrade tutorial"; pyFAI.version == 2026.9.0-dev0).
- the raw calibration image, in addition to the eigerSpatial/*.flt peak files:
  frame 1 of scan0001/eiger_0000.h5 from the same CeO2_Spatial_distortion_apr2021
  dataset referenced in the readme (ESRF path or the Zenodo record), read with
  hdf5plugin.

Everything else the notebook needs (newspatial_pyFAI.h5, 1.poni,
fitted_eiger_pars2.dat, ...) it generates itself when run top to bottom.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- Wrap ImageD11's t.fit() calls in contextlib.redirect_stdout: Simplex.minimize()
  prints a "\r"-prefixed progress line per iteration (up to hundreds of lines per
  fit, with no way to disable it from the caller), which doesn't behave as an
  overwriting line outside a live terminal - it just floods the saved notebook
  output. The few genuinely useful prints (peaks kept after outlier rejection,
  etc.) are left visible outside the redirect.
- Drop the `%matplotlib ipympl` cell. It switches to the interactive widget
  backend for the rest of the notebook, which has no static representation to
  save - every plot after that cell was rendering blank/disappearing when
  viewed statically (e.g. on GitHub). Everything now stays on the `%matplotlib
  inline` set at the top, so all plots are embedded as ordinary static PNGs.

Re-executed top to bottom; same results as before (this only touches output
formatting), file size roughly halved.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@jonwright

Copy link
Copy Markdown
Owner Author

Clean up the readme to be more concise and wait for @kif to finish up on the pyFAI side, in case we discover more issues to be resolved.

@kif

kif commented Sep 9, 2026

Copy link
Copy Markdown

Hi Jon, I read the comment & new cells from your notebook and they look correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants