Add docstrings skeletons.
authorThomas Mansencal <thomas.mansencal@gmail.com>
Thu, 15 Jan 2015 20:00:26 +0000 (21:00 +0100)
committerThomas Mansencal <thomas.mansencal@gmail.com>
Thu, 15 Jan 2015 20:00:26 +0000 (21:00 +0100)
aces_1.0.0/python/aces_ocio/createARRIColorSpaces.py
aces_1.0.0/python/aces_ocio/createCanonColorSpaces.py
aces_1.0.0/python/aces_ocio/createREDColorSpaces.py
aces_1.0.0/python/aces_ocio/createSonyColorSpaces.py
aces_1.0.0/python/aces_ocio/create_aces_config.py
aces_1.0.0/python/aces_ocio/generateLUT.py
aces_1.0.0/python/aces_ocio/process.py
aces_1.0.0/python/aces_ocio/tests/tests_aces_config.py
aces_1.0.0/python/aces_ocio/util.py

index 681e975..d7d195f 100644 (file)
@@ -18,15 +18,29 @@ __status__ = 'Production'
 __all__ = ['createLogC',
            'createColorSpaces']
 
 __all__ = ['createLogC',
            'createColorSpaces']
 
-#
-# LogC to ACES
-#
+
 def createLogC(gamut,
                transferFunction,
                exposureIndex,
                name,
                lutDir,
                lutResolution1d):
 def createLogC(gamut,
                transferFunction,
                exposureIndex,
                name,
                lutDir,
                lutResolution1d):
+    """
+    Object description.
+
+    LogC to ACES.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     name = "%s (EI%s) - %s" % (transferFunction, exposureIndex, gamut)
     if transferFunction == "":
         name = "Linear - %s" % gamut
     name = "%s (EI%s) - %s" % (transferFunction, exposureIndex, gamut)
     if transferFunction == "":
         name = "Linear - %s" % gamut
@@ -140,6 +154,20 @@ def createLogC(gamut,
 
 
 def createColorSpaces(lutDir, lutResolution1d):
 
 
 def createColorSpaces(lutDir, lutResolution1d):
+    """
+    Generates the colorspace conversions.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     colorspaces = []
 
     transferFunction = "V3 LogC"
     colorspaces = []
 
     transferFunction = "V3 LogC"
index aa3ee40..9b8d92c 100644 (file)
@@ -16,10 +16,24 @@ __status__ = 'Production'
 __all__ = ['createCanonLog',
            'createColorSpaces']
 
 __all__ = ['createCanonLog',
            'createColorSpaces']
 
-#
-# Canon-Log to ACES
-#
+
 def createCanonLog(gamut, transferFunction, name, lutDir, lutResolution1d):
 def createCanonLog(gamut, transferFunction, name, lutDir, lutResolution1d):
+    """
+    Object description.
+
+    Canon-Log to ACES.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     name = "%s - %s" % (transferFunction, gamut)
     if transferFunction == "":
         name = "Linear - %s" % gamut
     name = "%s - %s" % (transferFunction, gamut)
     if transferFunction == "":
         name = "Linear - %s" % gamut
@@ -128,8 +142,21 @@ def createCanonLog(gamut, transferFunction, name, lutDir, lutResolution1d):
     return cs
 
 
     return cs
 
 
-# Generate all color spaces conversion
 def createColorSpaces(lutDir, lutResolution1d):
 def createColorSpaces(lutDir, lutResolution1d):
+    """
+    Generates the colorspace conversions.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     colorspaces = []
 
     # Full conversion
     colorspaces = []
 
     # Full conversion
index 46cbd7f..74d375f 100644 (file)
@@ -16,10 +16,24 @@ __status__ = 'Production'
 __all__ = ['createREDlogFilm',
            'createColorSpaces']
 
 __all__ = ['createREDlogFilm',
            'createColorSpaces']
 
-#
-# RED color spaces to ACES
-#
+
 def createREDlogFilm(gamut, transferFunction, name, lutDir, lutResolution1d):
 def createREDlogFilm(gamut, transferFunction, name, lutDir, lutResolution1d):
+    """
+    Object description.
+
+    RED colorspaces to ACES.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     name = "%s - %s" % (transferFunction, gamut)
     if transferFunction == "":
         name = "Linear - %s" % gamut
     name = "%s - %s" % (transferFunction, gamut)
     if transferFunction == "":
         name = "Linear - %s" % gamut
@@ -112,8 +126,21 @@ def createREDlogFilm(gamut, transferFunction, name, lutDir, lutResolution1d):
     return cs
 
 
     return cs
 
 
-# Generate all color spaces conversion
 def createColorSpaces(lutDir, lutResolution1d):
 def createColorSpaces(lutDir, lutResolution1d):
+    """
+    Generates the colorspace conversions.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     colorspaces = []
 
     # Full conversion
     colorspaces = []
 
     # Full conversion
index 604777c..a7eaef1 100644 (file)
@@ -16,10 +16,24 @@ __status__ = 'Production'
 __all__ = ['createSlog',
            'createColorSpaces']
 
 __all__ = ['createSlog',
            'createColorSpaces']
 
-#
-# SLog to ACES
-#
+
 def createSlog(gamut, transferFunction, name, lutDir, lutResolution1d):
 def createSlog(gamut, transferFunction, name, lutDir, lutResolution1d):
