Skip to content

Stratified ("quiet") resampling#149

Open
Nathan-Majernik wants to merge 9 commits into
ChristopherMayes:masterfrom
Nathan-Majernik:quiet_resample
Open

Stratified ("quiet") resampling#149
Nathan-Majernik wants to merge 9 commits into
ChristopherMayes:masterfrom
Nathan-Majernik:quiet_resample

Conversation

@Nathan-Majernik

@Nathan-Majernik Nathan-Majernik commented Jul 2, 2026

Copy link
Copy Markdown

Adds the option for stratified ("quiet") resampling (in addition to the current, fully random downsampling) to resample(). Includes a new demo notebook contrasting random vs stratified downsampling and their effects on the bunching factor of a beam

image

This higher noise power from random downsampling can cause collective effects like CSR to be incorrectly represented in simulation, leading to major, macroscopic divergences from high fidelity simulations; stratified downsampling can mitigate this.

Stratified downsampling can cause distortions if the new population is not much smaller than the initial population. By default, if the ratio is not more than 5, stratified_resample_particles() will fall back to random. The user may override this behavior by setting allow_bad_sampling_ratio to True.

Claude made some tests for the new function; not sure how useful they are.

@Nathan-Majernik Nathan-Majernik changed the title Stratified resampling Stratified ("quiet") resampling Jul 2, 2026
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