-
Notifications
You must be signed in to change notification settings - Fork 216
Try "Handle motion/drift" documentation as a sphinx gallery #2879
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
7aac4c6
a051a05
7574b67
5189203
6adac7b
9979e9e
10ddf11
21016e5
250ef4a
c674c6f
4f2bb24
4ee1882
ef84685
e681b34
7f292a1
8d93038
c86913e
d21e2db
609fe3c
acbc9d2
2ac5364
a500d2c
d513f6a
061b859
1a80b0b
b4d9371
5e0f2a5
ca7d5d0
cba4b95
043b43c
4a0511f
2e33292
92594e0
a07117d
6559e17
84d60e4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -119,7 +119,7 @@ | |||||||||||||||||||||||
sphinx_gallery_conf = { | ||||||||||||||||||||||||
'only_warn_on_example_error': True, | ||||||||||||||||||||||||
'examples_dirs': ['../examples/tutorials'], | ||||||||||||||||||||||||
'gallery_dirs': ['tutorials' ], # path where to save gallery generated examples | ||||||||||||||||||||||||
'gallery_dirs': ['tutorials'], # path where to save gallery generated examples | ||||||||||||||||||||||||
'subsection_order': ExplicitOrder([ | ||||||||||||||||||||||||
'../examples/tutorials/core', | ||||||||||||||||||||||||
'../examples/tutorials/extractors', | ||||||||||||||||||||||||
|
@@ -130,9 +130,19 @@ | |||||||||||||||||||||||
'within_subsection_order': FileNameSortKey, | ||||||||||||||||||||||||
'ignore_pattern': '/generate_', | ||||||||||||||||||||||||
'nested_sections': False, | ||||||||||||||||||||||||
'copyfile_regex': r'.*\.rst|.*\.png|.*\.svg' | ||||||||||||||||||||||||
'copyfile_regex': r'.*\.rst|.*\.png|.*\.svg', | ||||||||||||||||||||||||
'filename_pattern': '/plot_', | ||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a default value, why add it here? If you want to be explicit can we add a small comment and what it does? |
||||||||||||||||||||||||
} | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
if tags.has("handle_drift") or tags.has("all_long_plot"): | ||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice! Worth generalising this? Something like:
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is very nice, for now if it works for you I will wait for the upcoming PR tackling the Neuropixels how-to to implement this, just to make checking it's working for multiple cases a bit easier. I'll link to this suggestion in our issue to not forget! |
||||||||||||||||||||||||
|
||||||||||||||||||||||||
if (handle_drift_path := (Path('long_tutorials/handle_drift'))).is_dir(): | ||||||||||||||||||||||||
shutil.rmtree(handle_drift_path) | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
sphinx_gallery_conf['examples_dirs'].append('../examples/long_tutorials/handle_drift') | ||||||||||||||||||||||||
sphinx_gallery_conf["gallery_dirs"].append(handle_drift_path.as_posix()) | ||||||||||||||||||||||||
|
||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How does sphinx knows what goes to where? That is, what things on eample_dirs who to which gallery_dirs? Is that positionally? |
||||||||||||||||||||||||
|
||||||||||||||||||||||||
intersphinx_mapping = { | ||||||||||||||||||||||||
"neo": ("https://neo.readthedocs.io/en/latest/", None), | ||||||||||||||||||||||||
"probeinterface": ("https://probeinterface.readthedocs.io/en/stable/", None), | ||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Given that this won't be display with a thumbnail, do we need this? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
:orphan: | ||
|
||
Handle Drift Tutorial | ||
--------------------- | ||
|
||
This tutorial is not mean to be displayed on | ||
a sphinx gallery. The generated index.rst is not | ||
meant to be linked to in any toctree. | ||
|
||
Instead, sphinx-gallery is used to | ||
automatically build this page, which | ||
takes a long time (~25 minutes), and it is | ||
linked too manually, directly to the | ||
rst (TODO: fill in filename) that | ||
sphinx-gallery generates. | ||
|
||
|
||
|
||
.. raw:: html | ||
|
||
<div class="sphx-glr-thumbnails"> | ||
|
||
.. thumbnail-parent-div-open | ||
|
||
.. raw:: html | ||
|
||
<div class="sphx-glr-thumbcontainer" tooltip="Probe movement is an inevitability when running in vivo electrophysiology recordings. Motion, c..."> | ||
|
||
.. only:: html | ||
|
||
.. image:: /long_tutorials/handle_drift/images/thumb/sphx_glr_plot_handle_drift_thumb.png | ||
:alt: | ||
|
||
:ref:`sphx_glr_long_tutorials_handle_drift_plot_handle_drift.py` | ||
|
||
.. raw:: html | ||
|
||
<div class="sphx-glr-thumbnail-title">Handle probe drift with spikeinterface NEW</div> | ||
</div> | ||
|
||
|
||
.. thumbnail-parent-div-close | ||
|
||
.. raw:: html | ||
|
||
</div> | ||
|
||
|
||
.. toctree:: | ||
:hidden: | ||
|
||
/long_tutorials/handle_drift/plot_handle_drift | ||
|
||
|
||
.. only:: html | ||
|
||
.. container:: sphx-glr-footer sphx-glr-footer-gallery | ||
|
||
.. container:: sphx-glr-download sphx-glr-download-python | ||
|
||
:download:`Download all examples in Python source code: handle_drift_python.zip </long_tutorials/handle_drift/handle_drift_python.zip>` | ||
|
||
.. container:: sphx-glr-download sphx-glr-download-jupyter | ||
|
||
:download:`Download all examples in Jupyter notebooks: handle_drift_jupyter.zip </long_tutorials/handle_drift/handle_drift_jupyter.zip>` | ||
|
||
|
||
.. only:: html | ||
|
||
.. rst-class:: sphx-glr-signature | ||
|
||
`Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_ |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we need this in version control? |
Large diffs are not rendered by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chrishalcrow can you remind me what this does? I re-read the section and I could not locate this into the context of our project. Would you be so kind?
https://sphinx-gallery.github.io/stable/configuration.html#manually-passing-files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, sorry I missed this.
This copies any rst, png or svg files from the source
sphinx-gallery
directory to the output directory. In this case the source directory isexamples/tutorials/
and we would like it to copywaveform_extractor_to_sorting_analyzer.rst
from there to where the gallery is outputted (doc/tutorials
).This is done so that the tutorial pages (https://spikeinterface.readthedocs.io/en/latest/tutorials/index.html), which is a sphinx-gallery, can include a non-sphinx gallery page (the waveforms page).
The
.svg
s were included to copy over the svg of the extension parent/child figure, but this is not kept indoc/_images
since it's repeated in a few places.