Skip to content

Commit

Permalink
Add projected range property to Stack
Browse files Browse the repository at this point in the history
  • Loading branch information
pheuer committed Feb 6, 2025
1 parent 093485e commit b57f6dc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
20 changes: 20 additions & 0 deletions src/cr39py/filtration/stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,26 @@ def _range_ion(
return 0 * E.u
return E

def projected_range(self, particle: str, E_in: u.Quantity) -> u.Quantity:
"""
Calculate the projected range of a particle in the layer.
Parameters
----------
particle : str
Incident particle
E_in : u.Quantity
Energy of the particle before ranging in the layer.
Returns
-------
R : u.Quantity
Projected range of the particle in the layer.
"""
prjrng_interp = self.srim_data(particle).projected_range_interpolator
return prjrng_interp(E_in.m_as(u.eV)) * u.m

def range_down(
self,
particle: str,
Expand Down
3 changes: 2 additions & 1 deletion src/cr39py/scan/base_scan.py
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,8 @@ def chi(self) -> tuple[np.ndarray]:
return x, y, chi

def F2(self) -> tuple[np.ndarray]:
"""The Zylstra overlap parameter ``F2`` for each cell.
"""
The Zylstra overlap parameter ``F2`` for each cell.
F2 is the fraction of tracks that overlap one other track, and
is a reasonable approximation of the number of tracks that will
Expand Down
2 changes: 2 additions & 0 deletions tests/filtration/test_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def test_save_layer(tmpdir):
("25 um Al", "Triton", 3 * u.MeV, 1.642 * u.MeV),
]

# TODO add tests for projected range


@pytest.mark.parametrize("layer,particle,Ein,expected", cases)
def test_layer_ion_ranging(layer, particle, Ein, expected):
Expand Down

0 comments on commit b57f6dc

Please sign in to comment.