Skip to content
This repository has been archived by the owner on Nov 22, 2019. It is now read-only.

Commit

Permalink
Add simple gamma function
Browse files Browse the repository at this point in the history
  • Loading branch information
mfe committed Jan 22, 2014
1 parent e3d6dfd commit a415de5
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions utils/colors_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
.. moduleauthor:: `Marie FETIVEAU <github.com/mfe>`_
"""
import math


def xy_to_XYZ(xy, Y=1):
Expand All @@ -22,3 +23,33 @@ def xy_to_XYZ(xy, Y=1):
X = (x*Y)/y
Z = ((1-x-y)*Y)/y
return [X, Y, Z]


def lin_to_gamma(self, value, gamma):
"""Simple lin to Gamma function
Args:
value (float): input value
gamma (float): gamma value
Returns:
.float
"""
return math.pow(value, 1/gamma)


def gamma_to_lin(self, value, gamma):
"""Simple gamma to lin function
Args:
value (float): input value
gamma (float): gamma value
Returns:
.float
"""
return math.pow(value, gamma)

0 comments on commit a415de5

Please sign in to comment.