Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_mda_extractor(self):
path1 = self.test_dir + '/mda'
path2 = path1 + '/firings_true.mda'
se.MdaRecordingExtractor.write_recording(self.RX, path1)
se.MdaSortingExtractor.write_sorting(self.SX, path2)
RX_mda = se.MdaRecordingExtractor(path1)
SX_mda = se.MdaSortingExtractor(path2)
self._check_recording_return_types(RX_mda)
self._check_recordings_equal(self.RX, RX_mda)
self._check_sorting_return_types(SX_mda)
self._check_sortings_equal(self.SX, SX_mda)
def real(name='franklab_tetrode', download=True):
if name == 'franklab_tetrode':
dsdir = 'kbucket://b5ecdf1474c5/datasets/neuron_paper/franklab_tetrode'
IX = se.MdaRecordingExtractor(dir_path=dsdir)
return (IX, None)
else:
raise Exception('Unrecognized name for real dataset: ' + name)
def _setup_recording(self, recording, output_folder):
from mountainlab_pytools import mdaio
p = self.params
if not check_if_installed(IronclustSorter.ironclust_path):
raise ImportError(IronclustSorter.installation_mesg)
dataset_dir = (output_folder / 'ironclust_dataset').absolute()
if not dataset_dir.is_dir():
dataset_dir.mkdir()
# Generate three files in the dataset directory: raw.mda, geom.csv, params.json
se.MdaRecordingExtractor.write_recording(recording=recording, save_path=dataset_dir)
samplerate = recording.get_sampling_frequency()
if self.debug:
print('Reading timeseries header...')
HH = mdaio.readmda_header(str(dataset_dir / 'raw.mda'))
num_channels = HH.dims[0]
num_timepoints = HH.dims[1]
duration_minutes = num_timepoints / samplerate / 60
if self.debug:
print('Num. channels = {}, Num. timepoints = {}, duration = {} minutes'.format(num_channels, num_timepoints,
duration_minutes))
if self.debug:
print('Creating .params file...')
txt = ''
txt += 'samplerate={}\n'.format(samplerate)