Skip to content

Visual coding dataset channels.y==channels.z in persession nwb file? #2776

@lilytong0919

Description

@lilytong0919

Describe the bug

I believe in the nwb file 'y' and 'z' column under electrodes table supposingly represent the dv and ml axis of the registered ccf coordinate of the channel. The value under these columns are exactly identical.
The collective channel table is not effected.

To reproduce

For quick visualization mybe check this data preview on Neurosift: https://neurosift.app/nwb?url=https://api.dandiarchive.org/api/assets/ac4bfefc-d259-4d13-a083-89df1f9044b9/download/&dandisetId=000022&dandisetVersion=0.251116.2247
(Find the row for electrode and click preview one should see this:

Image

Below is how I access data through allen package functions or directly from nwb file on my local machine

# Imports
import os
from pathlib import Path

from allensdk.brain_observatory.ecephys.ecephys_project_cache import EcephysProjectCache
# Setup cache directory (without download hopefully?)
output_dir = "F:/Data/allen_ecephysProjectData"
resources_dir = Path.cwd().parent / 'resources'
DOWNLOAD_LFP = False

# store downloaded data
manifest_path = os.path.join(output_dir, "manifest.json")
cache = EcephysProjectCache.from_warehouse(manifest=manifest_path)

# columns to look at
cols = ['dorsal_ventral_ccf_coordinate', 
        'anterior_posterior_ccf_coordinate', 
        'left_right_ccf_coordinate',
        'ecephys_structure_acronym']
nwb_cols = ['x', 'y', 'z', 'location']
# get channels
channel = cache.get_channels()

# load one session 
sid = 715093703

# get a specific session's data on the columns we care about
overall_ch_tbl = channel[channel['ecephys_session_id'] == sid][cols]

# load session data
session = cache.get_session_data(sid)
# get channel table for this session
channel_table = session.channels[cols]

# load session from nwb file
nwb_path = os.path.join(output_dir, f"session_{sid}", f"session_{sid}.nwb")
from pynwb import NWBHDF5IO
import pandas as pd
nwb_channel_table = pd.DataFrame()
with NWBHDF5IO(nwb_path, 'r') as io:
    nwb = io.read()
    nwb_channel_table = nwb.electrodes.to_dataframe()
    nwb_channel_table = nwb_channel_table[nwb_cols]

And from that I get:

Image

We can see that only in the nwb file y and z columns are equal.

Environment

  • OS and version: Windows 11 Pro
  • Python version: 3.11
  • AllenSDK version: 2.16.2
  • Install method (pip/conda/source): (The pynwb install is just to allow me to use pynwb. For some reason if I just pip install allensdk the pynwb package is there but cannt be found when I try to import)
    conda create -n allensdk python=3.11 pynwb=2.8.3
    conda activate allensdk
    pip install allensdk
    conda install ipykernel
  • Execution context (local/CI/notebook/cluster): local notebook
  • Any pinned dependencies or unusual environment details: No

Are you willing to submit a fix?

  • Yes, I can work on a PR for this
  • No, but I can help test a proposed fix

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions