Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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,
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(
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,
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