Skip to content

Commit

Permalink
MAINT: propagate -> drift
Browse files Browse the repository at this point in the history
  • Loading branch information
ken-lauer committed Aug 20, 2024
1 parent 93658ca commit b8f822b
Show file tree
Hide file tree
Showing 3 changed files with 92 additions and 30 deletions.
108 changes: 85 additions & 23 deletions docs/examples/wavefront.ipynb

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions pmd_beamphysics/wavefront.py
Original file line number Diff line number Diff line change
Expand Up @@ -888,15 +888,15 @@ def focus(
self._field_kspace = None
return self

def propagate(
def drift(
self,
direction: Union[str, int],
distance: float,
*,
inplace: bool = False,
) -> Wavefront:
"""
Propagate this Wavefront in-place along Z in meters.
Drift this Wavefront along `direction` in meters.
Parameters
----------
Expand All @@ -918,7 +918,7 @@ def propagate(

if not inplace:
wavefront = copy.copy(self)
return wavefront.propagate(direction, distance, inplace=True)
return wavefront.drift(direction, distance, inplace=True)

self._field_kspace = drift_propagator_z(
field_kspace=self.field_kspace,
Expand Down
8 changes: 4 additions & 4 deletions tests/test_wavefront.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ def projection_plane(request: pytest.FixtureRequest) -> str:
return request.param


def test_smoke_propagate_z_in_place(wavefront: Wavefront) -> None:
def test_smoke_drift_z_in_place(wavefront: Wavefront) -> None:
# Implicitly calculates the FFT:
wavefront.propagate(direction="z", distance=0.0, inplace=True)
wavefront.drift(direction="z", distance=0.0, inplace=True)
# Use the property to calculate the inverse fft:
wavefront.field_rspace


def test_smoke_propagate_z(wavefront: Wavefront) -> None:
new = wavefront.propagate(direction="z", distance=0.0, inplace=False)
def test_smoke_drift_z(wavefront: Wavefront) -> None:
new = wavefront.drift(direction="z", distance=0.0, inplace=False)
assert new is not wavefront


Expand Down

0 comments on commit b8f822b

Please sign in to comment.