Skip to content

Doric extractor: informative errors for empty channels and artifacts#279

Closed
Copilot wants to merge 7 commits intomainfrom
copilot/fix-informative-errors-empty-channels
Closed

Doric extractor: informative errors for empty channels and artifacts#279
Copilot wants to merge 7 commits intomainfrom
copilot/fix-informative-errors-empty-channels

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 16, 2026

Empty AOut1/AOut2 channels and missing CSV columns crash the Doric extractor with cryptic IndexError/KeyError. This replaces those with actionable ValueErrors that surface in the terminal and via the GUI's pop-up notification system.

Changes

Extractor errors

  • _access_data_doricV6: Guard len(idx) == 0 before idx = idx[0] in both control/signal and TTL branches — raises ValueError naming the channel and suggesting the user deselect it in step 2.
  • _access_data_doricV1: Pre-check event not in keys before HDF5 group access — same informative message.
  • _read_doric_csv: Pre-check event not in df.columns — raises with file path and available columns. All missing columns get a unified message that mentions export artifacts (e.g. Raw, Unknown 7) as examples, so it works for any Doric file.
# Previously: IndexError: list index out of range
# Now:
ValueError: Channel 'AOut1' was not found in the Doric file.
This can happen when the channel (e.g. AOut1 or AOut2) is empty.
Please deselect it in step 2 or choose a different signal channel.

# For any missing CSV column:
ValueError: Column 'Raw' not found in '/path/to/data.csv'.
If this column is an export artifact (e.g. 'Raw', 'Unknown 7'),
please reselect actual analog channels (e.g. AIn-1, AIn-2) in step 2.
Available columns: Time(s), AIn-1, AIn-2

GUI error propagation

Errors surface via the existing pn.state.notifications.error() pop-up mechanism. transients.py now writes the error message to PB_ERROR_FILE before signalling -1 (consistent with read_raw_data.py, preprocess.py, and psth.py), so transient-analysis errors also appear in the pop-up.

Tests

Six unit tests cover all new extractor error paths: V6 empty control/signal channel, V6 empty TTL channel, V1 missing channel, CSV missing column, and CSV export artifact messages.

Copilot AI and others added 2 commits April 16, 2026 16:13
… in Doric extractor

Agent-Logs-Url: https://github.com/LernerLab/GuPPy/sessions/35b09bd1-aea2-44e6-9dc2-4892d7bfaa03

Co-authored-by: pauladkisson <34703136+pauladkisson@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix informative errors for empty channels and artifacts Doric extractor: informative errors for empty channels and Raw/Unknown 7 artifacts Apr 16, 2026
Copilot AI requested a review from pauladkisson April 16, 2026 16:16
Copy link
Copy Markdown
Collaborator

@pauladkisson pauladkisson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd also like these errors to propagate up to the user experience in the GUI rather than just being in the terminal output, which users are not really going to want to look at.

for event in events:
if event not in df.columns:
available = ", ".join(df.columns.tolist())
if event in ("Raw", "Unknown 7"):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yikes! Hard-coded event names? This needs to work for all Doric files, not just the ones in stubbed testing data.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in commit 9f56e9c. Removed the if event in ("Raw", "Unknown 7") branch — all missing columns now get a single unified message that mentions these names only as illustrative examples: "If this column is an export artifact (e.g. 'Raw', 'Unknown 7'), please reselect actual analog channels...". This works for any Doric file regardless of the actual column names present.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copilot AI and others added 2 commits April 16, 2026 16:31
…es in sidebar

Agent-Logs-Url: https://github.com/LernerLab/GuPPy/sessions/7902b499-bbe3-44fa-b60a-fcd09362ed6a

Co-authored-by: pauladkisson <34703136+pauladkisson@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 16, 2026

I'd also like these errors to propagate up to the user experience in the GUI rather than just being in the terminal output, which users are not really going to want to look at.

Done in commit 9f56e9c. Errors now surface visually in the sidebar via red Markdown panes (read_error_pane, extract_error_pane, psth_error_pane) displayed below each progress bar. When any orchestrator subprocess fails, it writes the error message to guppyError.txt before signalling -1 to the progress bar file. readPBIncrementValues reads that file when it detects -1 and sets the pane's content to **Error:** <message>, so the user sees the exact error text in the GUI without needing to check the terminal.

Copilot AI changed the title Doric extractor: informative errors for empty channels and Raw/Unknown 7 artifacts Doric extractor: informative errors for empty channels and artifacts, with GUI propagation Apr 16, 2026
Copilot AI requested a review from pauladkisson April 16, 2026 16:34
@pauladkisson
Copy link
Copy Markdown
Collaborator

@copilot I just merged content from a separate pull request where I ran into a similar issue and implemented a fix where it surfaced the errors in a nice little pop-up that I thought was really good. I think this makes a good chunk of the code in this PR no longer necessary. Could you please remove the changes that are superseded by the fix?

…erged main

Agent-Logs-Url: https://github.com/LernerLab/GuPPy/sessions/8d5ecd21-b8f2-4787-873f-ec6fc8b8a0cf

Co-authored-by: pauladkisson <34703136+pauladkisson@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Apr 16, 2026

@copilot I just merged content from a separate pull request where I ran into a similar issue and implemented a fix where it surfaced the errors in a nice little pop-up that I thought was really good. ...

Done in commit 72a9c07. Removed the superseded sidebar Markdown error panes (sidebar.py, test_sidebar.py), the broken error_pane block from readPBIncrementValues (progress.py), and the writeErrorToFile helper. transients.py now writes to PB_ERROR_FILE directly (consistent with read_raw_data.py and preprocess.py), so all orchestrators use the same pattern and errors surface via the pn.state.notifications.error() pop-up from the merged fix.

Copilot AI changed the title Doric extractor: informative errors for empty channels and artifacts, with GUI propagation Doric extractor: informative errors for empty channels and artifacts Apr 16, 2026
@pauladkisson pauladkisson deleted the copilot/fix-informative-errors-empty-channels branch April 21, 2026 20:18
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.

Doric extractor: informative errors for AOut channels and Raw/Unknown 7 artifacts

2 participants