Skip to content

Commit

Permalink
[geom] Fix Graph.shifted/at
Browse files Browse the repository at this point in the history
  • Loading branch information
holl- committed Apr 17, 2024
1 parent 04e526d commit 92f06b8
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion phi/geom/_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,14 @@ def bounding_half_extent(self) -> Tensor:
return self._nodes.bounding_half_extent()

def at(self, center: Tensor) -> 'Geometry':
return Graph(self.nodes.at(center), self._edges, self._boundary)
raise NotImplementedError("Changing the node positions of a Graph is not supported as it would invalidate distances.")
# warnings.warn("Changing the node positions of a graph triggers re-evaluation of distances.", RuntimeWarning, stacklevel=2)
# return Graph(self.nodes.at(center), self._edges, self._boundary, bounding_distance=self._bounding_distance is not None)

def shifted(self, delta: Tensor) -> 'Geometry':
if non_batch(delta).non_channel.only(self._nodes.shape): # shift varies between
raise NotImplementedError("Shifting the node positions of a Graph is not supported as it would invalidate distances.")
return Graph(self.nodes.shifted(delta), self._edges, self._boundary, deltas=self._deltas, distances=self._distances, bounding_distance=self._bounding_distance is not None)

def rotated(self, angle: Union[float, Tensor]) -> 'Geometry':
raise NotImplementedError
Expand Down

0 comments on commit 92f06b8

Please sign in to comment.