Skip to content

Commit f0df8be

Browse files
committed
implement isolation
1 parent 74d9298 commit f0df8be

2 files changed

Lines changed: 27 additions & 2 deletions

File tree

native_fisher_py/python/native_fisher_py/data/classes.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2173,12 +2173,14 @@ def get_last_precursor_mass(self, index):
21732173
def get_isolation_width(self, index):
21742174
if _IS_SPHINX:
21752175
return 0.0
2176-
raise NotImplementedError("get_isolation_width")
2176+
from ..native_fisher_py_backend import get_scan_event_isolation_width
2177+
return get_scan_event_isolation_width(self._handle, self._scan_number, index)
21772178

21782179
def get_isolation_width_offset(self, index):
21792180
if _IS_SPHINX:
21802181
return 0.0
2181-
raise NotImplementedError("get_isolation_width_offset")
2182+
from ..native_fisher_py_backend import get_scan_event_isolation_width_offset
2183+
return get_scan_event_isolation_width_offset(self._handle, self._scan_number, index)
21822184

21832185
def get_is_multiple_activation(self, index):
21842186
if _IS_SPHINX:

tests/test_collision_energy.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,3 +40,26 @@ def test_reaction_collision_energy(raw_file):
4040
scan_event = raw_file.get_scan_event_for_scan_number(scan_num)
4141
reaction = scan_event.get_reaction(0)
4242
assert reaction.collision_energy == pytest.approx(28.0)
43+
44+
45+
def test_isolation_width(raw_file):
46+
# Test values obtained from a reference run
47+
width_expectations = {
48+
2: 1.6,
49+
3: 1.6,
50+
4: 1.6,
51+
6: 1.6,
52+
8: 1.6
53+
}
54+
55+
for scan_num, expected_width in width_expectations.items():
56+
scan_event = raw_file.get_scan_event_for_scan_number(scan_num)
57+
58+
# Test ScanEvent.get_isolation_width
59+
actual_width = scan_event.get_isolation_width(0)
60+
assert actual_width == pytest.approx(expected_width), f"Scan {scan_num} ScanEvent isolation width mismatch"
61+
62+
# Test Reaction.isolation_width
63+
reaction = scan_event.get_reaction(0)
64+
assert reaction.isolation_width == pytest.approx(expected_width), f"Scan {scan_num} Reaction isolation width mismatch"
65+
assert reaction.isolation_width_offset == pytest.approx(0.0), f"Scan {scan_num} Reaction isolation width offset mismatch"

0 commit comments

Comments
 (0)