Installing Custom MountainSort Processors for WSL Draft

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

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 Python code, the Python kernel has no sense of what is going on within the WSL terminal, think of it as an open looped system in its current state.

You could theoretically program a wait function at each step, and wait for the outputs from the previous step to be generated before continuing with the next step. That is not the worst solution, but if there is an error, then you are infinitely waiting for a file to be produced (which likely won't happen when an error is raised). 

A solution to those (hopefully infrequent) problems would be a timer that would wait X seconds/minutes, and when that time threshold has been crossed you would assume that this session's analysis has an error and to continue with the next session. What should the time threshold be? You would have to know how long it would take each step to finish and then choose some arbitrary number beyond that point.

This all being said, the best solution would be creating your own processor. You can create a processor within MountainSort using various programming languages (MATLAB, Python, etc.). There are some example processors provided on GitHub1. I created my own custom pipeline called ms4_geoff_pipeline (MGP), uploaded to GitHub2. This is going to be the pipeline that I discuss installing. If you want to know more about the MGP, feel free to learn more in the referenced link3.

Table of Contents

Installation

  1. Identify the location where your mountainlab packages exist (I'll call this location $Packages). If you installed it using the method I described in the Installing MountainSort post, then the path should be the following: ~/conda/envs/[environment_name]/etc/mountainlab/packages, where [environment_name] is replaced with the name of the environment you created, in the example my environment name was called mlab.
  2. Navigate to $Packages using the following command: 
    cd ~/conda/envs/[environment_name]/etc/mountainlab/packages​
  3. $Packages is where you will install any custom packages, usually using git clone.
    1. The MGP does require that you have the franklab_mstaggecuration4 pipeline installed.
      • Use the following command to install the franklab_mstaggedcuration pipeline in your $Packages path.
        git clone https://bitbucket.org/franklab/franklab_mstaggedcuration.git
      • You should now have pyms.add_curation_tags, and pyms.merge_burst_parents within the processor list. You can use the following command to double-check:
        ml-list-processors | grep pyms​

        You should see a result similar to what is below:

    2. Now we can clone the MGP into the %Packages path using the following command:
      git clone https://github.com/GeoffBarrett/ms4_geoff_pipeline.git​
    3. When properly installed, you should have the ms4_geoff.sort processor. Double-check that this processor exists by using the following command:
      ml-list-processors | grep geoff​

      • If you do not see the ms4_geoff.sort processor listed, you need to ensure that some of the files have executable permissions by using the following command (from the $Packages file-path):
        chmod a+x ./ms4_geoff_pipeline/ms4_geoff_pipeline/ms4_geoff_spec.py.mp​

References

  1. Example Custom MountainSort Processors: https://github.com/flatironinstitute/mountainlab-js#custom-processor-libraries
  2. ms4_geoff_pipeline GitHub repository: https://github.com/GeoffBarrett/ms4_geoff_pipeline
  3. ms4_geoff_pipeline in-depth description: https://geba.technology/project/mountainsort-with-windows-mountainsort-custom-ms4_geoff_pipeline-processor
  4. franklab_mstaggedcuration pipeline: https://bitbucket.org/franklab/franklab_mstaggedcuration/src

Comments

Post Comment