elephant.trials.TrialsFromBlock

class elephant.trials.TrialsFromBlock(block: <module 'neo.core.block' from '/home/docs/checkouts/readthedocs.org/user_builds/elephant/conda/latest/lib/python3.12/site-packages/neo/core/block.py'>, **kwargs)[source]

This class implements support for handling trials from neo.Block.

Parameters:
blockneo.Block

An instance of neo.Block containing the trials. The structure is assumed to follow the neo representation: A block contains multiple segments which are considered to contain the single trials.

descriptionstring, optional

A textual description of the set of trials. Can be accessed via the class attribute description. Default: None.

get_analogsignals_from_trial_as_list(trial_id: int) List[AnalogSignal][source]

Get all analogsignals from a specific trial and return a list.

Parameters:
trial_idint

Trial ID to get the analogsignals from (starting at trial ID 0).

Returns:
list of :class`neo.AnalogSignal`: list of all analogsignal objects of

the trial.

get_analogsignals_from_trial_as_segment(trial_id: int) Segment[source]

Get all analogsignal objects from a specific trial and return a neo.Segment.

Parameters:
trial_idint

Trial ID to get the analogsignals from (starting at trial ID 0).

Returns:
class:neo.Segment: segment containing all analogsignal objects of

the trial.

get_spiketrains_from_trial_as_list(trial_id: int = 0) SpikeTrainList[source]

Get all spike trains from a specific trial and return a list.

Parameters:
trial_idint

Trial ID to get the spike trains from (starting at trial ID 0).

Returns:
list of neo.SpikeTrain

List of all spike trains of the trial.

get_spiketrains_from_trial_as_segment(trial_id: int) Segment[source]

Get all spike trains from a specific trial and return a Segment.

Parameters:
trial_idint

Trial ID to get the spike trains from (starting at trial ID 0).

Returns:
neo.Segment: Segment containing all spike trains of the trial.
get_trial_as_segment(trial_id: int) Segment[source]

Get trial as segment.

Parameters:
trial_idint

Trial number to get (starting at trial ID 0).

Returns:
class:neo.Segment: a segment containing all spike trains and

analogsignal objects of the trial.

get_trials_as_block(trial_ids: List[int] = None) Block[source]

Get trials as block.

Parameters:
trial_idslist of int

Trial IDs to include in the Block (starting at trial ID 0). If None is specified, all trials are returned. Default: None

Returns:
class:neo.Block: a Block containing neo.Segment objects for

each of the selected trials, each containing all spike trains and analogsignal objects of the corresponding trial.

get_trials_as_list(trial_ids: List[int] = None) List[Segment][source]

Get trials as list of segments.

Parameters:
trial_idslist of int

Trial IDs to include in the list (starting at trial ID 0). If None is specified, all trials are returned. Default: None

Returns:
list of neo.Segment: a list containing neo.Segment

objects for each of the selected trials, each containing all spike trains and analogsignal objects of the corresponding trial.

property n_analogsignals_trial_by_trial: List[int]

Get the number of analogsignal objects in each trial as a list.

Returns:
list of int: For each trial, contains the number of analogsignal objects

in the trial.

property n_spiketrains_trial_by_trial: List[int]

Get the number of spike trains in each trial as a list.

Returns:
list of int: For each trial, contains the number of spike trains in the

trial.

property n_trials: int

Get the number of trials.

Returns:
int: Number of trials