laion_fmri.group

Multi-subject Group wrapper for cross-subject analyses.

Functions

load_subjects(subjects)

Load multiple subjects into a Group.

laion_fmri.group.load_subjects(subjects)[source]

Load multiple subjects into a Group.

Parameters:

subjects (list[str | int] or "all") – List of subject identifiers, or "all" to load every subject in the dataset.

Return type:

Group

Classes

Group(subjects_dict)

Holds several Subject instances and dispatches to them.

class laion_fmri.group.Group(subjects_dict)[source]

Bases: object

Holds several Subject instances and dispatches to them.

Parameters:

subjects_dict (dict[str, laion_fmri.subject.Subject]) – Mapping of BIDS ID to loaded subject objects.

get_shared_betas(session, roi=None, mask=None, nc_threshold=None, mask_source='anatomical')[source]

Load shared-stimulus single-trial betas for all subjects.

Parameters:
  • session (str) – BIDS session ID. Required – single-trial betas are stored per session.

  • roi (str or None)

  • mask (np.ndarray[bool] or None)

  • nc_threshold (float or None)

  • mask_source ("anatomical" (default) | "rsquare") – Forwarded to Subject.get_betas(); see Subject.get_brain_mask() for the difference.

Returns:

Mapping of subject ID to a betas array of shape (n_shared_trials, n_voxels).

Return type:

dict[str, np.ndarray]

get_shared_images(format='pil')[source]

Load shared stimulus images from disk.

Parameters:

format ("pil" or "numpy") – Output container – a list of PIL.Image.Image or a stacked (N, H, W, 3) uint8 array.

get_shared_stimulus_metadata()[source]

Return the shared subset of the stimulus metadata.