Skip to content

Commit dc80b4f

Browse files
fix: Report Peak of Interest data as calculated data in Stunner parser (#1215)
## Summary - PkOI (Peak of Interest) columns were being silently discarded — consumed by peak extraction to prevent custom info leaking, but never written to output - Added `alt_columns` for new `pkoi` naming convention to existing `CALCULATED_DATA_LOOKUP` Peak of Interest entries - Added two new calculated data entries: Peak of Interest Mass Mean Diameter and Peak of Interest Rayleigh Ratio R (new fields in newer instrument software) - All 72 columns from the customer file are now accounted for in the ASM output ## Context Follow-up to #1213. The `CALCULATED_DATA_LOOKUP` already had "Peak of Interest" entries but they used old column names (`peak of interest mean dia (nm)`) that didn't match the new format (`pkoi intensity mean dia. (nm)`). Meanwhile, `_extract_peak_data` was consuming the PkOI columns to prevent leaking, effectively discarding the data entirely. ## Test plan - [x] All 34 Stunner/Lunatic tests pass - [x] Lint clean (ruff, black, mypy) - [x] Customer file produces 510 Peak of Interest calculated data docs across 6 fields - [x] All 72 original columns validated as present in ASM output - [x] 60/85 measurements have real PkOI values, 25 correctly report N/A (blanks/no-peaks) - [x] No duplicate columns in data system document 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5f9d227 commit dc80b4f

5 files changed

Lines changed: 701 additions & 75 deletions

File tree

src/allotropy/parsers/unchained_labs_lunatic_stunner/constants.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@
128128
},
129129
{
130130
"column": "peak of interest mean dia (nm)",
131+
"alt_columns": ["pkoi intensity mean dia. (nm)"],
131132
"name": "Peak of Interest Mean Diameter",
132133
"feature": "dynamic light scattering",
133134
"unit": "nm",
@@ -140,18 +141,21 @@
140141
},
141142
{
142143
"column": "peak of interest est. mw (kda)",
144+
"alt_columns": ["pkoi est. mw (kda)"],
143145
"name": "Peak of Interest Est. MW",
144146
"feature": "dynamic light scattering",
145147
"unit": "kDa",
146148
},
147149
{
148150
"column": "peak of interest intensity (%)",
151+
"alt_columns": ["pkoi intensity area (%)"],
149152
"name": "Peak of Interest Intensity",
150153
"feature": "dynamic light scattering",
151154
"unit": "%",
152155
},
153156
{
154157
"column": "peak of interest mass (%)",
158+
"alt_columns": ["pkoi mass area (%)"],
155159
"name": "Peak of Interest Mass",
156160
"feature": "dynamic light scattering",
157161
"unit": "%",
@@ -162,6 +166,20 @@
162166
"feature": "dynamic light scattering",
163167
"unit": UNITLESS,
164168
},
169+
{
170+
"column": "peak of interest mass mean dia (nm)",
171+
"alt_columns": ["pkoi mass mean dia. (nm)"],
172+
"name": "Peak of Interest Mass Mean Diameter",
173+
"feature": "dynamic light scattering",
174+
"unit": "nm",
175+
},
176+
{
177+
"column": "peak of interest rayleigh ratio r (cm^-1)",
178+
"alt_columns": ["pkoi rayleigh ratio r (1/km)"],
179+
"name": "Peak of Interest Rayleigh Ratio R",
180+
"feature": "dynamic light scattering",
181+
"unit": UNITLESS,
182+
},
165183
{
166184
"column": "derived intensity (cps)",
167185
"name": "Derived intensity",

src/allotropy/parsers/unchained_labs_lunatic_stunner/unchained_labs_lunatic_stunner_calcdocs.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,20 @@ def create_calculated_data(
197197
view_data=detection_type_view,
198198
source_configs=(dynamic_light_scattering_conf,),
199199
),
200+
CalculatedDataConfig(
201+
name="Peak of Interest Mass Mean Diameter",
202+
value="peak of interest mass mean dia (nm)",
203+
unit="nm",
204+
view_data=detection_type_view,
205+
source_configs=(dynamic_light_scattering_conf,),
206+
),
207+
CalculatedDataConfig(
208+
name="Peak of Interest Rayleigh Ratio R",
209+
value="peak of interest rayleigh ratio r (cm^-1)",
210+
unit=UNITLESS,
211+
view_data=detection_type_view,
212+
source_configs=(dynamic_light_scattering_conf,),
213+
),
200214
CalculatedDataConfig(
201215
name="Derived intensity (cps)",
202216
value="derived intensity (cps)",

src/allotropy/parsers/unchained_labs_lunatic_stunner/unchained_labs_lunatic_stunner_structure.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,6 @@ def _extract_peak_data(well_plate_data: SeriesData) -> list[dict[str, Any]]:
115115
if peak_info := _extract_peak_info(well_plate_data, prefix, str(peak_num)):
116116
peak_data.append(peak_info)
117117

118-
# Read "peak of interest" / "pkoi" columns to prevent them from leaking
119-
# into custom_info, but don't add as a separate peak entry since it
120-
# duplicates one of the numbered peaks.
121-
poi_prefix = "pkoi" if uses_new_format else "peak of interest"
122-
_extract_peak_info(well_plate_data, poi_prefix, "OI")
123-
124118
return peak_data
125119

126120

0 commit comments

Comments
 (0)