The CNMF-E package for extracting calcium traces from microendoscope data outputs Matlab .mat files. These files represent the data as a custom Matlab class called Sources2D, so they cannot be directly loaded into Python for further analysis. This repository provides functions for converting the CNMF-E output into Numpy .npy files.
The Matlab function Sources2D_to_simple_mat
converts the .mat file output by CNMFe to a more basic .mat file that can be opened in Python using scipy.io.loadmat
. In order to load the .mat files generated by CNMF-E into Matlab you must also have the file Sources2D.m which contains the Matlab class definition in the Matlab file path.
The Python function simple_mat_to_npy
converts the .mat file generated by Sources2D_to_simple_mat
to a folder of .npy files with a separate file for each of the variables 'A', 'S', 'C', 'C_raw'. The A matrix is reshaped such that neuron footprints can be visualised with plt.imshow(A[0])
etc.