featuremapper/__init__.py
def _present_permutation(self, p, permutation, permutation_num):
        """Present a pattern with the specified set of feature values."""
        output_names = self.metadata['outputs'].keys()
        for label in self.measurement_product:
            out_label = label[0]
            f_vals = label[1:]
            self._activities[out_label][f_vals] *= 0

        # Calculate complete set of settings
        permuted_settings = list(zip(self.feature_names, permutation))
        complete_settings = permuted_settings +\
                            [(f.name, f.compute_fn(permuted_settings))
                             for f in self.features_to_compute]

        for i, op in enumerate(self.outer_permutations):
            for j in range(0, p.repetitions):
                permutation = dict(permuted_settings)
                permutation.update(list(zip(self.outer_names, op)))

                for f in p.pre_presentation_hooks:
                    try: 
                        f()
                    except:
                        f(permutation)

                presentation_num = p.repetitions*((self.n_outer*permutation_num)+i) + j

                inputs = self._coordinate_inputs(p, permutation)

                responses = p.pattern_response_fn(inputs, output_names,
                                                  presentation_num, self.total_steps,
                                                  durations=p.durations)

                for f in p.post_presentation_hooks: 
                    try: 
                        f()
                    except:
                        f(permutation, responses)

                for response_labels, response in responses.items():
                    name, duration = response_labels
                    self._activities[name][(duration,)+op] += response

            for response_labels in responses.keys():
                name, duration = response_labels
                self._activities[name][(duration,)+op] /= p.repetitions

        self._update(p, complete_settings)
Present a pattern with the specified set of feature values.
Present a pattern with the specified set of feature values.
Present a pattern with the specified set of feature values .
def _present_permutation(self, p, permutation, permutation_num):
        output_names = self.metadata['outputs'].keys()
        for label in self.measurement_product:
            out_label = label[0]
            f_vals = label[1:]
            self._activities[out_label][f_vals] *= 0
        permuted_settings = list(zip(self.feature_names, permutation))
        complete_settings = permuted_settings +\
                            [(f.name, f.compute_fn(permuted_settings))
                             for f in self.features_to_compute]
        for i, op in enumerate(self.outer_permutations):
            for j in range(0, p.repetitions):
                permutation = dict(permuted_settings)
                permutation.update(list(zip(self.outer_names, op)))
                for f in p.pre_presentation_hooks:
                    try: 
                        f()
                    except:
                        f(permutation)
                presentation_num = p.repetitions*((self.n_outer*permutation_num)+i) + j
                inputs = self._coordinate_inputs(p, permutation)
                responses = p.pattern_response_fn(inputs, output_names,
                                                  presentation_num, self.total_steps,
                                                  durations=p.durations)
                for f in p.post_presentation_hooks: 
                    try: 
                        f()
                    except:
                        f(permutation, responses)
                for response_labels, response in responses.items():
                    name, duration = response_labels
                    self._activities[name][(duration,)+op] += response
            for response_labels in responses.keys():
                name, duration = response_labels
                self._activities[name][(duration,)+op] /= p.repetitions
        self._update(p, complete_settings)
def _present_permutation ( self , p , permutation , permutation_num ) : output_names = self . metadata [ 'outputs' ] . keys ( ) for label in self . measurement_product : out_label = label [ 0 ] f_vals = label [ 1 : ] self . _activities [ out_label ] [ f_vals ] *= 0 permuted_settings = list ( zip ( self . feature_names , permutation ) ) complete_settings = permuted_settings + [ ( f . name , f . compute_fn ( permuted_settings ) ) for f in self . features_to_compute ] for i , op in enumerate ( self . outer_permutations ) : for j in range ( 0 , p . repetitions ) : permutation = dict ( permuted_settings ) permutation . update ( list ( zip ( self . outer_names , op ) ) ) for f in p . pre_presentation_hooks : try : f ( ) except : f ( permutation ) presentation_num = p . repetitions * ( ( self . n_outer * permutation_num ) + i ) + j inputs = self . _coordinate_inputs ( p , permutation ) responses = p . pattern_response_fn ( inputs , output_names , presentation_num , self . total_steps , durations = p . durations ) for f in p . post_presentation_hooks : try : f ( ) except : f ( permutation , responses ) for response_labels , response in responses . items ( ) : name , duration = response_labels self . _activities [ name ] [ ( duration , ) + op ] += response for response_labels in responses . keys ( ) : name , duration = response_labels self . _activities [ name ] [ ( duration , ) + op ] /= p . repetitions self . _update ( p , complete_settings )
Present a pattern with the specified set of feature values.
Present a pattern with the specified set of feature values .
"""Present a pattern with the specified set of feature values.""" # Calculate complete set of settings
self
p
permutation
permutation_num