How to use the nwbwidgets.utils.timeseries.get_timeseries_in_units 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 / behavior.py View on Github external
def show_spatial_series(node: SpatialSeries, **kwargs):

    data, unit = get_timeseries_in_units(node)
    tt = get_timeseries_tt(node)

    if len(data.shape) == 1:
        fig, ax = plt.subplots()
        ax.plot(tt, data, **kwargs)
        ax.set_xlabel('t (sec)')
        if unit:
            ax.set_xlabel('x ({})'.format(unit))
        else:
            ax.set_xlabel('x')
        ax.set_ylabel('x')

    elif data.shape[1] == 2:
        fig, ax = plt.subplots()
        ax.plot(data[:, 0], data[:, 1], **kwargs)
        if unit:
github NeurodataWithoutBorders / nwb-jupyter-widgets / nwbwidgets / behavior.py View on Github external
def show_spatial_series_over_time(node: SpatialSeries, **kwargs):

    text_widget = base.show_text_fields(
        node, exclude=('timestamps_unit', 'comments', 'data', 'timestamps', 'interval'))

    data, unit = get_timeseries_in_units(node)

    if len(data.shape) == 1:
        ndims = 1
    else:
        ndims = data.shape[1]

    tt = get_timeseries_tt(node)

    if ndims == 1:
        fig, ax = plt.subplots()
        ax.plot(tt, data, **kwargs)
        ax.set_xlabel('t (sec)')
        if unit:
            ax.set_ylabel('x ({})'.format(unit))
        else:
            ax.set_ylabel('x')
github NeurodataWithoutBorders / nwb-jupyter-widgets / nwbwidgets / timeseries.py View on Github external
def show_timeseries_mpl(node: TimeSeries, neurodata_vis_spec=None, istart=0, istop=None, ax=None, zero_start=False,
                        xlabel=None, ylabel=None, title=None, **kwargs):
    if xlabel is None:
        xlabel = 'time (s)'

    if ylabel is None and node.unit:
        ylabel = node.unit

    if ax is None:
        fig, ax = plt.subplots()

    tt = get_timeseries_tt(node, istart=istart, istop=istop)
    if zero_start:
        tt = tt - tt[0]
    data, unit = get_timeseries_in_units(node, istart=istart, istop=istop)

    ax.plot(tt, data, **kwargs)
    ax.set_xlabel(xlabel)
    if node.unit:
        ax.set_ylabel(ylabel)
    if title is not None:
        ax.set_title(title)

    ax.autoscale(enable=True, axis='x', tight=True)

    return ax