def normalize(field: SampledField, norm: SampledField, epsilon=1e-5): """ Multiplies the values of `field` so that its sum matches the source. """ data = math.normalize_to(field.values, norm.values, epsilon) return field.with_values(data)
def normalized(self, total, epsilon=1e-5): if isinstance(total, CenteredGrid): total = total.data normalize_data = math.normalize_to(self.data, total, epsilon) return self.with_data(normalize_data)
def normalize(field: SampledField, norm: SampledField, epsilon=1e-5): data = math.normalize_to(field.values, norm.values, epsilon) return field.with_(values=data)