[WIP] Add dipole contribution visualization - #1178
Open
Arnav05-cyber wants to merge 3 commits into
Open
Conversation
- Changed _OutputWidgetHandler.emit() to append new messages to the end - This ensures errors and new log messages appear at the bottom where they're more visible - Fixes issue where errors could be hidden when appearing at the top of log window Fixes: GUI error visibility issue
- Enhanced Optimizer class to accept custom callable loss functions - Added validation for custom objective function signatures - Implemented three predefined custom loss functions: * _spectral_power_loss: for matching power spectral densities * _phase_coherence_loss: for optimizing rhythmic coherence * _custom_rmse_with_weights: for time-weighted RMSE optimization - Added comprehensive example showing usage of custom loss functions - Added test suite for custom loss function validation and functionality - Updated exports in __init__.py to include new loss functions This addresses the need for custom loss functions suitable for Poisson drives and steady-state oscillations where traditional RMSE is not appropriate. Fixes: Custom loss function feature request
- Created new dipole_contributions.py module with analysis and visualization functions - Added plot_dipole_contributions() to visualize UP vs DOWN dipole components - Added analyze_dipole_contributions() to analyze component contributions - Enhanced Dipole class with plot_contributions() and analyze_contributions() methods - Identifies components that contribute to UP (positive) vs DOWN (negative) deflections: * L2 pyramidal cells and proximal drives UP components (red) * L5 pyramidal cells and distal drives DOWN components (blue) * Tonic biases based on amplitude polarity - Comprehensive example script showing usage and interpretation - Full test suite ensuring functionality and edge cases - Updated exports in __init__.py This addresses Stephanie's request for visualization showing what components contribute to dipole flow 'up' versus 'down' throughout the simulation, similar to figure C in issue jonescompneurolab#966. Features: - Time-series visualization of component contributions - Color-coded UP (red) vs DOWN (blue) components - Overlay of total dipole signal - Analysis of drive locations, layer contributions, and biases - Educational annotations and interpretive guidance
Collaborator
|
Thank you for your contribution Arnav and apologies for the late response. Your PR is very interesting and possibly relevant to other ongoing work that we are doing ourselves. We will try to respond in greater detail to your proposed changes as soon as we can. In the meantime, if you have any figures displaying some of the functionality, it would be great if you could post it here. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Stephanie requested a visualization that shows what components (drives, channels, etc.) contribute to dipole flow "up" versus "down" throughout the simulation, similar to figure C in issue #966.
Solution
Implemented comprehensive dipole contribution analysis and visualization tools:
New Features
plot_dipole_contributions(): Time-series visualization of UP vs DOWN componentsanalyze_dipole_contributions(): Quantitative analysis of contributionsplot_contributions()andanalyze_contributions()methodsComponent Classification
Key Benefits
Files Added
dipole_contributions.pymodule with analysis functionsUsage