From da6bf2d046b19137ad8ae5184d97be22b3c8bcef Mon Sep 17 00:00:00 2001 From: Daniel McCloy Date: Wed, 2 Oct 2024 10:41:55 -0500 Subject: [PATCH 1/4] refactor channels HTML repr --- mne/html_templates/repr/_channels.html.jinja | 18 +----------------- .../repr/static/_channels.html.jinja | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 17 deletions(-) create mode 100644 mne/html_templates/repr/static/_channels.html.jinja diff --git a/mne/html_templates/repr/_channels.html.jinja b/mne/html_templates/repr/_channels.html.jinja index 4f7646e9c80..1d057b9688f 100644 --- a/mne/html_templates/repr/_channels.html.jinja +++ b/mne/html_templates/repr/_channels.html.jinja @@ -11,23 +11,7 @@ {%include 'static/_section_header_row.html.jinja' %} {% for channel_type, channels in (info | format_channels).items() %} -{% set channel_names_good = channels["good"] | map(attribute='name_html') | join(', ') %} - - - {{ channel_type }} - - - - {% if channels["bad"] %} - {% set channel_names_bad = channels["bad"] | map(attribute='name_html') | join(', ') %} - and - {% endif %} - - + {% include 'static/_channels.html.jinja' %} {% endfor %} diff --git a/mne/html_templates/repr/static/_channels.html.jinja b/mne/html_templates/repr/static/_channels.html.jinja new file mode 100644 index 00000000000..d40f62f5d6b --- /dev/null +++ b/mne/html_templates/repr/static/_channels.html.jinja @@ -0,0 +1,17 @@ +{% set channel_names_good = channels["good"] | map(attribute='name_html') | join(', ') %} + + + {{ channel_type }} + + + + {% if channels["bad"] %} + {% set channel_names_bad = channels["bad"] | map(attribute='name_html') | join(', ') %} + and + {% endif %} + + From 6c3dea4e76556ded474acb68c1fbf5ae0ddcbba5 Mon Sep 17 00:00:00 2001 From: Daniel McCloy Date: Wed, 2 Oct 2024 10:43:16 -0500 Subject: [PATCH 2/4] use channels template in fwd --- mne/html_templates/repr/forward.html.jinja | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/mne/html_templates/repr/forward.html.jinja b/mne/html_templates/repr/forward.html.jinja index 510a775c2b6..e22dd6e0643 100644 --- a/mne/html_templates/repr/forward.html.jinja +++ b/mne/html_templates/repr/forward.html.jinja @@ -1,27 +1,9 @@ {%include '_js_and_css.html.jinja' %} + {%include 'static/_section_header_row.html.jinja' %} {% for channel_type, channels in (info | format_channels).items() %} - {% set channel_names_good = channels["good"] | map(attribute='name_html') | join(', ') %} - - - - + {% include 'static/_channels.html.jinja' %} {% endfor %} From 95afeb195f161266842527a3bc655b1b1a2eabfa Mon Sep 17 00:00:00 2001 From: Daniel McCloy Date: Wed, 2 Oct 2024 10:43:44 -0500 Subject: [PATCH 3/4] make fwd collapsible --- mne/html_templates/repr/forward.html.jinja | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/mne/html_templates/repr/forward.html.jinja b/mne/html_templates/repr/forward.html.jinja index e22dd6e0643..e8bce9649b1 100644 --- a/mne/html_templates/repr/forward.html.jinja +++ b/mne/html_templates/repr/forward.html.jinja @@ -1,17 +1,29 @@ {%include '_js_and_css.html.jinja' %} +{% set section = "Forward" %} +{% 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 %} +
{{ channel_type }} - - - {% if channels["bad"] %} - {% set channel_names_bad = channels["bad"] | map(attribute='name_html') | join(', ') %} - and - {% endif %} -
{%include 'static/_section_header_row.html.jinja' %} {% for channel_type, channels in (info | format_channels).items() %} {% include 'static/_channels.html.jinja' %} {% endfor %} - - + + + - - + + +
Source space
Source space {{ source_space_descr }}
Source orientation
Source orientation {{ source_orientation }}
\ No newline at end of file From 3c76cd64cb286f373f5adfcfea6282d17c6643fa Mon Sep 17 00:00:00 2001 From: Daniel McCloy Date: Wed, 2 Oct 2024 10:43:56 -0500 Subject: [PATCH 4/4] demo it in docs --- tutorials/forward/35_eeg_no_mri.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tutorials/forward/35_eeg_no_mri.py b/tutorials/forward/35_eeg_no_mri.py index a2deaa069b6..0fca916cabf 100644 --- a/tutorials/forward/35_eeg_no_mri.py +++ b/tutorials/forward/35_eeg_no_mri.py @@ -82,7 +82,7 @@ fwd = mne.make_forward_solution( raw.info, trans=trans, src=src, bem=bem, eeg=True, mindist=5.0, n_jobs=None ) -print(fwd) +fwd ############################################################################## # From here on, standard inverse imaging methods can be used!