Skip to content

Commit

Permalink
patch for new event structure
Browse files Browse the repository at this point in the history
  • Loading branch information
zm711 authored Sep 21, 2023
1 parent b37b949 commit 1bf3c76
Showing 1 changed file with 7 additions and 36 deletions.
43 changes: 7 additions & 36 deletions src/spikeanalysis/spike_plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,48 +682,19 @@ def _get_event_lengths_all(self) -> dict:
stim_lengths: dict
dictionary of stimulus lengths on a per event basis"""
stim_lengths = {}
try:
stim_dict = self.data._get_key_for_stim()

for key, value in stim_dict.items():
stim_lengths[key] = np.array(self.data.digital_events[value]["lengths"]) / self.data._sampling_rate

self.HAVE_DIGITAL = True
except AttributeError:
self.HAVE_DIGITAL = False

try:
for key in self.data.dig_analog_events.keys():
stim_lengths[self.data.dig_analog_events[key]["stim"]] = (
np.array(self.data.dig_analog_events[key]["lengths"]) / self.data._sampling_rate
)

self.HAVE_ANALOG = True
except AttributeError:
self.HAVE_ANALOG = False
stim_dict = self.data._get_key_for_stim()

for key, value in stim_dict.items():
stim_lengths[key] = np.array(self.data.events[value]["lengths"]) / self.data._sampling_rate

return stim_lengths

def _get_trial_groups(self) -> dict:
stim_trial_groups = {}
try:
stim_dict = self.data._get_key_for_stim()

for key, value in stim_dict.items():
stim_trial_groups[key] = np.array(self.data.digital_events[value]["trial_groups"])
self.HAVE_DIGITAL = True
except AttributeError:
self.HAVE_DIGITAL = False
stim_dict = self.data._get_key_for_stim()

try:
for key in self.data.dig_analog_events.keys():
stim_trial_groups[self.data.dig_analog_events[key]["stim"]] = np.array(
self.data.dig_analog_events[key]["trial_groups"]
)

self.HAVE_ANALOG = True
except AttributeError:
self.HAVE_ANALOG = False
for key, value in stim_dict.items():
stim_trial_groups[key] = np.array(self.data.events[value]["trial_groups"])

return stim_trial_groups

Expand Down

0 comments on commit 1bf3c76

Please sign in to comment.