Skip to content

Commit

Permalink
Int replaced by floor to accept negative coordinates.
Browse files Browse the repository at this point in the history
  • Loading branch information
ceciliaromaro authored Dec 2, 2024
1 parent d83a372 commit a89dff0
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions share/lib/python/neuron/rxd/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
_concentration_node = 0
_molecule_node = 1

_floor = numpy.floor

def _get_data():
return (_volumes, _surface_area, _diffs)
Expand Down Expand Up @@ -646,13 +647,13 @@ def satisfies(self, condition):
except:
pass # ignore the error and try Node3D specific conditions

if isinstance(condition, tuple) and len(condition) == 3:
if isinstance(condition, tuple) and len(condition) == 3: # Int replaced by floor to accept negative coordinates.
x, y, z = condition
mesh = self._r._mesh_grid
return (
int((x - mesh["xlo"]) / mesh["dx"]) == self._i
and int((y - mesh["ylo"]) / mesh["dy"]) == self._j
and int((z - mesh["zlo"]) / mesh["dz"]) == self._k
_floor((x - mesh["xlo"]) / mesh["dx"]) == self._i
and _floor((y - mesh["ylo"]) / mesh["dy"]) == self._j
and _floor((z - mesh["zlo"]) / mesh["dz"]) == self._k
)
# check for a position condition so as to provide a more useful error
checked_for_normalized_position = False
Expand Down Expand Up @@ -881,12 +882,12 @@ def satisfies(self, condition):
except:
pass # ignore the error and try NodeExtracellular specific conditions

if isinstance(condition, tuple) and len(condition) == 3:
if isinstance(condition, tuple) and len(condition) == 3: # Int replaced by floor to accept negative coordinates.
x, y, z = condition
r = self._regionref()
return (
int((x - r._xlo) / r._dx[0]) == self._i
and int((y - r._ylo) / r._dx[1]) == self._j
and int((z - r._zlo) / r._dx[2]) == self._k
_floor((x - r._xlo) / r._dx[0]) == self._i
and _floor((y - r._ylo) / r._dx[1]) == self._j
and _floor((z - r._zlo) / r._dx[2]) == self._k
)
raise RxDException(f"unrecognized node condition: {condition}")

0 comments on commit a89dff0

Please sign in to comment.