Skip to content

Commit 722fa91

Browse files
committed
Reformat a bit.
1 parent 0e9fe2b commit 722fa91

File tree

4 files changed

+34
-31
lines changed

4 files changed

+34
-31
lines changed

doc/how_to/handle_times.rst

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ please see the below dropdown for a refresher.
3737
This is known as the 'sampling step' (sometimes denoted $t_s$) and is the inverse of
3838
the sampling frequency.
3939

40-
.. image:: handle-times-sampling-image.png
40+
.. image:: handle_times_files/handle-times-sampling-image.png
4141
:alt: Image of continuous signal (1 second) with dots indicating samples collected at 0, 0.25, 0.5 and 0.75 seconds.
4242
:width: 400px
4343
:align: center
@@ -56,28 +56,29 @@ An Overview of the possible Time representations in SpikeInterface
5656

5757
When you load a recording into SpikeInterface, it will be automatically
5858
associated with a time array. Depending on your data format, this might
59-
be loaded from metadata on your raw recording. [TODO: concrete example of this?]
59+
be loaded from metadata on your raw recording.
60+
61+
**[TODO: concrete example of this?]**
6062

6163
If there is no time metadata on your raw recording, the times will be
6264
generated based on your sampling rate and number of samples.
6365

6466
You can use the `get_times()` method to inspect the time array associated
6567
with your recording.
6668

67-
```
68-
import spikeinterface.full as si
69+
.. code-block:: python
6970
70-
# Generate a recording for this example
71-
recording, _ = si.generate_ground_truth_recording(durations=[10])
71+
import spikeinterface.full as si
7272
73-
print(f"number of samples: {recording.get_num_samples()}")
74-
print(f"sampling frequency: {recording.get_sampling_frequency()}"
73+
# Generate a recording for this example
74+
recording, _ = si.generate_ground_truth_recording(durations=[10])
7575
76-
print(
77-
recording.get_times()
78-
)
76+
print(f"number of samples: {recording.get_num_samples()}")
77+
print(f"sampling frequency: {recording.get_sampling_frequency()}"
7978
80-
```
79+
print(
80+
recording.get_times()
81+
)
8182
8283
Here, we see that as no time metadata was associated with the loaded recording,
8384
the time array starts at 0 seconds and continues until 10 seconds
@@ -106,15 +107,15 @@ the first timepoint of the recording. Shifting by a positive value will
106107
increase the start time, while shifting by a negative value will decrease
107108
the start time.
108109
109-
```
110-
recording.shift_start_time(100.15)
110+
.. code-block:: python
111+
112+
recording.shift_start_time(100.15)
111113
112-
print(recording.get_times()) # time now start at 100.15 seconds
114+
print(recording.get_times()) # time now start at 100.15 seconds
113115
114-
recording.shift_start_time(-50.15)
116+
recording.shift_start_time(-50.15)
115117
116-
print(recording.get_times()) # time now start at 50 seconds
117-
```
118+
print(recording.get_times()) # time now start at 50 seconds
118119
119120
120121
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -144,20 +145,21 @@ Retrieving timepoints from sample index
144145
SpikeInterface provides two convenience methods for obtaining the timepoint in seconds
145146
given an index of the time array:
146147
147-
```
148-
sample_index = recording.time_to_sample_index(5.0)
148+
.. code-block:: python
149+
150+
sample_index = recording.time_to_sample_index(5.0)
151+
152+
print(sample_index)
149153
150-
print(sample_index)
151-
```
152154
153155
Similarly, you can retrieve the time array index given a timepoint:
154156
155157
156-
```
157-
timepoint = recording.sample_index_to_to_time(125000)
158+
.. code-block:: python
159+
160+
timepoint = recording.sample_index_to_to_time(125000)
158161
159-
print(timepoint)
160-
```
162+
print(timepoint)
161163
162164
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
163165
Aligning events across timestreams
@@ -167,6 +169,6 @@ The alignment of electrophysiology recording time to other data streams (e.g. be
167169
is an important step in ephys analysis. To acheive this,it is common to collect
168170
a synconrisation ('sync') pulse on an additional channel. At present SpikeInterface does not include
169171
features for time-alignment, but some useful articles can be found on the following pages,
170-
[SpikeGLX](https://github.com/billkarsh/SpikeGLX/blob/master/Markdown/UserManual.md#procedure-to-calibrate-sample-rates),
171-
[OpenEphys](https://open-ephys.github.io/gui-docs/Tutorials/Data-Synchronization.html),
172-
[NWB](https://neuroconv.readthedocs.io/en/main/user_guide/temporal_alignment.html).
172+
`SpikeGLX <https://github.com/billkarsh/SpikeGLX/blob/master/Markdown/UserManual.md#procedure-to-calibrate-sample-rates>`_,
173+
`OpenEphys <https://open-ephys.github.io/gui-docs/Tutorials/Data-Synchronization.html>`_,
174+
`NWB <https://neuroconv.readthedocs.io/en/main/user_guide/temporal_alignment.html>`_

doc/how_to/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Guides on how to solve specific, short problems in SpikeInterface. Learn how to.
88

99
viewers
1010
handle_drift
11+
handle_times
1112
analyse_neuropixels
1213
load_matlab_data
1314
combine_recordings

doc/sg_execution_times.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
Computation times
88
=================
9-
**03:26.753** total execution time for 16 files **from all galleries**:
9+
**00:04.190** total execution time for 16 files **from all galleries**:
1010

1111
.. container::
1212

@@ -33,7 +33,7 @@ Computation times
3333
- Time
3434
- Mem (MB)
3535
* - :ref:`sphx_glr_tutorials_core_plot_4_sorting_analyzer.py` (``..\examples\tutorials\core\plot_4_sorting_analyzer.py``)
36-
- 03:26.753
36+
- 00:04.190
3737
- 0.0
3838
* - :ref:`sphx_glr_tutorials_comparison_generate_erroneous_sorting.py` (``..\examples\tutorials\comparison\generate_erroneous_sorting.py``)
3939
- 00:00.000

0 commit comments

Comments
 (0)