Skip to content

feat: Poisson noise samples and frozen-phonon exit waves - #33

Merged
Paullo9 merged 1 commit into
mainfrom
issue-9-poisson-samples
Oct 31, 2026
Merged

Paullo9 merged 1 commit into
mainfrom
issue-9-poisson-samples

Conversation

@Paullo9

@Paullo9 Paullo9 commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Requested by Paul · project thread

Part of #9

Two ensemble axes abTEM adds to a scan:

  • ScanMeasurement.poissonNoise(dose:samples:seed:) and poissonNoise(dosePerArea:samplingX:samplingY:samples:seed:) return samples independent Poisson draws as an array (abTEM poisson_noise(samples=)). One generator stream runs over the samples (abTEM also draws all samples from one stream), so sample 0 is the single draw of the same seed. Samples below 1, or beyond half of the physical memory, are refused before any work. The generator is the kit's own, as before: parity is statistical.
  • STEM.scanFrozenPhonons(probe:potentials:scan:detector:backend:options:memoryLimit:) (built and unbuilt potentials) returns one ScanWaves per frozen-phonon configuration, never averaged. abTEM keeps the configuration axis for waves too (Waves.reduce_ensemble passes waves through). Each configuration equals its single-potential scan bit for bit; the memory limit counts all configurations; a grid mismatch on any configuration is refused first. STEM.scan with a WavesDetector is unchanged.

No existing number changes. Additive API, so feat:.

Test evidence: Tests/SimulatoDetectorTests/EnsembleTests.swift (4 tests) fails to compile on main (the API is new) and passes here; the gate swift test -c release --skip SimulatoKitParityTests is green locally. Reviewed by a separate reviewer pass before the commit (one should-fix, the sample-count cap, applied; nits applied).

Remaining in #9 (not in this PR): the segmented-detector DPC measurement, line profiles for segmented and pixelated line scans, the azimuthal average, LineScan defaults, integrate_disc(interpolate:), tilt distributions.

🤖 Generated with Claude Code

ScanMeasurement.poissonNoise(dose:samples:seed:) and the dose-per-area form return that many independent Poisson draws as an array, the sample axis of abTEM poisson_noise(samples=). One generator stream runs over the samples, so sample 0 is the single draw of the same seed; samples below 1 or beyond half of the physical memory are refused before any work.

STEM.scanFrozenPhonons(probe:potentials:scan:detector:backend:options:memoryLimit:) returns one ScanWaves per frozen-phonon configuration, never averaged, as abTEM keeps the configuration axis for waves. Each equals the single-potential scan bit for bit; the memory limit counts every configuration. STEM.scan with a WavesDetector still takes one potential.

Tests: SimulatoDetectorTests/EnsembleTests (red before: the API did not exist). parity.md, README, the docc article and open-items updated.

Done: two bullets of issue 9 (Poisson samples, WavesDetector with frozen phonons). Next: the segmented-detector DPC measurement.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Paullo9 Paullo9 self-assigned this Oct 31, 2026
@Paullo9
Paullo9 merged commit a40af46 into main Oct 31, 2026
8 checks passed
@Paullo9
Paullo9 deleted the issue-9-poisson-samples branch October 31, 2026 09:34
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.

1 participant