Calculate the Spatiotemporal Pattern Similarity (STPS)

neurora.stps_cal module

a module for calculating the spatiotemporal pattern similarity based on neural data

neurora.stps_cal.stps(data, label_item, label_rf, time_win=20, time_step=1)

Calculate the spatiotemporal pattern similarities (STPS) for EEG-like data

Parameters
  • data (array) – The neural data. The shape of data must be [n_subs, n_trials, n_chls, n_ts]. n_subs, n_trials, n_chls and n_ts represent the number of subjects, the number of trials, the number of channels or regions and the number of time-points.

  • label_item (array or list.) – The label of trials. The shape of label_wibi must be [n_trials]. n_trials represents the number of trials.

  • label_rf (array or list.) – The label of trials: Remembered (0) or Forgot (1). The shape of label_rf must be [n_trials]. n_trials represents the number of trials. If the trial i is a remembered trial, label_rf[i]=0. If the trial j is a forgot trial, label_rf[j]=0.

  • time_win (int. Default is 20.) – Set a time-window for calculating the STPS for different time-points. If time_win=20, that means each calculation process based on 20 time-points.

  • time_step (int. Default is 1.) – The time step size for each time of calculating.

Returns

stps – The STPS. The shape of stps is [n_subs, 8, n_chls, int((n_ts-time_win)/time_step)+1]. 8 represents eight different conditions: 0: Within-Item, 1: Between-Item, 2: Remembered, 3: Forgot, 4: Within-Item&Remembered, 5: Within-Item&Forgot, 6: Between-Item&Remembered, 7: Between-Item&Forgot.

Return type

array.

neurora.stps_cal.stps_fmri(fmri_data, label_item, label_rf, ksize=[3, 3, 3], strides=[1, 1, 1])

Calculate the spatiotemporal pattern similarities (STPS) for fMRI (searchlight)

Parameters
  • fmri_data (array) – The fMRI data. The shape of fmri_data must be [n_subs, n_trials, nx, ny, nz]. n_subs, n_trials, nx, ny, nz represent the number of subjects, the number of trials & the size of fMRI-img, respectively.

  • label_item (array or list.) – The label of trials. The shape of label_item must be [n_trials]. n_trials represents the number of trials.

  • label_rf (array or list.) – The label of trials: Remembered (0) or Forgot (1). The shape of label_rf must be [n_trials]. n_trials represents the number of trials. If the trial i is a remembered trial, label_rf[i]=0. If the trial j is a forgot trial, label_rf[j]=0.

  • ksize (array or list [kx, ky, kz]. Default is [3, 3, 3].) – The size of the calculation unit for searchlight. kx, ky, kz represent the number of voxels along the x, y, z axis. kx, ky, kz should be odd.

  • strides (array or list [sx, sy, sz]. Default is [1, 1, 1].) – The strides for calculating along the x, y, z axis.

Returns

stps – The STPS. The shape of stps is [n_subs, 8, n_x, n_y, n_z]. 8 represents eight different conditions: 0: Within-Item, 1: Between-Item, 2: Remembered, 3: Forgot, 4: Within-Item&Remembered, 5: Within-Item&Forgot, 6: Between-Item&Remembered, 7: Between-Item&Forgot. n_x, n_y, n_z represent the number of calculation units for searchlight along the x, y, z axis.

Return type

array.

Notes

The size of the calculation units should at least be [3, 3, 3].

neurora.stps_cal.stps_fmri_roi(fmri_data, mask_data, label_item, label_rf)

Calculate the spatiotemporal pattern similarities (STPS) for fMRI (for ROI)

Parameters
  • fmri_data (array) – The fmri data. The shape of fmri_data must be [n_subs, n_trials, nx, ny, nz]. n_subs, n_trials, nx, ny, nz represent the number of subjects, the number of trials & the size of fMRI-img, respectively.

  • mask_data (array [nx, ny, nz].) – The mask data for region of interest (ROI). The size of the fMRI-img. nx, ny, nz represent the number of voxels along the x, y, z axis.

  • label_item (array or list.) – The label of trials. The shape of label_wibi must be [n_trials]. n_trials represents the number of trials.

  • label_rf (array or list.) – The label of trials: Remembered (0) or Forgot (1). The shape of label_rf must be [n_trials]. n_trials represents the number of trials. If the trial i is a remembered trial, label_rf[i]=0. If the trial j is a forgot trial, label_rf[j]=0.

Returns

stps – The STPS. The shape of stps is [n_subs, 8]. 8 represents eight different conditions: 0: Within-Item, 1: Between-Item, 2: Remembered, 3: Forgot, 4: Within-Item&Remembered, 5: Within-Item&Forgot, 6: Between-Item&Remembered, 7: Between-Item&Forgot.

Return type

array.

Notes

The size of the calculation units should at least be [3, 3, 3].