HRF models

Example to illutrate the different HRF model in HemoLearn.

# Authors: Hamza Cherkaoui <hamza.cherkaoui@inria.fr>
# License: BSD (3-clause)

import os
import time
import numpy as np
import matplotlib.pyplot as plt

from hemolearn.hrf_model import scaled_hrf, hrf_3_basis, hrf_2_basis

Plot all the HRF models

_, axis = plt.subplots(1, 1, figsize=(6, 3))
axis.plot(hrf_3_basis_.T, lw=2.0, label="3-basis HRF")
axis.plot(hrf_2_basis_.T, lw=2.0, label="2-basis HRF")
axis.plot(scaled_hrf_, lw=2.0, label=r"Scaled HRF ($\delta=1.0$)")
axis.set_xticks(_xticks)
axis.set_xticklabels(_xticks_labels, fontsize=18)
axis.set_title("HRF models", fontsize=20)
plt.grid()
plt.legend()
plt.tight_layout()
filename = os.path.join(plot_dir, 'hrf_model.png')
print(f"Saving plot under '{filename}'")
plt.savefig(filename, dpi=200)
HRF models

Out:

Saving plot under 'plots/hrf_model.png'

Plot different scaled model HRFs

_, axis = plt.subplots(1, 1, figsize=(6, 3))
axis.plot(scaled_hrf(0.5, TR, n_times_atom), lw=2.0,
          label=r"Scaled HRF ($\delta={0.5}$)")
axis.plot(scaled_hrf(1.0, TR, n_times_atom), lw=2.0,
          label=r"Scaled HRF ($\delta={1.0}$)")
axis.plot(scaled_hrf(2.0, TR, n_times_atom), lw=2.0,
          label=r"Scaled HRF ($\delta={2.0}$)")
axis.set_xticks(_xticks)
axis.set_xticklabels(_xticks_labels, fontsize=18)
axis.set_title("Scaled model HRFs", fontsize=20)
plt.grid()
plt.legend()
plt.tight_layout()
filename = os.path.join(plot_dir, 'scaled_hrf_model.png')
print(f"Saving plot under '{filename}'")
plt.savefig(filename, dpi=200)
Scaled model HRFs

Out:

Saving plot under 'plots/scaled_hrf_model.png'

Total running time of the script: ( 0 minutes 0.575 seconds)

Gallery generated by Sphinx-Gallery