Ejemplo n.º 1
0
def pick_trial_numbers(trials_info, outcome='hit', nonrandom=0, 
    isnotnull=None, **kwargs):
    """Returns trial numbers satisfying condition
    
    This convenience method provides common defaults for me
    isnotnull : asserts that the provided column is not Null
    """
    return utility.panda_pick(trials_info, outcome=outcome, 
        nonrandom=nonrandom, isnotnull=isnotnull, **kwargs)
Ejemplo n.º 2
0
def pick_trial_numbers(trials_info,
                       outcome='hit',
                       nonrandom=0,
                       isnotnull=None,
                       **kwargs):
    """Returns trial numbers satisfying condition
    
    This convenience method provides common defaults for me
    isnotnull : asserts that the provided column is not Null
    """
    return utility.panda_pick(trials_info,
                              outcome=outcome,
                              nonrandom=nonrandom,
                              isnotnull=isnotnull,
                              **kwargs)
Ejemplo n.º 3
0
 def pick(self, trials_info, labels=None, label_kwargs=None, 
     **all_kwargs):
     """Returns list of trial numbers satisfying list of constraints.
     
     trials_info : DataFrame containing information about each trial,
         indexed by trial_number
     labels : list of length N, labeling each set of constraints
     label_kwargs : list of length N, consisting of kwargs to pass to
         panda_pick on trials_info (the constraints)
     all_kwargs : added to each label_kwarg
     
     Returns: list of length N
     Each entry is a tuple (label, val) where label is the constraint
     label and val is the picked trial numbers satisfying that constraint.
     
     Example
     labels = ['LB', 'PB']
     label_kwargs = [{'block':2}, {'block':4}]
     all_kwargs = {'outcome':'hit'}
     The return value would be:
     [('LB', list_of_LB_trials), ('PB', list_of_PB_trials)]
     """
     if labels is None:
         labels = self.labels
     if label_kwargs is None:
         label_kwargs = self.label_kwargs
     
     assert len(labels) == len(label_kwargs)
     
     res = []
     for label, kwargs in zip(labels, label_kwargs):
         kk = kwargs.copy()
         kk.update(all_kwargs)
         val = utility.panda_pick(trials_info, **kk)
         res.append((label, val))
     
     return res
Ejemplo n.º 4
0
    def pick(self, trials_info, labels=None, label_kwargs=None, **all_kwargs):
        """Returns list of trial numbers satisfying list of constraints.
        
        trials_info : DataFrame containing information about each trial,
            indexed by trial_number
        labels : list of length N, labeling each set of constraints
        label_kwargs : list of length N, consisting of kwargs to pass to
            panda_pick on trials_info (the constraints)
        all_kwargs : added to each label_kwarg
        
        Returns: list of length N
        Each entry is a tuple (label, val) where label is the constraint
        label and val is the picked trial numbers satisfying that constraint.
        
        Example
        labels = ['LB', 'PB']
        label_kwargs = [{'block':2}, {'block':4}]
        all_kwargs = {'outcome':'hit'}
        The return value would be:
        [('LB', list_of_LB_trials), ('PB', list_of_PB_trials)]
        """
        if labels is None:
            labels = self.labels
        if label_kwargs is None:
            label_kwargs = self.label_kwargs

        assert len(labels) == len(label_kwargs)

        res = []
        for label, kwargs in zip(labels, label_kwargs):
            kk = kwargs.copy()
            kk.update(all_kwargs)
            val = utility.panda_pick(trials_info, **kk)
            res.append((label, val))

        return res