def default_data(block=None, n_chidx=1, n_units=1): # generate new block if none provided, otherwise attach to provided block if block is None: block = Block() for id in range(n_chidx): sorting_hash = elephant.spike_sorting.SpikeSorter.get_sorting_hash({ 'channel_index': id, 'random annotation': np.random.randint(0, 10**10) }) chidx = ChannelIndex([], sorting_hash=sorting_hash) chidx.block = block block.channel_indexes.append(chidx) for chidx in block.channel_indexes: for id in range(n_units): unit = Unit(unit_id=id) chidx.units.append(unit) unit.channel_index = chidx for st_id in range(id): st = SpikeTrain(np.random.uniform(0, st_id, 1) * pq.s, t_start=0 * pq.s, t_stop=st_id * pq.s, spiketrain_id=st_id) unit.spiketrains.append(st) st.unit = unit block.create_relationship() return block