Skip to content

Fixing parse warning messages - #745

Merged
smribet merged 3 commits into
py4dstem:devfrom
cophus:dev
Aug 1, 2026
Merged

smribet merged 3 commits into
py4dstem:devfrom
cophus:dev

Conversation

@cophus

@cophus cophus commented Aug 1, 2026

Copy link
Copy Markdown
Member

No description provided.

cophus and others added 3 commits August 1, 2026 09:30
pyparsing >= 3.3 introduced PyparsingDeprecationWarning, which inherits
UserWarning and is therefore displayed by default. Any dependency that
still calls the camelCase compatibility API (e.g. older matplotlib
mathtext: parseString / parseAll / resetCache) now emits a warning per
rendered label, flooding plot output with repeated
"'parseString' deprecated - use 'parse_string'" messages. Filter that
warning category at import time; guarded so older pyparsing without the
class is unaffected.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
match_orientations now correlates patterns in batches (default
batch_size=100) instead of one at a time. The first-match orientation
correlograms for a whole batch are computed with a single BLAS/cuBLAS
matrix product over the shell dimension followed by one inverse FFT
along gamma, which is mathematically identical to the per-pattern
computation by linearity of the FFT. Each pattern is then passed to
match_single_pattern with its precomputed correlograms, so orientation
selection, in-plane refinement, ACOM refinement mode, inversion
symmetry, and multiple matches all reuse the existing code path
unchanged.

- New helpers _calc_polar_image (polar transform extracted verbatim
  from match_single_pattern; two long-commented historical kernel
  variants were dropped in the move) and _calc_correlogram_batch
  (batched correlograms, zone-axis chunked to a memory budget,
  sieve-only zones in refinement mode, CuPy when CUDA=True).
- match_single_pattern accepts a private _precomputed argument used
  only for the first match; matches beyond the first recompute as
  before.
- New match_orientations arguments: batch_size (None or 1 restores the
  original per-pattern loop) and batch_max_memory_GB (default 2.0);
  the batch is clamped automatically for fine orientation plans.

Verified batched and per-pattern paths give identical orientation maps
(inds, mirror, corr, angles, matrices) on synthetic data for standard
plans, refinement plans, num_matches_return=2 with
min_angle_between_matches_deg, inversion_symmetry=False, and tiny
memory budgets. Where the correlation maximum is exactly degenerate
(zone axis on a crystal mirror plane), tie-breaking can differ, but
the resulting orientations are identical modulo crystal symmetry.
CPU speedup ~3x on a 1596-zone plan; larger gains expected on GPU.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@smribet
smribet merged commit b38f2b8 into py4dstem:dev Aug 1, 2026
6 checks passed
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