Skip to content

fix: Thermo Skanit - Initialize plate_well_count to prevent UnboundLocalError#1156

Merged
nathan-stender merged 3 commits into
mainfrom
fix/thermo-skanit-plate-well-count
Mar 26, 2026
Merged

fix: Thermo Skanit - Initialize plate_well_count to prevent UnboundLocalError#1156
nathan-stender merged 3 commits into
mainfrom
fix/thermo-skanit-plate-well-count

Conversation

@nathan-stender

Copy link
Copy Markdown
Collaborator

Summary

  • Fixes UnboundLocalError in Thermo Skanit parser when processing plates with empty wavelength data
  • Initializes plate_well_count to 0 at the start of each plate iteration to ensure the variable is always defined

Problem

When the Thermo Skanit parser processes a plate where all wavelength DataFrames are empty (no valid data), the plate_well_count variable was never assigned a value. This caused an UnboundLocalError at line 379 when trying to access plate_well_counts[plate_id].

Solution

Initialize plate_well_count = 0 at the beginning of each plate iteration. This ensures the variable is always defined even when no valid wavelength data is found.

This approach follows the established pattern in other parsers (e.g., QIAcuity dPCR) where 0 is used as a fallback value when plate well count cannot be determined. The field is required in the ASM schema and will be made optional in a future version.

Test plan

  • Existing tests pass
  • Linting passes (ruff, black, mypy)
  • Verify fix handles edge case of plates with empty wavelength data without crashing

🤖 Generated with Claude Code

…calError

When processing plates with empty wavelength data, the plate_well_count variable was never assigned, causing an UnboundLocalError when trying to access it later. This fix initializes plate_well_count to 0 at the start of each plate iteration, ensuring the variable is always defined even when no valid data is found.

This follows the established pattern in other parsers (e.g., QIAcuity dPCR) where 0 is used as a fallback value when plate well count cannot be determined, since the field is required in the ASM schema.

Co-Authored-By: Claude Opus 4.1 <noreply@anthropic.com>
@nathan-stender
nathan-stender requested review from a team and slopez-b as code owners March 25, 2026 20:09
@nathan-stender
nathan-stender force-pushed the fix/thermo-skanit-plate-well-count branch from 37456fb to 34a308c Compare March 25, 2026 20:44
… changes

The detect-changes workflow was failing when only source files (no test files)
were modified because grep returns exit code 1 when no matches are found.
With GitHub Actions' default 'set -e' behavior, this caused the script to
exit immediately.

Added '|| true' to grep commands that might not find matches to ensure the
script continues even when there are no test file changes or empty results.

This fixes the issue preventing CI from running on single-parser PRs.

Co-Authored-By: Claude Opus 4.1 <noreply@anthropic.com>
@nathan-stender
nathan-stender merged commit 3aa5c56 into main Mar 26, 2026
9 checks passed
@nathan-stender
nathan-stender deleted the fix/thermo-skanit-plate-well-count branch March 26, 2026 02:51
nathan-stender added a commit that referenced this pull request Mar 27, 2026
### Added

- MSD Workbench - Update support for CSV format and Calc Conc CV
handling (#1157)
- Add XLSX support to MSD Workbench parser (#1154)

### Fixed

- Thermo Skanit - Initialize plate_well_count to prevent
UnboundLocalError (#1156)
- AppBio QuantStudio Design & Analysis - Check for valid rq values
before setting r_sample and r_target (#1138)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants