############################################################################### # Now let's check what we have loaded: print('Channel ids:', recording_tetrodes.get_channel_ids()) print('Loaded properties', recording_tetrodes.get_shared_channel_property_names()) print( 'Label of channel 0:', recording_tetrodes.get_channel_property(channel_id=0, property_name='label')) ############################################################################### # and let's plot the probe layout: import spikeinterface.widgets as sw w_el_tetrode = sw.plot_electrode_geometry(recording_tetrodes) ################################################################################## # Alternatively, one can use a '.csv' file to load the electrode locations. Let's create a '.csv' file # with 2D locations in a circular layout: delta_deg = 2 * np.pi / recording.get_num_channels() with open('circular_layout.csv', 'w') as f: for i in range(recording.get_num_channels()): angle = i * delta_deg radius = 50 x = radius * np.cos(angle) y = radius * np.sin(angle) f.write(str(x) + ',' + str(y) + '\n') #######################################################################################
for i in range(n_spike_frames): frame_buff = np.array([]) # for j in range(n_units): frame_buff = np.append(frame_buff, (trains_buff[j])[pointers[j]]) min_id = np.argmin(frame_buff) # print(min_id) spike_labels_GT = np.append(spike_labels_GT, min_id) spike_times_GT = np.append(spike_times_GT, frame_buff[min_id]) pointers[min_id] += 1 info_dict['spike_labels_GT'] = spike_labels_GT.astype(np.int) info_dict['spike_times_GT'] = spike_times_GT.astype(np.int) return info_dict, recording_f if __name__ == "__main__": # recgen = mr.load_recordings(globvar.h5data_path) # mr.plot_recordings(recgen) # mr.plot_templates(recgen) # mr.plot_waveforms(recgen) # mr.plot_amplitudes(recgen) recording, sorting = load_data(globvar.h5data_path) info_dict, recording_f = preprocessing(recording, sorting) # sw.plot_unit_waveforms(recording_f, sorting, max_spikes_per_unit=10000000,ms_before=globvar.snippet_ms_before, ms_after=globvar.snippet_ms_after) channel_loc = recording_f.get_channel_locations() print(f'channel location:{channel_loc}') sw.plot_electrode_geometry(recording_f) plt.show() print(recording)
import numpy as np import spikeinterface.extractors as se import spikeinterface.widgets as sw import matplotlib.pyplot as plt recording, sorting_true = se.example_datasets.toy_example(duration=10, num_channels=256, seed=0) recording_OrgMEA = recording.load_probe_file(probe_file='OrgMEA_252.prb') print('Channel ids:', recording_OrgMEA.get_channel_ids()) print('Loaded properties', recording_OrgMEA.get_shared_channel_property_names()) print( 'Label of channel 60:', recording_OrgMEA.get_channel_property(channel_id=60, property_name='label')) w_el_OrgMEA = sw.plot_electrode_geometry(recording_OrgMEA) plt.show()
############################################################################## # First, let's create a toy example with the `extractors` module: recording, sorting = se.example_datasets.toy_example(duration=10, num_channels=4, seed=0) ############################################################################## # plot_timeseries() # ~~~~~~~~~~~~~~~~~ w_ts = sw.plot_timeseries(recording) w_ts1 = sw.plot_timeseries(recording, trange=[5, 8]) recording.set_channel_groups(channel_ids=recording.get_channel_ids(), groups=[0, 0, 1, 1]) w_ts2 = sw.plot_timeseries(recording, trange=[5, 8], color_groups=True) ############################################################################## # **Note**: each function returns a widget object, which allows to access the figure and axis. w_ts.figure.suptitle("Recording by group") w_ts.ax.set_ylabel("Channel_ids") ############################################################################## # plot_electrode_geometry() # ~~~~~~~~~~~~~~~~~~~~~~~~~ w_el = sw.plot_electrode_geometry(recording)