Skip to content
Snippets Groups Projects
Commit eee70249 authored by LeCam Steven's avatar LeCam Steven
Browse files

some comments added to readme file and code

parent c582f222
No related branches found
No related tags found
No related merge requests found
# LFP Despiking and Spike Sorting
## Getting started
To make it easy for you to get started with GitLab, here's a list of recommended next steps.
Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)!
## Add your files
- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files
- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command:
```
cd existing_repo
git remote add origin https://gitlab.univ-lorraine.fr/lecam5/lfp-despiking-and-spike-sorting.git
git branch -M main
git push -uf origin main
```
## Integrate with your tools
- [ ] [Set up project integrations](https://gitlab.univ-lorraine.fr/lecam5/lfp-despiking-and-spike-sorting/-/settings/integrations)
## Collaborate with your team
- [ ] [Invite team members and collaborators](https://docs.gitlab.com/ee/user/project/members/)
- [ ] [Create a new merge request](https://docs.gitlab.com/ee/user/project/merge_requests/creating_merge_requests.html)
- [ ] [Automatically close issues from merge requests](https://docs.gitlab.com/ee/user/project/issues/managing_issues.html#closing-issues-automatically)
- [ ] [Enable merge request approvals](https://docs.gitlab.com/ee/user/project/merge_requests/approvals/)
- [ ] [Automatically merge when pipeline succeeds](https://docs.gitlab.com/ee/user/project/merge_requests/merge_when_pipeline_succeeds.html)
## Test and Deploy
Use the built-in continuous integration in GitLab.
- [ ] [Get started with GitLab CI/CD](https://docs.gitlab.com/ee/ci/quick_start/index.html)
- [ ] [Analyze your code for known vulnerabilities with Static Application Security Testing(SAST)](https://docs.gitlab.com/ee/user/application_security/sast/)
- [ ] [Deploy to Kubernetes, Amazon EC2, or Amazon ECS using Auto Deploy](https://docs.gitlab.com/ee/topics/autodevops/requirements.html)
- [ ] [Use pull-based deployments for improved Kubernetes management](https://docs.gitlab.com/ee/user/clusters/agent/)
- [ ] [Set up protected environments](https://docs.gitlab.com/ee/ci/environments/protected_environments.html)
***
## Name
LFP Despiking and spike Sorting
## Description
Le Cam et al. 2023, A Bayesian approach for simultaneous spike/LFP separation and spike sorting, Journal of Neural Engineering
Implement the method described in "Le Cam et al. 2023, A Bayesian approach for simultaneous spike/LFP separation and spike sorting, Journal of Neural Engineering, 2023"
Simultaneous spike sorting and spike/lfp separation based on an iterative variational bayesian approach.
Modify the main.m file to load your own data. The current version can only process one channel at a time. The code comes with two examples:
- 20 seconds of simulated signals from "Le Cam et. al., 2023"
- 10 minutes of simulated signals from "Camunas-Mesa et. al., 2013"
The main parameters of the method can be changed on top of the main file, in particular the spike detection threshold factor 'coef' and the number of wavelet features 'nbfeat' to extract for classification.
## Configuration
Matlab Wavelet toolbox required
## Support
Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc.
This is a first sharable version of the code, probably need some further amelioration to be more user friendly and robust to any kind of data.
Please send me an email (steven.le-cam@univ-lorraine.fr) for questions or if you need any support, I will be happy to help and bug corrections will benefit to future users of the code
## License
For open source projects, say how it is licensed.
If you use this code to process your data, please cite "Le Cam et al. 2023, A Bayesian approach for simultaneous spike/LFP separation and spike sorting, Journal of Neural Engineering, 2023" (DOI 10.1088/1741-2552/acc210)
function [paramVBDS,Spike,w]=VBDS(xb,Fs,paramVBDS,display,verbose)
% Pipeline for spike detection, feature extraction and spike/LFP
% classification/separation
% input:
% xb: monochannel data
% Fs: data sampling rate
% paramVBDS: main parameters of the method
% display: display mode
% verbose: verbose mode
% output:
% paramVDBS: updated method parameters
% Spike: matrix of estimated spike waveforms
% w: despiked LFP
%%
%Band pass filtering to highlight the spikes and thresholding
......@@ -24,7 +34,7 @@ else
gB = fitLFPpowerSpectrum(xb',.01,2*10e3,Fs,display);
gB=fftshift(gB);
%% Initial guess on the number of classes (using GMM-EM)
%% If mode set to 1: automatic initial guess on the number of classes (using GMM-EM)
if paramVBDS.mode
......@@ -40,7 +50,7 @@ end
%%
% Classif and despiking (with iterations if mode=1)
% Classif and despiking
%
[paramVBDS,Spike,w]=LFPSpikeDemixing(xbr,xb,Fs,ideltasr,gB,wfeat,paramVBDS,indsupp,verbose);
......
......@@ -10,11 +10,11 @@ paramVBDS.spike_band=[300 3000]; % set the frequency band for spikes detection
paramVBDS.coef=4; %coef for robust threholding (spike detection)
paramVBDS.coefH=5; % coef for outlier rejection (rejection thr = coefH*detection thr)
paramVBDS.ds=3; % set spike duration in ms (3ms or above)
paramVBDS.nbfeat=6; %number of wav features for classif
paramVBDS.mode=1; % 0: number of class given by user, 1: automatic mode (with nbiter iterations)
paramVBDS.nbfeat=6; %number of wavelet features for classification
paramVBDS.mode=1; % 0: number of class given by user, 1: automatic mode (GMM initialization)
paramVBDS.K=2; % considered if mode=0
paramVBDS.nbiter=10;
paramVBDS.rangeK=1;
paramVBDS.rangeK=1; % Explore K values in the range [K-rangeK K+rangeK]
paramVBDS.nbiter=10; % number of iteration for each explored value of K
display=true; % display some figures during processing
verbose=true; % verbose mode
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment