def step_up(self, new_cable_activities):
        # Condition the cable activities to fall between 0 and 1
        if new_cable_activities.size < self.max_cables:
            new_cable_activities = tools.pad(new_cable_activities, 
                                             (self.max_cables, 1))
        # Update cable_activities
        self.raw_cable_activities *= 1. - (self.ACTIVITY_DECAY_RATE /
                                           float(self.step_multiplier))
        self.raw_cable_activities += new_cable_activities
        self.step_counter += 1
        if self.step_counter < self.step_multiplier:
            return self.bundle_activities
        self.min_vals = np.minimum(self.raw_cable_activities, self.min_vals)
        self.max_vals = np.maximum(self.raw_cable_activities, self.max_vals)
        spread = self.max_vals - self.min_vals
        self.cable_activities = ((self.raw_cable_activities - self.min_vals) / 
                   (self.max_vals - self.min_vals + tools.EPSILON))
        self.min_vals += spread * self.RANGE_DECAY_RATE
        self.max_vals -= spread * self.RANGE_DECAY_RATE
        cluster_training_activities = np.maximum(
                self.previous_cable_activities, self.cable_activities)
        self.previous_cable_activities = self.cable_activities.copy() 
        # Update the map from self.cable_activities to cogs
        self.ziptie.step_up(cluster_training_activities)
        # Process the upward pass of each of the cogs in the gearbox
        self.bundle_activities = np.zeros((0, 1))
        for cog_index in range(len(self.cogs)):
            # Pick out the cog's cable_activities, process them, 
            # and assign the results to gearbox's bundle_activities
            cog_cable_activities = self.cable_activities[
                    self.ziptie.get_index_projection(
                    cog_index).astype(bool)]
            # Cogs are only allowed to start forming bundles once 
            # the number of cables exceeds the fill_fraction_threshold
            enough_cables = (self.ziptie.cable_fraction_in_bundle(cog_index)
                             > self.fill_fraction_threshold)
            cog_bundle_activities = self.cogs[cog_index].step_up(
                    cog_cable_activities, enough_cables)
            self.bundle_activities = np.concatenate((self.bundle_activities, 
                                                     cog_bundle_activities))
        # Goal fulfillment and decay
        self.hub_cable_goals -= self.cable_activities
        self.hub_cable_goals *= self.ACTIVITY_DECAY_RATE
        self.hub_cable_goals = np.maximum(self.hub_cable_goals, 0.)
        return self.bundle_activities
git archive command
dataset/ETHPy150Open matt2000/becca/core/gearbox.py/Gearbox.step_up--crossover with--dataset/ETHPy150Open douban/ellen/ellen/git/archive.py/archive_repository