MountainSort with Windows 10 Draft

Posted by Geoff, Published: 5 years, 6 months ago (Updated: 5 years, 4 months ago)

Our lab has been using MoutainSort/MountainLab1 as a spike sorting algorithm (previously used KlustaKwik). In the referenced Neuron paper, Chung et al provided evidence that this algorithm is better than the existing automated methods (Kilosort, Spyking Circus, and etc.). Not only was this method proposed to do better than existing methods, but it also requires minimal (or no) parameter tuning, thus making it a standardized technique.

A primary issue for me when it came to using MountainSort is that it requires the use of Linux (they specify Ubuntu 16.04, but that it should work on other Linux distributions)2, while my recording software requires Windows. As someone who has looked over the MountainSort code (and contributed to some of the pre-processing code), it might be difficult to envision future Windows compatibility. This is due to MountainSort leveraging the utility of the multiprocessing module to parallelize the code. The multiprocessing module within Windows has always been quite finicky, and MountainSort likely would have to be rewritten to be compatible with Windows.

That being said, I have created a workflow that will allow me to use Windows to sort with MountainSort. 

Requirements:

  • Operating System: Windows 10. This requires Windows 10 as it requires the user of the Windows Subsystem for Linux (WSL). The WSL will allow us to have a GNU/Linux environment that MountainSort requires. As far as I know, the WSL is only compatible with Windows 10 (correct me if I'm wrong).

Resources

  1. Chung, J. E., Magland, J. F., Barnett, A. H., Tolosa, V. M., Tooker, A. C., Lee, K. Y., ... Greengard, L. (2017). A Fully Automated Approach to Spike Sorting. Neuron, 95(6), 1381-1394.e6. https://doi.org/10.1016/j.neuron.2017.08.030 https://www.cell.com/neuron/fulltext/S0896-6273(17)30745-6
  2. Old MountainSort Documentation https://mountainsort.readthedocs.io/en/latest/

Project Contents

Installing Windows Subsystem for Linux (WSL) Draft

Before you can continue with MountainSort, you must first download the Windows Subsystem for Linux (WSL). The procedure that I used to download Ubuntu comes from the reference below. Keep in mind there are ways to download Ubuntu without the Microsoft Store1, but I feel as though this is the most simple method.

Installation

  1. Open PowerShell as Administrator (search "powershell" in the search bar, …

Read More →

Installing MountainSort (on the Windows Subsystem for Linux) Draft

This page will take you through setting up MountainSort on your WSL. These set of instructions follow the directions provided on the GitHub1 page for MountainSort so feel free to follow their instructions instead as this post was written on May 1st, 2019.

Install Conda

The documentation suggests using conda to install MountainSort, so lets not go …

Read More →

Executing WSL Commands from Windows (Using Python 3) Draft

Now that we have the Windows Subsystem for Linux (WSL) and MountainSort/MountainLab installed, I can discuss my method for interfacing with MountainSort from Windows. MountainSort commands are all executed through the Linux terminal. Therefore the initial problem was that I had to determine how to run commands through the WSL without having to necessarily open the WSL terminal manually. I know you can use the os module from Python to run commands in the Command Prompt on Windows (and the Termin…

Read More →

Executing MountainSort Commands from Windows (Using Python 3) Draft

Now that we know how to run commands in WSL using Python 3, lets get into executing MountainSort commands. Again, I have provided a Jupyter Notebook and all the relevant code in a GitHub repository1.

Synthesizing Data

First we will synthesize a timeseries that will contain 20 waveforms, sampled at 30 kHz using a few pipelines within MountainSort. I will follow the same process that the MountainSort d…

Read More →

Installing Custom MountainSort Processors for WSL Draft

In the previous post I gave examples on how to run MountainSort commands using Python and the WSL. However, you had to execute a command using the WSL terminal for each step (i.e. synthesize the waveforms, then synthesize the firing times, then synthesize the timeseries data).

Theoretically you could put the time upfront into creating a notebook/script that would perform each of the steps. However, it becomes problematic when the successive steps depend on the previous. Once you execute the Py…

Read More →

MountainSort Custom "ms4_geoff_pipeline" Processor Draft

When using Python code to execute WSL terminal commands as I've shown throughout this project, it can be problematic to have a workflow that requires a long sequence of steps with different MountainSort processors as you'd likely have to wait for outputs to be produced before these outputs can be used as inputs for the following step. For example, sorting might require some pre-processing steps. First step might be to band-pass the raw data. We do not need the low frequency signal anymore, as w…

Read More →

Comments

Post Comment