Skip to content

Commit 1e5dd28

Browse files
authored
make documentation buildable in 2024 :) (#209)
* make documentation buildable in 2024 :) * document dependencies for building the docs in the readme --------- Co-authored-by: Martin Billinger-Finke <[email protected]>
1 parent 97db015 commit 1e5dd28

File tree

12 files changed

+51
-31
lines changed

12 files changed

+51
-31
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,21 @@ To run the examples on Linux, invoke the following commands inside the SCoT dire
3737
etc.
3838

3939
Note that the example data from https://github.com/SCoT-dev/scot-data needs to be available. The `scot-data` package must be on Python's search path.
40+
41+
42+
### Building the docs
43+
44+
In February 2024 we managed to build the docs with the following package versions:
45+
46+
```
47+
[tool.poetry.dependencies]
48+
python = "^3.11"
49+
sphinx = "^7.2.6"
50+
matplotlib = "^3.8.3"
51+
scipy = "^1.12.0"
52+
scikit-learn = "^1.4.1.post1"
53+
```
54+
55+
Note that these are the most recent versions at the moment, so it is likely that future versions will just work.
56+
When using a newer version of sphinx, it may be necessary to update the subrepository in doc/sphinxext/numpydoc.
57+

doc/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Updating the docs
2+
3+
1. run `generate_apidoc.sh`
4+
2. run `make.py`
5+
3. fix any errors and repeat steps 1-2 as often as necessary
6+
4. (ignore that building the latex docs fails)
7+
5. copy the content of build/html into the scot-doc repository, commit, push
8+

doc/source/conf.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/usr/bin/env python3
2-
# -*- coding: utf-8 -*-
32
#
43
# SCoT documentation build configuration file, created by
54
# sphinx-quickstart on Thu Jan 23 12:52:18 2014.
@@ -31,7 +30,7 @@
3130
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
3231
extensions = [
3332
# 'matplotlib.sphinxext.mathmpl',
34-
'matplotlib.sphinxext.only_directives',
33+
# 'matplotlib.sphinxext.only_directives', # requires matplotlib <2.2.x
3534
'matplotlib.sphinxext.plot_directive',
3635
# 'matplotlib.sphinxext.ipython_directive',
3736
'sphinx.ext.autosummary',
@@ -211,7 +210,7 @@
211210
#'pointsize': '10pt',
212211

213212
# Additional stuff for the LaTeX preamble.
214-
'preamble': '\usepackage{amssymb}',
213+
'preamble': r'\usepackage{amssymb}',
215214
}
216215

217216
# Grouping the document tree into LaTeX files. List of tuples

doc/source/pyplots/ellipses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
delta = 45.0 # degrees
55

66
angles = arange(0, 360+delta, delta)
7-
ells = [Ellipse((1, 1), 4, 2, a) for a in angles]
7+
ells = [Ellipse((1, 1), 4, 2, angle=a) for a in angles]
88

99
a = subplot(111, aspect='equal')
1010

doc/sphinxext/gen_gallery.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,7 @@ def gen_gallery(app, doctree):
151151
fh.write(content)
152152
fh.close()
153153

154-
for key in app.builder.status_iterator(
155-
iter(thumbnails.keys()), "generating thumbnails... ",
156-
length=len(thumbnails)):
154+
for key in thumbnails.keys():
157155
if out_of_date(key, thumbnails[key]):
158156
image.thumbnail(key, thumbnails[key], 0.3)
159157

doc/sphinxext/gen_rst.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ def generate_example_rst(app):
6464
SCoT Examples
6565
####################
6666
67-
.. htmlonly::
6867
6968
:Release: |version|
7069
:Date: |today|
@@ -98,7 +97,6 @@ def generate_example_rst(app):
9897
%s Examples
9998
##############################################
10099
101-
.. htmlonly::
102100
103101
:Release: |version|
104102
:Date: |today|

doc/sphinxext/numpydoc

Submodule numpydoc updated 71 files

examples/misc/features.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis as LDA
1212
except ImportError:
1313
from sklearn.lda import LDA
14-
from sklearn.cross_validation import KFold
14+
from sklearn.model_selection import KFold
1515
from sklearn.metrics import confusion_matrix
1616

1717
import scot.xvschema
@@ -58,7 +58,7 @@
5858

5959
# Initialize cross-validation
6060
nfolds = 10
61-
kf = KFold(len(triggers), n_folds=nfolds)
61+
kf = KFold(n_splits=nfolds)
6262

6363
# LDA requires numeric class labels
6464
cl = np.unique(classes)
@@ -68,7 +68,7 @@
6868
lda = LDA()
6969
cm = np.zeros((2, 2))
7070
fold = 0
71-
for train, test in kf:
71+
for train, test in kf.split(data):
7272
fold += 1
7373

7474
# Perform CSPVARICA

examples/test/premixing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
data -= np.mean(data, axis=1, keepdims=True)
4343

4444
# pre-transform data with a PCA
45-
myunmix, mymix, data = scot.config.backend['pca'](data, 0.99)
45+
myunmix, mymix, data = scot.backend['pca'](data, 0.99)
4646

4747
print('Remaining data components:', data.shape[1])
4848
print('Note that the Topoplots still map to all 45 EEG channels.')

scot/datasets.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ def fetch(dataset="mi", datadir=datadir):
3535
3636
Returns
3737
-------
38-
data : list of dicts
39-
The data set is stored in a list, where each list element
40-
corresponds to data from one subject. Each list element is a
41-
dictionary with the following keys:
42-
"eeg" ... EEG signals
43-
"triggers" ... Trigger latencies
44-
"labels" ... Class labels
45-
"fs" ... Sample rate
46-
"locations" ... Channel locations
38+
data : list of dicts
39+
The data set is stored in a list, where each list element
40+
corresponds to data from one subject. Each list element is a
41+
dictionary with the following keys:
42+
- "eeg" ... EEG signals
43+
- "triggers" ... Trigger latencies
44+
- "labels" ... Class labels
45+
- "fs" ... Sample rate
46+
- "locations" ... Channel locations
4747
"""
4848
if dataset not in datasets:
4949
raise ValueError("Example data '{}' not available.".format(dataset))
@@ -65,7 +65,7 @@ def fetch(dataset="mi", datadir=datadir):
6565
with open(fullfile, "rb") as f: # check if MD5 of downloaded file matches original hash
6666
hash = hashlib.md5(f.read()).hexdigest()
6767
if hash != md5[n]:
68-
raise MD5MismatchError("MD5 hash of {} does not match {}.".format(fullfile, md5[n]))
68+
raise MD5MismatchError("MD5 hash of {} {} does not match {}.".format(fullfile, hash, md5[n]))
6969
data.append(convert(dataset, loadmat(fullfile)))
7070

7171
return data

0 commit comments

Comments
 (0)