allensdk.brain_observatory.behavior.data_objects.cell_specimens.rois_mixin module

class allensdk.brain_observatory.behavior.data_objects.cell_specimens.rois_mixin.RoisMixin[source]

Bases: object

A mixin for a collection of rois stored as a dataframe (._value is a dataframe)

filter_and_reorder(roi_ids: ndarray, raise_if_rois_missing=True)[source]

Orders dataframe according to input roi_ids. Will also filter dataframe to contain only rois given by roi_ids. Use for, ie excluding invalid rois

Parameters:
roi_ids

Filter/reorder _value to these roi_ids

raise_if_rois_missing

Whether to raise exception if there are rois in the input roi_ids not in the dataframe

Raises:
RuntimeError if raise_if_rois_missing and there are input roi_ids not
in dataframe

Notes

Will both filter and reorder dataframe to have same order as the input roi_ids.

If there are values in the input roi_ids that are not in the dataframe, then these roi ids will be ignored and a warning will be logged.