Skip to content

Conversation

@ChristopherMayes
Copy link
Owner

Problem

ResistiveWallPseudomode called PseudomodeWakefield.__init__ in __post_init__, which stored a static mode list (_modes) at creation time. If a user later modified parameters like radius, the stored mode was not updated, causing incorrect wakefield calculations.

Solution

Replaced the static _modes attribute with a dynamic @property that recomputes the pseudomode from current parameters on each access.

Changes

  • Removed PseudomodeWakefield.__init__ call from __post_init__
  • Added _modes property that dynamically returns [self._create_mode()]

Verification

wake = ResistiveWallPseudomode.from_material('copper-slac-pub-10707', radius=2.5e-3)
print(wake._modes[0].A)  # 5.752e+15

wake.radius = 5e-3
print(wake._modes[0].A)  # 1.438e+15 (correctly scaled by 1/radius²)

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where ResistiveWallPseudomode parameters weren't dynamically propagating to wakefield calculations. The static mode list was computed once at initialization and never updated when parameters changed.

Changes:

  • Replaced static _modes attribute with dynamic @property that recomputes pseudomode from current parameters
  • Removed PseudomodeWakefield.__init__ call from __post_init__ method

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ChristopherMayes ChristopherMayes merged commit 93bbc63 into master Jan 24, 2026
28 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