+    """
+    Object description.
+
+    SLog to ACES.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     name = "%s - %s" % (transferFunction, gamut)
     if transferFunction == "":
         name = "Linear - %s" % gamut
     name = "%s - %s" % (transferFunction, gamut)
     if transferFunction == "":
         name = "Linear - %s" % gamut
@@ -190,6 +204,20 @@ def createSlog(gamut, transferFunction, name, lutDir, lutResolution1d):
 
 
 def createColorSpaces(lutDir, lutResolution1d):
 
 
 def createColorSpaces(lutDir, lutResolution1d):
+    """
+    Generates the colorspace conversions.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     colorspaces = []
 
     # SLog1
     colorspaces = []
 
     # SLog1
index aa004b2..49943bf 100755 (executable)
@@ -2,18 +2,18 @@
 # -*- coding: utf-8 -*-
 
 """
 # -*- coding: utf-8 -*-
 
 """
-usage from python
+usage from python:
 
 
-import sys
-sys.path.append("/path/to/script")
-import create_aces_config as cac
-acesReleaseCTLDir = "/path/to/github/checkout/releases/v0.7.1/transforms/ctl"
-configDir = "/path/to/config/dir"
-cac.createACESConfig(acesReleaseCTLDir, configDir, 1024, 33, True)
+>>> import sys
+>>> sys.path.append("/path/to/script")
+>>> import create_aces_config as cac
+>>> acesReleaseCTLDir = "/path/to/github/checkout/releases/v0.7.1/transforms/ctl"
+>>> configDir = "/path/to/config/dir"
+>>> cac.createACESConfig(acesReleaseCTLDir, configDir, 1024, 33, True)
 
 
-usage from command line, from the directory with 'create_aces_config.py'
-python create_aces_config.py -a "/path/to/github/checkout/releases/v0.7.1/transforms/ctl" -c "/path/to/config/dir" --lutResolution1d 1024 --lutResolution3d 33 --keepTempImages
+usage from command line, from the directory with 'create_aces_config.py':
 
 
+$ python create_aces_config.py -a "/path/to/github/checkout/releases/v0.7.1/transforms/ctl" -c "/path/to/config/dir" --lutResolution1d 1024 --lutResolution3d 33 --keepTempImages
 
 
 build instructions for osx for needed packages.
 
 
 build instructions for osx for needed packages.
