Repository: mne-tools/mne-bids

Issue:
Binder links in examples
This uses a new-ish feature of sphinx-gallery to auto-generate binder links for the examples.

We can't merge this until my PR in sphinx gallery lands (https://github.com/sphinx-gallery/sphinx-gallery/pull/439)

In the meantime, here's an example of how it'll look live:

http://predictablynoisy.com/mne-bids/


Discussion:
One challenge here - our examples use a **TON** of storage space...do we really need to use multiple different MNE sample datasets for the examples? What if we had a subset of examples that were "quick to run" and another set that were more in-depth and used lots of extra data?

As an example, the eegbci dataset alone is like 8GB, and that's just for one example. I think it's unrealistic to expect users to download tens of GB of data to run the examples... @jasmainak what are your thoughts on this?
# [Codecov](https://codecov.io/gh/mne-tools/mne-bids/pull/152?src=pr&el=h1) Report
> Merging [#152](https://codecov.io/gh/mne-tools/mne-bids/pull/152?src=pr&el=desc) into [master](https://codecov.io/gh/mne-tools/mne-bids/commit/0c44749689c96e197e593bf02d2c35cb6b66b947?src=pr&el=desc) will **not change** coverage.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/mne-tools/mne-bids/pull/152/graphs/tree.svg?width=650&token=x8vQyTMM9Y&height=150&src=pr)](https://codecov.io/gh/mne-tools/mne-bids/pull/152?src=pr&el=tree)

```diff
@@           Coverage Diff           @@
##           master     #152   +/-   ##
=======================================
  Coverage   94.73%   94.73%           
=======================================
  Files          14       14           
  Lines         988      988           
=======================================
  Hits          936      936           
  Misses         52       52
```



------

[Continue to review full report at Codecov](https://codecov.io/gh/mne-tools/mne-bids/pull/152?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/mne-tools/mne-bids/pull/152?src=pr&el=footer). Last update [0c44749...1875423](https://codecov.io/gh/mne-tools/mne-bids/pull/152?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

agreed. We should try to limit dataset sizes. It should not be necessary
for educational purposes

> One challenge here - our examples use a TON of storage space

> agreed. We should try to limit dataset sizes. It should not be necessary for educational purposes

+1, relevant to #75 
The ds000117 data is largeish and I agree we should maybe crop these files
and a host them in a mirror (license permitting). But EEGBCI should be
small ... it cannot be 8 GB

+1 for skipping the examples that take too much space. Can you also add a
badge on the readme?

Sorry I’m swamped at the moment ... will try to look more closely in a day
or two. Thanks @choldgraf for taking a stab at this !

On Fri 14 Dec 2018 at 01:58, Stefan Appelhoff <notifications@github.com>
wrote:

> One challenge here - our examples use a TON of storage space
>
> agreed. We should try to limit dataset sizes. It should not be necessary
> for educational purposes
>
> +1, relevant to #75 <https://github.com/mne-tools/mne-bids/issues/75>
>
> —
> You are receiving this because you were mentioned.
>
>
> Reply to this email directly, view it on GitHub
> <https://github.com/mne-tools/mne-bids/pull/152#issuecomment-447233778>,
> or mute the thread
> <https://github.com/notifications/unsubscribe-auth/APHiommmhaXaF1LoQ7jnTttXFmECoAzDks5u40v5gaJpZM4ZSpA0>
> .
>
-- 
Sent from my iPhone

@agramfort and I chatted a while back and thought it might be advantageous to bids-ify the sample dataset. that way we would be able to pull selected files from osf instead of the entire dataset. it would greatly simplify a lot of things, however, we would need to correct all the examples it touches
Yes all mne datasets should be converted to bids

For sample it’s harder as it contains many derivative files 

@choldgraf I couldn't build the docs. I got:

```py
Exception occurred:
  File "/home/mainak/anaconda2/envs/mne/lib/python3.6/site-packages/sphinx_gallery/binder.py", line 209, in check_binder_conf
    missing_values))
ValueError: binder_conf is missing values for: ['url']
```

also on your PR branch from `sphinx-gallery`. So let's wait until the PR is merged. Looking forward to seeing this in!
any news on this @choldgraf ? :-)
I can put some cycles into this, though tbh I kinda think it's a bit impractical as long as running the examples requires downloading 10 gb of data :-\
> I can put some cycles into this, though tbh I kinda think it's a bit impractical as long as running the examples requires downloading 10 gb of data :-\

right, I was just checking this out and also saw that https://github.com/sphinx-gallery/sphinx-gallery/pull/439 hasn't landed yet, so that's why I was wondering. However, let's deal with our examples first then (reducing size) :+1:
yes, sounds good. It would be helpful to reduce the size of examples. @choldgraf what size should we be aiming for?
@jasmainak it's mostly just a subjective thing, there isn't any "right" answer, just that it's a better user experience to not have to wait a long time to download examples. My (subjective) opinion is that like 1-3GB should be enough to demonstrate the functionality of a package like MNE-BIDS (the examples should really only be about learning, not about re-creating full analysis pipelines etc)
@choldgraf I'm taking over this PR in #183. Hope that's fine for you.

I think it's useful to have a binder badge in any case for demo purposes. I'll just create binder links on select examples (which can run with <10 MB of data) using plain rst :) Thanks for the efforts!
sure, that works for me...just please do open issues/PRs in sphinx gallery if something is confusing :-)
Sure thing :) 

