Skip to content

Commit

Permalink
Merge pull request #57 from SpikeInterface/small_doc_fix
Browse files Browse the repository at this point in the history
Fix bug in plot_2_sorting_extractor.py
  • Loading branch information
alejoe91 committed Feb 28, 2020
2 parents a79149d + b96d2a9 commit 0ccf637
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions examples/modules/extractors/plot_2_sorting_extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,12 @@
# property and store it in the :code:`SortingExtractor`

full_spike_train = sorting2.get_unit_spike_train(unit_id=1)
firing_rate = float(len(full_spike_train)) / sorting2.get_sampling_frequency()
firing_rate = float(len(full_spike_train)) / duration
sorting2.set_unit_property(unit_id=1, property_name='firing_rate', value=firing_rate)
print('Average firing rate during the recording of unit 1 = {}'.format(sorting2.get_unit_property(unit_id=1,
property_name='firing_rate')))
print("Spike property names: " + str(sorting2.get_shared_unit_property_names()))
property_name=
'firing_rate')))
print("Spike property names: " + str(sorting2.get_unit_property_names(unit_id=1)))

##############################################################################
# :code:`SubSortingExtractor` objects can be used to extract arbitrary subsets of your units/spike trains manually
Expand All @@ -77,7 +78,7 @@
start_frame=10000, end_frame=20000)
print('Num. units = {}'.format(len(sorting3.get_unit_ids())))
print('Average firing rate of units1 during frames 10000-20000 = {}'.format(
float(len(sorting3.get_unit_spike_train(unit_id=1))) / 6000))
float(len(sorting3.get_unit_spike_train(unit_id=1))) / (10000 / sorting3.get_sampling_frequency())))

##############################################################################
# Unit features are name value pairs that we can store for each spike. Let's load a randomly generated 'random_value'
Expand All @@ -86,4 +87,4 @@
random_values = np.random.randn(len(sorting3.get_unit_spike_train(unit_id=1)))
sorting3.set_unit_spike_features(unit_id=1, feature_name='random_value',
value=random_values)
print("Spike feature names: " + str(sorting3.get_shared_unit_spike_feature_names()))
print("Spike feature names: " + str(sorting3.get_unit_spike_feature_names(unit_id=1)))

0 comments on commit 0ccf637

Please sign in to comment.