@@ -86,9 +86,7 @@ __all__ = ['ACES_OCIO_CTL_DIRECTORY_ENVIRON',
 ACES_OCIO_CTL_DIRECTORY_ENVIRON = 'ACES_OCIO_CTL_DIRECTORY'
 ACES_OCIO_CONFIGURATION_DIRECTORY_ENVIRON = 'ACES_OCIO_CONFIGURATION_DIRECTORY'
 
 ACES_OCIO_CTL_DIRECTORY_ENVIRON = 'ACES_OCIO_CTL_DIRECTORY'
 ACES_OCIO_CONFIGURATION_DIRECTORY_ENVIRON = 'ACES_OCIO_CONFIGURATION_DIRECTORY'
 
-#
-# Utility functions
-#
+
 def setConfigDefaultRoles(config,
                           color_picking="",
                           color_timing="",
 def setConfigDefaultRoles(config,
                           color_picking="",
                           color_timing="",
@@ -99,7 +97,38 @@ def setConfigDefaultRoles(config,
                           reference="",
                           scene_linear="",
                           texture_paint=""):
                           reference="",
                           scene_linear="",
                           texture_paint=""):
-    # Add Roles
+    """
+    Sets given *OCIO* configuration default roles.
+
+    Parameters
+    ----------
+    config : config
+        *OCIO* configuration.
+    color_picking : str or unicode
+        Color picking role title.
+    color_timing : str or unicode
+        Color timing role title.
+    compositing_log : str or unicode
+        Compositing log role title.
+    data : str or unicode
+        Data role title.
+    default : str or unicode
+        Default role title.
+    matte_paint : str or unicode
+        Matte painting role title.
+    reference : str or unicode
+        Reference role title.
+    scene_linear : str or unicode
+        Scene linear role title.
+    texture_paint : str or unicode
+        Texture painting role title.
+
+    Returns
+    -------
+    bool
+         Definition success.
+    """
+
     if color_picking:
         config.setRole(OCIO.Constants.ROLE_COLOR_PICKING, color_picking)
     if color_timing:
     if color_picking:
         config.setRole(OCIO.Constants.ROLE_COLOR_PICKING, color_picking)
     if color_timing:
@@ -119,9 +148,24 @@ def setConfigDefaultRoles(config,
     if texture_paint:
         config.setRole(OCIO.Constants.ROLE_TEXTURE_PAINT, texture_paint)
 
     if texture_paint:
         config.setRole(OCIO.Constants.ROLE_TEXTURE_PAINT, texture_paint)
 
+    return True
+
 
 
-# Write config to disk
 def writeConfig(config, configPath, sanityCheck=True):
 def writeConfig(config, configPath, sanityCheck=True):
+    """
+    Writes the configuration to given path.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     if sanityCheck:
         try:
             config.sanityCheck()
     if sanityCheck:
         try:
             config.sanityCheck()
@@ -137,6 +181,20 @@ def writeConfig(config, configPath, sanityCheck=True):
 
 
 def generateOCIOTransform(transforms):
 
 
 def generateOCIOTransform(transforms):
+    """
+    Object description.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     # print("Generating transforms")
 
     interpolationOptions = {
     # print("Generating transforms")
 
     interpolationOptions = {
@@ -200,6 +258,20 @@ def generateOCIOTransform(transforms):
 
 
 def createConfig(configData, nuke=False):
 
 
 def createConfig(configData, nuke=False):
+    """
+    Object description.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     # Create the config
     config = OCIO.Config()
 
     # Create the config
     config = OCIO.Config()
 
@@ -326,13 +398,6 @@ def createConfig(configData, nuke=False):
     return config
 
 
     return config
 
 
-#
-# Functions to generate color space definitions and LUTs for transforms for a
-# specific ACES release.
-#
-
-# Output is a list of colorspaces and transforms that convert between those
-# colorspaces and reference color space, ACES
 def generateLUTs(odtInfo,
                  lmtInfo,
                  shaperName,
 def generateLUTs(odtInfo,
                  lmtInfo,
                  shaperName,
@@ -341,6 +406,21 @@ def generateLUTs(odtInfo,
                  lutResolution1d=4096,
                  lutResolution3d=64,
                  cleanup=True):
                  lutResolution1d=4096,
                  lutResolution3d=64,
                  cleanup=True):
+    """
+    Object description.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    dict
+         Colorspaces and transforms converting between those colorspaces and
+         the reference colorspace, *ACES*.
+    """
+
     print("generateLUTs - begin")
     configData = {}
 
     print("generateLUTs - begin")
     configData = {}
 
@@ -1279,6 +1359,20 @@ def generateBakedLUTs(odtInfo,
                       lutResolution1d,
                       lutResolution3d,
                       lutResolutionShaper=1024):
                       lutResolution1d,
                       lutResolution3d,
                       lutResolutionShaper=1024):
+    """
+    Object description.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     # Add the legal and full variations into this list
     odtInfoC = dict(odtInfo)
     for odtCTLName, odtValues in odtInfo.iteritems():
     # Add the legal and full variations into this list
     odtInfoC = dict(odtInfo)
     for odtCTLName, odtValues in odtInfo.iteritems():
@@ -1369,6 +1463,20 @@ def generateBakedLUTs(odtInfo,
 
 
 def createConfigDir(configDir, bakeSecondaryLUTs):
 
 
 def createConfigDir(configDir, bakeSecondaryLUTs):
+    """
+    Object description.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     dirs = [configDir, "%s/luts" % configDir]
     if bakeSecondaryLUTs:
         dirs.extend(["%s/baked" % configDir,
     dirs = [configDir, "%s/luts" % configDir]
     if bakeSecondaryLUTs:
         dirs.extend(["%s/baked" % configDir,
@@ -1384,6 +1492,20 @@ def createConfigDir(configDir, bakeSecondaryLUTs):
 
 
 def getTransformInfo(ctlTransform):
 
 
 def getTransformInfo(ctlTransform):
+    """
+    Object description.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     fp = open(ctlTransform, 'rb')
 
     # Read lines
     fp = open(ctlTransform, 'rb')
 
     # Read lines
@@ -1404,8 +1526,23 @@ def getTransformInfo(ctlTransform):
     return transformID, transformUserName, transformUserNamePrefix
 
 
     return transformID, transformUserName, transformUserNamePrefix
 
 
-# For versions after WGR9
 def getODTInfo(acesCTLReleaseDir):
 def getODTInfo(acesCTLReleaseDir):
+    """
+    Object description.
+
+    For versions after WGR9.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     # Credit to Alex Fry for the original approach here
     odtDir = os.path.join(acesCTLReleaseDir, "odt")
     allodt = []
     # Credit to Alex Fry for the original approach here
     odtDir = os.path.join(acesCTLReleaseDir, "odt")
     allodt = []
@@ -1478,8 +1615,23 @@ def getODTInfo(acesCTLReleaseDir):
     return odts
 
 
     return odts
 
 
-# For versions after WGR9
 def getLMTInfo(acesCTLReleaseDir):
 def getLMTInfo(acesCTLReleaseDir):
+    """
+    Object description.
+
+    For versions after WGR9.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     # Credit to Alex Fry for the original approach here
     lmtDir = os.path.join(acesCTLReleaseDir, "lmt")
     alllmt = []
     # Credit to Alex Fry for the original approach here
     lmtDir = os.path.join(acesCTLReleaseDir, "lmt")
     alllmt = []
@@ -1553,15 +1705,26 @@ def getLMTInfo(acesCTLReleaseDir):
     return lmts
 
 
     return lmts
 
 
-#
-# Create the ACES config
-#
 def createACESConfig(acesCTLReleaseDir,
                      configDir,
                      lutResolution1d=4096,
                      lutResolution3d=64,
                      bakeSecondaryLUTs=True,
                      cleanup=True):
 def createACESConfig(acesCTLReleaseDir,
                      configDir,
                      lutResolution1d=4096,
                      lutResolution3d=64,
                      bakeSecondaryLUTs=True,
                      cleanup=True):
+    """
+    Creates the ACES configuration.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     # Get ODT names and CTL paths
     odtInfo = getODTInfo(acesCTLReleaseDir)
 
     # Get ODT names and CTL paths
     odtInfo = getODTInfo(acesCTLReleaseDir)
 
@@ -1613,10 +1776,21 @@ def createACESConfig(acesCTLReleaseDir,
     return True
 
 
     return True
 
 
-#
-# Main
-#
 def main():
 def main():
+    """
+    Object description.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     import optparse
 
     p = optparse.OptionParser(description='An OCIO config generation script',
     import optparse
 
     p = optparse.OptionParser(description='An OCIO config generation script',
@@ -1636,7 +1810,7 @@ def main():
 
     #
     # Get options
 
     #
     # Get options
-    # 
+    #
     acesCTLDir = options.acesCTLDir
     configDir = options.configDir
     lutResolution1d = int(options.lutResolution1d)
     acesCTLDir = options.acesCTLDir
     configDir = options.configDir
     lutResolution1d = int(options.lutResolution1d)
@@ -1670,7 +1844,6 @@ def main():
                             bakeSecondaryLUTs,
                             cleanupTempImages)
 
                             bakeSecondaryLUTs,
                             cleanupTempImages)
 
-# main
 
 if __name__ == '__main__':
     main()
 
 if __name__ == '__main__':
     main()
index e9e7718..8e420aa 100644 (file)
@@ -52,13 +52,25 @@ __all__ = ['generate1dLUTImage',
            'generate3dLUTFromCTL',
            'main']
 
            'generate3dLUTFromCTL',
            'main']
 
-#
-# Functions used to generate LUTs using CTL transforms
-#
+
 def generate1dLUTImage(ramp1dPath,
                        resolution=1024,
                        minValue=0.0,
                        maxValue=1.0):
 def generate1dLUTImage(ramp1dPath,
                        resolution=1024,
                        minValue=0.0,
                        maxValue=1.0):
+    """
+    Object description.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     # print("Generate 1d LUT image - %s" % ramp1dPath)
 
     # open image
     # print("Generate 1d LUT image - %s" % ramp1dPath)
 
     # open image
@@ -87,9 +99,24 @@ def generate1dLUTImage(ramp1dPath,
     ramp.close()
 
 
     ramp.close()
 
 
-# Credit to Alex Fry for the original single channel version of the spi1d
-# writer
 def writeSPI1D(filename, fromMin, fromMax, data, entries, channels):
 def writeSPI1D(filename, fromMin, fromMax, data, entries, channels):
+    """
+    Object description.
+
+    Credit to *Alex Fry* for the original single channel version of the spi1d
+    writer.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     f = file(filename, 'w')
     f.write("Version 1\n")
     f.write("From %f %f\n" % (fromMin, fromMax))
     f = file(filename, 'w')
     f.write("Version 1\n")
     f.write("From %f %f\n" % (fromMin, fromMax))
@@ -109,6 +136,20 @@ def generate1dLUTFromImage(ramp1dPath,
                            outputPath=None,
                            minValue=0.0,
                            maxValue=1.0):
                            outputPath=None,
                            minValue=0.0,
                            maxValue=1.0):
+    """
+    Object description.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     if outputPath == None:
         outputPath = ramp1dPath + ".spi1d"
 
     if outputPath == None:
         outputPath = ramp1dPath + ".spi1d"
 
@@ -132,6 +173,20 @@ def generate1dLUTFromImage(ramp1dPath,
 
 
 def generate3dLUTImage(ramp3dPath, resolution=32):
 
 
 def generate3dLUTImage(ramp3dPath, resolution=32):
+    """
+    Object description.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     args = ["--generate",
             "--cubesize",
             str(resolution),
     args = ["--generate",
             "--cubesize",
             str(resolution),
@@ -146,6 +201,20 @@ def generate3dLUTImage(ramp3dPath, resolution=32):
 
 
 def generate3dLUTFromImage(ramp3dPath, outputPath=None, resolution=32):
 
 
 def generate3dLUTFromImage(ramp3dPath, outputPath=None, resolution=32):
+    """
+    Object description.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     if outputPath == None:
         outputPath = ramp3dPath + ".spi3d"
 
     if outputPath == None:
         outputPath = ramp3dPath + ".spi3d"
 
@@ -171,6 +240,20 @@ def applyCTLToImage(inputImage,
                     outputScale=1.0,
                     globalParams={},
                     acesCTLReleaseDir=None):
                     outputScale=1.0,
                     globalParams={},
                     acesCTLReleaseDir=None):
+    """
+    Object description.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     if len(ctlPaths) > 0:
         ctlenv = os.environ
         if acesCTLReleaseDir != None:
     if len(ctlPaths) > 0:
         ctlenv = os.environ
         if acesCTLReleaseDir != None:
@@ -203,6 +286,20 @@ def applyCTLToImage(inputImage,
 
 
 def convertBitDepth(inputImage, outputImage, depth):
 
 
 def convertBitDepth(inputImage, outputImage, depth):
+    """
+    Object description.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     args = [inputImage,
             "-d",
             depth,
     args = [inputImage,
             "-d",
             depth,
@@ -225,6 +322,20 @@ def generate1dLUTFromCTL(lutPath,
                          acesCTLReleaseDir=None,
                          minValue=0.0,
                          maxValue=1.0):
                          acesCTLReleaseDir=None,
                          minValue=0.0,
                          maxValue=1.0):
+    """
+    Object description.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     # print(lutPath)
     # print(ctlPaths)
 
     # print(lutPath)
     # print(ctlPaths)
 
@@ -263,6 +374,20 @@ def generate1dLUTFromCTL(lutPath,
 
 
 def correctLUTImage(transformedLUTImage, correctedLUTImage, lutResolution):
 
 
 def correctLUTImage(transformedLUTImage, correctedLUTImage, lutResolution):
+    """
+    Object description.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     # open image
     transformed = oiio.ImageInput.open(transformedLUTImage)
 
     # open image
     transformed = oiio.ImageInput.open(transformedLUTImage)
 
@@ -337,6 +462,20 @@ def generate3dLUTFromCTL(lutPath,
                          globalParams={},
                          cleanup=True,
                          acesCTLReleaseDir=None):
                          globalParams={},
                          cleanup=True,
                          acesCTLReleaseDir=None):
+    """
+    Object description.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     # print(lutPath)
     # print(ctlPaths)
 
     # print(lutPath)
     # print(ctlPaths)
 
@@ -380,6 +519,20 @@ def generate3dLUTFromCTL(lutPath,
 
 
 def main():
 
 
 def main():
+    """
+    Object description.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     import optparse
 
     p = optparse.OptionParser(
     import optparse
 
     p = optparse.OptionParser(
index 7660c15..1a3506b 100755 (executable)
@@ -25,6 +25,20 @@ __all__ = ['readText',
 \r
 \r
 def readText(textFile):\r
 \r
 \r
 def readText(textFile):\r
+    """\r
+    Object description.\r
+\r
+    Parameters\r
+    ----------\r
+    parameter : type\r
+        Parameter description.\r
+\r
+    Returns\r
+    -------\r
+    type\r
+         Return value description.\r
+    """\r
+\r
     if (textFile != ""):\r
         fp = open(textFile, 'rb')\r
         # Create a text/plain message\r
     if (textFile != ""):\r
         fp = open(textFile, 'rb')\r
         # Create a text/plain message\r
@@ -33,9 +47,21 @@ def readText(textFile):
     return text\r
 \r
 \r
     return text\r
 \r
 \r
-# readText\r
-\r
 def writeText(text, textFile):\r
 def writeText(text, textFile):\r
+    """\r
+    Object description.\r
+\r
+    Parameters\r
+    ----------\r
+    parameter : type\r
+        Parameter description.\r
+\r
+    Returns\r
+    -------\r
+    type\r
+         Return value description.\r
+    """\r
+\r
     if (textFile != ""):\r
         fp = open(textFile, 'wb')\r
         # Create a text/plain message\r
     if (textFile != ""):\r
         fp = open(textFile, 'wb')\r
         # Create a text/plain message\r
@@ -44,11 +70,9 @@ def writeText(text, textFile):
     return text\r
 \r
 \r
     return text\r
 \r
 \r
-# readText\r
-\r
 class Process:\r
     """\r
 class Process:\r
     """\r
-    A process with logged output\r
+    A process with logged output.\r
     """\r
 \r
     def __init__(self,\r
     """\r
 \r
     def __init__(self,\r
@@ -58,7 +82,20 @@ class Process:
                  cwd=None,\r
                  env=None,\r
                  batchWrapper=False):\r
                  cwd=None,\r
                  env=None,\r
                  batchWrapper=False):\r
-        """Initialize the standard class variables"""\r
+        """\r
+        Initialize the standard class variables.\r
+\r
+        Parameters\r
+        ----------\r
+        parameter : type\r
+            Parameter description.\r
+\r
+        Returns\r
+        -------\r
+        type\r
+             Return value description.\r
+        """\r
+\r
         self.cmd = cmd\r
         if not description:\r
             self.description = cmd\r
         self.cmd = cmd\r
         if not description:\r
             self.description = cmd\r
@@ -75,9 +112,21 @@ class Process:
         self.batchWrapper = batchWrapper\r
         self.processKeys = []\r
 \r
         self.batchWrapper = batchWrapper\r
         self.processKeys = []\r
 \r
-    # __init__\r
-\r
     def getElapsedSeconds(self):\r
     def getElapsedSeconds(self):\r
+        """\r
+        Object description.\r
+\r
+        Parameters\r
+        ----------\r
+        parameter : type\r
+            Parameter description.\r
+\r
+        Returns\r
+        -------\r
+        type\r
+             Return value description.\r
+        """\r
+\r
         import math\r
 \r
         if self.end and self.start:\r
         import math\r
 \r
         if self.end and self.start:\r
@@ -88,10 +137,21 @@ class Process:
             formatted = None\r
         return formatted\r
 \r
             formatted = None\r
         return formatted\r
 \r
-    # getElapsedtime\r
-\r
     def writeKey(self, writeDict, key=None, value=None, startStop=None):\r
     def writeKey(self, writeDict, key=None, value=None, startStop=None):\r
-        "Write a key, value pair in a supported format"\r
+        """\r
+        Writes a key / value pair in a supported format.\r
+\r
+        Parameters\r
+        ----------\r
+        parameter : type\r
+            Parameter description.\r
+\r
+        Returns\r
+        -------\r
+        type\r
+             Return value description.\r
+        """\r
+\r
         if key != None and (value != None or startStop != None):\r
             indent = '\t' * writeDict['indentationLevel']\r
             if writeDict['format'] == 'xml':\r
         if key != None and (value != None or startStop != None):\r
             indent = '\t' * writeDict['indentationLevel']\r
             if writeDict['format'] == 'xml':\r
@@ -107,6 +167,20 @@ class Process:
                     "%s%40s : %s\n" % (indent, key, value))\r
 \r
     def writeLogHeader(self, writeDict):\r
                     "%s%40s : %s\n" % (indent, key, value))\r
 \r
     def writeLogHeader(self, writeDict):\r
+        """\r
+        Object description.\r
+\r
+        Parameters\r
+        ----------\r
+        parameter : type\r
+            Parameter description.\r
+\r
+        Returns\r
+        -------\r
+        type\r
+             Return value description.\r
+        """\r
+\r
         import platform\r
 \r
         # Retrieve operating environment information\r
         import platform\r
 \r
         # Retrieve operating environment information\r
@@ -137,7 +211,8 @@ class Process:
 \r
         self.writeKey(writeDict, 'description', self.description)\r
         self.writeKey(writeDict, 'cmd', self.cmd)\r
 \r
         self.writeKey(writeDict, 'description', self.description)\r
         self.writeKey(writeDict, 'cmd', self.cmd)\r
-        if self.args: self.writeKey(writeDict, 'args', ' '.join(self.args))\r
+        if self.args:\r
+            self.writeKey(writeDict, 'args', ' '.join(self.args))\r
         self.writeKey(writeDict, 'start', self.start)\r
         self.writeKey(writeDict, 'end', self.end)\r
         self.writeKey(writeDict, 'elapsed', self.getElapsedSeconds())\r
         self.writeKey(writeDict, 'start', self.start)\r
         self.writeKey(writeDict, 'end', self.end)\r
         self.writeKey(writeDict, 'elapsed', self.getElapsedSeconds())\r
@@ -161,17 +236,37 @@ class Process:
 \r
         self.writeKey(writeDict, 'status', self.status)\r
 \r
 \r
         self.writeKey(writeDict, 'status', self.status)\r
 \r
-    # writeLogHeader\r
-\r
     def writeLogFooter(self, writeDict):\r
     def writeLogFooter(self, writeDict):\r
+        """\r
+        Object description.\r
+\r
+        Parameters\r
+        ----------\r
+        parameter : type\r
+            Parameter description.\r
+\r
+        Returns\r
+        -------\r
+        type\r
+             Return value description.\r
+        """\r
+\r
         writeDict['indentationLevel'] -= 1\r
         self.writeKey(writeDict, 'process', None, 'stop')\r
 \r
         writeDict['indentationLevel'] -= 1\r
         self.writeKey(writeDict, 'process', None, 'stop')\r
 \r
-    # writeLogFooter\r
-\r
     def writeLog(self, logHandle=sys.stdout, indentationLevel=0, format='xml'):\r
         """\r
     def writeLog(self, logHandle=sys.stdout, indentationLevel=0, format='xml'):\r
         """\r
-        Write logging information to the specified handle\r
+        Writes logging information to the specified handle.\r
+\r
+        Parameters\r
+        ----------\r
+        parameter : type\r
+            Parameter description.\r
+\r
+        Returns\r
+        -------\r
+        type\r
+             Return value description.\r
         """\r
 \r
         writeDict = {}\r
         """\r
 \r
         writeDict = {}\r
@@ -194,9 +289,21 @@ class Process:
 \r
             self.writeLogFooter(writeDict)\r
 \r
 \r
             self.writeLogFooter(writeDict)\r
 \r
-    # writeLog\r
-\r
     def writeLogToDisk(self, logFilename=None, format='xml', header=None):\r
     def writeLogToDisk(self, logFilename=None, format='xml', header=None):\r
+        """\r
+        Object description.\r
+\r
+        Parameters\r
+        ----------\r
+        parameter : type\r
+            Parameter description.\r
+\r
+        Returns\r
+        -------\r
+        type\r
+             Return value description.\r
+        """\r
+\r
         if logFilename:\r
             try:\r
                 # This also doesn't seem like the best structure...\r
         if logFilename:\r
             try:\r
                 # This also doesn't seem like the best structure...\r
@@ -220,21 +327,40 @@ class Process:
             self.writeLog(logHandle)\r
             logHandle.close()\r
 \r
             self.writeLog(logHandle)\r
             logHandle.close()\r
 \r
-    # writeLogToDisk\r
-\r
     def logLine(self, line):\r
     def logLine(self, line):\r
-        "Add a line of text to the log"\r
+        """\r
+        Adds a line of text to the log.\r
+\r
+        Parameters\r
+        ----------\r
+        parameter : type\r
+            Parameter description.\r
+\r
+        Returns\r
+        -------\r
+        type\r
+             Return value description.\r
+        """\r
+\r
         self.log.append(line.rstrip())\r
         if self.echo:\r
             print("%s" % line.rstrip())\r
 \r
         self.log.append(line.rstrip())\r
         if self.echo:\r
             print("%s" % line.rstrip())\r
 \r
-    # logLine\r
-\r
     def execute(self):\r
         """\r
     def execute(self):\r
         """\r
-        Execute this process\r
+        Executes the current process.\r
+\r
+        Parameters\r
+        ----------\r
+        parameter : type\r
+            Parameter description.\r
+\r
+        Returns\r
+        -------\r
+        type\r
+             Return value description.\r
         """\r
         """\r
-        import re\r
+\r
         import datetime\r
         import traceback\r
 \r
         import datetime\r
         import traceback\r
 \r
@@ -363,28 +489,48 @@ class Process:
             self.status = exitCode\r
 \r
         self.end = datetime.datetime.now()\r
             self.status = exitCode\r
 \r
         self.end = datetime.datetime.now()\r
-        # execute\r
 \r
 \r
 \r
 \r
-# Process\r
-\r
 class ProcessList(Process):\r
     """\r
 class ProcessList(Process):\r
     """\r
-    A list of processes with logged output\r
+    A list of processes with logged output.\r
     """\r
 \r
     def __init__(self, description, blocking=True, cwd=None, env=None):\r
     """\r
 \r
     def __init__(self, description, blocking=True, cwd=None, env=None):\r
+        """\r
+        Object description.\r
+\r
+        Parameters\r
+        ----------\r
+        parameter : type\r
+            Parameter description.\r
+\r
+        Returns\r
+        -------\r
+        type\r
+             Return value description.\r
+        """\r
+\r
         Process.__init__(self, description, None, None, cwd, env)\r
         "Initialize the standard class variables"\r
         self.processes = []\r
         self.blocking = blocking\r
 \r
         Process.__init__(self, description, None, None, cwd, env)\r
         "Initialize the standard class variables"\r
         self.processes = []\r
         self.blocking = blocking\r
 \r
-    # __init__\r
-\r
     def generateReport(self, writeDict):\r
         """\r
     def generateReport(self, writeDict):\r
         """\r
-        Generate a log based on the success of the child processes\r
+        Generates a log based on the success of the child processes.\r
+\r
+        Parameters\r
+        ----------\r
+        parameter : type\r
+            Parameter description.\r
+\r
+        Returns\r
+        -------\r
+        type\r
+             Return value description.\r
         """\r
         """\r
+\r
         if self.processes:\r
             _status = True\r
             indent = '\t' * (writeDict['indentationLevel'] + 1)\r
         if self.processes:\r
             _status = True\r
             indent = '\t' * (writeDict['indentationLevel'] + 1)\r
@@ -417,6 +563,20 @@ class ProcessList(Process):
             self.status = -1\r
 \r
     def writeLogHeader(self, writeDict):\r
             self.status = -1\r
 \r
     def writeLogHeader(self, writeDict):\r
+        """\r
+        Object description.\r
+\r
+        Parameters\r
+        ----------\r
+        parameter : type\r
+            Parameter description.\r
+\r
+        Returns\r
+        -------\r
+        type\r
+             Return value description.\r
+        """\r
+\r
         self.writeKey(writeDict, 'processList', None, 'start')\r
         writeDict['indentationLevel'] += 1\r
 \r
         self.writeKey(writeDict, 'processList', None, 'start')\r
         writeDict['indentationLevel'] += 1\r
 \r
@@ -429,17 +589,37 @@ class ProcessList(Process):
 \r
         self.writeKey(writeDict, 'status', self.status)\r
 \r
 \r
         self.writeKey(writeDict, 'status', self.status)\r
 \r
-    # writeLogHeader\r
-\r
     def writeLogFooter(self, writeDict):\r
     def writeLogFooter(self, writeDict):\r
+        """\r
+        Object description.\r
+\r
+        Parameters\r
+        ----------\r
+        parameter : type\r
+            Parameter description.\r
+\r
+        Returns\r
+        -------\r
+        type\r
+             Return value description.\r
+        """\r
+\r
         writeDict['indentationLevel'] -= 1\r
         self.writeKey(writeDict, 'processList', None, 'stop')\r
 \r
         writeDict['indentationLevel'] -= 1\r
         self.writeKey(writeDict, 'processList', None, 'stop')\r
 \r
-    # writeLogFooter\r
-\r
     def writeLog(self, logHandle=sys.stdout, indentationLevel=0, format='xml'):\r
         """\r
     def writeLog(self, logHandle=sys.stdout, indentationLevel=0, format='xml'):\r
         """\r
-        Write logging information to the specified handle\r
+        Writes logging information to the specified handle.\r
+\r
+        Parameters\r
+        ----------\r
+        parameter : type\r
+            Parameter description.\r
+\r
+        Returns\r
+        -------\r
+        type\r
+             Return value description.\r
         """\r
 \r
         writeDict = {}\r
         """\r
 \r
         writeDict = {}\r
@@ -464,12 +644,21 @@ class ProcessList(Process):
 \r
             self.writeLogFooter(writeDict)\r
 \r
 \r
             self.writeLogFooter(writeDict)\r
 \r
-    # writeLog\r
-\r
     def execute(self):\r
         """\r
     def execute(self):\r
         """\r
-        Execute this list of processes\r
+        Executes the list of processes.\r
+\r
+        Parameters\r
+        ----------\r
+        parameter : type\r
+            Parameter description.\r
+\r
+        Returns\r
+        -------\r
+        type\r
+             Return value description.\r
         """\r
         """\r
+\r
         import datetime\r
 \r
         self.start = datetime.datetime.now()\r
         import datetime\r
 \r
         self.start = datetime.datetime.now()\r
@@ -493,12 +682,23 @@ class ProcessList(Process):
                         break\r
 \r
         self.end = datetime.datetime.now()\r
                         break\r
 \r
         self.end = datetime.datetime.now()\r
-        # execute\r
-\r
 \r
 \r
-# ProcessList\r
 \r
 def main():\r
 \r
 def main():\r
+    """\r
+    Object description.\r
+\r
+    Parameters\r
+    ----------\r
+    parameter : type\r
+        Parameter description.\r
+\r
+    Returns\r
+    -------\r
+    type\r
+         Return value description.\r
+    """\r
+\r
     import optparse\r
 \r
     p = optparse.OptionParser(description='A process logging script',\r
     import optparse\r
 \r
     p = optparse.OptionParser(description='A process logging script',\r
index 5d57b90..6925511 100644 (file)
@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 
 """
 # -*- coding: utf-8 -*-
 
 """
-Defines unit tests for the generated *ACES* configuration.
+Defines unit tests for *ACES* configuration.
 """
 
 import hashlib
 """
 
 import hashlib
@@ -42,6 +42,7 @@ UNHASHABLE_TEST_PATTERNS = ('\.icc', '\.ocio')
 
 class TestACESConfig(unittest.TestCase):
     """
 
 class TestACESConfig(unittest.TestCase):
     """
+    Performs tests on the *ACES* configuration.
     """
 
     def setUp(self):
     """
 
     def setUp(self):
@@ -71,8 +72,28 @@ class TestACESConfig(unittest.TestCase):
         shutil.rmtree(self.__temporary_directory)
 
     @staticmethod
         shutil.rmtree(self.__temporary_directory)
 
     @staticmethod
-    def directory_hashes(directory, filters_in=None, filters_out=None):
+    def directory_hashes(directory,
+                         filters_in=None,
+                         filters_out=None,
+                         flags=0):
         """
         """
+        Recursively computes the hashes from the file within given directory.
+
+        Parameters
+        ----------
+        directory : str or unicode
+            Directory to compute the file hashes.
+        filters_in : array_like
+            Included patterns.
+        filters_out : array_like
+            Excluded patterns.
+        flags : int
+            Regex flags.
+
+        Returns
+        -------
+        dict
+             Directory file hashes.
         """
 
         hashes = {}
         """
 
         hashes = {}
@@ -87,6 +108,8 @@ class TestACESConfig(unittest.TestCase):
 
     def test_ACES_config(self):
         """
 
     def test_ACES_config(self):
         """
+        Performs tests on the *ACES* configuration by computing hashes on the
+        generated configuration and comparing them to the existing one.
         """
 
         self.assertTrue(createACESConfig(self.__aces_ocio_ctl_directory,
         """
 
         self.assertTrue(createACESConfig(self.__aces_ocio_ctl_directory,
index c1ca5d3..f7b2e23 100644 (file)
@@ -39,8 +39,19 @@ class ColorSpace:
                  allocationType=OCIO.Constants.ALLOCATION_UNIFORM,
                  allocationVars=[0.0, 1.0]):
         """
                  allocationType=OCIO.Constants.ALLOCATION_UNIFORM,
                  allocationVars=[0.0, 1.0]):
         """
-        Initialize the standard class variables
+        Object description.
+
+        Parameters
+        ----------
+        parameter : type
+            Parameter description.
+
+        Returns
+        -------
+        type
+             Return value description.
         """
         """
+
         self.name = name
         self.bitDepth = bitDepth
         self.description = description
         self.name = name
         self.bitDepth = bitDepth
         self.description = description
@@ -53,17 +64,40 @@ class ColorSpace:
         self.allocationVars = allocationVars
 
 
         self.allocationVars = allocationVars
 
 
-# Create a 4x4 matrix (list) based on a 3x3 matrix (list) input
 def mat44FromMat33(mat33):
 def mat44FromMat33(mat33):
+    """
+    Creates a 4x4 matrix from given 3x3 matrix.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
+    """
+
     return [mat33[0], mat33[1], mat33[2], 0.0,
             mat33[3], mat33[4], mat33[5], 0.0,
             mat33[6], mat33[7], mat33[8], 0.0,
             0, 0, 0, 1.0]
 
 
     return [mat33[0], mat33[1], mat33[2], 0.0,
             mat33[3], mat33[4], mat33[5], 0.0,
             mat33[6], mat33[7], mat33[8], 0.0,
             0, 0, 0, 1.0]
 
 
-# TODO: Worth moving to *util.py*.
 def filter_words(words, filters_in=None, filters_out=None, flags=0):
     """
 def filter_words(words, filters_in=None, filters_out=None, flags=0):
     """
+    Object description.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
     """
 
     filtered_words = []
     """
 
     filtered_words = []
@@ -91,6 +125,17 @@ def filter_words(words, filters_in=None, filters_out=None, flags=0):
 
 def files_walker(directory, filters_in=None, filters_out=None, flags=0):
     """
 
 def files_walker(directory, filters_in=None, filters_out=None, flags=0):
     """
+    Object description.
+
+    Parameters
+    ----------
+    parameter : type
+        Parameter description.
+
+    Returns
+    -------
+    type
+         Return value description.
     """
 
     for parent_directory, directories, files in os.walk(directory,
     """
 
     for parent_directory, directories, files in os.walk(directory,
@@ -103,7 +148,3 @@ def files_walker(directory, filters_in=None, filters_out=None, flags=0):
                     continue
 
                 yield path
                     continue
 
                 yield path
-
-
-
-