How to use the phylib.io.model.load_raw_data function in phylib

To help you get started, we’ve selected a few phylib 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 rossant / pykilosort / pykilosort / gui.py View on Github external
def load_data(self):
        # TODO: use EphysTraces
        dat_path = self.dat_path
        if dat_path.suffix == '.cbin':
            data = load_raw_data(path=dat_path)
            sample_rate = data.sample_rate
            n_channels_dat = data.shape[1]
        else:
            sample_rate = float(self.sample_rate)
            assert sample_rate > 0.

            n_channels_dat = int(self.n_channels_dat)

            dtype = np.dtype(self.dtype)
            offset = int(self.offset or 0)
            order = getattr(self, 'order', None)

            # Memmap the raw data file.
            data = load_raw_data(
                path=dat_path,
                n_channels_dat=n_channels_dat,
github cortex-lab / phy / phy / apps / trace / gui.py View on Github external
if dat_path.suffix == '.cbin':  # pragma: no cover
        data = load_raw_data(path=dat_path)
        sample_rate = data.sample_rate
        n_channels_dat = data.shape[1]
    else:
        sample_rate = float(kwargs['sample_rate'])
        assert sample_rate > 0.

        n_channels_dat = int(kwargs['n_channels_dat'])

        dtype = np.dtype(kwargs['dtype'])
        offset = int(kwargs['offset'] or 0)
        order = kwargs.get('order', None)

        # Memmap the raw data file.
        data = load_raw_data(
            path=dat_path,
            n_channels_dat=n_channels_dat,
            dtype=dtype,
            offset=offset,
            order=order,
        )

    duration = data.shape[0] / sample_rate

    create_app()
    gui = GUI(name=gui_name, subtitle=dat_path.resolve(), enable_threading=False)

    gui.set_default_actions()

    def _get_traces(interval):
        return Bunch(
github cortex-lab / phy / phy / apps / trace / gui.py View on Github external
dtype : str
        The NumPy data type of the raw binary file.

    """

    gui_name = 'TraceGUI'

    dat_path = Path(dat_path)

    # Support passing a params.py file.
    if dat_path.suffix == '.py':
        params = get_template_params(str(dat_path))
        return create_trace_gui(next(iter(params.pop('dat_path'))), **params)

    if dat_path.suffix == '.cbin':  # pragma: no cover
        data = load_raw_data(path=dat_path)
        sample_rate = data.sample_rate
        n_channels_dat = data.shape[1]
    else:
        sample_rate = float(kwargs['sample_rate'])
        assert sample_rate > 0.

        n_channels_dat = int(kwargs['n_channels_dat'])

        dtype = np.dtype(kwargs['dtype'])
        offset = int(kwargs['offset'] or 0)
        order = kwargs.get('order', None)

        # Memmap the raw data file.
        data = load_raw_data(
            path=dat_path,
            n_channels_dat=n_channels_dat,
github rossant / pykilosort / pykilosort / gui.py View on Github external
if dat_path.suffix == '.cbin':
            data = load_raw_data(path=dat_path)
            sample_rate = data.sample_rate
            n_channels_dat = data.shape[1]
        else:
            sample_rate = float(self.sample_rate)
            assert sample_rate > 0.

            n_channels_dat = int(self.n_channels_dat)

            dtype = np.dtype(self.dtype)
            offset = int(self.offset or 0)
            order = getattr(self, 'order', None)

            # Memmap the raw data file.
            data = load_raw_data(
                path=dat_path,
                n_channels_dat=n_channels_dat,
                dtype=dtype,
                offset=offset,
                order=order,
            )

        # Parameters for the creation of params.py
        self.n_channels_dat = n_channels_dat
        self.offset = offset
        self.dtype = dtype

        self.data = data
        self.duration = self.data.shape[0] / sample_rate