import scipy import cPickle from circusort.io.utils import generate_fake_probe from circusort.obj import TemplateStore host = '127.0.0.1' # to run the test locally director = circusort.create_director(host=host) manager = director.create_manager(host=host) manager2 = director.create_manager(host=host) nb_channels = 10 sampling_rate = 20000 two_components = True nb_clustering = 2 probe_file = generate_fake_probe(nb_channels, radius=5) noise = manager.create_block('fake_spike_generator', nb_channels=nb_channels) filter = manager.create_block('filter') whitening = manager.create_block('whitening') mad_estimator = manager.create_block('mad_estimator') peak_detector = manager.create_block('peak_detector', threshold=6) pca = manager.create_block('pca', nb_waveforms=5000) clusters = [] for i in xrange(nb_clustering): clusters += [ manager2.create_block('density_clustering', probe=probe_file, nb_waveforms=500,
data_path = '/tmp/output.dat' peak_path = '/tmp/peaks.dat' thres_path = '/tmp/thresholds.dat' temp_path = '/tmp/templates' director = circusort.create_director(host=master) manager = {} for computer in slaves + [master]: manager[computer] = director.create_manager(host=computer) sampling_rate = 20000 two_components = True nb_channels = 4 probe_file = generate_fake_probe(nb_channels, radius=2, prb_file='test.prb') generator = manager[master].create_block('fake_spike_generator', nb_channels=nb_channels) filter = manager[master].create_block('filter', cut_off=100) whitening = manager[master].create_block('whitening') mad_estimator = manager[master].create_block('mad_estimator') peak_detector = manager[master].create_block('peak_detector', threshold=5) pca = manager[master].create_block('pca', nb_waveforms=500) cluster_1 = manager[slaves[0]].create_block('density_clustering', probe=probe_file, nb_waveforms=100, two_components=two_components, channels=range(0, nb_channels, 2)) cluster_2 = manager[slaves[1]].create_block('density_clustering',
# Test to measure the computational efficiency of two operations in one block # associated to one manager. import circusort import logging from circusort.io.utils import generate_fake_probe host = '127.0.0.1' # to run the test locally director = circusort.create_director(host=host) manager = director.create_manager(host=host) manager2 = director.create_manager(host=host) nb_channels = 10 probe_file = generate_fake_probe(nb_channels) noise = manager.create_block('fake_spike_generator', nb_channels=nb_channels) filter = manager.create_block('filter') whitening = manager.create_block('whitening') mad_estimator = manager.create_block('mad_estimator') peak_detector = manager.create_block('peak_detector', threshold=6, sign_peaks='both') pca = manager.create_block('pca', nb_waveforms=5000) cluster = manager2.create_block('density_clustering', probe=probe_file, nb_waveforms=1000, two_components=False, log_level=logging.DEBUG) director.initialize() director.connect(noise.output, filter.input) director.connect(filter.output, whitening.input) director.connect(whitening.output, [mad_estimator.input, peak_detector.get_input('data'), pca.get_input('data'), cluster.get_input('data')]) director.connect(mad_estimator.output, [peak_detector.get_input('mads'), cluster.get_input('mads')]) director.connect(peak_detector.get_output('peaks'), [pca.get_input('peaks'), cluster.get_input('peaks')])