Skip to content
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

Add ability to get "stable" units from ephys_data #322

Open
abuzarmahmood opened this issue Jan 22, 2025 · 1 comment
Open

Add ability to get "stable" units from ephys_data #322

abuzarmahmood opened this issue Jan 22, 2025 · 1 comment

Comments

@abuzarmahmood
Copy link
Collaborator

abuzarmahmood commented Jan 22, 2025

Do not recalculate drift, just load output of drift_check for post-stimulus drift into ephys_data (read csv)
If p-val is less than threshold (default = 0.05), then mark unit as unstable. Store vector of stable/unstable units as attribute in ephys_data

@abuzarmahmood
Copy link
Collaborator Author

The issue involves adding the ability to get "stable" units from ephys_data without recalculating drift. The following suggestions and changes were made by the agents:

  1. Files Identified for Modification:

    • File: /home/exouser/Desktop/blech_github_bot/src/repos/katzlabbrandeis/blech_clust/utils/ephys_data/ephys_data.py
      • Description: Contains the main implementation of the ephys_data class or module. Modifications here involve adding functionality to load the output of drift checks and mark units as stable or unstable based on the p-value threshold.
    • File: /home/exouser/Desktop/blech_github_bot/src/repos/katzlabbrandeis/blech_clust/utils/qa_utils/drift_check.py
      • Description: Handles drift checking utilities. It may need to be referenced or modified to ensure that the drift check results can be loaded into ephys_data.
  2. Suggested Changes:

    • Modify ephys_data.py:
      • Add a method to load drift check results from a CSV file and mark units as stable or unstable based on a p-value threshold.
      • Add an attribute to store the stability status of each unit.
      • Implement logic to mark units as stable or unstable using the p-value threshold.
  3. Code Implementation:

    # Add this method to the ephys_data class
    
    def load_drift_check_results(self, csv_path, p_val_threshold=0.05):
        """
        Load drift check results from a CSV file and mark units as stable or unstable.
    
        Parameters:
        - csv_path: Path to the CSV file containing drift check results.
        - p_val_threshold: Threshold for p-value to determine stability (default=0.05).
        """
        # Load the CSV file
        drift_results = pd.read_csv(csv_path)
    
        # Assume the CSV has columns 'unit' and 'p_value'
        self.stable_units = drift_results['p_value'] >= p_val_threshold
    
        # Store the stability vector as an attribute
        self.unit_stability = self.stable_units.to_numpy()
    
        print("Loaded drift check results and marked units as stable/unstable.")
  4. Integration and Testing:

    • Integrate the new method in the appropriate place in the workflow.
    • Update the documentation for the ephys_data class to reflect the new functionality.
    • Test the implementation with a sample CSV file to ensure correct functionality.

By following these steps, the ability to get "stable" units from ephys_data can be added as specified in the issue.


This response was automatically generated by blech_bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant