def pixel_to_ray(y, x, axis_length, axis_order="columns"):
    """Given a pixel we want to associate it to a ray index.

    Arguments:
    ---------
        y: int
           The pixel value along the y-axis (namely the height)
        x: int
           The pixel value along the x-axis (namely the width)
        axis_length: int
                     The length of the major axis
        axis_order: string
                    String that indicates whether the produced index will be
                    used to access a row- or a column-major array

    Return:
    -------
        ray_index: int
                   The index of the ray
    """
    if axis_order is "columns":
        return x*axis_length + y
    elif axis_order is "rows":
        return y*axis_length + x
    else:
        raise ValueError("axis_order argument can be either columns or rows")