Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def phy_model_from_ks2_path(ks2_path):
meta_file = next(ks2_path.rglob('*.ap.meta'), None)
if meta_file and meta_file.exists():
meta = spikeglx.read_meta_data(meta_file)
fs = spikeglx._get_fs_from_meta(meta)
nch = (spikeglx._get_nchannels_from_meta(meta) -
len(spikeglx._get_sync_trace_indices_from_meta(meta)))
else:
fs = 30000
nch = 384
bin_file = next(ks2_path.rglob('*.ap.*bin'), None)
m = model.TemplateModel(dir_path=ks2_path,
dat_path=bin_file, # this assumes the raw data is in the same folder
sample_rate=fs,
n_channels_dat=nch)
m.depths = m.get_depths()
return m
def _create_model(self, dir_path=None, **kwargs):
return TemplateModel(dir_path=dir_path, **kwargs)