Skip to content

Commit

Permalink
* use absolute value for distances
Browse files Browse the repository at this point in the history
* use normalization function for weights
  • Loading branch information
mogres committed Jul 18, 2023
1 parent 88d5a7d commit ee4f64b
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions cellpack/autopack/Gradient.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ def build_directional_weight_map(self, bb, master_grid_positions):
direction = self.normalize_vector(direction)
self.weight = []
center = self.mode_settings.get("center", self.get_center())
self.distances = numpy.dot(master_grid_positions - center, direction)
self.distances = numpy.abs(numpy.dot(master_grid_positions - center, direction))
self.set_weights_by_mode()

def build_axis_weight_map(self, bb, master_grid_positions):
Expand Down Expand Up @@ -232,9 +232,7 @@ def set_weights_by_mode(self):
-self.scaled_distances / self.weight_mode_settings["decay_length"]
)
# normalize the weight
self.weight = (self.weight - numpy.min(self.weight)) / (
numpy.max(self.weight) - numpy.min(self.weight)
)
self.weight = self.get_normalized_values(self.weight)

self.weight[numpy.isnan(self.weight)] = 0

Expand Down

0 comments on commit ee4f64b

Please sign in to comment.