neurostatslab / tensortools

A very simple and barebones tensor decomposition library for CP decomposition a.k.a. PARAFAC a.k.a. TCA
MIT License
160 stars 65 forks source link

Questions about TCA. Trial length preprocessing and event detection on 2 photon calcium imaging #35

Open pedrolagomarsino opened 2 years ago

pedrolagomarsino commented 2 years ago

Hi Alex, Thanks for the package, I've been using it and find it extremely helpful. The dataset that I have is very similar to the mice four-armed maze experiment from the paper, but with mice in Virtual reality running on a linear track.
I have a couple of very basic questions about the implementation, don't know if this is the correct place to ask, but here they are:

  1. As stated in the paper : We assume neural activity is recorded at T time points within each trial, but trials of variable duration can be aligned or temporally warped to accommodate this constraint (see, e.g., Kobak et al., 2016) From kobak et al I understand that what is done is alignment at relevant time points and then stretching to fit the data (some kind of interpolation). But then in the methods you state: [...] we used the largest number of intra-trial samples common to all trials (or, equivalently, the duration of the shortest trial) as the length of the intra-trial time dimension. We chose to temporally align trials to the end of each trial [...] Is in this example also some stretching being implemented to align the beginning of the track as well? What is the best practice for this?
  2. I've read your other 2 papers on time warping, but as far as I understand that doesn't solve the "different length trials" problem. And to fit the time warping models I still have to feed tensors with equal length trials. Is that correct?
  3. Would it make sense to use space as the second dimension instead of time (either interpolating or using binning averages)?
  4. Given that I have 2 photon imaging of the neurons, I generally first detect calcium events and set the non-event parts of the traces to zero. Would this give problems for the decomposition? is it better to keep the calcium traces as is?

Thank you again for developing the package and sorry if this is not the place for these questions.