Example 3: Extract trial-averaged neural trajectories from PSTHs


This video walks through the steps of inputting raw spike trains into DimReduce, choosing a small, non-overlapping bin width, trial-averaging, performing dimensionality reduction, and automatically uploading the extracted trial-averaged neural trajectories for visualization in DataHigh.



Download video



Detailed Step-by-step tutorial


The same tutorial can be found in the DataHigh User Guide .pdf in the main folder of the DataHigh software package. It corresponds to ex3_dimreduce.m in /DataHigh/examples/.

1.

Navigate to the examples folder in the main DataHigh directory. Enter ex3_dimreduce into the Matlab command console to input PSTHs into DimReduce. The example dataset contains two different experimental conditions whose PSTHs have already been computed. Each PSTH has 61 neurons and is binned with 1ms resolution. The same computation can be achieved by inputting raw spike trains into DimReduce and selecting the "Trial-averaged neural trajectories" check box. If you decide to input raw spike trains, make sure the spike trains have first been properly aligned.

2.

The DimReduce figure will pop up. The top right corner has Next Step instructions, so that the user can walk through the steps of performing dimensionality reduction. Note that clicking Next Step will move the large red number to the next location where a choice is needed by the user. Each option also has a ? button nearby to provide more information about that step.

3.

For this example dataset, in the time bin width box, enter 20ms (if not there by default). The "Type" will read "Trajs" for neural trajectories. DimReduce will convert the PSTHs to 20ms resolution by locally summing within non-overlapping 20ms bins.

4.

For the mean spikes/sec threshold, enter 1.0 spikes/sec. DataHigh removes 4 neurons from the analyses. Neurons with firing rates less than 1 spikes/sec can sometimes be problematic, so we remove them. Leave the "Trial-averaged neural trajs" box unchecked, since we already trial-averaged the data.

5.

Under Method, choose "PCA" for Principal Component Analysis. By averaging across trials, we presumably remove much of the Poisson-like spiking variability. Thus, we can apply PCA, which has no concept of observation noise, to the PSTHs. Leave the “Trial-averaged neural trajs” and “Square Root Transform” boxes unchecked, and leave the smoothing kernel width at 0ms.

6.

We can estimate the "optimal" dimensionality using PCA by viewing the eigenspectrum. Slide the Select dimensionality scrollbar on the right side of DimReduce to the maximum dimensionality (57). Click Perform Dim Reduction to perform dimensionality reduction. The PostDimReduce figure pops up.

7.

Click the View Each Dim button. The SingleDim figure pops up. It displays the individual orthonormalized latent variables for all conditions. Orthonormalization has the advantage of ordering the latent variables such that latent variable 1 describes the most variance in the data while latent variable 57 describes the least variance. Click Next to scan through the latent variables. One noticeable feature is that the traces in time are not smooth. This is probably due to a limited number of trials to estimate the PSTHs.

8.

We can go back and smooth the PSTHs before applying dimensionality reduction. Close the SingleDim and PostDimReduce figures. On the left side of DimReduce, slide the Smoothing kernel width to 25ms, which convolves each PSTH with a Gaussian with standard deviation of 25ms. Then click on Perform dim reduction again to perform dimensionality reduction. The PostDimReduce figure pops up.

9.

Again, click on the View Each Dim button, and scan through the latent variables. The neural trajectories are now smooth. After the top ten, the latent variables do not vary much across time or experimental condition, so we can probably safely disregard them. Close the SingleDim figure.

10.

Click the Eigenspectrum button, which pops up the Eigenspectrum figure. We see that the top six dimensions explain about 93% of the variance, which agrees with what we found in the individual latent variables with SingleDim. We could select the top ten latent variables, but it appears that the last four do not help much to describe the data. Close the Eigenspectrum figure.

11.

In the Select final dimensionality menu list, select a dimensionality of 6. DimReduce removes latent variables 7 through 57, and keeps the top six latent variables. Click Upload to DataHigh. The DataHigh interface fills the screen.

12.

Since there are so few trajectories, the rotation speed may be fast. You can test this by clicking and holding on one of the preview panels (to the left and right of the central panel), which rotates the central panel's 2-d projection. To change the rotation speed, click the Analysis Tools tab and then the Zoom/Rotate button to pop up the Zoom/Rotate figure. Slide the middle scrollbar (named Rotation Speed) down to a slower value. Close the Zoom/Rotate figure. The rotation speed has now been lowered, and can be tested by clicking and holding on a preview panel.



      Visualize trial-averaged neural trajectories in DataHigh

      Return to Tutorial Videos

      Return to the DataHigh main page