@choldgraf I do have a question. On the mybinder website, there is an option to provide a URL to a notebook. It cannot be _any_ URL, right? Because if I give the branch which contains the requirements.txt and a URL to [a notebook from another branch](https://raw.githubusercontent.com/jasmainak/mne-bids/gh-pages/_downloads/8d9cc83d1b8665c32c4ed9caf6e1be97/convert_eeg_to_bids.ipynb), it [does not work](https://mybinder.org/v2/gh/jasmainak/mne-bids/binder_badge?urlpath=https%3A%2F%2Fraw.githubusercontent.com%2Fjasmainak%2Fmne-bids%2Fgh-pages%2F_downloads%2F8d9cc83d1b8665c32c4ed9caf6e1be97%2Fconvert_eeg_to_bids.ipynb). Further, instead of telling me right away, I have to wait for the image to be built after which I'm told there is a 404 error -- page does not exist. Am I doing something wrong or it's how it's supposed to work?

Resolving patch:
diff --git a/doc/conf.py b/doc/conf.py
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -192,5 +192,15 @@
         'mne': 'http://mne-tools.github.io/stable/',
         'numpy': 'http://docs.scipy.org/doc/numpy-1.9.1',
         'scipy': 'http://docs.scipy.org/doc/scipy-0.17.0/reference'
+    },
+    'binder': {
+        # Required keys
+        'org': 'mne-tools',
+        'repo': 'mne-bids',
+        'branch': 'gh-pages',  # noqa: E501 Can be any branch, tag, or commit hash. Use a branch that hosts your docs.
+        'binderhub_url': 'https://mybinder.org',  # noqa: E501 Any URL of a binderhub deployment. Must be full URL (e.g. https://mybinder.org).
+        'dependencies': [
+            '../environment.yml'
+        ],
     }
 }
diff --git a/examples/convert_group_studies.py b/examples/convert_group_studies.py
--- a/examples/convert_group_studies.py
+++ b/examples/convert_group_studies.py
@@ -32,6 +32,7 @@
 
 ###############################################################################
 # And fetch the data.
+# .. warning:: This will download 7.9 GB of data for one subject!
 
 subject_ids = [1]
 runs = range(1, 7)
@@ -43,8 +44,6 @@
 output_path = op.join(data_path, 'ds000117-bids')
 
 ###############################################################################
-#
-# .. warning:: This will download 7.9 GB of data for one subject!
 # Define event_ids.
 
 event_id = {
@@ -77,4 +76,5 @@
 
 ###############################################################################
 # Now let's see the structure of the BIDS folder we created.
+
 print_dir_tree(output_path)


Test patch: