diff --git a/Makefile b/Makefile
index 89adc810eec..80c79edace3 100644
--- a/Makefile
+++ b/Makefile
@@ -44,7 +44,7 @@ test-doc: sample_data testing_data
$(PYTESTS) --doctest-modules --doctest-ignore-import-errors --doctest-glob='*.rst' ./doc/ --ignore=./doc/auto_examples --ignore=./doc/auto_tutorials --ignore=./doc/_build --ignore=./doc/conf.py --ignore=doc/sphinxext --fulltrace
pre-commit:
- @pre-commit run -a
+ @pre-commit run -a --show-diff-on-failure
# Aliases for stuff we used to support or users might think of
ruff: pre-commit
diff --git a/mne/html_templates/repr/_acquisition.html.jinja b/mne/html_templates/repr/_acquisition.html.jinja
index 0016740cdf8..e1ee4f69dd3 100644
--- a/mne/html_templates/repr/_acquisition.html.jinja
+++ b/mne/html_templates/repr/_acquisition.html.jinja
@@ -81,7 +81,7 @@
{{ "%0.2f" | format(info["sfreq"]) }} Hz |
{% endif %}
-{% if inst is defined and inst.times is defined %}
+{% if inst is defined and inst | has_attr("times") and inst.times is defined %}
|
Time points |
diff --git a/mne/html_templates/repr/_frequencies.html.jinja b/mne/html_templates/repr/_frequencies.html.jinja
new file mode 100644
index 00000000000..b55b8ddf883
--- /dev/null
+++ b/mne/html_templates/repr/_frequencies.html.jinja
@@ -0,0 +1,62 @@
+{% set section = "Frequencies" %}
+{% set section_class_name = section | lower | append_uuid %}
+
+{# Collapse content during documentation build. #}
+{% if collapsed %}
+{% set collapsed_row_class = "mne-repr-collapsed" %}
+{% else %}
+{% set collapsed_row_class = "" %}
+{% endif %}
+
+{%include 'static/_section_header_row.html.jinja' %}
+
+
+ |
+ Data type |
+ {{ inst._data_type }} |
+
+
+ |
+ Computed from |
+ {{ computed_from }} |
+
+
+ |
+ Estimation method |
+ {{ inst.method }} |
+
+
+{% if "taper" in inst._dims %}
+
+ |
+ Number of tapers |
+ {{ inst._mt_weights.size }} |
+
+{% endif %}
+{% if inst.freqs is defined %}
+
+ |
+ Frequency range |
+ {{ '%.2f'|format(inst.freqs[0]) }} – {{ '%.2f'|format(inst.freqs[-1]) }} Hz |
+
+
+ |
+ Number of frequency bins |
+ {{ inst.freqs|length }} |
+
+{%- for unit in units %}
+
+ |
+ {%- if loop.index == 1 %}
+ Units |
+ {%- endif %}
+ {{ unit }} |
+
+{%- endfor %}
+{% endif %}
diff --git a/mne/html_templates/repr/spectrum.html.jinja b/mne/html_templates/repr/spectrum.html.jinja
index 11a1d7a886f..40cc2222005 100644
--- a/mne/html_templates/repr/spectrum.html.jinja
+++ b/mne/html_templates/repr/spectrum.html.jinja
@@ -1,50 +1,11 @@
+{%include '_js_and_css.html.jinja' %}
+
+{% set info = inst.info %}
+
-
- Data type |
- {{ spectrum._data_type }} |
-
- {%- for unit in units %}
-
- {%- if loop.index == 1 %}
- Units |
- {%- endif %}
- {{ unit }} |
-
- {%- endfor %}
-
- Data source |
- {{ inst_type }} |
-
- {%- if inst_type == "Epochs" %}
-
- Number of epochs |
- {{ spectrum.shape[0] }} |
-
- {% endif -%}
-
- Dims |
- {{ spectrum._dims | join(", ") }} |
-
-
- Estimation method |
- {{ spectrum.method }} |
-
- {% if "taper" in spectrum._dims %}
-
- Number of tapers |
- {{ spectrum._mt_weights.size }} |
-
- {% endif %}
-
- Number of channels |
- {{ spectrum.ch_names|length }} |
-
-
- Number of frequency bins |
- {{ spectrum.freqs|length }} |
-
-
- Frequency range |
- {{ '%.2f'|format(spectrum.freqs[0]) }} – {{ '%.2f'|format(spectrum.freqs[-1]) }} Hz |
-
+ {%include '_general.html.jinja' %}
+ {%include '_acquisition.html.jinja' %}
+ {%include '_channels.html.jinja' %}
+ {%include '_frequencies.html.jinja' %}
+ {%include '_filters.html.jinja' %}
diff --git a/mne/time_frequency/spectrum.py b/mne/time_frequency/spectrum.py
index 97113d2e912..a70697fd57c 100644
--- a/mne/time_frequency/spectrum.py
+++ b/mne/time_frequency/spectrum.py
@@ -419,7 +419,9 @@ def _repr_html_(self, caption=None):
inst_type_str = _get_instance_type_string(self)
units = [f"{ch_type}: {unit}" for ch_type, unit in self.units().items()]
t = _get_html_template("repr", "spectrum.html.jinja")
- t = t.render(spectrum=self, inst_type=inst_type_str, units=units)
+ t = t.render(
+ inst=self, computed_from=inst_type_str, units=units, filenames=None
+ )
return t
def _check_values(self):
diff --git a/tools/hooks/sync_dependencies.py b/tools/hooks/sync_dependencies.py
index a07cc633b3c..1ff6d7f8712 100755
--- a/tools/hooks/sync_dependencies.py
+++ b/tools/hooks/sync_dependencies.py
@@ -82,7 +82,6 @@ def _prettify_pin(pin):
f"- `{key} <{url}>`__{core_deps_pins[key.lower()]}"
for key, url in CORE_DEPS_URLS.items()
]
-core_deps_rst = "\n" + "\n".join(core_deps_bullets) + "\n"
# rewrite the README file
lines = README_PATH.read_text("utf-8").splitlines()
@@ -92,7 +91,7 @@ def _prettify_pin(pin):
if line.strip() == BEGIN:
skip = True
out_lines.append(line)
- out_lines.append(core_deps_rst)
+ out_lines.extend(["", *core_deps_bullets, ""])
if line.strip() == END:
skip = False
if not skip:
diff --git a/tutorials/time-freq/10_spectrum_class.py b/tutorials/time-freq/10_spectrum_class.py
index 62f6103bfdb..9ba463e18b5 100644
--- a/tutorials/time-freq/10_spectrum_class.py
+++ b/tutorials/time-freq/10_spectrum_class.py
@@ -35,11 +35,10 @@
raw.compute_psd()
# %%
-# By default, the spectral estimation method will be the
-# :footcite:t:`Welch1967` method for continuous data, and the multitaper
-# method :footcite:`Slepian1978` for epoched or averaged data. This default can
-# be overridden by passing ``method='welch'`` or ``method='multitaper'`` to the
-# :meth:`~mne.io.Raw.compute_psd` method.
+# By default, the spectral estimation method will be the :footcite:t:`Welch1967` method
+# for continuous data, and the multitaper method :footcite:`Slepian1978` for epoched or
+# averaged data. This default can be overridden by passing ``method='welch'`` or
+# ``method='multitaper'`` to the :meth:`~mne.io.Raw.compute_psd` method.
#
# There are many other options available as well; for example we can compute a
# spectrum from a given span of times, for a chosen frequency range, and for a