diff --git a/src/cr39py/filtration/stack.py b/src/cr39py/filtration/stack.py index 82ec48a..1c9d2a8 100644 --- a/src/cr39py/filtration/stack.py +++ b/src/cr39py/filtration/stack.py @@ -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, diff --git a/src/cr39py/scan/base_scan.py b/src/cr39py/scan/base_scan.py index b5c9079..2f078b2 100644 --- a/src/cr39py/scan/base_scan.py +++ b/src/cr39py/scan/base_scan.py @@ -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 diff --git a/tests/filtration/test_stack.py b/tests/filtration/test_stack.py index b48238a..5a7aacf 100644 --- a/tests/filtration/test_stack.py +++ b/tests/filtration/test_stack.py @@ -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):