How to use the nwbwidgets.utils.dynamictable.infer_categorical_columns function in nwbwidgets

To help you get started, we’ve selected a few nwbwidgets examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NeurodataWithoutBorders / nwb-jupyter-widgets / nwbwidgets / ophys.py View on Github external
def plane_segmentation_2d_widget(plane_seg: PlaneSegmentation, **kwargs):

    categorical_columns = infer_categorical_columns(plane_seg)

    if len(categorical_columns) == 1:
        color_by = list(categorical_columns.keys())[0]
        return show_plane_segmentation_2d(plane_seg, color_by=color_by, **kwargs)

    elif len(categorical_columns) > 1:
        cat_controller = widgets.Dropdown(options=list(categorical_columns), description='color by')

        out_fig = show_plane_segmentation_2d(plane_seg, color_by=cat_controller.value, **kwargs)

        def on_change(change, out_fig=out_fig):
            if change['new'] and isinstance(change['new'], dict):
                ind = change['new']['index']
                if isinstance(ind, int):
                    color_by = change['owner'].options[ind]
                    show_plane_segmentation_2d(plane_seg, color_by=color_by, fig=out_fig, **kwargs)
github NeurodataWithoutBorders / nwb-jupyter-widgets / nwbwidgets / controllers.py View on Github external
def get_groups(self):
        return infer_categorical_columns(self.dynamic_table)
github NeurodataWithoutBorders / nwb-jupyter-widgets / nwbwidgets / misc.py View on Github external
def get_groups(self):
        return infer_categorical_columns(self.trials)