# Path: brew/constants.py
# GAL_PER_LITER = 1.0 / LITER_PER_GAL
# 
# Path: brew/constants.py
# IMPERIAL_UNITS = u"imperial"
# 
# Path: brew/constants.py
# POUND_PER_KG = 1.0 / KG_PER_POUND
# 
# Path: brew/constants.py
# SI_UNITS = u"metric"
# 
# Path: brew/exceptions.py
# class ColorException(BrewdayException):
#     pass
# 
# Path: brew/validators.py
# def validate_units(units):
#     """
#     Validate units
# 
#     :param str units: Unit type
#     :return: units
#     :rtype: str
#     :raises ValidatorException: If units is unknown
#     """
#     if units in [IMPERIAL_UNITS, SI_UNITS]:
#         return units
#     raise ValidatorException(
#         u"Unkown units '{}', must use {} or {}".format(units, IMPERIAL_UNITS, SI_UNITS)
#     )


from ..constants import GAL_PER_LITER
from ..constants import IMPERIAL_UNITS
from ..constants import POUND_PER_KG
from ..constants import SI_UNITS
from ..exceptions import ColorException
from ..validators import validate_units
    :param float mcu: The Malt Color Units
    :return: SRM Color
    :rtype: float
    :raises ColorException: If the MCU is > 50.0

    Assumptions:

    1. SRM is approximately equal to MCU for values from 0 to 10.
    2. Homebrew is generally darker than commercial beer.
    3. Base on the previous qualitative postulate, I assumed that Ray Daniels'
       predicted relationship exists for beers with color greater than 10.
    4. Since Mosher's equation predicts darker color than Daniels' model for
       values of MCU greater than 37, I assumed that Mosher's approximation
       governed beer color for all values more than 37 MCUs.
    5. Difference in color for beers greater than 40 SRM are essentially
       impossible to detect visually; therefore, I limited the analysis to SRM
       of 50 and less.

    Source:

    * http://babblehomebrewers.com/attachments/article/61/beercolor.pdf
    """
    srm = 0
    if 0 < mcu < 10:
        srm = mcu
    elif 10 <= mcu < 37:
        srm = calculate_srm_daniels(mcu)
    elif 37 <= mcu < 50:
        srm = calculate_srm_mosher(mcu)
    else:

# Path: brew/constants.py
# GAL_PER_LITER = 1.0 / LITER_PER_GAL
# 
# Path: brew/constants.py
# IMPERIAL_UNITS = u"imperial"
# 
# Path: brew/constants.py
# POUND_PER_KG = 1.0 / KG_PER_POUND
# 
# Path: brew/constants.py
# SI_UNITS = u"metric"
# 
# Path: brew/exceptions.py
# class ColorException(BrewdayException):
#     pass
# 
# Path: brew/validators.py
# def validate_units(units):
#     """
#     Validate units
# 
#     :param str units: Unit type
#     :return: units
#     :rtype: str
#     :raises ValidatorException: If units is unknown
#     """
#     if units in [IMPERIAL_UNITS, SI_UNITS]:
#         return units
#     raise ValidatorException(
#         u"Unkown units '{}', must use {} or {}".format(units, IMPERIAL_UNITS, SI_UNITS)
#     )


# Path: brew/utilities/color.py
from ..constants import GAL_PER_LITER
from ..constants import IMPERIAL_UNITS
from ..constants import POUND_PER_KG
from ..constants import SI_UNITS
from ..exceptions import ColorException
from ..validators import validate_units

    :param float mcu: The Malt Color Units
    :return: SRM Color
    :rtype: float
    :raises ColorException: If the MCU is > 50.0

    Assumptions:

    1. SRM is approximately equal to MCU for values from 0 to 10.
    2. Homebrew is generally darker than commercial beer.
    3. Base on the previous qualitative postulate, I assumed that Ray Daniels'
       predicted relationship exists for beers with color greater than 10.
    4. Since Mosher's equation predicts darker color than Daniels' model for
       values of MCU greater than 37, I assumed that Mosher's approximation
       governed beer color for all values more than 37 MCUs.
    5. Difference in color for beers greater than 40 SRM are essentially
       impossible to detect visually; therefore, I limited the analysis to SRM
       of 50 and less.

    Source:

    * http://babblehomebrewers.com/attachments/article/61/beercolor.pdf
    """
    srm = 0
    if 0 < mcu < 10:
        srm = mcu
    elif 10 <= mcu < 37:
        srm = calculate_srm_daniels(mcu)
    elif 37 <= mcu < 50:
        srm = calculate_srm_mosher(mcu)
    else:

        raise ColorException(u"Morey Hybrid does not work above MCU 50.0")