Code

In our codebase, we separate the Preprocess Code and the Paper Code, as well as some Demo Code for quick start, as outlined below.

Preprocess Code

code for spike sorting, preprocessing LFP and generating 'GoodUnit' files can be found here, which contains the preprocessing code for NNN data, as well as other datasets collected in BaoLab (PKU) using the Macaque Fixation task.

Run NSD_Process_pipeline.m to go through 4 steps:
1) Load_Data_function.m
This function extracts basic information from the MonkeyLogic .bhv file, and the meta data from SpikeGLX .meta, extracts event code from NI data, and check which trial is valid based on eye signal.
Output: META_YYMMDD_Subject_NSD1000_LOC.mat
1) PostProcess_function_raw.m
This function loads the output of Kilosort4, and run BombCell to classify unit into noise, single unit, MUA, and non-somatic unit.
Output: GoodUnitRaw*.mat
1) PostProcess_function.m
This function aligns the spike time to image onset time, generating GoodUnit structure consisting of raster data and PSTH data
Output: GoodUnit*.mat
1) PostProcess_function_LFP.m
This function loads LFP signal and align to image onset time.
Output: GoodLFP*.mat
Run S0_ConvertMatTOh5.m to generate H5 file from GoodUnit files

Our lab is also working on transferring and testing the preprocessing code to Python: pynpxpipe. It may take some time before we can confirm that the two pipelines produce nearly identical output. For now, please use and modify matlab version for re-running the preprocess pipeline.

Paper code

code for analyzing and generating figures in the paper can be found here.

Run CombinedCode.m to go through all figures related to triple-N paper.
Note: Some additional data is needed, please extract others/FMRI.zip and others/ModelFeature.zip before running human- and model- related analysis

Dependency
GSN toolbox
colormap_matplotlib
shadedErrorBar
npy-matlab
violinplot
BombCell

Python version
Here is the python code to reproduce main result from our data, written by Kesheng Wang: TripleNpy

related to plot_EF2_cd.ipynb Since npy-matlab cannot load structured .npy files, we provide a Jupyter notebook for visualizing probe drift. You can install Kilosort4 following the instructions in here.

related to plot_F4_PY_plot_surface_data.ipynb
This is notebook to plot any stats into human brain surface. You need to download the subjects' surface file before plotting stats on it.


Demo code

Several walkthrough demo for illustration our data can be found here.

  • demo1.m, generating single unit raster plot for several images
  • demo2.m, generating populational preference of interested ROI
  • Load_GoodUnit.py, python code for loading Goodunit data