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(func[, groupby])

Applies the passed function to the groups defined by the groupby argument.

clone([data])

Clone (deep copy) the current column, optionally replacing its data and/or any other attributes.

filter([filters, query, strict, inplace])

Returns a copy of the current Variable with only rows that match the filters retained.

get_duration()

Return the total duration of the Variable's run(s).

get_grouper([groupby])

Return a list suitable for use in groupby calls.

merge(variables[, name])

Merge/concatenate a list of variables along the row axis.

select_rows(rows)

Truncate internal arrays to keep only the specified rows.

split(grouper)

Split the current SparseRunVariable into multiple columns.

to_dense([sampling_rate])

Convert the current sparse column to a dense representation.

to_df([condition, entities])

Convert to a DataFrame, with columns for name and entities.

__init__(name, data, run_info, source, **kwargs)[source]

Methods

__init__(name, data, run_info, source, **kwargs)

apply(func[, groupby])

Applies the passed function to the groups defined by the groupby argument.

clone([data])

Clone (deep copy) the current column, optionally replacing its data and/or any other attributes.

filter([filters, query, strict, inplace])

Returns a copy of the current Variable with only rows that match the filters retained.

get_duration()

Return the total duration of the Variable's run(s).

get_grouper([groupby])

Return a list suitable for use in groupby calls.

merge(variables[, name])

Merge/concatenate a list of variables along the row axis.

select_rows(rows)

Truncate internal arrays to keep only the specified rows.

split(grouper)

Split the current SparseRunVariable into multiple columns.

to_dense([sampling_rate])

Convert the current sparse column to a dense representation.

to_df([condition, entities])

Convert to a DataFrame, with columns for name and entities.