featuremapper/__init__.py
def _initialize_featureresponses(self, p):
        """
        Create an empty DistributionMatrix for each feature and each
        measurement source, in addition to activity buffers and if
        requested, the full matrix.
        """
        self._apply_cmd_overrides(p)
        self.metadata = AttrDict(p.metadata)
        for fn in p.metadata_fns:
            self.metadata.update(fn(p.inputs, p.outputs))

        # Features are split depending on whether a preference_fn is supplied
        # to collapse them
        self.outer = [f for f in self.features if not has_preference_fn(f)]
        self.inner = [f for f in self.features if has_preference_fn(f)]
        self.outer_names, self.outer_vals = [(), ()] if not len(self.outer)\
            else zip(*[(f.name.lower(), f.values) for f in self.outer])
        dimensions = [features.Duration] + list(self.outer)

        self.measurement_product = [mp for mp in product(self.metadata.outputs.keys(), p.durations, *self.outer_vals)]

        ndmapping_fn = lambda: NdMapping(kdims=dimensions)
        self._featureresponses = defaultdict(ndmapping_fn)
        self._activities = defaultdict(ndmapping_fn)
        if p.store_responses:
            response_dimensions = [features.Time]+dimensions+list(self.inner)
            response_map_fn = lambda: HoloMap(kdims=response_dimensions)
            self._responses = defaultdict(response_map_fn)

        for label in self.measurement_product:
            out_label = label[0]
            output_metadata = self.metadata.outputs[out_label]
            f_vals = label[1:]

            self._activities[out_label][f_vals] = np.zeros(output_metadata['shape'])

            self._featureresponses[out_label][f_vals] = {}
            for f in self.inner:
                self._featureresponses[out_label][f_vals][f.name.lower()] = \
                    DistributionMatrix(output_metadata['shape'], axis_range=f.range, cyclic=f.cyclic)

        Create an empty DistributionMatrix for each feature and each
        measurement source, in addition to activity buffers and if
        requested, the full matrix.
        
Create an empty DistributionMatrix for each feature and each
measurement source, in addition to activity buffers and if
requested, the full matrix.
Create an empty DistributionMatrix for each feature and each measurement source in addition to activity buffers and if requested the full matrix .
def _initialize_featureresponses(self, p):
        self._apply_cmd_overrides(p)
        self.metadata = AttrDict(p.metadata)
        for fn in p.metadata_fns:
            self.metadata.update(fn(p.inputs, p.outputs))
        self.outer = [f for f in self.features if not has_preference_fn(f)]
        self.inner = [f for f in self.features if has_preference_fn(f)]
        self.outer_names, self.outer_vals = [(), ()] if not len(self.outer)\
            else zip(*[(f.name.lower(), f.values) for f in self.outer])
        dimensions = [features.Duration] + list(self.outer)
        self.measurement_product = [mp for mp in product(self.metadata.outputs.keys(), p.durations, *self.outer_vals)]
        ndmapping_fn = lambda: NdMapping(kdims=dimensions)
        self._featureresponses = defaultdict(ndmapping_fn)
        self._activities = defaultdict(ndmapping_fn)
        if p.store_responses:
            response_dimensions = [features.Time]+dimensions+list(self.inner)
            response_map_fn = lambda: HoloMap(kdims=response_dimensions)
            self._responses = defaultdict(response_map_fn)
        for label in self.measurement_product:
            out_label = label[0]
            output_metadata = self.metadata.outputs[out_label]
            f_vals = label[1:]
            self._activities[out_label][f_vals] = np.zeros(output_metadata['shape'])
            self._featureresponses[out_label][f_vals] = {}
            for f in self.inner:
                self._featureresponses[out_label][f_vals][f.name.lower()] = \
                    DistributionMatrix(output_metadata['shape'], axis_range=f.range, cyclic=f.cyclic)
def _initialize_featureresponses ( self , p ) : self . _apply_cmd_overrides ( p ) self . metadata = AttrDict ( p . metadata ) for fn in p . metadata_fns : self . metadata . update ( fn ( p . inputs , p . outputs ) ) self . outer = [ f for f in self . features if not has_preference_fn ( f ) ] self . inner = [ f for f in self . features if has_preference_fn ( f ) ] self . outer_names , self . outer_vals = [ ( ) , ( ) ] if not len ( self . outer ) else zip ( * [ ( f . name . lower ( ) , f . values ) for f in self . outer ] ) dimensions = [ features . Duration ] + list ( self . outer ) self . measurement_product = [ mp for mp in product ( self . metadata . outputs . keys ( ) , p . durations , * self . outer_vals ) ] ndmapping_fn = lambda : NdMapping ( kdims = dimensions ) self . _featureresponses = defaultdict ( ndmapping_fn ) self . _activities = defaultdict ( ndmapping_fn ) if p . store_responses : response_dimensions = [ features . Time ] + dimensions + list ( self . inner ) response_map_fn = lambda : HoloMap ( kdims = response_dimensions ) self . _responses = defaultdict ( response_map_fn ) for label in self . measurement_product : out_label = label [ 0 ] output_metadata = self . metadata . outputs [ out_label ] f_vals = label [ 1 : ] self . _activities [ out_label ] [ f_vals ] = np . zeros ( output_metadata [ 'shape' ] ) self . _featureresponses [ out_label ] [ f_vals ] = { } for f in self . inner : self . _featureresponses [ out_label ] [ f_vals ] [ f . name . lower ( ) ] = DistributionMatrix ( output_metadata [ 'shape' ] , axis_range = f . range , cyclic = f . cyclic )
Create an empty DistributionMatrix for each feature and each
measurement source, in addition to activity buffers and if
requested, the full matrix.
Create an empty DistributionMatrix for each feature and each measurement source in addition to activity buffers and if requested the full matrix .
"""
        Create an empty DistributionMatrix for each feature and each
        measurement source, in addition to activity buffers and if
        requested, the full matrix.
        """ # Features are split depending on whether a preference_fn is supplied # to collapse them
self
p