AllenInstitute / AllenSDK

code for reading and processing Allen Institute for Brain Science data
https://allensdk.readthedocs.io/en/latest/
Other
343 stars 149 forks source link

Missing channels in LFP data, also is the LFP pre-scaled? #2732

Closed AngCamp closed 10 months ago

AngCamp commented 10 months ago

I have two questions about working with the LFP data. Firstly in the tutorial on LFP analysis (here) they do not seem to be scaling the data at all and I heard the allen isntutute neuropixels data had a 0.195 byte/volt scale factor.

Secondly there seems to be some channels missing from a recordings for instance fro the first recording in probeE there are 73 channels from that probe in CA1, but in the lfp data only 18 exist.

Reproducible examples

# calling the metadata about the probes and channels from first recording and its LFP data
session = cache.get_session_data(sessions.index.values[0])
probe_id = session.probes[session.probes.description == 'probeE'].index.values[0]
lfp = session.get_lfp(probe_id)

But despite neuropixels probes have 364 channel (and one reference channel) there are only 73 lfp channels in the lfp data. lfp.shape returns (12028993, 95). Furthermore if I check for the number of channels in a brain regions, for instance CA1, as listed by the structure annotations in the session object sotring the meta data there are far fewer lfp channels in the lpf object.

# check the number of channels from this probe in CA1
session.channels.structure_acronym[(session.channels.probe_id==probe_id)&(session.channels.structure_acronym=='CA1')]

returns:

 id
850258856    CA1
850258862    CA1
850258868    CA1
850258874    CA1
850258880    CA1
            ... 
850258988    CA1
850258992    CA1
850258994    CA1
850258998    CA1
850259000    CA1
Name: structure_acronym, Length: 73, dtype: object
# pulling those channles data will likewise give 73
ca1_chans =session.channels.probe_channel_number[(session.channels.probe_id==probeid)&(session.channels.structure_acronym=='CA1')]

# now we check for matching channel identifiers
ca1_idx = np.isin(lfp.channel.values, ca1_chans.index.values)
ca1_idx = lfp.channel.values[ca1_idx]
ca1_idx.shape

There are only 18 channels in the lfp for probeE which match based on channel identifier. Which is not surprising considering there are only 73 channels in that probe.

Have I simply chosen a bad probe? Please help me understand why there is missing LFP data.

morriscb commented 10 months ago

Hi @AngCamp, these questions are likely better asked on the community forum https://community.brain-map.org/. If there ends up truly being an issue, open another github issue here.