diff --git a/mne/_fiff/meas_info.py b/mne/_fiff/meas_info.py
index 5f3fa7c0000..88be1c5b4a3 100644
--- a/mne/_fiff/meas_info.py
+++ b/mne/_fiff/meas_info.py
@@ -14,6 +14,7 @@
import operator
from textwrap import shorten
import string
+import uuid
import numpy as np
@@ -1877,7 +1878,7 @@ def _get_chs_for_repr(self):
return good_channels, bad_channels, ecg, eog
@repr_html
- def _repr_html_(self, caption=None):
+ def _repr_html_(self, caption=None, duration=None, filenames=None):
"""Summarize info for HTML representation."""
if isinstance(caption, str):
html = f"
{caption} "
@@ -1909,7 +1910,11 @@ def _repr_html_(self, caption=None):
projs = None
info_template = _get_html_template("repr", "info.html.jinja")
+ sections = ("General", "Channels", "Data")
+ section_ids = [f"section_{str(uuid.uuid4())}" for _ in sections]
return html + info_template.render(
+ sections=sections,
+ section_ids=section_ids,
caption=caption,
meas_date=meas_date,
projs=projs,
@@ -1923,6 +1928,8 @@ def _repr_html_(self, caption=None):
highpass=self.get("highpass"),
sfreq=self.get("sfreq"),
experimenter=self.get("experimenter"),
+ duration=duration,
+ filenames=filenames,
)
def save(self, fname):
diff --git a/mne/conftest.py b/mne/conftest.py
index df914120ece..c1e6b36a93b 100644
--- a/mne/conftest.py
+++ b/mne/conftest.py
@@ -158,7 +158,7 @@ def pytest_configure(config):
# h5py
ignore:`product` is deprecated as of NumPy.*:DeprecationWarning
# pandas
- ignore:.*np\.find_common_type is deprecated.*:DeprecationWarning
+ ignore:In the future `np.long`.*:FutureWarning
# https://github.com/joblib/joblib/issues/1454
ignore:.*`byte_bounds` is dep.*:DeprecationWarning
# numpy distutils used by SciPy
diff --git a/mne/html_templates/repr/info.html.jinja b/mne/html_templates/repr/info.html.jinja
index ec01af7decd..f6d46c49f34 100644
--- a/mne/html_templates/repr/info.html.jinja
+++ b/mne/html_templates/repr/info.html.jinja
@@ -1,5 +1,47 @@
+
+
+
+
+
+
+
+
+
Measurement date
{% if meas_date is not none %}
{{ meas_date }}
@@ -7,7 +49,7 @@
Unknown
{% endif %}
-
+
Experimenter
{% if experimenter is not none %}
{{ experimenter }}
@@ -15,8 +57,9 @@
Unknown
{% endif %}
+
Participant
- {% if subject_info is not none %}
+ {% if subject_info is defined and subject_info is not none %}
{% if 'his_id' in subject_info.keys() %}
{{ subject_info['his_id'] }}
{% endif %}
@@ -25,6 +68,13 @@
{% endif %}
+
+
+
Digitized points
{% if dig is not none %}
{{ dig|length }} points
@@ -32,43 +82,63 @@
Not available
{% endif %}
-
+
Good channels
{{ good_channels }}
-
+
Bad channels
{{ bad_channels }}
-
+
EOG channels
{{ eog }}
-
+
ECG channels
{{ ecg }}
- {% if sfreq is not none %}
+
+
+
+ {% if sfreq is not none %}
+
Sampling frequency
{{ '%0.2f'|format(sfreq) }} Hz
{% endif %}
{% if highpass is not none %}
-
+
Highpass
{{ '%0.2f'|format(highpass) }} Hz
{% endif %}
{% if lowpass is not none %}
-
+
Lowpass
{{ '%0.2f'|format(lowpass) }} Hz
{% endif %}
{% if projs is not none %}
-
+
Projections
{{ projs|join(' ') | safe }}
{% endif %}
+ {% if filenames %}
+
+ Filenames
+ {{ filenames|join(' ') }}
+
+ {% endif %}
+ {% if duration %}
+
+ Duration
+ {{ duration }} (HH:MM:SS)
+
+ {% endif %}
diff --git a/mne/html_templates/repr/raw.html.jinja b/mne/html_templates/repr/raw.html.jinja
index 7bc8542eaee..9cba46f43bf 100644
--- a/mne/html_templates/repr/raw.html.jinja
+++ b/mne/html_templates/repr/raw.html.jinja
@@ -1,12 +1 @@
-{{ info_repr[:-9] | safe }}
- {% if filenames %}
-
- Filenames
- {{ filenames|join(' ') }}
-
- {% endif %}
-
- Duration
- {{ duration }} (HH:MM:SS)
-
-
+{{ info_repr | safe }}
diff --git a/mne/io/base.py b/mne/io/base.py
index e4f917a7c29..3950861fed9 100644
--- a/mne/io/base.py
+++ b/mne/io/base.py
@@ -2069,9 +2069,11 @@ def _repr_html_(self, caption=None):
duration = f"{int(hours):02d}:{int(minutes):02d}:{int(seconds):02d}"
raw_template = _get_html_template("repr", "raw.html.jinja")
return raw_template.render(
- info_repr=self.info._repr_html_(caption=caption),
- filenames=basenames,
- duration=duration,
+ info_repr=self.info._repr_html_(
+ caption=caption,
+ filenames=basenames,
+ duration=duration,
+ )
)
def add_events(self, events, stim_channel=None, replace=False):
diff --git a/mne/utils/tests/test_misc.py b/mne/utils/tests/test_misc.py
index 14bfa183175..1309feafbec 100644
--- a/mne/utils/tests/test_misc.py
+++ b/mne/utils/tests/test_misc.py
@@ -24,7 +24,7 @@ def test_html_repr():
os.environ[key] = "True" # HTML repr on
info = mne.create_info(10, 256)
r = info._repr_html_()
- assert r.startswith("")
os.environ[key] = "False" # HTML repr off
r = info._repr_html_()
diff --git a/tutorials/intro/30_info.py b/tutorials/intro/30_info.py
index 98e4aab097a..2de72747528 100644
--- a/tutorials/intro/30_info.py
+++ b/tutorials/intro/30_info.py
@@ -182,7 +182,7 @@
print(mne.pick_info(info, eeg_indices)["nchan"])
# %%
-# We can also get a nice HTML representation in IPython like:
+# We can also get a nice HTML representation in IPython like this:
info
diff --git a/tutorials/intro/70_report.py b/tutorials/intro/70_report.py
index 0c8c086eff8..b23c8852694 100644
--- a/tutorials/intro/70_report.py
+++ b/tutorials/intro/70_report.py
@@ -17,7 +17,7 @@
HTML pages it generates are self-contained and do not require a running Python
environment. However, it is less flexible as you can't change code and re-run
something directly within the browser. This tutorial covers the basics of
-building a report. As usual, we'll start by importing the modules and data we
+building a report. As usual, we will start by importing the modules and data we
need:
"""
diff --git a/tutorials/raw/10_raw_overview.py b/tutorials/raw/10_raw_overview.py
index 0dbb8491d87..198cb5264ee 100644
--- a/tutorials/raw/10_raw_overview.py
+++ b/tutorials/raw/10_raw_overview.py
@@ -17,7 +17,6 @@
"""
# %%
-
import os
import numpy as np
import matplotlib.pyplot as plt