adc_channel_used = 0
adc_dtype = np.uint16
inter_spike_time_distance = 0.01
amp_gain = 100
num_ivm_channels = 32
amp_dtype = np.uint16



# 1) Generate the .dat file
filename_raw_data = join(data_folder,
                         'amplifier{}T{}.bin'.format(dates[rat], all_cell_capture_times[rat][cell]))
raw_data = ioep.load_raw_data(filename=filename_raw_data, numchannels=num_ivm_channels, dtype=amp_dtype)
filename_kl_data = join(analysis_folder, r'klustakwik_cell{}\raw_data_klusta.dat'.format(cell))
iokl.make_dat_file(raw_data=raw_data.dataMatrix, num_channels=num_ivm_channels, filename=filename_kl_data)



# Run t-sne
kwx_file_path = join(analysis_folder, 'klustakwik_cell{}'.format(cell),
                     r'threshold_6_5std/threshold_6_5std.kwx')
perplexity = 100
theta = 0.2
iterations = 2000
gpu_mem = 0.8
eta = 200
early_exaggeration = 4.0
indices_of_spikes_to_tsne = None#range(spikes_to_do)
seed = 100000
verbose = 2



# Single Cell comparison between Klusta and tsne
# 0) Create the required .dat file and the probe .prb file to throw into klustakwik (i.e. the phy module)
spikes_to_include = num_of_spikes
fin_time_point = spike_triggers[spikes_to_include] + 500
start_time_point = 0
time_limits = [start_time_point, fin_time_point]

raw_data_file_ivm = os.path.join(data_folder, 'amplifier'+date+'T'+cell_capture_times+'.bin')
raw_data_ivm = ephys.load_raw_data(raw_data_file_ivm, numchannels=num_ivm_channels, dtype=amp_dtype)
file_dat = os.path.join(analysis_folder, r'klustakwik\raw_data_ivm_klusta.dat')

klusta.make_dat_file(raw_data_ivm.dataMatrix, filename=file_dat, num_channels=num_ivm_channels, time_limits=time_limits)

file_prb = os.path.join(analysis_folder, r'klustakwik\128ch_passive_imec.prb')
electrode_structure = pr_imec.create_128channels_imec_prb(file_prb)



# 0.5) Grab the mask and the PCA components for all spikes from the .kwx file
filename = r'D:\Data\George\Projects\SpikeSorting\Joana_Paired_128ch\2015-09-03\Analysis\klustakwik\threshold_6_5std\threshold_6_5std.kwx'
h5file = h5.File(filename, mode='r')
pca_and_masks = np.array(list(h5file['channel_groups/0/features_masks']))
masks = np.array(pca_and_masks[:, :, 1])
pca_features = np.array(pca_and_masks[:, :, 0])
masked_pca_features = pca_features * masks

Exemplo n.º 3
0
inter_spike_time_distance = 0.01
amp_gain = 100
num_ivm_channels = 32
amp_dtype = np.uint16

# 1) Generate the .dat file
filename_raw_data = join(
    data_folder,
    'amplifier{}T{}.bin'.format(dates[rat], all_cell_capture_times[rat][cell]))
raw_data = ioep.load_raw_data(filename=filename_raw_data,
                              numchannels=num_ivm_channels,
                              dtype=amp_dtype)
filename_kl_data = join(analysis_folder,
                        r'klustakwik_cell{}\raw_data_klusta.dat'.format(cell))
iokl.make_dat_file(raw_data=raw_data.dataMatrix,
                   num_channels=num_ivm_channels,
                   filename=filename_kl_data)

# Run t-sne
kwx_file_path = join(analysis_folder, 'klustakwik_cell{}'.format(cell),
                     r'threshold_6_5std/threshold_6_5std.kwx')
perplexity = 100
theta = 0.2
iterations = 2000
gpu_mem = 0.8
eta = 200
early_exaggeration = 4.0
indices_of_spikes_to_tsne = None  #range(spikes_to_do)
seed = 100000
verbose = 2
tsne = tsne_spikes.t_sne_spikes(
Exemplo n.º 4
0



# Single Cell comparison between Klusta and tsne
# 0) Create the required .dat file and the probe .prb file to throw into klustakwik (i.e. the phy module)
spikes_to_include = num_of_spikes
fin_time_point = spike_triggers[spikes_to_include] + 500
start_time_point = 0
time_limits = [start_time_point, fin_time_point]

raw_data_file_ivm = os.path.join(data_folder, 'amplifier'+date+'T'+cell_capture_times+'.bin')
raw_data_ivm = ephys.load_raw_data(raw_data_file_ivm, numchannels=num_ivm_channels, dtype=amp_dtype)
file_dat = os.path.join(analysis_folder, r'klustakwik\raw_data_ivm_klusta.dat')

klusta.make_dat_file(raw_data_ivm.dataMatrix, filename=file_dat, num_channels=num_ivm_channels, time_limits=time_limits)

file_prb = os.path.join(analysis_folder, r'klustakwik\128ch_passive_imec.prb')
electrode_structure = pr_imec.create_128channels_imec_prb(file_prb)



# 0.5) Grab the mask and the PCA components for all spikes from the .kwx file
filename = os.path.join(analysis_folder, 'klustakwik', 'threshold_6_5std', r'threshold_6_5std.kwx')
h5file = h5.File(filename, mode='r')
pca_and_masks = np.array(list(h5file['channel_groups/0/features_masks']))
masks = np.array(pca_and_masks[:, :, 1])
pca_features = np.array(pca_and_masks[:, :, 0])
masked_pca_features = pca_features * masks