Skip to content

Commit 34ba6bc

Browse files
committed
Small changes to docs.
1 parent 001ed03 commit 34ba6bc

File tree

1 file changed

+23
-26
lines changed

1 file changed

+23
-26
lines changed

doc/how_to/inter_session_alignment.rst

Lines changed: 23 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ How to perform inter-session alignment
22
======================================
33

44
In this how-to, we will assess and correct changes in probe position across multiple experimental sessions
5-
using 'inter-session alignment'.
5+
using `inter-session alignment`.
66

7-
This is often valuable chronic-recording experiments, where the goal is to track units across sessions
7+
This is often valuable for chronic-recording experiments, where the goal is to track units across sessions
88

99
A full tutorial, including details on the many settings for this procedure, can be found `here <TODO: ADD LINK (INTERNAL)>`_.
1010

@@ -14,25 +14,23 @@ Running inter-session alignment
1414
In SpikeInterface, it is recommended to perform inter-session alignment
1515
following within-session motion correction (if used) and before whitening.
1616

17-
Preprocessed recordings should be stored in a list before being passed
18-
to the `session_alignment` functions:
17+
Preprocessed recordings should first be stored in a list:
1918

2019
.. code:: python
2120
2221
recordings_list = [prepro_session_1, prepro_session_2, ...]
2322
2423
Here, we will simulate such an experiment by generating a pair of sessions in
25-
which the probe is displaced 200 micrometers (um) along its y-axis (depth).
24+
which the probe is displaced 200 micrometers (μm) along its y-axis (depth).
2625

27-
The first step involves running all required imports:
26+
First, we will import all required packages and functions:
2827

2928
.. code:: python
3029
31-
from spikeinterface.generation.session_displacement_generator import generate_session_displacement_recordings
30+
# TODO: should add all of the below to spikeinterface.full? (CHECK)
3231
import spikeinterface.full as si
33-
from spikeinterface.preprocessing.inter_session_alignment import ( # TODO: should add all of the below to spikeinterface.full? (CHECK)
34-
session_alignment,
35-
)
32+
from spikeinterface.generation.session_displacement_generator import generate_session_displacement_recordings
33+
from spikeinterface.preprocessing.inter_session_alignment import session_alignment
3634
from spikeinterface.widgets import plot_session_alignment, plot_activity_histogram_2d
3735
import matplotlib.pyplot as plt
3836
@@ -50,14 +48,14 @@ and then generating the test recordings:
5048
We won't explicitly preprocess these recordings in this how-to, but you can imagine
5149
preprocessing steps have already been run (e.g. filtering, common reference etc.).
5250

53-
To run inter-session alignment, we need to detect peaks and compute the peak locations,
54-
as the location of firing neurons are used as anchors to align the sessions.
51+
To run inter-session alignment, peaks must be detected and localised
52+
as the locations of firing neurons are used to anchor the sessions alignment.
5553

5654
If you are **running inter-session alignment following motion correction**, the peaks will
57-
already be detected and localised. In this case, please jump to the
58-
:ref:`alignment guide <_with_motion_correction>`.
55+
already be detected and localised. In this case, please jump to
56+
:ref:`inter-session alignment after motion correction <with_motion_correction>`.
5957

60-
In this section we will imagine motion correction was not run, so we need to compute the peaks:
58+
In this section we will assume motion correction was not run, so we need to compute the peaks:
6159

6260
.. code:: python
6361
@@ -81,7 +79,7 @@ The peak locations (before correction) can be visualised with the plotting funct
8179
8280
Now, we are ready to perform inter-session alignment. There are many options associated
8381
with this method—the simplest way to edit these is to fetch the default options
84-
using the getter function as below:
82+
with the getter function and make select changes as required:
8583

8684
.. code:: python
8785
@@ -95,7 +93,7 @@ using the getter function as below:
9593
estimate_histogram_kwargs=estimate_histogram_kwargs
9694
)
9795
98-
To assess the performance of inter-session alignment, `plot_session_alignment()`
96+
To assess the performance of inter-session alignment, ``plot_session_alignment()``
9997
will plot both the original and corrected recordings:
10098

10199
.. code:: python
@@ -120,10 +118,10 @@ Inter-session alignment after motion correction
120118

121119
If motion correction has already been performed, it is possible to reuse the
122120
previously computed peaks and peak locations, avoiding the need for re-computation.
123-
We will use the special function `align_sessions_after_motion_correction()` for this case.
121+
We will use the special function` `align_sessions_after_motion_correction()`` for this case.
124122

125-
Critically, the last preprocessing step prior to inter-session alignment should be motion correction,
126-
so the correction for inter-session displacement will be **added directly to the motion correction**.
123+
Critically, the last preprocessing step prior to inter-session alignment should be motion correction.
124+
This ensures the correction for inter-session alignment will be **added directly to the motion correction**.
127125
This is beneficial as it avoids interpolating the data (i.e. shifting the traces) more than once.
128126

129127
.. admonition:: Warning
@@ -144,9 +142,9 @@ This is beneficial as it avoids interpolating the data (i.e. shifting the traces
144142
assert isinstance(recording, InterpolateMotionRecording) # error if not true
145143
146144
``align_sessions_after_motion_correction()`` will raise an error if the passed recordings
147-
are not all `InterpolateMotionRecordings`.
145+
are not all ``InterpolateMotionRecordings``.
148146

149-
Again, let's create some test data. We can create a recording with motion errors,
147+
Let's first create some test data. We can create a recording with motion errors,
150148
then split it in two to simulate two separate sessions:
151149

152150
.. code:: python
@@ -176,10 +174,9 @@ Next, motion correction is performed, storing the results in a list:
176174
motion_info_list.append(motion_info)
177175
178176
Now, we are ready to use ``align_sessions_after_motion_correction()``
179-
to align the motion-corrected sessions.
180-
181-
This function should always be used for aligning motion-corrected sessions,
182-
as it ensures the alignment parameters are properly matched.
177+
to align the motion-corrected sessions. This function should always be used
178+
for aligning motion-corrected sessions, as it ensures the alignment
179+
parameters are properly matched.
183180

184181
We can pass any arguments directly to ``align_sessions`` using the ``align_sessions_kwargs`` argument:
185182

0 commit comments

Comments
 (0)