Negative Directional Movement (-DM).


    -DM: if DWNMOVE > UPMOVE and DWNMOVE > 0 then -DM = DWNMOVE else -Dm = 0
482222
def negative_directional_movement(high_data, low_data):
    
    catch_errors.check_for_input_len_diff(high_data, low_data)
    up_moves = calculate_up_moves(high_data)
    down_moves = calculate_down_moves(low_data)

    ndm = []
    for idx in range(0, len(down_moves)):
        if down_moves[idx] > up_moves[idx] and down_moves[idx] > 0:
            ndm.append(down_moves[idx])
        else:
            ndm.append(0)

    return ndm
246785
function(currentDirection){
            var directions = ['up', 'right', 'down', 'left'],
                currentDirIndex = directions.indexOf(currentDirection),
                newDirIndex;
            // if currentDirection is not valid or is the last in the array use the first direction in the array
            if(currentDirIndex === -1 || currentDirIndex === directions.length - 1){
                newDirIndex = 0;
            } else {
                newDirIndex = currentDirIndex + 1;
            }
            return directions[newDirIndex];
        }
248379
function(direction){
            var directionCoords = {
                up:     {x: 0, y:-1},
                right:  {x: 1, y: 0},
                down:   {x: 0, y: 1},
                left:   {x:-1, y: 0}
            };
            return directionCoords[direction];
        }
618110
void robotTeleport(int nx, int ny)
    {
        oldX = nx;
        oldY = ny;
        x = nx;
        y = ny;
        wx = nx;
        wy = ny;
        mx = 0;
        my = 0;
        moved = false;
    }
762350
def true_negatives(y, y_pred):
    

    y, y_pred = convert_assert(y, y_pred)
    assert_binary_problem(y)

    return np.count_nonzero(y_pred[y == 0] == 0)
18109
function negate(v, dst) {
  dst = dst || new VecType(3);

  dst[0] = -v[0];
  dst[1] = -v[1];
  dst[2] = -v[2];

  return dst;
}
762038
function verifyAbsoluteDirection(direction) {
  if (!ABSOLUTE_DIRECTIONS.includes(direction)) {
    throw new Error(
      `Unknown direction: '${direction}'. Should be one of: '${NORTH}', '${EAST}', '${SOUTH}' or '${WEST}'.`,
    );
  }
}
53094
function isVertical(direction) {
      return (direction == ionic.Gestures.DIRECTION_UP || direction == ionic.Gestures.DIRECTION_DOWN);
    }
1353397
def staticMovingAverage2(x, N=3, mode='reflect'):
    
    assert N > 1
    x2 = np.empty(shape=x.shape[0] + N, dtype=x.dtype)

    start = N - 2
    if N == 2:
        start = 1
    end = N - start

    x2[start:-end] = x
    # boundaries
    if mode == 'reflect':
        x2[:start] = x[0] + x[0] - x[start - 1::-1]
        x2[-end:] = x[-1] + x[-1] - x[-2:-end - 2:-1]
    elif mode == 'nearest':
        x2[:start] = x[0]
        x2[-end:] = x[-1]
    else:
        raise NotImplementedError("mode='%s' not supported" % mode)
    a1 = np.cumsum(x2)
    a1 = (a1[N:] - a1[:-N]) / N

    a2 = np.cumsum(x2[::-1])
    a2 = (a2[N:] - a2[:-N]) / N

    return 0.5 * (a1 + a2[::-1])
    # TODO: unreachable code
    cumsum = np.cumsum(x2)
    return (cumsum[N:] - cumsum[:-N]) / N
428913
function(action) {
            // if the action is a direction
            if(RL.Util.DIRECTIONS_4.indexOf(action) !== -1){
                var offsetCoord = RL.Util.getOffsetCoordsFromDirection(action),
                    moveToX = this.x + offsetCoord.x,
                    moveToY = this.y + offsetCoord.y;
                return this.move(moveToX, moveToY);
            }

            if(action === 'wait'){
                this.wait();
                return true;
            }

            return false;
        }
459201
function(left, right) {
                const leftIndex = entryPoints.indexOf(left.names[0]);
                const rightIndex = entryPoints.indexOf(right.names[0]);
                let direction = 0;

                if (leftIndex > rightIndex) {
                    direction = 1;
                } else if (leftIndex < rightIndex) {
                    direction = -1;
                }

                return direction;
            }
1210385
def get_direction(self, direction, rev=False):
        
        if (direction < 90.0) or (direction >= 270.0):
            if not rev:
                return 'up'
            else:
                return 'down'
        elif (90.0 <= direction < 270.0):
            if not rev:
                return 'down'
            else:
                return 'up'
        else:
            return 'none'
995296
public static MotionDirection getVerticalMotionDirection(float delta, float threshold) {
        if (threshold < 0) {
            throw new IllegalArgumentException("threshold should be positive or zero.");
        }
        return delta < -threshold ? MotionDirection.DOWN : delta > threshold ? MotionDirection.UP : MotionDirection.FIX;
    }
77800
def isDirect(self):
        """"""
        direct = (self._messageType == 0x00)
        if self.isDirectACK or self.isDirectNAK:
            direct = True
        return direct
843790
def shift(self, direction):
        
        try:
            if direction == Direction.UP:
                return self.shift_up()
            elif direction == Direction.DOWN:
                return self.shift_down()
            elif direction == Direction.RIGHT:
                return self.shift_right()
            elif direction == Direction.LEFT:
                return self.shift_left()
            else:
                raise IndexError("Invalid direction {}".format(direction))
        except IndexError as e:
            raise IndexError(e)
995110
public static MotionDirection getHorizontalMotionDirection(float delta, float threshold) {
        if (threshold < 0) {
            throw new IllegalArgumentException("threshold should be positive or zero.");
        }
        return delta < -threshold ? MotionDirection.LEFT : delta > threshold ? MotionDirection.RIGHT : MotionDirection.FIX;
    }
922246
function calcDirection(start, end) {
  var direction = new Vec2(end);
  direction.subtract(start);
  direction.normalize();
  return direction;
}