raw_data_ivm = ephys.load_raw_data(raw_data_filename, numchannels=num_ivm_channels, dtype=amp_dtype).dataMatrix data_cube_filename = join(base_dir, data_cube_dir, 'baselined_data_cube.npy') autocor_bin_number = 100 cluster_info_filename = join(base_dir, tsne_dir, 'cluster_info.pkl') prb_file = r'D:\Data\George\Projects\SpikeSorting\Joana_Paired_128ch\2015-09-03\Analysis\klustakwik\128ch_passive_imec.prb' tsne_cluster.gui_manual_cluster_tsne_spikes(tsne_array_or_filename=tsne_filename, spike_times_list_or_filename=kwik_filename, time_samples_h5_dir=time_samples_h5_dir, raw_extracellular_data=None, num_of_points_for_baseline=num_of_points_for_baseline, cut_extracellular_data_or_filename=data_cube_filename, shape_of_cut_extracellular_data=shape_of_cut_extracellular_data, cube_type=cube_type, sampling_freq=sampling_freq, autocor_bin_number=autocor_bin_number, cluster_info_file=cluster_info_filename, use_existing_cluster=True, spike_indices_to_use=spike_indices_to_use, prb_file=prb_file, k4=True, verbose=True) # Make video from interim data label_path = r'D:\Data\George\Projects\SpikeSorting\Joana_Paired_128ch\2015-09-03\Analysis\klustakwik\threshold_6_5std\cluster_info.pkl' pkl_file = open(label_path, 'rb') labels = pickle.load(pkl_file) pkl_file.close()
spike_indices_to_use = None num_of_spikes = len(spikes_used) shape_of_cut_extracellular_data = (num_ivm_channels, num_of_points_in_spike_trig, num_of_spikes) raw_data_filename = os.path.join(base_dir, data_dir, 'amplifier2015-09-03T21_18_47.bin') raw_data_ivm = ephys.load_raw_data(raw_data_filename, numchannels=num_ivm_channels, dtype=amp_dtype).dataMatrix tsne_cluster.gui_manual_cluster_tsne_spikes(tsne_array_or_filename=template_features_tsne, spike_times_list_or_filename=np.reshape(spike_times_kilosort, (len(spike_times_kilosort))), raw_extracellular_data=None, num_of_points_for_baseline=num_of_points_for_baseline, cut_extracellular_data_or_filename=data_cube_filename, shape_of_cut_extracellular_data=shape_of_cut_extracellular_data, cube_type=cube_type, sampling_freq=sampling_freq, autocor_bin_number=autocor_bin_number, cluster_info_file=cluster_info_filename, use_existing_cluster=True, spike_indices_to_use=spike_indices_to_use, prb_file=prb_file, k4=True, verbose=True) # ====================================================================================================================== # Test code to sort out the SHIFT bug in Bokeh from bokeh.client import push_session from bokeh.layouts import column
if spike_indices_to_use is not None: num_of_spikes = len(spike_indices_to_use) shape_of_cut_extracellular_data = (num_ivm_channels, num_of_points_in_spike_trig, num_of_spikes) raw_data_filename = os.path.join(base_dir, data_dir, 'amplifier2015-09-03T21_18_47.bin') raw_data_ivm = ephys.load_raw_data(raw_data_filename, numchannels=num_ivm_channels, dtype=amp_dtype).dataMatrix tsne_cluster.gui_manual_cluster_tsne_spikes(tsne_array_or_filename=np.transpose(template_features_tsne)[:, indices_of_common_spikes_in_kilosort.tolist()], spike_times_list_or_filename=common_spikes, raw_extracellular_data=raw_data_ivm, num_of_points_for_baseline=num_of_points_for_baseline, cut_extracellular_data_or_filename=data_cube_filename, shape_of_cut_extracellular_data=shape_of_cut_extracellular_data, cube_type=cube_type, sampling_freq=sampling_freq, autocor_bin_number=autocor_bin_number, cluster_info_file=cluster_info_filename, use_existing_cluster=False, spike_indices_to_use=spike_indices_to_use, prb_file=prb_file, k4=True, verbose=True) # manual clustering all of the kilosort template_feature_tsne data cluster_info_filename = os.path.join(kilosort_path, 'tsne\\cluster_info_full.pkl') spike_indices_to_use = None num_of_spikes = np.shape(template_features_tsne)[0] shape_of_cut_extracellular_data = (num_ivm_channels, num_of_points_in_spike_trig, num_of_spikes)