'Update current trajectory position in mask.
If the new position has already been filled, raise `InvalidIndexError`.'

def _update_trajectory(self, xm, ym):

    if (self._current_xy != (xm, ym)):
        if (self[(ym, xm)] == 0):
            self._traj.append((ym, xm))
            self._mask[(ym, xm)] = 1
            self._current_xy = (xm, ym)
        else:
            raise InvalidIndexError
