def trim_whitespace(self, matrix, details, min_gap):
        if details == 1:
            row = matrix[0, ]
        else:
            row = matrix[matrix.shape[0] - 1, ]

        min_left = np.argmax(row)
        min_right = np.argmax(row[::-1])

        if min_left > min_gap:
            matrix = matrix[:, min_left - min_gap:]

        if min_right > min_gap:
            matrix = matrix[:, 0:len(row) - (min_right - min_gap)]

        return matrix
Trims unwanted white space from either of the obstacle
dataset/ETHPy150Open dandxy89/rf_helicopter/Model/Generate_obstacles.py/Obstacle_Tracks.trim_whitespace