def get(self, session=None, group=None, unit=None, **kwargs): """Returns spike times for specified session * unit Extra keywords override object defaults (eg group_multiplier, fs, memoization...) Current behavior is to always load and save memoized versions for best speed. This might change ... """ # Where the files are dirname = self.session_d[session] # Update the usual calling kwargs with any additional ones call_kwargs = self.kk_kwargs.copy() call_kwargs.update(kwargs) # Do the loading spikes = from_KK(dirname, **call_kwargs) # Make this panda pick #sub = spikes[spikes.unit == unit] sub = utility.panda_pick_data(spikes, group=group, unit=unit) return sub
def pick_trial_times(trials_info, outcome='hit', nonrandom=0, isnotnull='time', **kwargs): """Returns trial times satisfying condition This convenience method provides common defaults for me """ return np.asarray(utility.panda_pick_data(trials_info, outcome=outcome, nonrandom=nonrandom, isnotnull=isnotnull, **kwargs).time)
def pick_trials(trials_info, outcome='hit', nonrandom=0, isnotnull='time', **kwargs): """Returns trial rows satisfying condition This convenience method provides common defaults for me """ return utility.panda_pick_data(trials_info, outcome=outcome, nonrandom=nonrandom, isnotnull=isnotnull, **kwargs)
def pick(self, event_name, trials_l): """Return df[df.event==event_name] for df in trials_l If there is no such event, a warning is printed and the trial is skipped. If there is more than one event, a warning is taken and the first such event is taken. """ res = [] w, w2 = False, False for trial in trials_l: val = utility.panda_pick_data(trial, event=event_name).time if len(val) > 1: w2 = True res.append(val.values[0]) elif len(val) == 0: w = True else: res.append(val.item()) if w: print "warning: some events did not occur" if w2: print "warning: multiple events detected on some trials" return res