pytrax/__RandomWalk__.py
def check_edge(self, walkers, axis, move, real):
        r'''
        Check to see if next move passes out of the domain
        If so, zero walker move and update the real velocity direction.
        Walker has remained stationary in the small image but tranisioned
        between real and reflected domains.
        Parameters
        ----------
        walkers: ndarray of int and shape [nw, dim]
            the current coordinates of the walkers
        move: ndarray of int and shape [nw, dim]
            the vector of the next move to be made by the walker
        inds: array of int and shape [nw]
            the index of the wall map corresponding to the move vector
        '''
        next_move = walkers + move
        move_real = move.copy()
        # Divide walkers into two groups, those moving postive and negative
        # Check lower edge
        axis = axis.flatten()
        w_id = np.arange(len(walkers))
        shift = np.zeros_like(axis)
        # Check lower edge
        l_hit = next_move[w_id, axis] < 0
        shift[l_hit] = -1
        # Check upper edge
        u_hit = next_move[w_id, axis] >= self.shape[axis]
        shift[u_hit] = 1
        # Combine again and update arrays
        hit = np.logical_or(l_hit, u_hit)

        if np.any(hit):
            ax = axis[hit]
            real[hit, ax] *= -1
            # walker in the original image stays stationary
            move[hit, ax] = 0
            # walker in the real image passes through an interface between
            # original and flipped along the axis of travel
            # the transition step is reversed as it the reality of travel
            # both cancel to make the real walker follow the initial move
            move_real[hit, ax] *= -1

        return move, move_real, real
r'''
        Check to see if next move passes out of the domain
        If so, zero walker move and update the real velocity direction.
        Walker has remained stationary in the small image but tranisioned
        between real and reflected domains.
        Parameters
        ----------
        walkers: ndarray of int and shape [nw, dim]
            the current coordinates of the walkers
        move: ndarray of int and shape [nw, dim]
            the vector of the next move to be made by the walker
        inds: array of int and shape [nw]
            the index of the wall map corresponding to the move vector
        
r'''
Check to see if next move passes out of the domain
If so, zero walker move and update the real velocity direction.
Walker has remained stationary in the small image but tranisioned
between real and reflected domains.
Parameters

ndarray of int and shape [nw, dim]
the current coordinates of the walkers
move: ndarray of int and shape [nw, dim]
the vector of the next move to be made by the walker
inds: array of int and shape [nw]
the index of the wall map corresponding to the move vector
r ' ' ' Check to see if next move passes out of the domain If so zero walker move and update the real velocity direction . Walker has remained stationary in the small image but tranisioned between real and reflected domains . Parameters ndarray of int and shape [ nw dim ] the current coordinates of the walkers move : ndarray of int and shape [ nw dim ] the vector of the next move to be made by the walker inds : array of int and shape [ nw ] the index of the wall map corresponding to the move vector
def check_edge(self, walkers, axis, move, real):
        next_move = walkers + move
        move_real = move.copy()
        axis = axis.flatten()
        w_id = np.arange(len(walkers))
        shift = np.zeros_like(axis)
        l_hit = next_move[w_id, axis] < 0
        shift[l_hit] = -1
        u_hit = next_move[w_id, axis] >= self.shape[axis]
        shift[u_hit] = 1
        hit = np.logical_or(l_hit, u_hit)
        if np.any(hit):
            ax = axis[hit]
            real[hit, ax] *= -1
            move[hit, ax] = 0
            move_real[hit, ax] *= -1
        return move, move_real, real
def check_edge ( self , walkers , axis , move , real ) : next_move = walkers + move move_real = move . copy ( ) axis = axis . flatten ( ) w_id = np . arange ( len ( walkers ) ) shift = np . zeros_like ( axis ) l_hit = next_move [ w_id , axis ] < 0 shift [ l_hit ] = - 1 u_hit = next_move [ w_id , axis ] >= self . shape [ axis ] shift [ u_hit ] = 1 hit = np . logical_or ( l_hit , u_hit ) if np . any ( hit ) : ax = axis [ hit ] real [ hit , ax ] *= - 1 move [ hit , ax ] = 0 move_real [ hit , ax ] *= - 1 return move , move_real , real
r'''
Check to see if next move passes out of the domain
If so, zero walker move and update the real velocity direction.
r ' ' ' Check to see if next move passes out of the domain If so zero walker move and update the real velocity direction .
r'''
        Check to see if next move passes out of the domain
        If so, zero walker move and update the real velocity direction.
        Walker has remained stationary in the small image but tranisioned
        between real and reflected domains.
        Parameters
        ----------
        walkers: ndarray of int and shape [nw, dim]
            the current coordinates of the walkers
        move: ndarray of int and shape [nw, dim]
            the vector of the next move to be made by the walker
        inds: array of int and shape [nw]
            the index of the wall map corresponding to the move vector
        ''' # Divide walkers into two groups, those moving postive and negative # Check lower edge # Check lower edge # Check upper edge # Combine again and update arrays # walker in the original image stays stationary # walker in the real image passes through an interface between # original and flipped along the axis of travel # the transition step is reversed as it the reality of travel # both cancel to make the real walker follow the initial move
self
walkers
axis
move
real