def apply_function(self): '''Cf. `PiStage` docs.''' # TODO: do we need following line? Isn't this handled universally # by the base class (in PiStage's apply)? self.data.data_specs = self.output_specs # reset weights to initial weights prior to downstream stages running for container in self.data: vectorizer.assign(container['initial_weights'], out=container['weights'])
def setup_function(self): """Setup the stage""" # set the correct data mode self.data.data_specs = self.calc_specs for container in self.data: container['calculated_pid'] = np.empty((container.size), dtype=FTYPE) container['original_pid'] = np.empty((container.size), dtype=FTYPE) vectorizer.assign(vals=container['pid'], out=container['original_pid'])
def compute_function(self): for container in self.data: vectorizer.assign(vals=container["weights"], out=container["manual_variance"]) vectorizer.scale( vals=container["manual_variance"], scale=self.variance_scale, out=container["manual_variance"], ) if self.divide_n: vectorizer.scale( vals=container["manual_variance"], scale=self.expected_total_mc / self.total_mc[container.name], out=container["manual_variance"], ) if self.variance_floor is not None: apply_floor(self.variance_floor, out=container["manual_variance"])
def apply_function(self): for container in self.data: # set the pid value to the calculated one vectorizer.assign(vals=container['calculated_pid'], out=container['pid'])
def compute_function(self): for container in self.data: vectorizer.assign(vals=container["errors"], out=container["frozen_errors"]) container['frozen_errors'].mark_changed(WHERE)
def apply_function(self): for container in self.data: vectorizer.assign(vals=container['frozen_errors'], out=container['errors']) container['errors'].mark_changed(WHERE)
def apply_function(self): # reset weights for container in self.data: vectorizer.assign(container['initial_weights'], out=container['weights'])