Skip to content

Commit

Permalink
make HTML repr for Forward match others (#12883)
Browse files Browse the repository at this point in the history
  • Loading branch information
drammock authored Oct 2, 2024
1 parent 7e197c7 commit ed933b8
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 42 deletions.
18 changes: 1 addition & 17 deletions mne/html_templates/repr/_channels.html.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -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(', ') %}
<tr class="repr-element {{ section_class_name }} {{ collapsed_row_class }}">
<td class="mne-repr-section-toggle"></td>
<td>{{ channel_type }}</td>
<td>
<button class="mne-ch-names-btn sd-sphinx-override sd-btn sd-btn-info sd-text-wrap sd-shadow-sm" onclick="alert('Good {{ channel_type}}:\n\n{{ channel_names_good | safe }}')" title="(Click to open in popup)&#13;&#13;{{ channel_names_good | safe }}">
{{ channels["good"] | length}}
</button>

{% if channels["bad"] %}
{% set channel_names_bad = channels["bad"] | map(attribute='name_html') | join(', ') %}
and <button class="mne-ch-names-btn sd-sphinx-override sd-btn sd-btn-info sd-text-wrap sd-shadow-sm" onclick="alert('Bad {{ channel_type}}:\n\n{{ channel_names_bad | safe }}')" title="(Click to open in popup)&#13;&#13;{{ channel_names_bad | safe }}">
{{ channels["bad"] | length}} bad
</button>
{% endif %}
</td>
</tr>
{% include 'static/_channels.html.jinja' %}
{% endfor %}

<tr class="repr-element {{ section_class_name }} {{ collapsed_row_class }}">
Expand Down
42 changes: 18 additions & 24 deletions mne/html_templates/repr/forward.html.jinja
Original file line number Diff line number Diff line change
@@ -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 %}

<table class="table mne-repr-table">
{%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(', ') %}
<tr class="repr-element {{ section_class_name }} {{ collapsed_row_class }}">
<th>{{ channel_type }}</th>
<td>
<button class="mne-ch-names-btn sd-sphinx-override sd-button sd-btn-info sd-text-wrap sd-shadow-sm"
onclick="alert('Good {{ channel_type}}:\n\n{{ channel_names_good | safe }}')"
title="Show good channel names">
{{ channels["good"] | length}}
</button>

{% if channels["bad"] %}
{% set channel_names_bad = channels["bad"] | map(attribute='name_html') | join(', ') %}
and <button class="mne-ch-names-btn sd-sphinx-override sd-button sd-btn-info sd-text-wrap sd-shadow-sm"
onclick="alert('Bad {{ channel_type}}:\n\n{{ channel_names_bad | safe }}')"
title="Show bad channel names">
{{ channels["bad"] | length}} bad
</button>
{% endif %}
</td>
</tr>
{% include 'static/_channels.html.jinja' %}
{% endfor %}

<tr>
<th>Source space</th>
<tr class="repr-element {{ section_class_name }} {{ collapsed_row_class }}">
<td class="mne-repr-section-toggle"></td>
<td>Source space</td>
<td>{{ source_space_descr }}</td>
</tr>
<tr>
<th>Source orientation</th>
<tr class="repr-element {{ section_class_name }} {{ collapsed_row_class }}">
<td class="mne-repr-section-toggle"></td>
<td>Source orientation</td>
<td>{{ source_orientation }}</td>
</tr>
</table>
17 changes: 17 additions & 0 deletions mne/html_templates/repr/static/_channels.html.jinja
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{% set channel_names_good = channels["good"] | map(attribute='name_html') | join(', ') %}
<tr class="repr-element {{ section_class_name }} {{ collapsed_row_class }}">
<td class="mne-repr-section-toggle"></td>
<td>{{ channel_type }}</td>
<td>
<button class="mne-ch-names-btn sd-sphinx-override sd-btn sd-btn-info sd-text-wrap sd-shadow-sm" onclick="alert('Good {{ channel_type}}:\n\n{{ channel_names_good | safe }}')" title="(Click to open in popup)&#13;&#13;{{ channel_names_good | safe }}">
{{ channels["good"] | length}}
</button>

{% if channels["bad"] %}
{% set channel_names_bad = channels["bad"] | map(attribute='name_html') | join(', ') %}
and <button class="mne-ch-names-btn sd-sphinx-override sd-btn sd-btn-info sd-text-wrap sd-shadow-sm" onclick="alert('Bad {{ channel_type}}:\n\n{{ channel_names_bad | safe }}')" title="(Click to open in popup)&#13;&#13;{{ channel_names_bad | safe }}">
{{ channels["bad"] | length}} bad
</button>
{% endif %}
</td>
</tr>
2 changes: 1 addition & 1 deletion tutorials/forward/35_eeg_no_mri.py
Original file line number Diff line number Diff line change
Expand Up @@ -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!
Expand Down

0 comments on commit ed933b8

Please sign in to comment.