Skip to content

Commit

Permalink
Use new add figure method (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-luke authored Jan 21, 2022
1 parent 86bd664 commit ee7c4e8
Showing 1 changed file with 7 additions and 17 deletions.
24 changes: 7 additions & 17 deletions fnirsapp_qr.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,7 @@ def plot_raw(raw, report):
show_scrollbars=False, clipping=None)

msg = "Plot of the raw signal"
report.add_figs_to_section(fig1, comments=msg,
captions=raw.info["subject_info"]["first_name"] + "_raw",
section="Raw Waveform")
report.add_figure(fig=fig1, caption=msg, title="Raw Waveform")

return raw, report

Expand All @@ -160,8 +158,7 @@ def summarise_triggers(raw, report):
events, event_dict = mne.events_from_annotations(raw, verbose=False)
fig2 = mne.viz.plot_events(events, event_id=event_dict,
sfreq=raw.info['sfreq'])
report.add_figs_to_section(fig2, section="Triggers",
captions=raw.info["subject_info"]["first_name"] + "_triggers")
report.add_figure(fig=fig2, title="Triggers")

return raw, report

Expand All @@ -171,8 +168,7 @@ def summarise_montage(raw, report):
fig3 = raw.plot_sensors()
msg = f"Montage of sensors." \
f"Bad channels are marked in red: {raw.info['bads']}"
report.add_figs_to_section(fig3, section="Montage", comments=msg,
captions=raw.info["subject_info"]["first_name"] + "_montage")
report.add_figure(fig=fig3, title="Montage", caption=msg)

return raw, report

Expand All @@ -198,10 +194,7 @@ def summarise_sci(raw, report, threshold=0.8):

msg = f"Scalp coupling index with threshold at {threshold}." \
f"Results in bad channels {raw.info['bads']}"
report.add_figs_to_section(fig,
comments=msg,
captions=raw.info["subject_info"]["first_name"] + "_SCI",
section="Scalp Coupling Index")
report.add_figure(fig=fig, caption=msg, title="Scalp Coupling Index")

return raw, report

Expand All @@ -224,8 +217,7 @@ def summarise_sci_window(raw, report, threshold=0.8):
title="Scalp Coupling Index "
"Quality Evaluation")
msg = "Windowed SCI."
report.add_figs_to_section(fig, section="SCI Windowed", comments=msg,
captions=raw.info["subject_info"]["first_name"] + "_sciwin")
report.add_figure(fig=fig, title="SCI Windowed", caption=msg)

return raw, report

Expand All @@ -247,8 +239,7 @@ def summarise_pp(raw, report, threshold=0.8):
title="Peak Power "
"Quality Evaluation")
msg = "Windowed Peak Power."
report.add_figs_to_section(fig, section="Peak Power", comments=msg,
captions=raw.info["subject_info"]["first_name"] + "_pp")
report.add_figure(fig=fig, title="Peak Power", caption=msg)

return raw, report

Expand All @@ -263,8 +254,7 @@ def summarise_odpsd(raw, report):
ax[1].set_title("Average +- std")

msg = "PSD of the optical density signal."
report.add_figs_to_section(fig, section="OD PSD", comments=msg,
captions=raw.info["subject_info"]["first_name"] + "_psd")
report.add_figure(fig=fig, title="OD PSD", caption=msg)

return raw, report

Expand Down

0 comments on commit ee7c4e8

Please sign in to comment.