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

[Neuropixels] Add MATLAB script to convert "location" in "SU" struct to be readable in Python #27

Merged

Conversation

weiglszonja
Copy link
Collaborator

Problem

When reading certain ephys data files in Python (e.g., E003_2022-08-01.mat), the location field appears as a MatlabOpaque object, making it unreadable in Python. This occurs because the "location" data is stored in a MATLAB format that doesn't translate directly to Python.

Solution

Added a MATLAB utility script that:

  • Recursively processes all .mat files in the specified directory
  • Identifies files containing 'SU' (Single Unit) structures (skipping files that don't have "SU" named struct)
  • Converts the "location" field to a plain string format
  • Preserves the original data structure while making it Python-compatible

This script processes .mat files, checking for the 'SU' structure and converting 'location' fields to plain strings if they exist. It iterates through each file in the specified directory, handling errors, and saves the updated data.
@weiglszonja weiglszonja self-assigned this Dec 3, 2024
Copy link
Contributor

@alessandratrapani alessandratrapani left a comment

Choose a reason for hiding this comment

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

OK

@weiglszonja weiglszonja merged commit c11db70 into main Dec 5, 2024
@weiglszonja weiglszonja deleted the Neuropixels/convert-location-to-be-readable-in-Python branch December 5, 2024 08:49
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