snake.core.handlers.activations.bold

snake.core.handlers.activations.bold#

BOLD Signal utilities.

Module Contents#

Functions#

block_design

Create a simple block design paradigm.

get_bold

Convolve the HRF with the event condition to generate the BOLD signal.

get_event_ts

Get the event time series, sampled at tr_ms.

API#

snake.core.handlers.activations.bold.block_design(block_on: float, block_off: float, duration: float, offset: float = 0, event_name: str = 'block_on') pandas.DataFrame[source]#

Create a simple block design paradigm.

Parameters:
  • block_on (float) – in seconds, the amount of time the stimuli is on

  • block_off (float) – in seconds, the amount of time the stimuli is off (rest) after the on state.

  • duration (float) – in seconds, the total amount of the experiments.

  • offset (float) – in seconds, the starting point of the experiment, default=0.

  • event_name (str) – name of the block event, default=”block_on”

Returns:

the data frame corresponding to a block design.

Return type:

pd.DataFrame

Notes

The design is as follows

         |---------|          |----------|       |------>
|--------|         |----------|          |-------|
  offset   block_on  block_off  block_on   ...

And repeats until duration is reached.

snake.core.handlers.activations.bold.get_bold(tr_ms: float, max_time: float, event_condition: pandas.DataFrame, hrf_model: str, oversampling: int, min_onset: float, bold_strength: float) numpy.ndarray[source]#

Convolve the HRF with the event condition to generate the BOLD signal.

Parameters:
  • frame_times – array-like of shape (n_times,) The timing of the acquisition

  • event_condition – array-like of shape (3, n_events) yields description of events for this condition as a (onsets, durations, amplitudes) triplet

  • hrf_model – Choice for the HRF, FIR is not

  • oversampling – Oversampling factor to perform the convolution. Default=50.

  • min_onset – Minimal onset relative to frame_times[0] (in seconds) events that start before frame_times[0] + min_onset are not considered. Default=-24.

  • duration – Duration of the event in seconds.

  • offset – Offset of the event in seconds.

  • bold_strength – Strength of the BOLD signal.

Returns:

The convolved HRF with the event condition.

Return type:

np.ndarray

snake.core.handlers.activations.bold.get_event_ts(event_condition: pandas.DataFrame, max_time: float, tr_ms: float, min_onset: float) numpy.ndarray[source]#

Get the event time series, sampled at tr_ms.