carlson-lab / lpne-data-analysis

1 stars 0 forks source link

Feature shapes #8

Open jackgoffinet opened 3 years ago

jackgoffinet commented 3 years ago

saveFeatures.m lists the following shapes for features:

power: MxNxP
coherence: MxNxPxQ
granger: PxFxW
instant: PxFxW
causality: PxFxW

M: frequency
N: brain area
P: time window
Q: another brain area
F: frequency
W: window

Running the pipeline, I get these shapes:

power: [145,6,250]
coherence: [6,6,145,250]
causality: [145,251,30]

It looks like power is [M,N,P] and coherence is [N,N,M,P]. @neil-gallagher , are the docs wrong here? Or should coherence be reshaped?

jackgoffinet commented 3 years ago

And W is the upper/lower triangular part of an N by N matrix, right?

jackgoffinet commented 3 years ago

It also looks like causality is [M,P+1,N*(N-1)]. Is that an extra time window?

neil-gallagher commented 3 years ago

Hey Jack, are you viewing things in Python or Matlab? The dimensions get reversed between the two because I believe matlab has the first dimension iterate over adjacent elements in memory (fortran-style), while numpy typically does that for the last dimension (c-style).

jackgoffinet commented 3 years ago

Thanks, @neil-gallagher . I think that explains most of these differences -- the dimensions are just reversed in Python vs. Matlab. I think the shapes still don't match the docstrings, though. Right now I'm getting these shapes in Matlab:

power: [frequency, region, time]

This matches the docstring.

coherence: [frequency, time, region, region]

According to the docstring, this should be [frequency, region, time, region].

causality: [30, frequency+1, time]

According to the docstring, this should be [time, frequency, window]. Two questions about this: i) does "window" represent the region * (region-1) ordered pairs of regions? ii) is there an extra frequency bin here relative to the coherence and power? Is it a lower frequency or a higher frequency?