Skip to content

Commit

Permalink
Merge branch 'main' of https://www.github.com/mouseland/rastermap int…
Browse files Browse the repository at this point in the history
…o main
  • Loading branch information
carsen-stringer committed Oct 16, 2024
2 parents 09731da + 95d6051 commit a704411
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
[![GitHub forks](https://img.shields.io/github/forks/MouseLand/rastermap?style=social)](https://github.com/MouseLand/rastermap/)


Rastermap is a discovery algorithm for neural data. The algorithm was written by Carsen Stringer and Marius Pachitariu. For support, please open an [issue](https://github.com/MouseLand/rastermap/issues). Please see install instructions [below](README.md/#Installation). If you use Rastermap in your work, please cite the [paper](https://www.biorxiv.org/content/10.1101/2023.07.25.550571v1):
Rastermap is a discovery algorithm for neural data. The algorithm was written by Carsen Stringer and Marius Pachitariu. For support, please open an [issue](https://github.com/MouseLand/rastermap/issues). Please see install instructions [below](README.md/#Installation). If you use Rastermap or analysis code in this repo in your work, please cite the [paper](https://www.biorxiv.org/content/10.1101/2023.07.25.550571v1):

Stringer C., Zhong L., Syeda A., Du F., Kesa M., & Pachitariu M. (2023). Rastermap: a discovery method for neural population recordings. *bioRxiv* 2023.07.25.550571; doi: https://doi.org/10.1101/2023.07.25.550571

Expand All @@ -25,7 +25,7 @@ Rastermap runs in python 3.8+ and has a graphical user interface (GUI) for runni
* [rastermap_interactive.ipynb](notebooks/rastermap_interactive.ipynb) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/MouseLand/rastermap/blob/main/notebooks/rastermap_interactive.ipynb) allows running Rastermap in an interactive way without a local installation
* [tutorial.ipynb](notebooks/tutorial.ipynb) [![Open In Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/github/MouseLand/rastermap/blob/main/notebooks/tutorial.ipynb) is a guided tutorial for integrating rastermap and facemap to visualize behavioral representations. See the student/teacher versions [here](https://github.com/MouseLand/course-materials/tree/main/behavior_encoding).

All demo data available [here](https://osf.io/xn4cm/).
Also all notebooks to analyze the data and create the figures in the paper are [here](paper/). All data available [here](https://osf.io/xn4cm/).

Here is what the output looks like for a segment of a mesoscope recording in a mouse during spontaneous activity (3.2Hz sampling rate), compared to random neural sorting:

Expand All @@ -45,7 +45,7 @@ Linux, Windows and Mac OS are supported for running the code. For running the gr

### Instructions

Recommended to install an [Anaconda](https://www.anaconda.com/download/) distribution of Python -- Choose **Python 3.x** and your operating system. Note you might need to use an anaconda prompt (windows) if you did not add anaconda to the path. Open an anaconda prompt / command prompt with **python 3** in the path, then:
We recommend to install a [miniforge](https://github.com/conda-forge/miniforge) (conda-based) distribution of Python. Note you might need to use an anaconda prompt (windows) if you did not add anaconda to the path. Open an anaconda prompt / command prompt with **python 3** in the path, then:

~~~sh
pip install rastermap
Expand All @@ -59,13 +59,12 @@ pip install rastermap[gui]
Rastermap has only a few dependencies so you may not need to make a special environment for it
(e.g. it should work in a `suite2p` or `facemap` environment), but if the pip install above does not work,
please follow these instructions:

1. Open an anaconda prompt / command prompt with `conda` for **python 3** in the path.
2. Create a new environment with `conda create --name rastermap python=3.8`. Python 3.9 and 3.10 will likely work fine as well.
1. Open an anaconda prompt / command prompt which has `conda` for **python 3** in the path
3. Create a new environment with `conda create --name rastermap python=3.9`. We recommend python 3.9, but python 3.8, 3.9 and 3.11 will also work.
4. To activate this new environment, run `conda activate rastermap`
5. To install the minimal version of rastermap, run `pip install rastermap`.
6. To install rastermap and the GUI, run `pip install rastermap[gui]`. If you're on a zsh server, you may need to use ' ' around the rastermap[gui] call: `pip install 'rastermap[gui]'`.

5. (option 1) To install rastermap with the GUI, run `python -m pip install rastermap[gui]`. If you're on a zsh server, you may need to use ' ': `python -m pip install 'rastermap[gui]'`.
6. (option 2) To install rastermap without the GUI, run `python -m pip install rastermap`.
To upgrade rastermap (package [here](https://pypi.org/project/rastermap/)), run the following in the environment:

~~~sh
Expand Down Expand Up @@ -127,16 +126,14 @@ Short example code snippet for running rastermap:
```
import numpy as np
import matplotlib.pyplot as plt
from rastermap import Rastermap, utils
from scipy.stats import zscore
from rastermap import Rastermap
# spks is neurons by time
spks = np.load("spks.npy").astype("float32")
spks = zscore(spks, axis=1)
# fit rastermap
model = Rastermap(n_PCs=200, n_clusters=100,
locality=0.75, time_lag_window=5).fit(spks, compute_X_embedding=True)
locality=0.75, time_lag_window=5).fit(spks)
y = model.embedding # neurons x 1
isort = model.isort
Expand Down

0 comments on commit a704411

Please sign in to comment.