Skip to content

[Ref #215] Diagnostic plots for bad channel detection #221

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

chandrikarj
Copy link
Contributor

Implement Diagnostic Plots for Bad Channel Detection

Description

What is this PR

  • Addition of a new feature
  • Bug fix
  • Other

Why is this PR needed?
This PR adds functionality to generate and save diagnostic plots after bad channel detection, which will help users visually inspect the results of preprocessing. These plots include visualizations of the data before and after bad channel detection, as well as individual plots for each detected bad channel.

What does this PR do?

  1. Adds a new method _generate_and_save_plot() to create and save various diagnostic plots
  2. Implements _save_diagnostic_plots() to generate all necessary diagnostic visualizations
  3. Creates plots in a dedicated "diagnostic_plots" directory
  4. Adds comprehensive tests to ensure plots are correctly generated and saved

References

#215

How has this PR been tested?

A new test class TestDiagnosticPlots is added that specifically validates the diagnostic plot functionality. The test:

  1. Creates a mock PreprocessedRun with simulated bad channels
  2. Verifies that diagnostic plots directory doesn't exist initially
  3. Triggers the diagnostic plot generation via save_preprocessed()
  4. Confirms that all expected plot files are created in the correct location

The test ensures that for each shank, we generate:

  • A "before detection" plot
  • An "after detection" plot
  • Individual plots for each detected bad channel

Is this a breaking change?

No, this is a non-breaking addition.

Checklist:

  • The code has been tested locally
  • Tests have been added to cover all new functionality
  • The documentation has been updated to reflect any changes
  • The code has been formatted with pre-commit

@chandrikarj chandrikarj marked this pull request as draft March 17, 2025 19:59
@chandrikarj chandrikarj changed the title [Ref #215} Diagnostic plots for bad channel detection [Ref #215] Diagnostic plots for bad channel detection Mar 17, 2025
@chandrikarj chandrikarj force-pushed the diagnostic-plots-for-bad-channels branch from a905e85 to 32e3a04 Compare March 17, 2025 20:11
@chandrikarj
Copy link
Contributor Author

chandrikarj commented Mar 18, 2025

Will look into the test failures asap, hence marked as a draft for now.

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.

1 participant