Skip to content

Add CRCNS hc-6 MATLAB ingestion starter notebook with Neuropy-compatible conversion flow#5

Draft
CommanderPho with Copilot wants to merge 2 commits into
masterfrom
copilot/implement-jupyter-notebook-for-crcns
Draft

Add CRCNS hc-6 MATLAB ingestion starter notebook with Neuropy-compatible conversion flow#5
CommanderPho with Copilot wants to merge 2 commits into
masterfrom
copilot/implement-jupyter-notebook-for-crcns

Conversation

Copilot AI commented Jun 23, 2026

Copy link
Copy Markdown

This adds a lightweight starter notebook for loading locally unpacked CRCNS hc-6 .mat files and mapping core contents into Neuropy-compatible structures. The notebook is path-driven and intentionally easy to adapt when hc-6 file naming/layout differs across local copies.

  • What this PR adds

    • New notebook: EXTERNAL/TESTING/testing_notebooks/CRCNS_hc6_mat_to_neuropy_starter.ipynb
    • Focused execution flow: configure dataset root → discover .mat files → inspect keys → convert data
  • MAT loading + structure inspection

    • Uses repo-style import_mat_file when available (pyphoplacecellanalysis / neuropy), with scipy.io.loadmat fallback
    • Enumerates .mat files from a user-editable base_dir
    • Prints top-level keys from a sample file to quickly verify schema
  • Neuropy-compatible conversion path

    • Position conversion to Position.from_separate_arrays(...) when possible (fallback to dict)
    • Spike conversion to tabular form and grouped Neurons(...) object construction
    • Epoch conversion to DataFrame and Epoch(...) object construction
    • Optional assembly into a DataSession container when neuropy session classes are importable
  • Adaptability for hc-6 variants

    • File role discovery via editable pattern matching (position, spikes, epochs)
    • Defensive field extraction helpers for common MATLAB struct encodings (dtype.names / object fields)
base_dir = Path('/path/to/local/crcns/hc-6')
mat_files = sorted(base_dir.rglob('*.mat'))

position_file = _pick_file(['*position*.mat', '*pos*.mat', '*vt*.mat'])
spikes_file = _pick_file(['*spike*.mat', '*spikes*.mat', '*cell*.mat'])
epochs_file = _pick_file(['*epoch*.mat', '*behavior*.mat', '*states*.mat'])

Copilot AI changed the title [WIP] Add notebook for loading CRCNS hc-6 dataset Add CRCNS hc-6 MATLAB ingestion starter notebook with Neuropy-compatible conversion flow Jun 23, 2026
Copilot AI requested a review from CommanderPho June 23, 2026 17:20
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