def shaper_func_linear_to_log2(x, mid_gray=0.18, min_exposure=(- 6.5), max_exposure=6.5):
    '\n    ACESutil.Lin_to_Log2_param.ctl を参考に作成。\n    https://github.com/ampas/aces-dev/blob/master/transforms/ctl/utilities/ACESutil.Lin_to_Log2_param.ctl\n\n    Parameters\n    ----------\n    x : array_like\n        linear data.\n    mid_gray : float\n        18% gray value on linear scale.\n    min_exposure : float\n        minimum value on log scale.\n    max_exposure : float\n        maximum value on log scale.\n\n    Returns\n    -------\n    array_like\n        log2 value that is transformed from linear x value.\n\n    Examples\n    --------\n    >>> shaper_func_linear_to_log2(\n    ...     x=0.18, mid_gray=0.18, min_exposure=-6.5, max_exposure=6.5)\n    0.5\n    >>> shaper_func_linear_to_log2(\n    ...     x=np.array([0.00198873782209, 16.2917402385])\n    ...     mid_gray=0.18, min_exposure=-6.5, max_exposure=6.5)\n    array([  1.58232402e-13   1.00000000e+00])\n    '
    y = np.log2((x / mid_gray))
    y_normalized = ((y - min_exposure) / (max_exposure - min_exposure))
    y_normalized[(y_normalized < 0)] = 0
    return y_normalized
ACESutil.Lin_to_Log2_param.ctl を参考に作成。
https://github.com/ampas/aces-dev/blob/master/transforms/ctl/utilities/ACESutil.Lin_to_Log2_param.ctl

Parameters
----------
x : array_like
    linear data.
mid_gray : float
    18% gray value on linear scale.
min_exposure : float
    minimum value on log scale.
max_exposure : float
    maximum value on log scale.

Returns
-------
array_like
    log2 value that is transformed from linear x value.

Examples
--------
>>> shaper_func_linear_to_log2(
...     x=0.18, mid_gray=0.18, min_exposure=-6.5, max_exposure=6.5)
0.5
>>> shaper_func_linear_to_log2(
...     x=np.array([0.00198873782209, 16.2917402385])
...     mid_gray=0.18, min_exposure=-6.5, max_exposure=6.5)
array([  1.58232402e-13   1.00000000e+00])
def shaper_func_linear_to_log2(x, mid_gray=0.18, min_exposure=(- 6.5), max_exposure=6.5):
    '\n    ACESutil.Lin_to_Log2_param.ctl を参考に作成。\n    https://github.com/ampas/aces-dev/blob/master/transforms/ctl/utilities/ACESutil.Lin_to_Log2_param.ctl\n\n    Parameters\n    ----------\n    x : array_like\n        linear data.\n    mid_gray : float\n        18% gray value on linear scale.\n    min_exposure : float\n        minimum value on log scale.\n    max_exposure : float\n        maximum value on log scale.\n\n    Returns\n    -------\n    array_like\n        log2 value that is transformed from linear x value.\n\n    Examples\n    --------\n    >>> shaper_func_linear_to_log2(\n    ...     x=0.18, mid_gray=0.18, min_exposure=-6.5, max_exposure=6.5)\n    0.5\n    >>> shaper_func_linear_to_log2(\n    ...     x=np.array([0.00198873782209, 16.2917402385])\n    ...     mid_gray=0.18, min_exposure=-6.5, max_exposure=6.5)\n    array([  1.58232402e-13   1.00000000e+00])\n    '
    y = np.log2((x / mid_gray))
    y_normalized = ((y - min_exposure) / (max_exposure - min_exposure))
    y_normalized[(y_normalized < 0)] = 0
    return y_normalized