bids.variables.SparseRunVariable¶
-
class
SparseRunVariable
(name, data, run_info, source, **kwargs)[source]¶ A sparse representation of a single column of events.
- Parameters
name (str) – Name of the column.
data (
pandas.DataFrame
) – A pandas DataFrame minimally containing the columns ‘onset’, ‘duration’, and ‘amplitude’.run_info (list) – A list of RunInfo objects carrying information about all runs represented in the Variable.
source (str) – The type of BIDS variable file the data were extracted from. Must be one of: ‘events’, ‘physio’, ‘stim’, ‘regressors’, ‘scans’, ‘sessions’, ‘participants’, or ‘beh’.
kwargs (dict) – Optional keyword arguments passed onto superclass.
Methods
apply
(self, func[, groupby])Applies the passed function to the groups defined by the groupby argument.
clone
(self[, data])Clone (deep copy) the current column, optionally replacing its data and/or any other attributes.
filter
(self[, filters, query, strict, inplace])Returns a copy of the current Variable with only rows that match the filters retained.
get_duration
(self)Return the total duration of the Variable’s run(s).
get_grouper
(self[, groupby])Return a list suitable for use in groupby calls.
matches_entities
(self, entities[, strict])Checks whether current Variable’s entities match the input.
merge
(variables[, name])Merge/concatenate a list of variables along the row axis.
select_rows
(self, rows)Truncate internal arrays to keep only the specified rows.
split
(self, grouper)Split the current SparseRunVariable into multiple columns.
to_dense
(self[, sampling_rate])Convert the current sparse column to a dense representation.
to_df
(self[, condition, entities])Convert to a DataFrame, with columns for name and entities.
-
__init__
(self, name, data, run_info, source, \*\*kwargs)[source]¶ Initialize self. See help(type(self)) for accurate signature.
Methods
__init__
(self, name, data, run_info, source, …)Initialize self.
apply
(self, func[, groupby])Applies the passed function to the groups defined by the groupby argument.
clone
(self[, data])Clone (deep copy) the current column, optionally replacing its data and/or any other attributes.
filter
(self[, filters, query, strict, inplace])Returns a copy of the current Variable with only rows that match the filters retained.
get_duration
(self)Return the total duration of the Variable’s run(s).
get_grouper
(self[, groupby])Return a list suitable for use in groupby calls.
matches_entities
(self, entities[, strict])Checks whether current Variable’s entities match the input.
merge
(variables[, name])Merge/concatenate a list of variables along the row axis.
select_rows
(self, rows)Truncate internal arrays to keep only the specified rows.
split
(self, grouper)Split the current SparseRunVariable into multiple columns.
to_dense
(self[, sampling_rate])Convert the current sparse column to a dense representation.
to_df
(self[, condition, entities])Convert to a DataFrame, with columns for name and entities.