Skip to content

Fix: toTable adds category tables when NWB table is an AlignedDynamicTable#834

Open
ehennestad wants to merge 4 commits into
codex/aligned-dynamic-table-add-categoryfrom
to-table-support-aligneddynamictable
Open

Fix: toTable adds category tables when NWB table is an AlignedDynamicTable#834
ehennestad wants to merge 4 commits into
codex/aligned-dynamic-table-add-categoryfrom
to-table-support-aligneddynamictable

Conversation

@ehennestad

@ehennestad ehennestad commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

⚠️ Depends on #837 — merge that first

Motivation

Problem:
A user creates an IntracellularRecordingsTable and want to inspect it using the toTable method. However, the result only displays the columns of the table but none of the sub-tables (i.e. electrodes, stimuli, responses).

Solution:
Add category tables as columns in table when converting a DynamicTable (AlignedDynamicTable) to a MATLAB table object

Example:

>> evalc("run('icephys.mlx')");
>> nwbfile.general_intracellular_ephys_intracellular_recordings.toTable()

Before:

ans =

  3×2 table

    id    recordings_tag
    __    ______________

    0        {'Tag'}    
    1        {'Tag'}    
    2        {'Tag'}    

Only the recordings_tag column is present.

After:

ans =

  3×6 table

    id    recordings_tag                       electrodes                         stimuli      responses     recording_lab_data
                                     electrode              voltage_threshold     stimulus      response          location     
    __    ______________    _________________________________________________    __________    __________    __________________

    0        {'Tag'}        1×1 types.untyped.ObjectView           0.1           1×1 struct    1×1 struct        {'Mordor'}    
    1        {'Tag'}        1×1 types.untyped.ObjectView          0.12           1×1 struct    1×1 struct        {'Gondor'}    
    2        {'Tag'}        1×1 types.untyped.ObjectView          0.13           1×1 struct    1×1 struct        {'Rohan' }    

Each category table is added as a nested table

Note:
This PR surfaced a small detail that was missed in PR #828. columns of DynamicTable can be empty. Therefore, input validation in the getRow utility function was updated to allow empty colnames as input.

How to test the behavior?

Show here how to reproduce the new behavior (can be a bug fix or a new feature)

Checklist

  • Have you ensured the PR description clearly describes the problem and solutions?
  • Have you checked to ensure that there aren't other open or previously closed Pull Requests for the same change?
  • If this PR fixes an issue, is the first line of the PR description fix #XX where XX is the issue number?

@ehennestad ehennestad changed the title To table support aligneddynamictable Fix: toTable adds category tables when NWB table is an AlignedDynamicTable Jun 24, 2026
@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (codex/aligned-dynamic-table-add-category@19a73bd). Learn more about missing BASE report.

Additional details and impacted files
@@                             Coverage Diff                             @@
##             codex/aligned-dynamic-table-add-category     #834   +/-   ##
===========================================================================
  Coverage                                            ?   95.44%           
===========================================================================
  Files                                               ?      223           
  Lines                                               ?     7921           
  Branches                                            ?        0           
===========================================================================
  Hits                                                ?     7560           
  Misses                                              ?      361           
  Partials                                            ?        0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ehennestad ehennestad force-pushed the codex/aligned-dynamic-table-add-category branch 2 times, most recently from ad0fcb0 to 60d8028 Compare June 25, 2026 11:39
Add categories to column names
Convert categoryTable to Mtable before comparing ids
@ehennestad ehennestad force-pushed the to-table-support-aligneddynamictable branch from a5449bf to 56a9bcc Compare June 25, 2026 12:51
@ehennestad ehennestad added the category: enhancement improvements of code or code behavior label Jun 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: enhancement improvements of code or code behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant