From ed933b8d9d523a9f4f7006d6e6d1c81901e5478a Mon Sep 17 00:00:00 2001 From: Daniel McCloy Date: Wed, 2 Oct 2024 12:12:20 -0500 Subject: [PATCH] make HTML repr for Forward match others (#12883) --- mne/html_templates/repr/_channels.html.jinja | 18 +------- mne/html_templates/repr/forward.html.jinja | 42 ++++++++----------- .../repr/static/_channels.html.jinja | 17 ++++++++ tutorials/forward/35_eeg_no_mri.py | 2 +- 4 files changed, 37 insertions(+), 42 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/forward.html.jinja b/mne/html_templates/repr/forward.html.jinja index 510a775c2b6..e8bce9649b1 100644 --- a/mne/html_templates/repr/forward.html.jinja +++ b/mne/html_templates/repr/forward.html.jinja @@ -1,35 +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 %} + + {%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 %} - - + + + - - + + +
{{ channel_type }} - - - {% if channels["bad"] %} - {% set channel_names_bad = channels["bad"] | map(attribute='name_html') | join(', ') %} - and - {% endif %} -
Source space
Source space {{ source_space_descr }}
Source orientation
Source orientation {{ source_orientation }}
\ No newline at end of file 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 %} + + 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!