UPDATE: more recent installation attempts fail at the pip install mountainsort4
phase. There might be a problem caused by Visual studio compiling (??). I have listed a few of the errors and solution attempts in this other page. PLEASE let me know if you find a solution to make this work on Windows (10 or 11).
Note: these instructions work on Linux (Ubuntu 18.04). Note: these instructions also work on Windows Subsystem for Linux (WSL). See further down for instructions on how to install that.
Create a new environment, Python needs to be >=3.7
conda create --name name_of_your_environment
Activate your environment
conda activate name_of_your_environment
install your IDE (I use idlex)
pip install idle
pip install idlex
for spikeinterface installation
pip install spikeinterface[full]==0.93
for phy (as indicated on this page
pip install phy --pre --upgrade
For Mountainsort4 in spikeinterface
pip install mountainsort4
if this step fails, it means you need to do the following and then run pip install mountainsort4
again:
Option 1:
pip install git+https://github.com/magland/isosplit5_python.git`
(you might have to do pip install git
separately first, if git is not already installed; OR conda install -c anaconda git
if pip install git doesn't work)
Option 2: Clone the isosplit5 repo, cd to it, install it with the setup.py file using the command (note, it might throw some deprecation warnings; see this issue):
python setup.py install
All necessary modules should now be installed!
If the instructions above didn't work... all hope is not lost! You can try to install the pipeline using the WSL which mimics a Linux environment without having to actually install Linux. How-to:
wsl --install
3.1. Make sure you move to a folder that you have writing access to, like /home/your_user_name/ by doing cd path_to_that_folder
3.2 Download the miniconda installer
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
3.3. Run the installation, follow the instructions
bash Miniconda3-latest-Linux-x86_64.sh
3.3. Close and reopen
sudo apt install build-essential
And then you should be able to go back at the top of this readme and follow the general installation instructions.
To export the data from Trodes: navigate to the Trodes folder and then type
`trodesexport -mountainsort -rec <full path to rec file ending in .rec> -sortingmode 1`
Note, if using Linux, do instead:
`./trodesexport -mountainsort -rec <full path to rec file ending in .rec> -sortingmode 1`
(this will create 1 '.mda' file per tetrode, which is what Mountainsort expects)
2 options to run the code:
python -m idlexlib.launch
), open the script 'ScriptMS4.py', update tetrodes_list
and optionally path_to_file
to indicate the '.rec' raw data file. Run the code by pressing F5.run_MS_on_folder(tetrodes_list, path_to_file)
with appropriate contents given to those variables, note, path_to_file
can be set to empty (''
) and it will propt you to manually choose a folder.Note 1: you'll have to be in the right conda environment!
Note 2: this will create 1 subfolder (output_Tx) per tetrode where X is the tetrode number. It will use the inbuilt function of spikeinterface to run mountainsort and export to phy the result.
Once the main code has run: 3 options for the manual refinement with Phy:
tetrodes_list
(one after the other). Don't forget to save in Phy once you're finished with the sorting!from phy.apps.template import template_gui
this_params_file = path_to_data\output_TX\phy_MS\params.py (where X = the tetrode to be sorted)
template_gui(this_params_file)
phy template-gui path_to_data\output_Tx\phy_MS\params.py
(change the X to be the tetrode number of your choice)
Note for linux: I had an error related to numpy
('np.bool is deprecated'). I fixed it by downgrading numpy in that environment:
python -m pip uninstall numpy
python -m pip install numpy==1.23.1
Credits: Adrian Aleman & Kayvan Combadiere from the Genzel lab