Merge pull request #5 from colour-science/feature/code_style
authorhpd <hpd1@duikerresearch.com>
Mon, 3 Aug 2015 21:20:36 +0000 (14:20 -0700)
committerhpd <hpd1@duikerresearch.com>
Mon, 3 Aug 2015 21:20:36 +0000 (14:20 -0700)
PR: Improve overall code consistency.

16 files changed:
aces_1.0.0/python/aces_ocio/__init__.py
aces_1.0.0/python/aces_ocio/colorspaces/aces.py
aces_1.0.0/python/aces_ocio/colorspaces/arri.py
aces_1.0.0/python/aces_ocio/colorspaces/canon.py
aces_1.0.0/python/aces_ocio/colorspaces/general.py
aces_1.0.0/python/aces_ocio/colorspaces/gopro.py
aces_1.0.0/python/aces_ocio/colorspaces/panasonic.py
aces_1.0.0/python/aces_ocio/colorspaces/red.py
aces_1.0.0/python/aces_ocio/colorspaces/sony.py
aces_1.0.0/python/aces_ocio/generate_config.py [moved from aces_1.0.0/python/aces_ocio/aces_config.py with 57% similarity]
aces_1.0.0/python/aces_ocio/generate_lut.py
aces_1.0.0/python/aces_ocio/process.py
aces_1.0.0/python/aces_ocio/tests/__init__.py
aces_1.0.0/python/aces_ocio/tests/tests_aces_config.py
aces_1.0.0/python/aces_ocio/utilities.py
aces_1.0.0/python/bin/create_aces_config

index fe1f182..ed02d6b 100644 (file)
@@ -11,10 +11,10 @@ Usage
 Python
 ******
 
->>> from aces_ocio.aces_config import create_ACES_config
+>>> from aces_ocio.generate_config import generate_config
 >>> aces_ctl_directory = '/path/to/github/checkout/releases/v1.0.0/transforms/ctl'
 >>> config_directory = '/path/to/configuration/dir'
->>> create_ACES_config(aces_ctl_directory, config_directory, 1024, 33, True)
+>>> generate_config(aces_ctl_directory, config_directory, 1024, 33, True)
 
 Command Line
 ************
@@ -88,4 +88,4 @@ __minor_version__ = '0'
 __change_version__ = '0'
 __version__ = '.'.join((__major_version__,
                         __minor_version__,
-                        __change_version__))
\ No newline at end of file
+                        __change_version__))
index b45cd43..4f8839d 100644 (file)
@@ -26,7 +26,6 @@ from aces_ocio.utilities import (
     sanitize,
     compact)
 
-
 __author__ = 'ACES Developers'
 __copyright__ = 'Copyright (C) 2014 - 2015 - ACES Developers'
 __license__ = ''
@@ -35,16 +34,20 @@ __email__ = 'aces@oscars.org'
 __status__ = 'Production'
 
 __all__ = ['ACES_AP1_TO_AP0',
+           'ACES_AP0_TO_AP1',
            'ACES_AP0_TO_XYZ',
+           'ACES_XYZ_TO_AP0',
            'create_ACES',
            'create_ACEScc',
            'create_ACESproxy',
            'create_ACEScg',
            'create_ADX',
-           'create_ACES_LMT',
-           'create_ACES_RRT_plus_ODT',
            'create_generic_log',
+           'create_Dolby_PQ',
+           'create_Dolby_PQ_scaled',
+           'create_ACES_LMT',
            'create_LMTs',
+           'create_ACES_RRT_plus_ODT',
            'create_ODTs',
            'get_transform_info',
            'get_ODTs_info',
@@ -92,7 +95,7 @@ def create_ACES():
     aces2065_1.description = (
         'The Academy Color Encoding System reference color space')
     aces2065_1.equality_group = ''
-    aces2065_1.aliases = ["lin_ap0", "aces"]
+    aces2065_1.aliases = ['lin_ap0', 'aces']
     aces2065_1.family = 'ACES'
     aces2065_1.is_data = False
     aces2065_1.allocation_type = ocio.Constants.ALLOCATION_LG2
@@ -125,13 +128,13 @@ def create_ACEScc(aces_ctl_directory,
 
     cs = ColorSpace(name)
     cs.description = 'The %s color space' % name
-    cs.aliases = ["acescc", "acescc_ap1"]
+    cs.aliases = ['acescc', 'acescc_ap1']
     cs.equality_group = ''
     cs.family = 'ACES'
     cs.is_data = False
     cs.allocation_type = ocio.Constants.ALLOCATION_UNIFORM
     cs.allocation_vars = [min_value, max_value]
-    cs.aces_transform_id = "ACEScsc.ACEScc_to_ACES.a1.0.0"
+    cs.aces_transform_id = 'ACEScsc.ACEScc_to_ACES.a1.0.0'
 
     ctls = [os.path.join(aces_ctl_directory,
                          'ACEScc',
@@ -167,7 +170,7 @@ def create_ACEScc(aces_ctl_directory,
         'interpolation': 'linear',
         'direction': 'forward'})
 
-    # *AP1* primaries to *AP0* primaries.
+    # *AP1* primaries to *AP0* primaries
     cs.to_reference_transforms.append({
         'type': 'matrix',
         'matrix': mat44_from_mat33(ACES_AP1_TO_AP0),
@@ -198,12 +201,12 @@ def create_ACESproxy(aces_ctl_directory,
 
     cs = ColorSpace(name)
     cs.description = 'The %s color space' % name
-    cs.aliases = ["acesproxy", "acesproxy_ap1"]
+    cs.aliases = ['acesproxy', 'acesproxy_ap1']
     cs.equality_group = ''
     cs.family = 'ACES'
     cs.is_data = False
 
-    cs.aces_transform_id = "ACEScsc.ACESproxy10i_to_ACES.a1.0.0"
+    cs.aces_transform_id = 'ACEScsc.ACESproxy10i_to_ACES.a1.0.0'
 
     ctls = [os.path.join(aces_ctl_directory,
                          'ACESproxy',
@@ -239,7 +242,7 @@ def create_ACESproxy(aces_ctl_directory,
         'interpolation': 'linear',
         'direction': 'forward'})
 
-    # *AP1* primaries to *AP0* primaries.
+    # *AP1* primaries to *AP0* primaries
     cs.to_reference_transforms.append({
         'type': 'matrix',
         'matrix': mat44_from_mat33(ACES_AP1_TO_AP0),
@@ -252,11 +255,7 @@ def create_ACESproxy(aces_ctl_directory,
 # -------------------------------------------------------------------------
 # *ACEScg*
 # -------------------------------------------------------------------------
-def create_ACEScg(aces_ctl_directory,
-                  lut_directory,
-                  lut_resolution_1d,
-                  cleanup,
-                  name='ACEScg'):
+def create_ACEScg():
     """
     Creates the *ACEScg* colorspace.
 
@@ -271,20 +270,22 @@ def create_ACEScg(aces_ctl_directory,
          *ACEScg* colorspace.
     """
 
+    name = 'ACEScg'
+
     cs = ColorSpace(name)
     cs.description = 'The %s color space' % name
-    cs.aliases = ["acescg", "lin_ap1"]
+    cs.aliases = ['acescg', 'lin_ap1']
     cs.equality_group = ''
     cs.family = 'ACES'
     cs.is_data = False
     cs.allocation_type = ocio.Constants.ALLOCATION_LG2
     cs.allocation_vars = [-8, 5, 0.00390625]
 
-    cs.aces_transform_id = "ACEScsc.ACEScg_to_ACES.a1.0.0"
+    cs.aces_transform_id = 'ACEScsc.ACEScg_to_ACES.a1.0.0'
 
     cs.to_reference_transforms = []
 
-    # *AP1* primaries to *AP0* primaries.
+    # *AP1* primaries to *AP0* primaries
     cs.to_reference_transforms.append({
         'type': 'matrix',
         'matrix': mat44_from_mat33(ACES_AP1_TO_AP0),
@@ -292,7 +293,7 @@ def create_ACEScg(aces_ctl_directory,
 
     cs.from_reference_transforms = []
 
-    # *AP1* primaries to *AP0* primaries.
+    # *AP1* primaries to *AP0* primaries
     cs.from_reference_transforms.append({
         'type': 'matrix',
         'matrix': mat44_from_mat33(ACES_AP0_TO_AP1),
@@ -305,7 +306,6 @@ def create_ACEScg(aces_ctl_directory,
 # *ADX*
 # -------------------------------------------------------------------------
 def create_ADX(lut_directory,
-               lut_resolution_1d,
                bit_depth=10,
                name='ADX'):
     """
@@ -325,13 +325,13 @@ def create_ADX(lut_directory,
     name = '%s%s' % (name, bit_depth)
     cs = ColorSpace(name)
     cs.description = '%s color space - used for film scans' % name
-    cs.aliases = ["adx%s" % str(bit_depth)]
+    cs.aliases = ['adx%s' % str(bit_depth)]
     cs.equality_group = ''
     cs.family = 'ADX'
     cs.is_data = False
 
     if bit_depth == 10:
-        cs.aces_transform_id = "ACEScsc.ADX10_to_ACES.a1.0.0"
+        cs.aces_transform_id = 'ACEScsc.ADX10_to_ACES.a1.0.0'
 
         cs.bit_depth = ocio.Constants.BIT_DEPTH_UINT10
         ADX_to_CDD = [1023 / 500, 0, 0, 0,
@@ -340,7 +340,7 @@ def create_ADX(lut_directory,
                       0, 0, 0, 1]
         offset = [-95 / 500, -95 / 500, -95 / 500, 0]
     elif bit_depth == 16:
-        cs.aces_transform_id = "ACEScsc.ADX16_to_ACES.a1.0.0"
+        cs.aces_transform_id = 'ACEScsc.ADX16_to_ACES.a1.0.0'
 
         cs.bit_depth = ocio.Constants.BIT_DEPTH_UINT16
         ADX_to_CDD = [65535 / 8000, 0, 0, 0,
@@ -358,7 +358,8 @@ def create_ADX(lut_directory,
         'offset': offset,
         'direction': 'forward'})
 
-    # Convert from Channel-Dependent Density to Channel-Independent Density
+    # Converting from *Channel-Dependent Density* to
+    # *Channel-Independent Density*.
     cs.to_reference_transforms.append({
         'type': 'matrix',
         'matrix': [0.75573, 0.22197, 0.02230, 0,
@@ -370,10 +371,10 @@ def create_ADX(lut_directory,
     # Copied from *Alex Fry*'s *adx_cid_to_rle.py*
     def create_CID_to_RLE_LUT():
 
-        def interpolate_1D(x, xp, fp):
+        def interpolate_1d(x, xp, fp):
             return numpy.interp(x, xp, fp)
 
-        LUT_1D_xp = [-0.190000000000000,
+        LUT_1D_XP = [-0.190000000000000,
                      0.010000000000000,
                      0.028000000000000,
                      0.054000000000000,
@@ -385,7 +386,7 @@ def create_ADX(lut_directory,
                      0.500000000000000,
                      0.600000000000000]
 
-        LUT_1D_fp = [-6.000000000000000,
+        LUT_1D_FP = [-6.000000000000000,
                      -2.721718645000000,
                      -2.521718645000000,
                      -2.321718645000000,
@@ -402,7 +403,7 @@ def create_ADX(lut_directory,
 
         def cid_to_rle(x):
             if x <= 0.6:
-                return interpolate_1D(x, LUT_1D_xp, LUT_1D_fp)
+                return interpolate_1d(x, LUT_1D_XP, LUT_1D_FP)
             return (100 / 55) * x - REF_PT
 
         def fit(value, from_min, from_max, to_min, to_max):
@@ -458,14 +459,14 @@ def create_ADX(lut_directory,
 
 
 # -------------------------------------------------------------------------
-# *Generic Log Transform*
+# Generic *Log* Transform
 # -------------------------------------------------------------------------
 def create_generic_log(aces_ctl_directory,
                        lut_directory,
                        lut_resolution_1d,
                        cleanup,
                        name='log',
-                       aliases=[],
+                       aliases=None,
                        min_value=0,
                        max_value=1,
                        input_scale=1,
@@ -486,6 +487,9 @@ def create_generic_log(aces_ctl_directory,
          *Generic Log* colorspace.
     """
 
+    if aliases is None:
+        aliases = []
+
     cs = ColorSpace(name)
     cs.description = 'The %s color space' % name
     cs.aliases = aliases
@@ -529,17 +533,20 @@ def create_generic_log(aces_ctl_directory,
 
 
 # -------------------------------------------------------------------------
-# *base Dolby PQ Transform*
+# Base *Dolby PQ* Transform
 # -------------------------------------------------------------------------
-def create_dolbypq(aces_CTL_directory,
-                   lut_directory,
-                   lut_resolution_1d,
-                   cleanup,
-                   name='pq',
-                   aliases=[],
-                   min_value=0.0,
-                   max_value=1.0,
-                   input_scale=1.0):
+def create_Dolby_PQ(aces_ctl_directory,
+                    lut_directory,
+                    lut_resolution_1d,
+                    cleanup,
+                    name='pq',
+                    aliases=None,
+                    min_value=0.0,
+                    max_value=1.0,
+                    input_scale=1.0):
+    if aliases is None:
+        aliases = []
+
     cs = ColorSpace(name)
     cs.description = 'The %s color space' % name
     cs.aliases = aliases
@@ -548,7 +555,7 @@ def create_dolbypq(aces_CTL_directory,
     cs.is_data = False
 
     ctls = [os.path.join(
-        aces_CTL_directory,
+        aces_ctl_directory,
         'utilities',
         'ACESlib.DolbyPQ_to_Lin.a1.0.0.ctl')]
     lut = '%s_to_linear.spi1d' % name
@@ -564,7 +571,7 @@ def create_dolbypq(aces_CTL_directory,
         1.0,
         {},
         cleanup,
-        aces_CTL_directory,
+        aces_ctl_directory,
         min_value,
         max_value)
 
@@ -580,20 +587,23 @@ def create_dolbypq(aces_CTL_directory,
 
 
 # -------------------------------------------------------------------------
-# *Dolby PQ Transform that considers a fixed linear range*
+# *Dolby PQ* Transform - Fixed Linear Range
 # -------------------------------------------------------------------------
-def create_dolbypq_scaled(aces_CTL_directory,
-                          lut_directory,
-                          lut_resolution_1d,
-                          cleanup,
-                          name='pq',
-                          aliases=[],
-                          min_value=0.0,
-                          max_value=1.0,
-                          input_scale=1.0,
-                          middle_grey=0.18,
-                          min_exposure=-6.0,
-                          max_exposure=6.5):
+def create_Dolby_PQ_scaled(aces_ctl_directory,
+                           lut_directory,
+                           lut_resolution_1d,
+                           cleanup,
+                           name='pq',
+                           aliases=None,
+                           min_value=0.0,
+                           max_value=1.0,
+                           input_scale=1.0,
+                           middle_grey=0.18,
+                           min_exposure=-6.0,
+                           max_exposure=6.5):
+    if aliases is None:
+        aliases = []
+
     cs = ColorSpace(name)
     cs.description = 'The %s color space' % name
     cs.aliases = aliases
@@ -602,7 +612,7 @@ def create_dolbypq_scaled(aces_CTL_directory,
     cs.is_data = False
 
     ctls = [os.path.join(
-        aces_CTL_directory,
+        aces_ctl_directory,
         'utilities',
         'ACESlib.DolbyPQ_to_lin_param.a1.0.0.ctl')]
     lut = '%s_to_linear.spi1d' % name
@@ -620,7 +630,7 @@ def create_dolbypq_scaled(aces_CTL_directory,
          'minExposure': min_exposure,
          'maxExposure': max_exposure},
         cleanup,
-        aces_CTL_directory,
+        aces_ctl_directory,
         min_value,
         max_value)
 
@@ -636,14 +646,13 @@ def create_dolbypq_scaled(aces_CTL_directory,
 
 
 # -------------------------------------------------------------------------
-# *Individual LMT*
+# Individual *LMT*
 # -------------------------------------------------------------------------
 def create_ACES_LMT(lmt_name,
                     lmt_values,
                     shaper_info,
                     aces_ctl_directory,
                     lut_directory,
-                    lut_resolution_1d=1024,
                     lut_resolution_3d=64,
                     cleanup=True,
                     aliases=None):
@@ -678,16 +687,15 @@ def create_ACES_LMT(lmt_name,
 
     # Generating the *shaper* transform.
     (shaper_name,
-     shaper_to_ACES_CTL,
-     shaper_from_ACES_CTL,
+     shaper_to_aces_ctl,
+     shaper_from_aces_ctl,
      shaper_input_scale,
      shaper_params) = shaper_info
 
-    # Add the shaper transform
     shaper_lut = '%s_to_linear.spi1d' % shaper_name
     shaper_lut = sanitize(shaper_lut)
 
-    shaper_OCIO_transform = {
+    shaper_ocio_transform = {
         'type': 'lutFile',
         'path': shaper_lut,
         'interpolation': 'linear',
@@ -697,7 +705,7 @@ def create_ACES_LMT(lmt_name,
     cs.from_reference_transforms = []
 
     if 'transformCTL' in lmt_values:
-        ctls = [shaper_to_ACES_CTL % aces_ctl_directory,
+        ctls = [shaper_to_aces_ctl % aces_ctl_directory,
                 os.path.join(aces_ctl_directory,
                              lmt_values['transformCTL'])]
         lut = '%s.%s.spi3d' % (shaper_name, lmt_name)
@@ -715,7 +723,7 @@ def create_ACES_LMT(lmt_name,
             cleanup,
             aces_ctl_directory)
 
-        cs.from_reference_transforms.append(shaper_OCIO_transform)
+        cs.from_reference_transforms.append(shaper_ocio_transform)
         cs.from_reference_transforms.append({
             'type': 'lutFile',
             'path': lut,
@@ -728,8 +736,8 @@ def create_ACES_LMT(lmt_name,
     if 'transformCTLInverse' in lmt_values:
         ctls = [os.path.join(aces_ctl_directory,
                              lmt_values['transformCTLInverse']),
-                shaper_from_ACES_CTL % aces_ctl_directory]
-        lut = 'Inverse.%s.%s.spi3d' % (odt_name, shaper_name)
+                shaper_from_aces_ctl % aces_ctl_directory]
+        lut = 'Inverse.%s.%s.spi3d' % (lmt_name, shaper_name)
 
         lut = sanitize(lut)
 
@@ -743,9 +751,7 @@ def create_ACES_LMT(lmt_name,
             shaper_params,
             cleanup,
             aces_ctl_directory,
-            0,
-            1,
-            1)
+            0)
 
         cs.to_reference_transforms.append({
             'type': 'lutFile',
@@ -753,7 +759,7 @@ def create_ACES_LMT(lmt_name,
             'interpolation': 'tetrahedral',
             'direction': 'forward'})
 
-        shaper_inverse = shaper_OCIO_transform.copy()
+        shaper_inverse = shaper_ocio_transform.copy()
         shaper_inverse['direction'] = 'forward'
         cs.to_reference_transforms.append(shaper_inverse)
 
@@ -768,7 +774,6 @@ def create_LMTs(aces_ctl_directory,
                 lut_resolution_1d,
                 lut_resolution_3d,
                 lmt_info,
-                shaper_name,
                 cleanup):
     """
     Object description.
@@ -825,18 +830,17 @@ def create_LMTs(aces_ctl_directory,
         shaper_input_scale_generic_log2,
         lmt_params]
 
-    sorted_LMTs = sorted(lmt_info.iteritems(), key=lambda x: x[1])
-    print(sorted_LMTs)
-    for lmt in sorted_LMTs:
+    sorted_lmts = sorted(lmt_info.iteritems(), key=lambda x: x[1])
+    print(sorted_lmts)
+    for lmt in sorted_lmts:
         lmt_name, lmt_values = lmt
-        lmt_aliases = ["look_%s" % compact(lmt_values['transformUserName'])]
+        lmt_aliases = ['look_%s' % compact(lmt_values['transformUserName'])]
         cs = create_ACES_LMT(
             lmt_values['transformUserName'],
             lmt_values,
             lmt_shaper_data,
             aces_ctl_directory,
             lut_directory,
-            lmt_lut_resolution_1d,
             lmt_lut_resolution_3d,
             cleanup,
             lmt_aliases)
@@ -853,7 +857,6 @@ def create_ACES_RRT_plus_ODT(odt_name,
                              shaper_info,
                              aces_ctl_directory,
                              lut_directory,
-                             lut_resolution_1d=1024,
                              lut_resolution_3d=64,
                              cleanup=True,
                              aliases=None):
@@ -888,8 +891,8 @@ def create_ACES_RRT_plus_ODT(odt_name,
 
     # Generating the *shaper* transform.
     (shaper_name,
-     shaper_to_ACES_CTL,
-     shaper_from_ACES_CTL,
+     shaper_to_aces_ctl,
+     shaper_from_aces_ctl,
      shaper_input_scale,
      shaper_params) = shaper_info
 
@@ -898,11 +901,10 @@ def create_ACES_RRT_plus_ODT(odt_name,
     else:
         shaper_params['legalRange'] = 0
 
-    # Add the shaper transform
     shaper_lut = '%s_to_linear.spi1d' % shaper_name
     shaper_lut = sanitize(shaper_lut)
 
-    shaper_OCIO_transform = {
+    shaper_ocio_transform = {
         'type': 'lutFile',
         'path': shaper_lut,
         'interpolation': 'linear',
@@ -912,20 +914,20 @@ def create_ACES_RRT_plus_ODT(odt_name,
     cs.from_reference_transforms = []
 
     if 'transformLUT' in odt_values:
-        transform_LUT_file_name = os.path.basename(
+        transform_lut_file_name = os.path.basename(
             odt_values['transformLUT'])
-        lut = os.path.join(lut_directory, transform_LUT_file_name)
+        lut = os.path.join(lut_directory, transform_lut_file_name)
         shutil.copy(odt_values['transformLUT'], lut)
 
-        cs.from_reference_transforms.append(shaper_OCIO_transform)
+        cs.from_reference_transforms.append(shaper_ocio_transform)
         cs.from_reference_transforms.append({
             'type': 'lutFile',
-            'path': transform_LUT_file_name,
+            'path': transform_lut_file_name,
             'interpolation': 'tetrahedral',
             'direction': 'forward'})
     elif 'transformCTL' in odt_values:
         ctls = [
-            shaper_to_ACES_CTL % aces_ctl_directory,
+            shaper_to_aces_ctl % aces_ctl_directory,
             os.path.join(aces_ctl_directory,
                          'rrt',
                          'RRT.a1.0.0.ctl'),
@@ -938,7 +940,6 @@ def create_ACES_RRT_plus_ODT(odt_name,
 
         generate_3d_LUT_from_CTL(
             os.path.join(lut_directory, lut),
-            # shaperLUT,
             ctls,
             lut_resolution_3d,
             'float',
@@ -948,7 +949,7 @@ def create_ACES_RRT_plus_ODT(odt_name,
             cleanup,
             aces_ctl_directory)
 
-        cs.from_reference_transforms.append(shaper_OCIO_transform)
+        cs.from_reference_transforms.append(shaper_ocio_transform)
         cs.from_reference_transforms.append({
             'type': 'lutFile',
             'path': lut,
@@ -959,18 +960,18 @@ def create_ACES_RRT_plus_ODT(odt_name,
     cs.to_reference_transforms = []
 
     if 'transformLUTInverse' in odt_values:
-        transform_LUT_inverse_file_name = os.path.basename(
+        transform_lut_inverse_file_name = os.path.basename(
             odt_values['transformLUTInverse'])
-        lut = os.path.join(lut_directory, transform_LUT_inverse_file_name)
+        lut = os.path.join(lut_directory, transform_lut_inverse_file_name)
         shutil.copy(odt_values['transformLUTInverse'], lut)
 
         cs.to_reference_transforms.append({
             'type': 'lutFile',
-            'path': transform_LUT_inverse_file_name,
+            'path': transform_lut_inverse_file_name,
             'interpolation': 'tetrahedral',
             'direction': 'forward'})
 
-        shaper_inverse = shaper_OCIO_transform.copy()
+        shaper_inverse = shaper_ocio_transform.copy()
         shaper_inverse['direction'] = 'forward'
         cs.to_reference_transforms.append(shaper_inverse)
     elif 'transformCTLInverse' in odt_values:
@@ -980,14 +981,13 @@ def create_ACES_RRT_plus_ODT(odt_name,
                 os.path.join(aces_ctl_directory,
                              'rrt',
                              'InvRRT.a1.0.0.ctl'),
-                shaper_from_ACES_CTL % aces_ctl_directory]
+                shaper_from_aces_ctl % aces_ctl_directory]
         lut = 'InvRRT.a1.0.0.%s.%s.spi3d' % (odt_name, shaper_name)
 
         lut = sanitize(lut)
 
         generate_3d_LUT_from_CTL(
             os.path.join(lut_directory, lut),
-            # None,
             ctls,
             lut_resolution_3d,
             'half',
@@ -1003,7 +1003,7 @@ def create_ACES_RRT_plus_ODT(odt_name,
             'interpolation': 'tetrahedral',
             'direction': 'forward'})
 
-        shaper_inverse = shaper_OCIO_transform.copy()
+        shaper_inverse = shaper_ocio_transform.copy()
         shaper_inverse['direction'] = 'forward'
         cs.to_reference_transforms.append(shaper_inverse)
 
@@ -1046,7 +1046,7 @@ def create_ODTs(aces_ctl_directory,
 
     # Defining the *Log 2* shaper.
     log2_shaper_name = shaper_name
-    log2_shaper_name_aliases = ["crv_%s" % compact(log2_shaper_name)]
+    log2_shaper_name_aliases = ['crv_%s' % compact(log2_shaper_name)]
     log2_params = {
         'middleGrey': 0.18,
         'minExposure': -6,
@@ -1081,10 +1081,12 @@ def create_ODTs(aces_ctl_directory,
     shaper_data[log2_shaper_name] = log2_shaper_data
 
     # Space with a more user-friendly name. Direct copy otherwise.
-    log2_shaper_copy_name = "Log2 Shaper"
+    log2_shaper_copy_name = 'Log2 Shaper'
     log2_shaper_copy_colorspace = ColorSpace(log2_shaper_copy_name)
-    log2_shaper_copy_colorspace.description = 'The %s color space' % log2_shaper_copy_name
-    log2_shaper_copy_colorspace.aliases = ["crv_%s" % compact(log2_shaper_copy_name)]
+    log2_shaper_copy_colorspace.description = (
+        'The %s color space' % log2_shaper_copy_name)
+    log2_shaper_copy_colorspace.aliases = [
+        'crv_%s' % compact(log2_shaper_copy_name)]
     log2_shaper_copy_colorspace.equality_group = log2_shaper_copy_name
     log2_shaper_copy_colorspace.family = log2_shaper_colorspace.family
     log2_shaper_copy_colorspace.is_data = log2_shaper_colorspace.is_data
@@ -1095,11 +1097,12 @@ def create_ODTs(aces_ctl_directory,
     colorspaces.append(log2_shaper_copy_colorspace)
 
     # Defining the *Log2 shaper that includes the AP1* primaries.
-    log2_shaper_api1_name = "%s - AP1" % "Log2 Shaper"
+    log2_shaper_api1_name = '%s - AP1' % 'Log2 Shaper'
     log2_shaper_api1_colorspace = ColorSpace(log2_shaper_api1_name)
-    log2_shaper_api1_colorspace.description = 'The %s color space' % log2_shaper_api1_name
+    log2_shaper_api1_colorspace.description = (
+        'The %s color space' % log2_shaper_api1_name)
     log2_shaper_api1_colorspace.aliases = [
-        "%s_ap1" % compact(log2_shaper_copy_name)]
+        '%s_ap1' % compact(log2_shaper_copy_name)]
     log2_shaper_api1_colorspace.equality_group = log2_shaper_api1_name
     log2_shaper_api1_colorspace.family = log2_shaper_colorspace.family
     log2_shaper_api1_colorspace.is_data = log2_shaper_colorspace.is_data
@@ -1108,7 +1111,7 @@ def create_ODTs(aces_ctl_directory,
     log2_shaper_api1_colorspace.from_reference_transforms = list(
         log2_shaper_colorspace.from_reference_transforms)
 
-    # *AP1* primaries to *AP0* primaries.
+    # *AP1* primaries to *AP0* primaries
     log2_shaper_api1_colorspace.to_reference_transforms.append({
         'type': 'matrix',
         'matrix': mat44_from_mat33(ACES_AP1_TO_AP0),
@@ -1116,12 +1119,13 @@ def create_ODTs(aces_ctl_directory,
     })
     colorspaces.append(log2_shaper_api1_colorspace)
 
-    # Defining the *Log2 shaper that includes the AP1* primaries.
-    # Named with 'shaper_name' variable. Needed for some LUT baking steps.
-    shaper_api1_name = "%s - AP1" % shaper_name
+    # Defining the *Log2* shaper that includes the *AP1* primaries.
+    # Named with `shaper_name` variable and needed for some *LUT* baking steps.
+    shaper_api1_name = '%s - AP1' % shaper_name
     shaper_api1_colorspace = ColorSpace(shaper_api1_name)
-    shaper_api1_colorspace.description = 'The %s color space' % shaper_api1_name
-    shaper_api1_colorspace.aliases = ["%s_ap1" % compact(shaper_name)]
+    shaper_api1_colorspace.description = (
+        'The %s color space' % shaper_api1_name)
+    shaper_api1_colorspace.aliases = ['%s_ap1' % compact(shaper_name)]
     shaper_api1_colorspace.equality_group = shaper_api1_name
     shaper_api1_colorspace.family = log2_shaper_colorspace.family
     shaper_api1_colorspace.is_data = log2_shaper_colorspace.is_data
@@ -1133,21 +1137,21 @@ def create_ODTs(aces_ctl_directory,
 
     # Define the base *Dolby PQ Shaper*
     #
-    dolbypq_shaper_name = "Dolby PQ 10000"
-    dolbypq_shaper_name_aliases = ["crv_%s" % "dolbypq_10000"]
+    dolby_pq_shaper_name = 'Dolby PQ 10000'
+    dolby_pq_shaper_name_aliases = ['crv_%s' % 'dolbypq_10000']
 
-    dolbypq_shaper_colorspace = create_dolbypq(
+    dolby_pq_shaper_colorspace = create_Dolby_PQ(
         aces_ctl_directory,
         lut_directory,
         lut_resolution_1d,
         cleanup,
-        name=dolbypq_shaper_name,
-        aliases=dolbypq_shaper_name_aliases)
-    colorspaces.append(dolbypq_shaper_colorspace)
+        name=dolby_pq_shaper_name,
+        aliases=dolby_pq_shaper_name_aliases)
+    colorspaces.append(dolby_pq_shaper_colorspace)
 
     # *Dolby PQ* shaper name and *CTL* transforms bundled up.
-    dolbypq_shaper_data = [
-        dolbypq_shaper_name,
+    dolby_pq_shaper_data = [
+        dolby_pq_shaper_name,
         os.path.join('%s',
                      'utilities',
                      'ACESlib.DolbyPQ_to_Lin.a1.0.0.ctl'),
@@ -1157,25 +1161,24 @@ def create_ODTs(aces_ctl_directory,
         1.0,
         {}]
 
-    shaper_data[dolbypq_shaper_name] = dolbypq_shaper_data
+    shaper_data[dolby_pq_shaper_name] = dolby_pq_shaper_data
 
     # Define the *Dolby PQ Shaper that considers a fixed linear range*
-    #
-    dolbypq_scaled_shaper_name = "Dolby PQ Scaled"
-    dolbypq_scaled_shaper_name_aliases = ["crv_%s" % "dolbypq_scaled"]
+    dolby_pq_scaled_shaper_name = 'Dolby PQ Scaled'
+    dolby_pq_scaled_shaper_name_aliases = ['crv_%s' % 'dolbypq_scaled']
 
-    dolbypq_scaled_shaper_colorspace = create_dolbypq_scaled(
+    dolby_pq_scaled_shaper_colorspace = create_Dolby_PQ_scaled(
         aces_ctl_directory,
         lut_directory,
         lut_resolution_1d,
         cleanup,
-        name=dolbypq_scaled_shaper_name,
-        aliases=dolbypq_scaled_shaper_name_aliases)
-    colorspaces.append(dolbypq_scaled_shaper_colorspace)
+        name=dolby_pq_scaled_shaper_name,
+        aliases=dolby_pq_scaled_shaper_name_aliases)
+    colorspaces.append(dolby_pq_scaled_shaper_colorspace)
 
     # *Dolby PQ* shaper name and *CTL* transforms bundled up.
-    dolbypq_scaled_shaper_data = [
-        dolbypq_scaled_shaper_name,
+    dolby_pq_scaled_shaper_data = [
+        dolby_pq_scaled_shaper_name,
         os.path.join('%s',
                      'utilities',
                      'ACESlib.DolbyPQ_to_Lin_param.a1.0.0.ctl'),
@@ -1185,13 +1188,10 @@ def create_ODTs(aces_ctl_directory,
         1.0,
         log2_params]
 
-    shaper_data[dolbypq_scaled_shaper_name] = dolbypq_scaled_shaper_data
+    shaper_data[dolby_pq_scaled_shaper_name] = dolby_pq_scaled_shaper_data
 
-    #
-    # Pick a specific shaper
-    #
     rrt_shaper = log2_shaper_data
-    # rrt_shaper = dolbypq_scaled_shaper_data
+    # rrt_shaper = dolby_pq_scaled_shaper_data
 
     # *RRT + ODT* combinations.
     sorted_odts = sorted(odt_info.iteritems(), key=lambda x: x[1])
@@ -1199,22 +1199,23 @@ def create_ODTs(aces_ctl_directory,
     for odt in sorted_odts:
         (odt_name, odt_values) = odt
 
-        # Generating only full range transform for *ODTs* that can generate 
-        # either *legal* or *full* output.
+        # Defining full range transform for *ODTs* that can generate either
+        # *legal* or *full* output.
 
-        # Uncomment these lines and the lower section and flip the 'legalRange' value to 1
-        # to recover the old behavior, where both legal and full range LUTs were generated
+        # Uncomment these lines and the lower section and
+        # flip the `legalRange` value to 1 to restore the old behavior,
+        # where both *legal* or *full* range *LUTs* were generated.
         if odt_values['transformHasFullLegalSwitch']:
-            #odt_name_legal = '%s - Legal' % odt_values['transformUserName']
+            # odt_name_legal = '%s - Legal' % odt_values['transformUserName']
             odt_legal['legalRange'] = 0
-        #else:
+        # else:
         #    odt_name_legal = odt_values['transformUserName']
+
         odt_name_legal = odt_values['transformUserName']
 
         odt_legal = odt_values.copy()
 
-        odt_aliases = ["out_%s" % compact(odt_name_legal)]
+        odt_aliases = ['out_%s' % compact(odt_name_legal)]
 
         cs = create_ACES_RRT_plus_ODT(
             odt_name_legal,
@@ -1222,7 +1223,6 @@ def create_ODTs(aces_ctl_directory,
             rrt_shaper,
             aces_ctl_directory,
             lut_directory,
-            lut_resolution_1d,
             lut_resolution_3d,
             cleanup,
             odt_aliases)
@@ -1233,7 +1233,7 @@ def create_ODTs(aces_ctl_directory,
             'Log': log_display_space,
             'Output Transform': cs}
 
-        '''
+        """
         # Generating full range transform for *ODTs* that can generate 
         # either *legal* or *full* output.
         if odt_values['transformHasFullLegalSwitch']:
@@ -1243,7 +1243,7 @@ def create_ODTs(aces_ctl_directory,
             odt_full = odt_values.copy()
             odt_full['legalRange'] = 0
 
-            odt_full_aliases = ["out_%s" % compact(odt_name_full)]
+            odt_full_aliases = ['out_%s' % compact(odt_name_full)]
 
             cs_full = create_ACES_RRT_plus_ODT(
                 odt_name_full,
@@ -1261,9 +1261,9 @@ def create_ODTs(aces_ctl_directory,
                 'Raw': linear_display_space,
                 'Log': log_display_space,
                 'Output Transform': cs_full}
-        '''
+        """
 
-    return (colorspaces, displays)
+    return colorspaces, displays
 
 
 def get_transform_info(ctl_transform):
@@ -1291,15 +1291,18 @@ def get_transform_info(ctl_transform):
     transform_user_name_prefix = (
         lines[2][3:].split('<')[1].split('>')[1].split('-')[0].strip())
 
-    # Figuring out if this transform has options for processing full and legal range
+    # Figuring out if this transform has options for processing *full* and
+    # *legal* ranges.
     transform_full_legal_switch = False
     for line in lines:
-        if line.strip() == "input varying int legalRange = 0":
-            # print( "%s has legal range flag" % transform_user_name)
+        if line.strip() == 'input varying int legalRange = 0':
+            # print( '%s has legal range flag' % transform_user_name)
             transform_full_legal_switch = True
             break
 
-    return (transform_id, transform_user_name, transform_user_name_prefix,
+    return (transform_id,
+            transform_user_name,
+            transform_user_name_prefix,
             transform_full_legal_switch)
 
 
@@ -1328,13 +1331,13 @@ def get_ODTs_info(aces_ctl_directory):
         for fname in file_list:
             all_odt.append((os.path.join(dir_name, fname)))
 
-    odt_CTLs = [x for x in all_odt if
+    odt_ctls = [x for x in all_odt if
                 ('InvODT' not in x) and (os.path.split(x)[-1][0] != '.')]
 
     odts = {}
 
-    for odt_CTL in odt_CTLs:
-        odt_tokens = os.path.split(odt_CTL)
+    for odt_ctl in odt_ctls:
+        odt_tokens = os.path.split(odt_ctl)
 
         # Handling nested directories.
         odt_path_tokens = os.path.split(odt_tokens[-2])
@@ -1343,48 +1346,48 @@ def get_ODTs_info(aces_ctl_directory):
             odt_path_tokens = os.path.split(odt_path_tokens[-2])
             odt_dir = os.path.join(odt_path_tokens[-1], odt_dir)
 
-        # Building full name,
-        transform_CTL = odt_tokens[-1]
-        odt_name = string.join(transform_CTL.split('.')[1:-1], '.')
+        # Building full name.
+        transform_ctl = odt_tokens[-1]
+        odt_name = string.join(transform_ctl.split('.')[1:-1], '.')
 
         # Finding id, user name and user name prefix.
-        (transform_ID,
+        (transform_id,
          transform_user_name,
          transform_user_name_prefix,
          transform_full_legal_switch) = get_transform_info(
-            os.path.join(aces_ctl_directory, 'odt', odt_dir, transform_CTL))
+            os.path.join(aces_ctl_directory, 'odt', odt_dir, transform_ctl))
 
         # Finding inverse.
-        transform_CTL_inverse = 'InvODT.%s.ctl' % odt_name
+        transform_ctl_inverse = 'InvODT.%s.ctl' % odt_name
         if not os.path.exists(
-                os.path.join(odt_tokens[-2], transform_CTL_inverse)):
-            transform_CTL_inverse = None
+                os.path.join(odt_tokens[-2], transform_ctl_inverse)):
+            transform_ctl_inverse = None
 
-        # Add to list of ODTs
+        # Adding to list of *ODTs*.
         odts[odt_name] = {}
-        odts[odt_name]['transformCTL'] = os.path.join(odt_dir, transform_CTL)
-        if transform_CTL_inverse is not None:
+        odts[odt_name]['transformCTL'] = os.path.join(odt_dir, transform_ctl)
+        if transform_ctl_inverse is not None:
             odts[odt_name]['transformCTLInverse'] = os.path.join(
-                odt_dir, transform_CTL_inverse)
+                odt_dir, transform_ctl_inverse)
 
-        odts[odt_name]['transformID'] = transform_ID
+        odts[odt_name]['transformID'] = transform_id
         odts[odt_name]['transformUserNamePrefix'] = transform_user_name_prefix
         odts[odt_name]['transformUserName'] = transform_user_name
         odts[odt_name][
             'transformHasFullLegalSwitch'] = transform_full_legal_switch
 
-        forward_CTL = odts[odt_name]['transformCTL']
+        forward_ctl = odts[odt_name]['transformCTL']
 
         print('ODT : %s' % odt_name)
-        print('\tTransform ID               : %s' % transform_ID)
+        print('\tTransform ID               : %s' % transform_id)
         print('\tTransform User Name Prefix : %s' % transform_user_name_prefix)
         print('\tTransform User Name        : %s' % transform_user_name)
         print(
             '\tHas Full / Legal Switch    : %s' % transform_full_legal_switch)
-        print('\tForward ctl                : %s' % forward_CTL)
+        print('\tForward ctl                : %s' % forward_ctl)
         if 'transformCTLInverse' in odts[odt_name]:
-            inverse_CTL = odts[odt_name]['transformCTLInverse']
-            print('\tInverse ctl                : %s' % inverse_CTL)
+            inverse_ctl = odts[odt_name]['transformCTLInverse']
+            print('\tInverse ctl                : %s' % inverse_ctl)
         else:
             print('\tInverse ctl                : %s' % 'None')
 
@@ -1419,14 +1422,14 @@ def get_LMTs_info(aces_ctl_directory):
         for fname in file_list:
             all_lmt.append((os.path.join(dir_name, fname)))
 
-    lmt_CTLs = [x for x in all_lmt if
+    lmt_ctls = [x for x in all_lmt if
                 ('InvLMT' not in x) and ('README' not in x) and (
                     os.path.split(x)[-1][0] != '.')]
 
     lmts = {}
 
-    for lmt_CTL in lmt_CTLs:
-        lmt_tokens = os.path.split(lmt_CTL)
+    for lmt_ctl in lmt_ctls:
+        lmt_tokens = os.path.split(lmt_ctl)
 
         # Handlimg nested directories.
         lmt_path_tokens = os.path.split(lmt_tokens[-2])
@@ -1436,42 +1439,42 @@ def get_LMTs_info(aces_ctl_directory):
             lmt_dir = os.path.join(lmt_path_tokens[-1], lmt_dir)
 
         # Building full name.
-        transform_CTL = lmt_tokens[-1]
-        lmt_name = string.join(transform_CTL.split('.')[1:-1], '.')
+        transform_ctl = lmt_tokens[-1]
+        lmt_name = string.join(transform_ctl.split('.')[1:-1], '.')
 
         # Finding id, user name and user name prefix.
-        (transform_ID,
+        (transform_id,
          transform_user_name,
          transform_user_name_prefix,
          transform_full_legal_switch) = get_transform_info(
-            os.path.join(aces_ctl_directory, lmt_dir, transform_CTL))
+            os.path.join(aces_ctl_directory, lmt_dir, transform_ctl))
 
         # Finding inverse.
-        transform_CTL_inverse = 'InvLMT.%s.ctl' % lmt_name
+        transform_ctl_inverse = 'InvLMT.%s.ctl' % lmt_name
         if not os.path.exists(
-                os.path.join(lmt_tokens[-2], transform_CTL_inverse)):
-            transform_CTL_inverse = None
+                os.path.join(lmt_tokens[-2], transform_ctl_inverse)):
+            transform_ctl_inverse = None
 
         lmts[lmt_name] = {}
-        lmts[lmt_name]['transformCTL'] = os.path.join(lmt_dir, transform_CTL)
-        if transform_CTL_inverse is not None:
+        lmts[lmt_name]['transformCTL'] = os.path.join(lmt_dir, transform_ctl)
+        if transform_ctl_inverse is not None:
             lmts[lmt_name]['transformCTLInverse'] = os.path.join(
-                lmt_dir, transform_CTL_inverse)
+                lmt_dir, transform_ctl_inverse)
 
-        lmts[lmt_name]['transformID'] = transform_ID
+        lmts[lmt_name]['transformID'] = transform_id
         lmts[lmt_name]['transformUserNamePrefix'] = transform_user_name_prefix
         lmts[lmt_name]['transformUserName'] = transform_user_name
 
-        forward_CTL = lmts[lmt_name]['transformCTL']
+        forward_ctl = lmts[lmt_name]['transformCTL']
 
         print('LMT : %s' % lmt_name)
-        print('\tTransform ID               : %s' % transform_ID)
+        print('\tTransform ID               : %s' % transform_id)
         print('\tTransform User Name Prefix : %s' % transform_user_name_prefix)
         print('\tTransform User Name        : %s' % transform_user_name)
-        print('\t Forward ctl               : %s' % forward_CTL)
+        print('\t Forward ctl               : %s' % forward_ctl)
         if 'transformCTLInverse' in lmts[lmt_name]:
-            inverse_CTL = lmts[lmt_name]['transformCTLInverse']
-            print('\t Inverse ctl                : %s' % inverse_CTL)
+            inverse_ctl = lmts[lmt_name]['transformCTLInverse']
+            print('\t Inverse ctl                : %s' % inverse_ctl)
         else:
             print('\t Inverse ctl                : %s' % 'None')
 
@@ -1515,14 +1518,13 @@ def create_colorspaces(aces_ctl_directory,
                                  lut_resolution_1d, cleanup)
     colorspaces.append(ACESproxy)
 
-    ACEScg = create_ACEScg(aces_ctl_directory, lut_directory,
-                           lut_resolution_1d, cleanup)
+    ACEScg = create_ACEScg()
     colorspaces.append(ACEScg)
 
-    ADX10 = create_ADX(lut_directory, lut_resolution_1d, bit_depth=10)
+    ADX10 = create_ADX(lut_directory, bit_depth=10)
     colorspaces.append(ADX10)
 
-    ADX16 = create_ADX(lut_directory, lut_resolution_1d, bit_depth=16)
+    ADX16 = create_ADX(lut_directory, bit_depth=16)
     colorspaces.append(ADX16)
 
     lmts = create_LMTs(aces_ctl_directory,
@@ -1530,7 +1532,6 @@ def create_colorspaces(aces_ctl_directory,
                        lut_resolution_1d,
                        lut_resolution_3d,
                        lmt_info,
-                       shaper_name,
                        cleanup)
     colorspaces.extend(lmts)
 
@@ -1545,8 +1546,8 @@ def create_colorspaces(aces_ctl_directory,
                                  ACEScc)
     colorspaces.extend(odts)
 
-    # Wish there was an automatic way to get this from the CTL
-    defaultDisplay = "sRGB (D60 sim.)"
+    # TODO: Investigate if there is a way to retrieve the value from *CTL*.
+    default_display = 'sRGB (D60 sim.)'
 
     roles = {'color_picking': ACEScg.name,
              'color_timing': ACEScc.name,
@@ -1558,4 +1559,4 @@ def create_colorspaces(aces_ctl_directory,
              'scene_linear': ACEScg.name,
              'texture_paint': ''}
 
-    return ACES, colorspaces, displays, ACEScc, roles, defaultDisplay
+    return ACES, colorspaces, displays, ACEScc, roles, default_display
index efd7c07..58f52cb 100644 (file)
@@ -16,7 +16,6 @@ import PyOpenColorIO as ocio
 import aces_ocio.generate_lut as genlut
 from aces_ocio.utilities import ColorSpace, mat44_from_mat33, sanitize
 
-
 __author__ = 'ACES Developers'
 __copyright__ = 'Copyright (C) 2014 - 2015 - ACES Developers'
 __license__ = ''
@@ -31,7 +30,6 @@ __all__ = ['create_log_c',
 def create_log_c(gamut,
                  transfer_function,
                  exposure_index,
-                 name,
                  lut_directory,
                  lut_resolution_1d,
                  aliases):
@@ -65,14 +63,14 @@ def create_log_c(gamut,
     cs.is_data = False
 
     if gamut and transfer_function:
-        cs.aces_transform_id = "IDT.ARRI.Alexa-v3-logC-EI%s.a1.v1" % exposure_index
+        cs.aces_transform_id = (
+            'IDT.ARRI.Alexa-v3-logC-EI%s.a1.v1' % exposure_index)
 
-    # A linear space needs allocation variables
+    # A linear space needs allocation variables.
     if transfer_function == '':
         cs.allocation_type = ocio.Constants.ALLOCATION_LG2
         cs.allocation_vars = [-8, 5, 0.00390625]
 
-    # Globals.
     IDT_maker_version = '0.08'
 
     nominal_EI = 400
@@ -154,8 +152,7 @@ def create_log_c(gamut,
             'type': 'lutFile',
             'path': lut,
             'interpolation': 'linear',
-            'direction': 'forward'
-        })
+            'direction': 'forward'})
 
     if gamut == 'Wide Gamut':
         cs.to_reference_transforms.append({
@@ -163,8 +160,7 @@ def create_log_c(gamut,
             'matrix': mat44_from_mat33([0.680206, 0.236137, 0.083658,
                                         0.085415, 1.017471, -0.102886,
                                         0.002057, -0.062563, 1.060506]),
-            'direction': 'forward'
-        })
+            'direction': 'forward'})
 
     cs.from_reference_transforms = []
     return cs
@@ -202,10 +198,9 @@ def create_colorspaces(lut_directory, lut_resolution_1d):
             gamut,
             transfer_function,
             EI,
-            'LogC',
             lut_directory,
             lut_resolution_1d,
-            ["%sei%s_%s" % ("logc3", str(EI), "arriwide")])
+            ['%sei%s_%s' % ('logc3', str(EI), 'arriwide')])
         colorspaces.append(log_c_EI_full)
 
     # Linearization Only
@@ -214,10 +209,9 @@ def create_colorspaces(lut_directory, lut_resolution_1d):
             '',
             transfer_function,
             EI,
-            'LogC',
             lut_directory,
             lut_resolution_1d,
-            ["crv_%sei%s" % ("logc3", str(EI))])
+            ['crv_%sei%s' % ('logc3', str(EI))])
         colorspaces.append(log_c_EI_linearization)
 
     # Primaries Only
@@ -225,10 +219,9 @@ def create_colorspaces(lut_directory, lut_resolution_1d):
         gamut,
         '',
         default_EI,
-        'LogC',
         lut_directory,
         lut_resolution_1d,
-        ["%s_%s" % ('lin', "arriwide")])
+        ['%s_%s' % ('lin', 'arriwide')])
     colorspaces.append(log_c_EI_primaries)
 
     return colorspaces
index 2be9690..64ffb60 100644 (file)
@@ -28,7 +28,6 @@ __all__ = ['create_c_log',
 
 def create_c_log(gamut,
                  transfer_function,
-                 name,
                  lut_directory,
                  lut_resolution_1d,
                  aliases):
@@ -61,7 +60,7 @@ def create_c_log(gamut,
     cs.family = 'Input/Canon'
     cs.is_data = False
 
-    # A linear space needs allocation variables
+    # A linear space needs allocation variables.
     if transfer_function == '':
         cs.allocation_type = ocio.Constants.ALLOCATION_LG2
         cs.allocation_vars = [-8, 5, 0.00390625]
@@ -177,120 +176,107 @@ def create_colorspaces(lut_directory, lut_resolution_1d):
     c_log_1 = create_c_log(
         'Rec. 709 Daylight',
         'Canon-Log',
-        'Canon-Log',
         lut_directory,
         lut_resolution_1d,
-        ["canonlog_rec709day"])
+        ['canonlog_rec709day'])
     colorspaces.append(c_log_1)
 
     c_log_2 = create_c_log(
         'Rec. 709 Tungsten',
         'Canon-Log',
-        'Canon-Log',
         lut_directory,
         lut_resolution_1d,
-        ["canonlog_rec709tung"])
+        ['canonlog_rec709tung'])
     colorspaces.append(c_log_2)
 
     c_log_3 = create_c_log(
         'DCI-P3 Daylight',
         'Canon-Log',
-        'Canon-Log',
         lut_directory,
         lut_resolution_1d,
-        ["canonlog_dcip3day"])
+        ['canonlog_dcip3day'])
     colorspaces.append(c_log_3)
 
     c_log_4 = create_c_log(
         'DCI-P3 Tungsten',
         'Canon-Log',
-        'Canon-Log',
         lut_directory,
         lut_resolution_1d,
-        ["canonlog_dcip3tung"])
+        ['canonlog_dcip3tung'])
     colorspaces.append(c_log_4)
 
     c_log_5 = create_c_log(
         'Cinema Gamut Daylight',
         'Canon-Log',
-        'Canon-Log',
         lut_directory,
         lut_resolution_1d,
-        ["canonlog_cgamutday"])
+        ['canonlog_cgamutday'])
     colorspaces.append(c_log_5)
 
     c_log_6 = create_c_log(
         'Cinema Gamut Tungsten',
         'Canon-Log',
-        'Canon-Log',
         lut_directory,
         lut_resolution_1d,
-        ["canonlog_cgamuttung"])
+        ['canonlog_cgamuttung'])
     colorspaces.append(c_log_6)
 
     # Linearization Only
     c_log_7 = create_c_log(
         '',
         'Canon-Log',
-        'Canon-Log',
         lut_directory,
         lut_resolution_1d,
-        ["crv_canonlog"])
+        ['crv_canonlog'])
     colorspaces.append(c_log_7)
 
     # Primaries Only
     c_log_8 = create_c_log(
         'Rec. 709 Daylight',
         '',
-        'Canon-Log',
         lut_directory,
         lut_resolution_1d,
-        ["lin_canonrec709day"])
+        ['lin_canonrec709day'])
     colorspaces.append(c_log_8)
 
     c_log_9 = create_c_log(
         'Rec. 709 Tungsten',
         '',
-        'Canon-Log',
         lut_directory,
         lut_resolution_1d,
-        ["lin_canonrec709tung"])
+        ['lin_canonrec709tung'])
     colorspaces.append(c_log_9)
 
     c_log_10 = create_c_log(
         'DCI-P3 Daylight',
         '',
-        'Canon-Log',
         lut_directory,
         lut_resolution_1d,
-        ["lin_canondcip3day"])
+        ['lin_canondcip3day'])
     colorspaces.append(c_log_10)
 
     c_log_11 = create_c_log(
         'DCI-P3 Tungsten',
         '',
-        'Canon-Log',
         lut_directory,
         lut_resolution_1d,
-        ["lin_canondcip3tung"])
+        ['lin_canondcip3tung'])
     colorspaces.append(c_log_11)
 
     c_log_12 = create_c_log(
         'Cinema Gamut Daylight',
         '',
-        'Canon-Log',
         lut_directory,
         lut_resolution_1d,
-        ["lin_canoncgamutday"])
+        ['lin_canoncgamutday'])
     colorspaces.append(c_log_12)
 
     c_log_13 = create_c_log(
         'Cinema Gamut Tungsten',
         '',
-        'Canon-Log',
         lut_directory,
         lut_resolution_1d,
-        ["lin_canoncgamuttung"])
+        ['lin_canoncgamuttung'])
     colorspaces.append(c_log_13)
 
     return colorspaces
index 1a05f06..cb935f7 100644 (file)
@@ -16,7 +16,6 @@ import aces_ocio.generate_lut as genlut
 from aces_ocio.colorspaces import aces
 from aces_ocio.utilities import ColorSpace, mat44_from_mat33
 
-
 __author__ = 'ACES Developers'
 __copyright__ = 'Copyright (C) 2014 - 2015 - ACES Developers'
 __license__ = ''
@@ -25,7 +24,16 @@ __email__ = 'aces@oscars.org'
 __status__ = 'Production'
 
 __all__ = ['create_matrix_colorspace',
-           'create_colorspaces']
+           'create_transfer_colorspace',
+           'create_matrix_plus_transfer_colorspace',
+           'transfer_function_sRGB_to_linear',
+           'transfer_function_Rec709_to_linear',
+           'transfer_function_Rec2020_10bit_to_linear',
+           'transfer_function_Rec2020_12bit_to_linear',
+           'transfer_function_Rec1886_to_linear',
+           'create_colorspaces',
+           'create_raw']
+
 
 # -------------------------------------------------------------------------
 # *Matrix Transform*
@@ -33,7 +41,7 @@ __all__ = ['create_matrix_colorspace',
 def create_matrix_colorspace(name='matrix',
                              from_reference_values=None,
                              to_reference_values=None,
-                             aliases=[]):
+                             aliases=None):
     """
     Object description.
 
@@ -54,6 +62,9 @@ def create_matrix_colorspace(name='matrix',
     if to_reference_values is None:
         to_reference_values = []
 
+    if aliases is None:
+        aliases = []
+
     cs = ColorSpace(name)
     cs.description = 'The %s color space' % name
     cs.aliases = aliases
@@ -61,7 +72,7 @@ def create_matrix_colorspace(name='matrix',
     cs.family = 'Utility'
     cs.is_data = False
 
-    # A linear space needs allocation variables
+    # A linear space needs allocation variables.
     cs.allocation_type = ocio.Constants.ALLOCATION_UNIFORM
     cs.allocation_vars = [0, 1]
 
@@ -83,6 +94,7 @@ def create_matrix_colorspace(name='matrix',
 
     return cs
 
+
 # -------------------------------------------------------------------------
 # *Transfer Function Transform*
 # -------------------------------------------------------------------------
@@ -91,7 +103,7 @@ def create_transfer_colorspace(name='transfer',
                                transfer_function=lambda x: x,
                                lut_directory='/tmp',
                                lut_resolution_1d=1024,
-                               aliases=[]):
+                               aliases=None):
     """
     Object description.
 
@@ -106,6 +118,9 @@ def create_transfer_colorspace(name='transfer',
          Return value description.
     """
 
+    if aliases is None:
+        aliases = []
+
     cs = ColorSpace(name)
     cs.description = 'The %s color space' % name
     cs.aliases = aliases
@@ -113,16 +128,16 @@ def create_transfer_colorspace(name='transfer',
     cs.family = 'Utility'
     cs.is_data = False
 
-    # A linear space needs allocation variables
+    # A linear space needs allocation variables.
     cs.allocation_type = ocio.Constants.ALLOCATION_UNIFORM
     cs.allocation_vars = [0, 1]
 
-    # Sample the transfer function
+    # Sampling the transfer function.
     data = array.array('f', '\0' * lut_resolution_1d * 4)
     for c in range(lut_resolution_1d):
         data[c] = transfer_function(c / (lut_resolution_1d - 1))
 
-    # Write the sampled data to a LUT
+    # Writing the sampled data to a *LUT*.
     lut = '%s_to_linear.spi1d' % transfer_function_name
     genlut.write_SPI_1d(
         os.path.join(lut_directory, lut),
@@ -132,7 +147,7 @@ def create_transfer_colorspace(name='transfer',
         lut_resolution_1d,
         1)
 
-    # Create the 'to_reference' transforms
+    # Creating the *to_reference* transforms.
     cs.to_reference_transforms = []
     cs.to_reference_transforms.append({
         'type': 'lutFile',
@@ -140,23 +155,24 @@ def create_transfer_colorspace(name='transfer',
         'interpolation': 'linear',
         'direction': 'forward'})
 
-    # Create the 'from_reference' transforms
+    # Creating the *from_reference* transforms.
     cs.from_reference_transforms = []
 
     return cs
-# create_transfer_colorspace
+
 
 # -------------------------------------------------------------------------
 # *Transfer Function + Matrix Transform*
 # -------------------------------------------------------------------------
-def create_matrix_plus_transfer_colorspace(name='matrix_plus_transfer',
-                                           transfer_function_name='transfer_function',
-                                           transfer_function=lambda x: x,
-                                           lut_directory='/tmp',
-                                           lut_resolution_1d=1024,
-                                           from_reference_values=None,
-                                           to_reference_values=None,
-                                           aliases=[]):
+def create_matrix_plus_transfer_colorspace(
+        name='matrix_plus_transfer',
+        transfer_function_name='transfer_function',
+        transfer_function=lambda x: x,
+        lut_directory='/tmp',
+        lut_resolution_1d=1024,
+        from_reference_values=None,
+        to_reference_values=None,
+        aliases=None):
     """
     Object description.
 
@@ -177,6 +193,9 @@ def create_matrix_plus_transfer_colorspace(name='matrix_plus_transfer',
     if to_reference_values is None:
         to_reference_values = []
 
+    if aliases is None:
+        aliases = []
+
     cs = ColorSpace(name)
     cs.description = 'The %s color space' % name
     cs.aliases = aliases
@@ -184,16 +203,16 @@ def create_matrix_plus_transfer_colorspace(name='matrix_plus_transfer',
     cs.family = 'Utility'
     cs.is_data = False
 
-    # A linear space needs allocation variables
+    # A linear space needs allocation variables.
     cs.allocation_type = ocio.Constants.ALLOCATION_UNIFORM
     cs.allocation_vars = [0, 1]
 
-    # Sample the transfer function
+    # Sampling the transfer function.
     data = array.array('f', '\0' * lut_resolution_1d * 4)
     for c in range(lut_resolution_1d):
         data[c] = transfer_function(c / (lut_resolution_1d - 1))
 
-    # Write the sampled data to a LUT
+    # Writing the sampled data to a *LUT*.
     lut = '%s_to_linear.spi1d' % transfer_function_name
     genlut.write_SPI_1d(
         os.path.join(lut_directory, lut),
@@ -203,7 +222,7 @@ def create_matrix_plus_transfer_colorspace(name='matrix_plus_transfer',
         lut_resolution_1d,
         1)
 
-    # Create the 'to_reference' transforms
+    # Creating the *to_reference* transforms.
     cs.to_reference_transforms = []
     if to_reference_values:
         cs.to_reference_transforms.append({
@@ -218,7 +237,7 @@ def create_matrix_plus_transfer_colorspace(name='matrix_plus_transfer',
                 'matrix': mat44_from_mat33(matrix),
                 'direction': 'forward'})
 
-    # Create the 'from_reference' transforms
+    # Creating the *from_reference* transforms.
     cs.from_reference_transforms = []
     if from_reference_values:
         for matrix in from_reference_values:
@@ -234,9 +253,9 @@ def create_matrix_plus_transfer_colorspace(name='matrix_plus_transfer',
             'direction': 'inverse'})
 
     return cs
-# create_matrix_plus_transfer_colorspace
 
-# Transfer functions for standard color spaces
+
+# Transfer functions for standard colorspaces.
 def transfer_function_sRGB_to_linear(v):
     a = 1.055
     b = 0.04045
@@ -244,59 +263,63 @@ def transfer_function_sRGB_to_linear(v):
     g = 2.4
 
     if v < b:
-        return v/d
+        return v / d
     return pow(((v + (a - 1)) / a), g)
 
+
 def transfer_function_Rec709_to_linear(v):
     a = 1.099
     b = 0.018
     d = 4.5
-    g = (1.0/0.45)
+    g = (1.0 / 0.45)
 
-    if v < b*d:
-        return v/d
+    if v < b * d:
+        return v / d
 
     return pow(((v + (a - 1)) / a), g)
 
+
 def transfer_function_Rec2020_10bit_to_linear(v):
     a = 1.099
     b = 0.018
     d = 4.5
-    g = (1.0/0.45)
+    g = (1.0 / 0.45)
 
-    if v < b*d:
-        return v/d
+    if v < b * d:
+        return v / d
 
     return pow(((v + (a - 1)) / a), g)
 
+
 def transfer_function_Rec2020_12bit_to_linear(v):
     a = 1.0993
     b = 0.0181
     d = 4.5
-    g = (1.0/0.45)
+    g = (1.0 / 0.45)
 
-    if v < b*d:
-        return v/d
+    if v < b * d:
+        return v / d
 
     return pow(((v + (a - 1)) / a), g)
 
+
 def transfer_function_Rec1886_to_linear(v):
     g = 2.4
     Lw = 1
     Lb = 0
 
-    # Ignoring legal to full scaling for now
-    #v = (1023.0*v - 64.0)/876.0
+    # Ignoring legal to full scaling for now.
+    # v = (1023.0*v - 64.0)/876.0
 
-    t = pow(Lw, 1.0/g) - pow(Lb, 1.0/g)
+    t = pow(Lw, 1.0 / g) - pow(Lb, 1.0 / g)
     a = pow(t, g)
-    b = pow(Lb, 1.0/g)/t
+    b = pow(Lb, 1.0 / g) / t
+
+    return a * pow(max((v + b), 0.0), g)
 
-    return a*pow(max((v + b), 0.0), g)
 
 def create_colorspaces(lut_directory,
-                       lut_resolution_1d,
-                       lut_resolution_3d):
+                       lut_resolution_1d):
     """
     Generates the colorspace conversions.
 
@@ -313,19 +336,19 @@ def create_colorspaces(lut_directory,
 
     colorspaces = []
 
-    #
+    # -------------------------------------------------------------------------
     # XYZ
-    #
+    # -------------------------------------------------------------------------
     cs = create_matrix_colorspace('XYZ-D60',
-                               to_reference_values=[aces.ACES_XYZ_TO_AP0],
-                               from_reference_values=[aces.ACES_AP0_TO_XYZ],
-                               aliases=["lin_xyz_d60"])
+                                  to_reference_values=[aces.ACES_XYZ_TO_AP0],
+                                  from_reference_values=[aces.ACES_AP0_TO_XYZ],
+                                  aliases=['lin_xyz_d60'])
     colorspaces.append(cs)
 
-    #
+    # -------------------------------------------------------------------------
     # P3-D60
-    #
-    # *ACES* to *Linear*, *P3D60* primaries.
+    # -------------------------------------------------------------------------
+    # *ACES* to *Linear*, *P3D60* primaries
     XYZ_to_P3D60 = [2.4027414142, -0.8974841639, -0.3880533700,
                     -0.8325796487, 1.7692317536, 0.0237127115,
                     0.0388233815, -0.0824996856, 1.0363685997]
@@ -333,13 +356,13 @@ def create_colorspaces(lut_directory,
     cs = create_matrix_colorspace(
         'Linear - P3-D60',
         from_reference_values=[aces.ACES_AP0_TO_XYZ, XYZ_to_P3D60],
-        aliases=["lin_p3d60"])
+        aliases=['lin_p3d60'])
     colorspaces.append(cs)
 
-    #
+    # -------------------------------------------------------------------------
     # P3-DCI
-    #
-    # *ACES* to *Linear*, *P3DCI* primaries.
+    # -------------------------------------------------------------------------
+    # *ACES* to *Linear*, *P3DCI* primaries
     XYZ_to_P3DCI = [2.7253940305, -1.0180030062, -0.4401631952,
                     -0.7951680258, 1.6897320548, 0.0226471906,
                     0.0412418914, -0.0876390192, 1.1009293786]
@@ -347,14 +370,14 @@ def create_colorspaces(lut_directory,
     cs = create_matrix_colorspace(
         'Linear - P3-DCI',
         from_reference_values=[aces.ACES_AP0_TO_XYZ, XYZ_to_P3DCI],
-        aliases=["lin_p3dci"])
+        aliases=['lin_p3dci'])
     colorspaces.append(cs)
 
-    #
+    # -------------------------------------------------------------------------
     # sRGB
-    #
+    # -------------------------------------------------------------------------
     # *ACES* to *Linear*, *Rec. 709* primaries.
-    # sRGB and Rec 709 use the same gamut
+    # *sRGB* and *Rec 709* use the same gamut.
     XYZ_to_Rec709 = [3.2409699419, -1.5373831776, -0.4986107603,
                      -0.9692436363, 1.8759675015, 0.0415550574,
                      0.0556300797, -0.2039769589, 1.0569715142]
@@ -362,7 +385,7 @@ def create_colorspaces(lut_directory,
     cs = create_matrix_colorspace(
         'Linear - sRGB',
         from_reference_values=[aces.ACES_AP0_TO_XYZ, XYZ_to_Rec709],
-        aliases=["lin_srgb"])
+        aliases=['lin_srgb'])
     colorspaces.append(cs)
 
     # *Linear* to *sRGB* Transfer Function*
@@ -372,7 +395,7 @@ def create_colorspaces(lut_directory,
         transfer_function_sRGB_to_linear,
         lut_directory,
         lut_resolution_1d,
-        aliases=["crv_srgb"])
+        aliases=['crv_srgb'])
     colorspaces.append(cs)
 
     # *ACES* to *sRGB* Primaries + Transfer Function*
@@ -383,13 +406,13 @@ def create_colorspaces(lut_directory,
         lut_directory,
         lut_resolution_1d,
         from_reference_values=[aces.ACES_AP0_TO_XYZ, XYZ_to_Rec709],
-        aliases=["srgb"])
+        aliases=['srgb'])
     colorspaces.append(cs)
 
-    #
+    # -------------------------------------------------------------------------
     # Rec 709
-    #
-    # *ACES* to *Linear*, *Rec. 709* primaries.
+    # -------------------------------------------------------------------------
+    # *ACES* to *Linear*, *Rec. 709* primaries
     XYZ_to_Rec709 = [3.2409699419, -1.5373831776, -0.4986107603,
                      -0.9692436363, 1.8759675015, 0.0415550574,
                      0.0556300797, -0.2039769589, 1.0569715142]
@@ -397,7 +420,7 @@ def create_colorspaces(lut_directory,
     cs = create_matrix_colorspace(
         'Linear - Rec.709',
         from_reference_values=[aces.ACES_AP0_TO_XYZ, XYZ_to_Rec709],
-        aliases=["lin_rec709"])
+        aliases=['lin_rec709'])
     colorspaces.append(cs)
 
     # *Linear* to *Rec. 709* Transfer Function*
@@ -407,7 +430,7 @@ def create_colorspaces(lut_directory,
         transfer_function_Rec709_to_linear,
         lut_directory,
         lut_resolution_1d,
-        aliases=["crv_rec709"])
+        aliases=['crv_rec709'])
     colorspaces.append(cs)
 
     # *ACES* to *Rec. 709* Primaries + Transfer Function*
@@ -418,13 +441,13 @@ def create_colorspaces(lut_directory,
         lut_directory,
         lut_resolution_1d,
         from_reference_values=[aces.ACES_AP0_TO_XYZ, XYZ_to_Rec709],
-        aliases=["rec709_camera"])
+        aliases=['rec709_camera'])
     colorspaces.append(cs)
 
-    #
+    # -------------------------------------------------------------------------
     # Rec 2020
-    #
-    # *ACES* to *Linear*, *Rec. 2020* primaries.
+    # -------------------------------------------------------------------------
+    # *ACES* to *Linear*, *Rec. 2020* primaries
     XYZ_to_Rec2020 = [1.7166511880, -0.3556707838, -0.2533662814,
                       -0.6666843518, 1.6164812366, 0.0157685458,
                       0.0176398574, -0.0427706133, 0.9421031212]
@@ -432,7 +455,7 @@ def create_colorspaces(lut_directory,
     cs = create_matrix_colorspace(
         'Linear - Rec.2020',
         from_reference_values=[aces.ACES_AP0_TO_XYZ, XYZ_to_Rec2020],
-        aliases=["lin_rec2020"])
+        aliases=['lin_rec2020'])
     colorspaces.append(cs)
 
     # *Linear* to *Rec. 2020 10 bit* Transfer Function*
@@ -442,7 +465,7 @@ def create_colorspaces(lut_directory,
         transfer_function_Rec2020_10bit_to_linear,
         lut_directory,
         lut_resolution_1d,
-        aliases=["crv_rec2020"])
+        aliases=['crv_rec2020'])
     colorspaces.append(cs)
 
     # *ACES* to *Rec. 2020 10 bit* Primaries + Transfer Function*
@@ -453,13 +476,12 @@ def create_colorspaces(lut_directory,
         lut_directory,
         lut_resolution_1d,
         from_reference_values=[aces.ACES_AP0_TO_XYZ, XYZ_to_Rec2020],
-        aliases=["rec2020_camera"])
+        aliases=['rec2020_camera'])
     colorspaces.append(cs)
 
-    #
+    # -------------------------------------------------------------------------
     # Rec 1886
-    #
-
+    # -------------------------------------------------------------------------
     # *Linear* to *Rec.1886* Transfer Function*
     cs = create_transfer_colorspace(
         'Curve - Rec.1886',
@@ -467,7 +489,7 @@ def create_colorspaces(lut_directory,
         transfer_function_Rec1886_to_linear,
         lut_directory,
         lut_resolution_1d,
-        aliases=["crv_rec1886"])
+        aliases=['crv_rec1886'])
     colorspaces.append(cs)
 
     # *ACES* to *sRGB* Primaries + Transfer Function*
@@ -478,7 +500,7 @@ def create_colorspaces(lut_directory,
         lut_directory,
         lut_resolution_1d,
         from_reference_values=[aces.ACES_AP0_TO_XYZ, XYZ_to_Rec709],
-        aliases=["rec709_display"])
+        aliases=['rec709_display'])
     colorspaces.append(cs)
 
     # *ACES* to *sRGB* Primaries + Transfer Function*
@@ -489,13 +511,13 @@ def create_colorspaces(lut_directory,
         lut_directory,
         lut_resolution_1d,
         from_reference_values=[aces.ACES_AP0_TO_XYZ, XYZ_to_Rec2020],
-        aliases=["rec2020_display"])
+        aliases=['rec2020_display'])
     colorspaces.append(cs)
 
-    #
+    # -------------------------------------------------------------------------
     # ProPhoto
-    #
-    # *ACES* to *Linear*, *Pro Photo* primaries.
+    # -------------------------------------------------------------------------
+    # *ACES* to *Linear*, *Pro Photo* primaries
     AP0_to_RIMM = [1.2412367771, -0.1685692287, -0.0726675484,
                    0.0061203066, 1.083151174, -0.0892714806,
                    -0.0032853314, 0.0099796402, 0.9933056912]
@@ -503,13 +525,13 @@ def create_colorspaces(lut_directory,
     cs = create_matrix_colorspace(
         'Linear - RIMM ROMM (ProPhoto)',
         from_reference_values=[AP0_to_RIMM],
-        aliases=["lin_prophoto", "lin_rimm"])
+        aliases=['lin_prophoto', 'lin_rimm'])
     colorspaces.append(cs)
 
-    #
+    # -------------------------------------------------------------------------
     # Adobe RGB
-    #
-    # *ACES* to *Linear*, *Adobe RGB* primaries.
+    # -------------------------------------------------------------------------
+    # *ACES* to *Linear*, *Adobe RGB* primaries
     AP0_to_ADOBERGB = [1.7245603168, -0.4199935942, -0.3045667227,
                        -0.2764799142, 1.3727190877, -0.0962391734,
                        -0.0261255258, -0.0901747807, 1.1163003065]
@@ -517,14 +539,13 @@ def create_colorspaces(lut_directory,
     cs = create_matrix_colorspace(
         'Linear - Adobe RGB',
         from_reference_values=[AP0_to_ADOBERGB],
-        aliases=["lin_adobergb"])
+        aliases=['lin_adobergb'])
     colorspaces.append(cs)
 
-    #
+    # -------------------------------------------------------------------------
     # Adobe Wide Gamut RGB
-    #
-
-    # *ACES* to *Linear*, *Adobe Wide Gamut RGB* primaries.
+    # -------------------------------------------------------------------------
+    # *ACES* to *Linear*, *Adobe Wide Gamut RGB* primaries
     AP0_to_ADOBERGB = [1.3809814778, -0.1158594573, -0.2651220205,
                        0.0057015535, 1.0402949043, -0.0459964578,
                        -0.0038908746, -0.0597091815, 1.0636000561]
@@ -532,7 +553,7 @@ def create_colorspaces(lut_directory,
     cs = create_matrix_colorspace(
         'Linear - Adobe Wide Gamut RGB',
         from_reference_values=[AP0_to_ADOBERGB],
-        aliases=["lin_adobewidegamutrgb"])
+        aliases=['lin_adobewidegamutrgb'])
     colorspaces.append(cs)
 
     return colorspaces
@@ -540,14 +561,12 @@ def create_colorspaces(lut_directory,
 
 def create_raw():
     # *Raw* utility space
-    name = "Raw"
+    name = 'Raw'
     raw = ColorSpace(name)
     raw.description = 'The %s color space' % name
-    raw.aliases = ["raw"]
+    raw.aliases = ['raw']
     raw.equality_group = name
     raw.family = 'Utility'
     raw.is_data = True
 
     return raw
-
-
index 0b05f57..44b5858 100644 (file)
@@ -28,7 +28,6 @@ __all__ = ['create_protune',
 
 def create_protune(gamut,
                    transfer_function,
-                   name,
                    lut_directory,
                    lut_resolution_1d,
                    aliases):
@@ -48,8 +47,8 @@ def create_protune(gamut,
          Return value description.
     """
 
-    # The gamut should be marked as experimental until
-    # matrices are fully verified
+    # The gamut should be marked as experimental until  matrices are fully
+    # verified.
     name = '%s - %s - Experimental' % (transfer_function, gamut)
     if transfer_function == '':
         name = 'Linear - %s - Experimental' % gamut
@@ -63,7 +62,7 @@ def create_protune(gamut,
     cs.family = 'Input/GoPro'
     cs.is_data = False
 
-    # A linear space needs allocation variables
+    # A linear space needs allocation variables.
     if transfer_function == '':
         cs.allocation_type = ocio.Constants.ALLOCATION_LG2
         cs.allocation_vars = [-8, 5, 0.00390625]
@@ -72,7 +71,7 @@ def create_protune(gamut,
         c1 = 113.0
         c2 = 1.0
         c3 = 112.0
-        linear = ((pow(c1, (normalized_code_value)) - c2) / c3)
+        linear = ((pow(c1, normalized_code_value) - c2) / c3)
 
         return linear
 
@@ -133,30 +132,27 @@ def create_colorspaces(lut_directory, lut_resolution_1d):
     protune_1 = create_protune(
         'Protune Native',
         'Protune Flat',
-        'Protune',
         lut_directory,
         lut_resolution_1d,
-        ["protuneflat_protunegamutexp"])
+        ['protuneflat_protunegamutexp'])
     colorspaces.append(protune_1)
 
     # Linearization Only
     protune_2 = create_protune(
         '',
         'Protune Flat',
-        'Protune',
         lut_directory,
         lut_resolution_1d,
-        ["crv_protuneflat"])
+        ['crv_protuneflat'])
     colorspaces.append(protune_2)
 
     # Primaries Only
     protune_3 = create_protune(
         'Protune Native',
         '',
-        'Protune',
         lut_directory,
         lut_resolution_1d,
-        ["lin_protunegamutexp"])
+        ['lin_protunegamutexp'])
     colorspaces.append(protune_3)
 
     return colorspaces
index 359ec2e..2d32131 100644 (file)
@@ -2,7 +2,8 @@
 # -*- coding: utf-8 -*-
 
 """
-Implements support for *Panasonic* colorspaces conversions and transfer functions.
+Implements support for *Panasonic* colorspaces conversions and transfer
+functions.
 """
 
 import array
@@ -26,7 +27,6 @@ __all__ = ['create_v_log',
 
 def create_v_log(gamut,
                  transfer_function,
-                 name,
                  lut_directory,
                  lut_resolution_1d,
                  aliases):
@@ -65,12 +65,12 @@ def create_v_log(gamut,
         cs.allocation_vars = [-8, 5, 0.00390625]
 
     def v_log_to_linear(x):
-        cutInv = 0.181
+        cut_inv = 0.181
         b = 0.00873
         c = 0.241514
         d = 0.598206
 
-        if (x <= cutInv):
+        if x <= cut_inv:
             return (x - 0.125) / 5.6
         else:
             return pow(10, (x - d) / c) - b
@@ -131,30 +131,27 @@ def create_colorspaces(lut_directory, lut_resolution_1d):
     v_log_1 = create_v_log(
         'V-Gamut',
         'V-Log',
-        'V-Log',
         lut_directory,
         lut_resolution_1d,
-        ["vlog_vgamut"])
+        ['vlog_vgamut'])
     colorspaces.append(v_log_1)
 
     # Linearization Only
     v_log_2 = create_v_log(
         '',
         'V-Log',
-        'V-Log',
         lut_directory,
         lut_resolution_1d,
-        ["crv_vlog"])
+        ['crv_vlog'])
     colorspaces.append(v_log_2)
 
     # Primaries Only
     v_log_3 = create_v_log(
         'V-Gamut',
         '',
-        'V-Log',
         lut_directory,
         lut_resolution_1d,
-        ["lin_vgamut"])
+        ['lin_vgamut'])
     colorspaces.append(v_log_3)
 
     return colorspaces
index 67792f8..0614a7f 100644 (file)
@@ -22,16 +22,15 @@ __maintainer__ = 'ACES Developers'
 __email__ = 'aces@oscars.org'
 __status__ = 'Production'
 
-__all__ = ['create_RED_log_film',
+__all__ = ['create_red_log_film',
            'create_colorspaces']
 
 
-def create_RED_log_film(gamut,
+def create_red_log_film(gamut,
                         transfer_function,
-                        name,
                         lut_directory,
                         lut_resolution_1d,
-                        aliases=[]):
+                        aliases=None):
     """
     Object description.
 
@@ -48,6 +47,9 @@ def create_RED_log_film(gamut,
          Return value description.
     """
 
+    if aliases is None:
+        aliases = []
+
     name = '%s - %s' % (transfer_function, gamut)
     if transfer_function == '':
         name = 'Linear - %s' % gamut
@@ -166,123 +168,110 @@ def create_colorspaces(lut_directory, lut_resolution_1d):
     colorspaces = []
 
     # Full conversion
-    RED_log_film_dragon = create_RED_log_film(
+    red_log_film_dragon = create_red_log_film(
         'DRAGONcolor',
         'REDlogFilm',
-        'REDlogFilm',
         lut_directory,
         lut_resolution_1d,
-        ["rlf_dgn"])
-    colorspaces.append(RED_log_film_dragon)
+        ['rlf_dgn'])
+    colorspaces.append(red_log_film_dragon)
 
-    RED_log_film_dragon2 = create_RED_log_film(
+    red_log_film_dragon2 = create_red_log_film(
         'DRAGONcolor2',
         'REDlogFilm',
-        'REDlogFilm',
         lut_directory,
         lut_resolution_1d,
-        ["rlf_dgn2"])
-    colorspaces.append(RED_log_film_dragon2)
+        ['rlf_dgn2'])
+    colorspaces.append(red_log_film_dragon2)
 
-    RED_log_film_color = create_RED_log_film(
+    red_log_film_color = create_red_log_film(
         'REDcolor',
         'REDlogFilm',
-        'REDlogFilm',
         lut_directory,
         lut_resolution_1d,
-        ["rlf_rc"])
-    colorspaces.append(RED_log_film_color)
+        ['rlf_rc'])
+    colorspaces.append(red_log_film_color)
 
-    RED_log_film_color2 = create_RED_log_film(
+    red_log_film_color2 = create_red_log_film(
         'REDcolor2',
         'REDlogFilm',
-        'REDlogFilm',
         lut_directory,
         lut_resolution_1d,
-        ["rlf_rc2"])
-    colorspaces.append(RED_log_film_color2)
+        ['rlf_rc2'])
+    colorspaces.append(red_log_film_color2)
 
-    RED_log_film_color3 = create_RED_log_film(
+    red_log_film_color3 = create_red_log_film(
         'REDcolor3',
         'REDlogFilm',
-        'REDlogFilm',
         lut_directory,
         lut_resolution_1d,
-        ["rlf_rc3"])
-    colorspaces.append(RED_log_film_color3)
+        ['rlf_rc3'])
+    colorspaces.append(red_log_film_color3)
 
-    RED_log_film_color4 = create_RED_log_film(
+    red_log_film_color4 = create_red_log_film(
         'REDcolor4',
         'REDlogFilm',
-        'REDlogFilm',
         lut_directory,
         lut_resolution_1d,
-        ["rlf_rc4"])
-    colorspaces.append(RED_log_film_color4)
+        ['rlf_rc4'])
+    colorspaces.append(red_log_film_color4)
 
     # Linearization only
-    RED_log_film = create_RED_log_film(
+    red_log_film = create_red_log_film(
         '',
         'REDlogFilm',
-        'REDlogFilm',
         lut_directory,
         lut_resolution_1d,
-        ["crv_rlf"])
-    colorspaces.append(RED_log_film)
+        ['crv_rlf'])
+    colorspaces.append(red_log_film)
 
     # Primaries only
-    RED_dragon = create_RED_log_film(
+    red_dragon = create_red_log_film(
         'DRAGONcolor',
         '',
-        'REDlogFilm',
         lut_directory,
         lut_resolution_1d,
-        ["lin_dgn"])
-    colorspaces.append(RED_dragon)
+        ['lin_dgn'])
+    colorspaces.append(red_dragon)
 
-    RED_dragon2 = create_RED_log_film(
+    red_dragon2 = create_red_log_film(
         'DRAGONcolor2',
         '',
-        'REDlogFilm',
         lut_directory,
         lut_resolution_1d,
-        ["lin_dgn2"])
-    colorspaces.append(RED_dragon2)
+        ['lin_dgn2'])
+    colorspaces.append(red_dragon2)
 
-    RED_color = create_RED_log_film(
+    red_color = create_red_log_film(
         'REDcolor',
         '',
-        'REDlogFilm',
         lut_directory,
         lut_resolution_1d,
-        ["lin_rc"])
-    colorspaces.append(RED_color)
+        ['lin_rc'])
+    colorspaces.append(red_color)
 
-    RED_color2 = create_RED_log_film(
+    red_color2 = create_red_log_film(
         'REDcolor2',
         '',
-        'REDlogFilm',
         lut_directory,
         lut_resolution_1d,
-        ["lin_rc2"])
-    colorspaces.append(RED_color2)
+        ['lin_rc2'])
+    colorspaces.append(red_color2)
 
-    RED_color3 = create_RED_log_film(
+    red_color3 = create_red_log_film(
         'REDcolor3',
         '',
-        'REDlogFilm',
         lut_directory,
         lut_resolution_1d,
-        ["lin_rc3"])
-    colorspaces.append(RED_color3)
+        ['lin_rc3'])
+    colorspaces.append(red_color3)
 
-    RED_color4 = create_RED_log_film(
+    red_color4 = create_red_log_film(
         'REDcolor4',
         '',
-        'REDlogFilm',
         lut_directory,
         lut_resolution_1d,
-        ["lin_rc4"])
-    colorspaces.append(RED_color4)
+        ['lin_rc4'])
+    colorspaces.append(red_color4)
 
     return colorspaces
index 2d221f9..a19d2e5 100644 (file)
@@ -28,7 +28,6 @@ __all__ = ['create_s_log',
 
 def create_s_log(gamut,
                  transfer_function,
-                 name,
                  lut_directory,
                  lut_resolution_1d,
                  aliases):
@@ -62,10 +61,11 @@ def create_s_log(gamut,
     cs.is_data = False
 
     if gamut and transfer_function:
-        cs.aces_transform_id = "IDT.Sony.%s_%s_10i.a1.v1" % (
-            transfer_function.replace('-', ''), gamut.replace('-', '').replace(' ', '_'))
+        cs.aces_transform_id = 'IDT.Sony.%s_%s_10i.a1.v1' % (
+            transfer_function.replace('-', ''),
+            gamut.replace('-', '').replace(' ', '_'))
 
-    # A linear space needs allocation variables
+    # A linear space needs allocation variables.
     if transfer_function == '':
         cs.allocation_type = ocio.Constants.ALLOCATION_LG2
         cs.allocation_vars = [-8, 5, 0.00390625]
@@ -235,131 +235,117 @@ def create_colorspaces(lut_directory, lut_resolution_1d):
     s_log1_s_gamut = create_s_log(
         'S-Gamut',
         'S-Log1',
-        'S-Log',
         lut_directory,
         lut_resolution_1d,
-        ["slog1_sgamut"])
+        ['slog1_sgamut'])
     colorspaces.append(s_log1_s_gamut)
 
     # *S-Log2*
     s_log2_s_gamut = create_s_log(
         'S-Gamut',
         'S-Log2',
-        'S-Log2',
         lut_directory,
         lut_resolution_1d,
-        ["slog2_sgamut"])
+        ['slog2_sgamut'])
     colorspaces.append(s_log2_s_gamut)
 
     s_log2_s_gamut_daylight = create_s_log(
         'S-Gamut Daylight',
         'S-Log2',
-        'S-Log2',
         lut_directory,
         lut_resolution_1d,
-        ["slog2_sgamutday"])
+        ['slog2_sgamutday'])
     colorspaces.append(s_log2_s_gamut_daylight)
 
     s_log2_s_gamut_tungsten = create_s_log(
         'S-Gamut Tungsten',
         'S-Log2',
-        'S-Log2',
         lut_directory,
         lut_resolution_1d,
-        ["slog2_sgamuttung"])
+        ['slog2_sgamuttung'])
     colorspaces.append(s_log2_s_gamut_tungsten)
 
     # *S-Log3*
     s_log3_s_gamut3Cine = create_s_log(
         'S-Gamut3.Cine',
         'S-Log3',
-        'S-Log3',
         lut_directory,
         lut_resolution_1d,
-        ["slog3_sgamutcine"])
+        ['slog3_sgamutcine'])
     colorspaces.append(s_log3_s_gamut3Cine)
 
     s_log3_s_gamut3 = create_s_log(
         'S-Gamut3',
         'S-Log3',
-        'S-Log3',
         lut_directory,
         lut_resolution_1d,
-        ["slog3_sgamut3"])
+        ['slog3_sgamut3'])
     colorspaces.append(s_log3_s_gamut3)
 
     # Linearization Only
     s_log1 = create_s_log(
         '',
         'S-Log1',
-        'S-Log',
         lut_directory,
         lut_resolution_1d,
-        ["crv_slog1"])
+        ['crv_slog1'])
     colorspaces.append(s_log1)
 
     s_log2 = create_s_log(
         '',
         'S-Log2',
-        'S-Log2',
         lut_directory,
         lut_resolution_1d,
-        ["crv_slog2"])
+        ['crv_slog2'])
     colorspaces.append(s_log2)
 
     s_log3 = create_s_log(
         '',
         'S-Log3',
-        'S-Log3',
         lut_directory,
         lut_resolution_1d,
-        ["crv_slog3"])
+        ['crv_slog3'])
     colorspaces.append(s_log3)
 
     # Primaries Only
     s_gamut = create_s_log(
         'S-Gamut',
         '',
-        'S-Log',
         lut_directory,
         lut_resolution_1d,
-        ["lin_sgamut"])
+        ['lin_sgamut'])
     colorspaces.append(s_gamut)
 
     s_gamut_daylight = create_s_log(
         'S-Gamut Daylight',
         '',
-        'S-Log2',
         lut_directory,
         lut_resolution_1d,
-        ["lin_sgamutday"])
+        ['lin_sgamutday'])
     colorspaces.append(s_gamut_daylight)
 
     s_gamut_tungsten = create_s_log(
         'S-Gamut Tungsten',
         '',
-        'S-Log2',
         lut_directory,
         lut_resolution_1d,
-        ["lin_sgamuttung"])
+        ['lin_sgamuttung'])
     colorspaces.append(s_gamut_tungsten)
 
     s_gamut3Cine = create_s_log(
         'S-Gamut3.Cine',
         '',
-        'S-Log3',
         lut_directory,
         lut_resolution_1d,
-        ["lin_sgamut3cine"])
+        ['lin_sgamut3cine'])
     colorspaces.append(s_gamut3Cine)
 
     s_gamut3 = create_s_log(
         'S-Gamut3',
         '',
-        'S-Log3',
         lut_directory,
         lut_resolution_1d,
-        ["lin_sgamut3"])
+        ['lin_sgamut3'])
     colorspaces.append(s_gamut3)
 
     return colorspaces
similarity index 57%
rename from aces_1.0.0/python/aces_ocio/aces_config.py
rename to aces_1.0.0/python/aces_ocio/generate_config.py
index 3cc5727..94c6811 100755 (executable)
@@ -23,7 +23,12 @@ from aces_ocio.colorspaces import red
 from aces_ocio.colorspaces import sony
 from aces_ocio.process import Process
 
-from aces_ocio.utilities import replace, ColorSpace, compact
+from aces_ocio.utilities import (
+    ColorSpace,
+    colorspace_prefixed_name,
+    compact,
+    replace,
+    unpack_default)
 
 __author__ = 'ACES Developers'
 __copyright__ = 'Copyright (C) 2014 - 2015 - ACES Developers'
@@ -34,145 +39,114 @@ __status__ = 'Production'
 
 __all__ = ['ACES_OCIO_CTL_DIRECTORY_ENVIRON',
            'ACES_OCIO_CONFIGURATION_DIRECTORY_ENVIRON',
-           'set_config_default_roles',
-           'write_config',
-           'generate_OCIO_transform',
-           'add_colorspace_alias',
+           'set_config_roles',
+           'create_ocio_transform',
+           'add_colorspace_aliases',
+           'add_look',
+           'add_looks_to_views',
            'create_config',
-           'generate_LUTs',
+           'create_config_data',
+           'write_config',
            'generate_baked_LUTs',
-           'create_config_dir',
-           'create_ACES_config',
+           'generate_config_directory',
+           'generate_config',
            'main']
 
 ACES_OCIO_CTL_DIRECTORY_ENVIRON = 'ACES_OCIO_CTL_DIRECTORY'
 ACES_OCIO_CONFIGURATION_DIRECTORY_ENVIRON = 'ACES_OCIO_CONFIGURATION_DIRECTORY'
 
 
-def set_config_default_roles(config,
-                             color_picking='',
-                             color_timing='',
-                             compositing_log='',
-                             data='',
-                             default='',
-                             matte_paint='',
-                             reference='',
-                             scene_linear='',
-                             texture_paint='',
-                             rendering='',
-                             compositing_linear=''):
+def set_config_roles(config,
+                     color_picking=None,
+                     color_timing=None,
+                     compositing_log=None,
+                     data=None,
+                     default=None,
+                     matte_paint=None,
+                     reference=None,
+                     scene_linear=None,
+                     texture_paint=None,
+                     rendering=None,
+                     compositing_linear=None):
     """
-    Sets given *OCIO* configuration default roles.
-
+    Sets given *OCIO* configuration roles to the config.
     Parameters
     ----------
-    config : config
+    config : Config
         *OCIO* configuration.
-    color_picking : str or unicode
+    color_picking : str or unicode, optional
         Color picking role title.
-    color_timing : str or unicode
+    color_timing : str or unicode, optional
         Color timing role title.
-    compositing_log : str or unicode
+    compositing_log : str or unicode, optional
         Compositing log role title.
-    data : str or unicode
+    data : str or unicode, optional
         Data role title.
-    default : str or unicode
+    default : str or unicode, optional
         Default role title.
-    matte_paint : str or unicode
+    matte_paint : str or unicode, optional
         Matte painting role title.
-    reference : str or unicode
+    reference : str or unicode, optional
         Reference role title.
-    scene_linear : str or unicode
+    scene_linear : str or unicode, optional
         Scene linear role title.
-    texture_paint : str or unicode
+    texture_paint : str or unicode, optional
         Texture painting role title.
-
     Returns
     -------
     bool
          Definition success.
     """
 
-    if color_picking:
+    if color_picking is not None:
         config.setRole(ocio.Constants.ROLE_COLOR_PICKING, color_picking)
-    if color_timing:
+    if color_timing is not None:
         config.setRole(ocio.Constants.ROLE_COLOR_TIMING, color_timing)
-    if compositing_log:
+    if compositing_log is not None:
         config.setRole(ocio.Constants.ROLE_COMPOSITING_LOG, compositing_log)
-    if data:
+    if data is not None:
         config.setRole(ocio.Constants.ROLE_DATA, data)
-    if default:
+    if default is not None:
         config.setRole(ocio.Constants.ROLE_DEFAULT, default)
-    if matte_paint:
+    if matte_paint is not None:
         config.setRole(ocio.Constants.ROLE_MATTE_PAINT, matte_paint)
-    if reference:
+    if reference is not None:
         config.setRole(ocio.Constants.ROLE_REFERENCE, reference)
-    if texture_paint:
+    if texture_paint is not None:
         config.setRole(ocio.Constants.ROLE_TEXTURE_PAINT, texture_paint)
 
-    # 'rendering' and 'compositing_linear' roles default to the 'scene_linear'
-    # value if not set explicitly
-    if rendering:
-        config.setRole("rendering", rendering)
-    if compositing_linear:
-        config.setRole("compositing_linear", compositing_linear)
-    if scene_linear:
+    # *rendering* and *compositing_linear* roles default to the *scene_linear*
+    # value if not set explicitly.
+    if rendering is not None:
+        config.setRole('rendering', rendering)
+    if compositing_linear is not None:
+        config.setRole('compositing_linear', compositing_linear)
+    if scene_linear is not None:
         config.setRole(ocio.Constants.ROLE_SCENE_LINEAR, scene_linear)
-        if not rendering:
-            config.setRole("rendering", scene_linear)
-        if not compositing_linear:
-            config.setRole("compositing_linear", scene_linear)
+        if rendering is None:
+            config.setRole('rendering', scene_linear)
+        if compositing_linear is None:
+            config.setRole('compositing_linear', scene_linear)
 
     return True
 
 
-def write_config(config, config_path, sanity_check=True):
-    """
-    Writes the configuration to given path.
-
-    Parameters
-    ----------
-    parameter : type
-        Parameter description.
-
-    Returns
-    -------
-    type
-         Return value description.
-    """
-
-    if sanity_check:
-        try:
-            config.sanityCheck()
-        except Exception, e:
-            print e
-            print 'Configuration was not written due to a failed Sanity Check'
-            return
-
-    with open(config_path, mode='w') as fp:
-        fp.write(config.serialize())
-
-
-def generate_OCIO_transform(transforms):
+def create_ocio_transform(transforms):
     """
-    Object description.
+    Returns an *OCIO* transform from given array of transform descriptions.
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    transforms : array_like
+        Transform descriptions as an array_like of dicts:
+        {'type', 'src', 'dst', 'direction'}
 
     Returns
     -------
-    type
-         Return value description.
+    Transform
+         *OCIO* transform.
     """
 
-    interpolation_options = {
-        'linear': ocio.Constants.INTERP_LINEAR,
-        'nearest': ocio.Constants.INTERP_NEAREST,
-        'tetrahedral': ocio.Constants.INTERP_TETRAHEDRAL}
-
     direction_options = {
         'forward': ocio.Constants.TRANSFORM_DIR_FORWARD,
         'inverse': ocio.Constants.TRANSFORM_DIR_INVERSE}
@@ -181,9 +155,8 @@ def generate_OCIO_transform(transforms):
 
     for transform in transforms:
 
-        # lutFile transform
+        # *lutFile* transform
         if transform['type'] == 'lutFile':
-            # Create transforms
             ocio_transform = ocio.FileTransform()
 
             if 'path' in transform:
@@ -203,11 +176,11 @@ def generate_OCIO_transform(transforms):
 
             ocio_transforms.append(ocio_transform)
 
-        # matrix transform
+        # *matrix* transform
         elif transform['type'] == 'matrix':
             ocio_transform = ocio.MatrixTransform()
-            # MatrixTransform member variables can't be initialized directly.
-            # Each must be set individually.
+            # `MatrixTransform` member variables can't be initialized directly,
+            # each must be set individually.
             ocio_transform.setMatrix(transform['matrix'])
 
             if 'offset' in transform:
@@ -219,7 +192,7 @@ def generate_OCIO_transform(transforms):
 
             ocio_transforms.append(ocio_transform)
 
-        # exponent transform
+        # *exponent* transform
         elif transform['type'] == 'exponent':
             ocio_transform = ocio.ExponentTransform()
 
@@ -228,7 +201,7 @@ def generate_OCIO_transform(transforms):
 
             ocio_transforms.append(ocio_transform)
 
-        # log transform
+        # *log* transform
         elif transform['type'] == 'log':
             ocio_transform = ocio.LogTransform()
 
@@ -241,7 +214,7 @@ def generate_OCIO_transform(transforms):
 
             ocio_transforms.append(ocio_transform)
 
-        # color space transform
+        # *colorspace* transform
         elif transform['type'] == 'colorspace':
             ocio_transform = ocio.ColorSpaceTransform()
 
@@ -257,7 +230,7 @@ def generate_OCIO_transform(transforms):
 
             ocio_transforms.append(ocio_transform)
 
-        # look transform
+        # *look* transform
         elif transform['type'] == 'look':
             ocio_transform = ocio.LookTransform()
             if 'look' in transform:
@@ -275,9 +248,9 @@ def generate_OCIO_transform(transforms):
 
             ocio_transforms.append(ocio_transform)
 
-        # unknown type
+        # *unknown* type
         else:
-            print("Ignoring unknown transform type : %s" % transform['type'])
+            print('Ignoring unknown transform type : %s' % transform['type'])
 
     if len(ocio_transforms) > 1:
         group_transform = ocio.GroupTransform()
@@ -296,23 +269,30 @@ def add_colorspace_aliases(config,
                            colorspace_alias_names,
                            family='Aliases'):
     """
-    Object description.
+    Adds given colorspace aliases to the *OCIO* config.
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    config : Config
+        *OCIO* configuration.
+    reference_colorspace : Colorspace
+        Reference colorspace.
+    colorspace : Colorspace
+        Colorspace to set the aliases into the *OCIO* config.
+    family : unicode
+        Family.
 
     Returns
     -------
-    type
-         Return value description.
+    bool
+        Definition success.
     """
 
     for alias_name in colorspace_alias_names:
         if alias_name.lower() == colorspace.name.lower():
-            print('Skipping alias creation for %s, alias %s, because lower cased names match' % (
-                colorspace.name, alias_name) )
+            print('Skipping alias creation for %s, alias %s, '
+                  'because lower cased names match' % (
+                      colorspace.name, alias_name))
             continue
 
         print('Adding alias colorspace space %s, alias to %s' % (
@@ -322,7 +302,8 @@ def add_colorspace_aliases(config,
 
         description = colorspace.description
         if colorspace.aces_transform_id:
-            description += "\n\nACES Transform ID : %s" % colorspace.aces_transform_id
+            description += (
+                '\n\nACES Transform ID : %s' % colorspace.aces_transform_id)
 
         ocio_colorspace_alias = ocio.ColorSpace(
             name=alias_name,
@@ -336,7 +317,7 @@ def add_colorspace_aliases(config,
 
         if colorspace.to_reference_transforms:
             print('\tGenerating To-Reference transforms')
-            ocio_transform = generate_OCIO_transform(
+            ocio_transform = create_ocio_transform(
                 [{'type': 'colorspace',
                   'src': colorspace.name,
                   'dst': reference_colorspace.name,
@@ -347,7 +328,7 @@ def add_colorspace_aliases(config,
 
         if colorspace.from_reference_transforms:
             print('\tGenerating From-Reference transforms')
-            ocio_transform = generate_OCIO_transform(
+            ocio_transform = create_ocio_transform(
                 [{'type': 'colorspace',
                   'src': reference_colorspace.name,
                   'dst': colorspace.name,
@@ -358,59 +339,52 @@ def add_colorspace_aliases(config,
 
         config.addColorSpace(ocio_colorspace_alias)
 
-def colorspace_prefixed_name(colorspace):
-    prefix = colorspace.family.replace("/", " - ")
-    return "%s - %s" % (prefix, colorspace.name)
 
 def add_look(config,
              look,
-             prefix,
              custom_lut_dir,
              reference_name,
-             config_data,
-             multiple_displays=False):
+             config_data):
     """
-    Object description.
+    Adds given look to the *OCIO* config.
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    config : Config
+        *OCIO* configuration.
+    look : array_like
+        Look description: {'name', 'colorspace', 'lut', 'cccid'}
+    custom_lut_dir : str or unicode
+        Directory to copy the look lut into.
+    reference_name : str or unicode
+        Reference name.
+    config_data : dict
+        Colorspaces and transforms converting between those colorspaces and
+        the reference colorspace, *ACES*.
 
     Returns
     -------
-    type
-         Return value description.
+    bool
+        Definition success.
     """
 
-    look_name = look[0]
-    look_colorspace = look[1]
-    look_lut = look[2]
-    look_cccid = None
-    if len(look) == 4:
-        look_cccid = look[3]
+    look_name, look_colorspace, look_lut, look_cccid = unpack_default(look, 4)
 
-    print('Adding look %s - %s' % (look_name, ", ".join(look)) )
+    print('Adding look %s - %s' % (look_name, ', '.join(look)))
 
-    #
-    # Copy look lut
-    #
+    # Copy *look LUT* if `custom_lut_dir` is provided.
     if custom_lut_dir:
-        if not '$' in look_lut:
-            print( "Getting ready to copy look lut : %s" % look_lut )
+        if '$' not in look_lut:
+            print('Getting ready to copy look lut : %s' % look_lut)
             shutil.copy2(look_lut, custom_lut_dir)
             look_lut = os.path.split(look_lut)[1]
         else:
-            print( "Skipping LUT copy because path contains a context variable" )
+            print('Skipping LUT copy because path contains a context variable')
 
-    #
-    # Create OCIO Look
-    #
-    # Look 1
-    print('Adding look to config' )
-    lk1 = ocio.Look()
-    lk1.setName( look_name )
-    lk1.setProcessSpace( look_colorspace )
+    print('Adding look to config')
+    ocio_look = ocio.Look()
+    ocio_look.setName(look_name)
+    ocio_look.setProcessSpace(look_colorspace)
 
     keys = {'type': 'lutFile',
             'path': look_lut,
@@ -418,44 +392,40 @@ def add_look(config,
     if look_cccid:
         keys['cccid'] = look_cccid
 
-    ocio_transform = generate_OCIO_transform([keys])
-    lk1.setTransform( ocio_transform )
+    ocio_transform = create_ocio_transform([keys])
+    ocio_look.setTransform(ocio_transform)
 
-    # add to config
-    config.addLook( lk1 )
+    config.addLook(ocio_look)
 
-    print( "Creating aliased colorspace")
+    print('Creating aliased colorspace')
 
-    #
-    # Create OCIO colorspace that references that look
-    # - Needed for some implementations that don't process looks well
-    # - Also needed for some implementations that don't expose looks well
-    #
-    look_aliases = ["look_%s" % compact(look_name)]
+    # Creating *OCIO* colorspace referencing the look:
+    # - Needed for implementations that don't process looks properly.
+    # - Needed for implementations that don't expose looks properly.
+    look_aliases = ['look_%s' % compact(look_name)]
     colorspace = ColorSpace(look_name,
-        aliases=look_aliases,
-        description="The %s Look colorspace" % look_name,
-        family='Look')
+                            aliases=look_aliases,
+                            description='The %s Look colorspace' % look_name,
+                            family='Look')
 
     colorspace.from_reference_transforms = [{'type': 'look',
-        'look': look_name,
-        'src': reference_name,
-        'dst': reference_name,
-        'direction': 'forward'}]
+                                             'look': look_name,
+                                             'src': reference_name,
+                                             'dst': reference_name,
+                                             'direction': 'forward'}]
 
     print('Adding colorspace %s, alias to look %s to config data' % (
         look_name, look_name))
 
-    # Add this colorspace into the main list of colorspaces
     config_data['colorSpaces'].append(colorspace)
 
-    print("")
+    print('')
+
 
-def integrate_looks_into_views(config,
-                               looks,
-                               reference_name,
-                               config_data,
-                               multiple_displays=False):
+def add_looks_to_views(looks,
+                       reference_name,
+                       config_data,
+                       multiple_displays=False):
     """
     Object description.
 
@@ -469,79 +439,88 @@ def integrate_looks_into_views(config,
     type
          Return value description.
     """
-    look_names = [look[0] for look in looks] 
+    look_names = [look[0] for look in looks]
 
-    # Option 1 - Add a 'look' to each Display
-    # - Assumes there is a Display for each ACES Output Transform
+    # Option 1
+    # - Adding a *look* per *Display*.
+    # - Assuming there is a *Display* for each *ACES* *Output Transform*.
     if multiple_displays:
         for look_name in look_names:
             config_data['looks'].append(look_name)
 
     # Option 2
-    # - Copy each Output Transform colorspace
-    # - For each copy, add a LookTransform at the head of the from_reference
-    #     transform list
-    # - Add these new copied colorspaces for the Displays / Views 
+    # - Copy each *Output Transform* colorspace.
+    # - For each copy, add a *LookTransform* to the head of the
+    # `from_reference` transform list.
+    # - Add these the copy colorspaces for the *Displays* / *Views*.
     else:
         for display, view_list in config_data['displays'].iteritems():
-            output_colorspace_copy = None
-            look_names_string = ""
+            colorspace_c = None
+            look_names_string = ''
             for view_name, output_colorspace in view_list.iteritems():
-                if view_name == "Output Transform":
+                if view_name == 'Output Transform':
 
-                    print( "Adding new View that incorporates looks" )
+                    print('Adding new View that incorporates looks')
 
-                    # Make a copy of the output colorspace
-                    output_colorspace_copy = copy.deepcopy(output_colorspace)
+                    colorspace_c = copy.deepcopy(output_colorspace)
 
-                    #for look_name in look_names:
-                    for i in range(len(look_names)):
+                    for i, look_name in enumerate(look_names):
                         look_name = look_names[i]
 
-                        # Add the LookTransform to the head of the from_reference transform list
-                        if output_colorspace_copy.from_reference_transforms:
-                            output_colorspace_copy.from_reference_transforms.insert(i, {'type': 'look',
-                                'look': look_name,
-                                'src': reference_name,
-                                'dst': reference_name,
-                                'direction': 'forward'})
-
-                        # Add the LookTransform to the end of the to_reference transform list
-                        if output_colorspace_copy.to_reference_transforms:
-                            inverse_look_name = look_names[len(look_names) -1 -i]
-
-                            output_colorspace_copy.to_reference_transforms.append({'type': 'look',
-                                'look': inverse_look_name,
-                                'src': reference_name,
-                                'dst': reference_name,
-                                'direction': 'inverse'})
-
-                        if not look_name in config_data['looks']:
+                        # Add the `LookTransform` to the head of the
+                        # `from_reference` transform list.
+                        if colorspace_c.from_reference_transforms:
+                            colorspace_c.from_reference_transforms.insert(
+                                i,
+                                {'type': 'look',
+                                 'look': look_name,
+                                 'src': reference_name,
+                                 'dst': reference_name,
+                                 'direction': 'forward'})
+
+                        # Add the `LookTransform` to the end of
+                        # the `to_reference` transform list.
+                        if colorspace_c.to_reference_transforms:
+                            inverse_look_name = look_names[
+                                len(look_names) - 1 - i]
+
+                            colorspace_c.to_reference_transforms.append(
+                                {'type': 'look',
+                                 'look': inverse_look_name,
+                                 'src': reference_name,
+                                 'dst': reference_name,
+                                 'direction': 'inverse'})
+
+                        if look_name not in config_data['looks']:
                             config_data['looks'].append(look_name)
 
-                    look_names_string = ", ".join(look_names)
-                    output_colorspace_copy.name = "%s with %s" % (output_colorspace.name, look_names_string)
-                    output_colorspace_copy.aliases = ["out_%s" % compact(output_colorspace_copy.name)]
+                    look_names_string = ', '.join(look_names)
+                    colorspace_c.name = '%s with %s' % (
+                        output_colorspace.name, look_names_string)
+                    colorspace_c.aliases = [
+                        'out_%s' % compact(colorspace_c.name)]
 
-                    print( "Colorspace that incorporates looks created : %s" % output_colorspace_copy.name )
+                    print('Colorspace that incorporates looks '
+                          'created : %s' % colorspace_c.name)
 
-                    config_data['colorSpaces'].append(output_colorspace_copy)
+                    config_data['colorSpaces'].append(colorspace_c)
 
-            if output_colorspace_copy:
-                print( "Adding colorspace that incorporates looks into view list" )
+            if colorspace_c:
+                print('Adding colorspace that incorporates looks '
+                      'into view list')
 
-                # Change the name of the View
-                view_list["Output Transform with %s" % look_names_string] = output_colorspace_copy
+                # Updating the *View* name.
+                view_list['Output Transform with %s' % look_names_string] = (
+                    colorspace_c)
                 config_data['displays'][display] = view_list
 
-                #print( "Display : %s, View List : %s" % (display, ", ".join(view_list)) )
 
-def create_config(config_data, 
-    aliases=False, 
-    prefix=False,
-    multiple_displays=False,
-    look_info=[],
-    custom_lut_dir=None):
+def create_config(config_data,
+                  aliases=False,
+                  prefix=False,
+                  multiple_displays=False,
+                  look_info=None,
+                  custom_lut_dir=None):
     """
     Object description.
 
@@ -556,26 +535,25 @@ def create_config(config_data,
          Return value description.
     """
 
+    if look_info is None:
+        look_info = []
+
     prefixed_names = {}
     alias_colorspaces = []
 
-    # Creating the *OCIO* configuration.
     config = ocio.Config()
 
-    # Setting configuration description.
     config.setDescription('An ACES config generated from python')
 
-    # Setting configuration search path.
-    searchPath = ['luts']
+    search_path = ['luts']
     if custom_lut_dir:
-        searchPath.append('custom')
-    config.setSearchPath(':'.join(searchPath))
+        search_path.append('custom')
+    config.setSearchPath(':'.join(search_path))
 
-    # Defining the reference colorspace.
     reference_data = config_data['referenceColorSpace']
 
-    # Adding the color space Family into the name
-    # Helps with applications that present colorspaces as one long list
+    # Adding the colorspace *Family* into the name which helps with
+    # applications that presenting colorspaces as one a flat list.
     if prefix:
         prefixed_name = colorspace_prefixed_name(reference_data)
         prefixed_names[reference_data.name] = prefixed_name
@@ -595,51 +573,47 @@ def create_config(config_data,
 
     config.addColorSpace(reference)
 
-    # Add alias
     if aliases:
-        if reference_data.aliases != []:
-            #add_colorspace_alias(config, reference_data,
-            #                     reference_data, reference_data.aliases)
-            # defer adding alias colorspaces until end. Helps with some applications
-            alias_colorspaces.append([reference_data, reference_data, reference_data.aliases])
-
-
-    print("")
-
-    #print( "color spaces : %s" % [x.name for x in sorted(config_data['colorSpaces'])])
-
-    #
-    # Add Looks and Look colorspaces
-    #
-    if look_info != []:
+        if reference_data.aliases:
+            # Deferring adding alias colorspaces until end, which helps with
+            # applications listing the colorspaces in the order that they were
+            # defined in the configuration: alias colorspaces are usually named
+            # lower case with spaces but normal colorspaces names are longer
+            # and more verbose, thus it becomes harder for user to visually
+            # parse the list of colorspaces when there are names such as
+            # "crv_canonlog" interspersed with names like
+            # "Input - Canon - Curve - Canon-Log".
+            # Moving the alias colorspace definitions to the end of the
+            # configuration avoids the above problem.
+            alias_colorspaces.append(
+                [reference_data, reference_data, reference_data.aliases])
+
+    print('')
+
+    if look_info:
         print('Adding looks')
 
         config_data['looks'] = []
 
-        # Add looks and colorspaces
         for look in look_info:
-            add_look(config, 
-                look, 
-                prefix, 
-                custom_lut_dir, 
-                reference_data.name,
-                config_data)
+            add_look(config,
+                     look,
+                     custom_lut_dir,
+                     reference_data.name,
+                     config_data)
 
-        # Integrate looks with displays, views
-        integrate_looks_into_views(config, 
-            look_info,
-            reference_data.name,
-            config_data,
-            multiple_displays)
+        add_looks_to_views(look_info,
+                           reference_data.name,
+                           config_data,
+                           multiple_displays)
 
-        print("")
+        print('')
 
-    print('Adding the regular color spaces')
+    print('Adding regular colorspaces')
 
-    # Creating the remaining colorspaces.
     for colorspace in sorted(config_data['colorSpaces']):
-        # Adding the color space Family into the name
-        # Helps with applications that present colorspaces as one long list
+        # Adding the colorspace *Family* into the name which helps with
+        # applications that presenting colorspaces as one a flat list.
         if prefix:
             prefixed_name = colorspace_prefixed_name(colorspace)
             prefixed_names[colorspace.name] = prefixed_name
@@ -649,7 +623,8 @@ def create_config(config_data,
 
         description = colorspace.description
         if colorspace.aces_transform_id:
-            description += "\n\nACES Transform ID : %s" % colorspace.aces_transform_id
+            description += (
+                '\n\nACES Transform ID : %s' % colorspace.aces_transform_id)
 
         ocio_colorspace = ocio.ColorSpace(
             name=colorspace.name,
@@ -663,7 +638,7 @@ def create_config(config_data,
 
         if colorspace.to_reference_transforms:
             print('\tGenerating To-Reference transforms')
-            ocio_transform = generate_OCIO_transform(
+            ocio_transform = create_ocio_transform(
                 colorspace.to_reference_transforms)
             ocio_colorspace.setTransform(
                 ocio_transform,
@@ -671,7 +646,7 @@ def create_config(config_data,
 
         if colorspace.from_reference_transforms:
             print('\tGenerating From-Reference transforms')
-            ocio_transform = generate_OCIO_transform(
+            ocio_transform = create_ocio_transform(
                 colorspace.from_reference_transforms)
             ocio_colorspace.setTransform(
                 ocio_transform,
@@ -679,48 +654,52 @@ def create_config(config_data,
 
         config.addColorSpace(ocio_colorspace)
 
-        #
-        # Add alias to normal colorspace, using compact name
-        #
         if aliases:
-            if colorspace.aliases != []:
-                #add_colorspace_alias(config, reference_data,
-                #                     colorspace, colorspace.aliases)
-                # defer adding alias colorspaces until end. Helps with some applications
-                alias_colorspaces.append([reference_data, colorspace, colorspace.aliases])
+            if colorspace.aliases:
+                # Deferring adding alias colorspaces until end, which helps
+                # with applications listing the colorspaces in the order that
+                # they were defined in the configuration.
+                alias_colorspaces.append(
+                    [reference_data, colorspace, colorspace.aliases])
 
         print('')
 
-    print("")
+    print('')
 
-    #
-    # We add roles early so we can create alias colorspaces with the names of the roles
-    # before the rest of the colorspace aliases are added to the config.
-    #
+    # Adding roles early so that alias colorspaces can be created
+    # with roles names before remaining colorspace aliases are added
+    # to the configuration.
     print('Setting the roles')
 
     if prefix:
-        set_config_default_roles(
+        set_config_roles(
             config,
-            color_picking=prefixed_names[config_data['roles']['color_picking']],
+            color_picking=prefixed_names[
+                config_data['roles']['color_picking']],
             color_timing=prefixed_names[config_data['roles']['color_timing']],
-            compositing_log=prefixed_names[config_data['roles']['compositing_log']],
+            compositing_log=prefixed_names[
+                config_data['roles']['compositing_log']],
             data=prefixed_names[config_data['roles']['data']],
             default=prefixed_names[config_data['roles']['default']],
             matte_paint=prefixed_names[config_data['roles']['matte_paint']],
             reference=prefixed_names[config_data['roles']['reference']],
             scene_linear=prefixed_names[config_data['roles']['scene_linear']],
-            texture_paint=prefixed_names[config_data['roles']['texture_paint']])
-        # Not allowed for the moment. role names can not overlap with colorspace names.
-        '''
+            texture_paint=prefixed_names[
+                config_data['roles']['texture_paint']])
+
+        # TODO: Pending code path reactivation.
+        # Not allowed at the moment as role names can not overlap
+        # with colorspace names.
+        """
         # Add the aliased colorspaces for each role
         for role_name, role_colorspace_name in config_data['roles'].iteritems():
             role_colorspace_prefixed_name = prefixed_names[role_colorspace_name]
 
-            print( "Finding colorspace : %s" % role_colorspace_prefixed_name )
+            print( 'Finding colorspace : %s' % role_colorspace_prefixed_name )
             # Find the colorspace pointed to by the role
-            role_colorspaces = [colorspace for colorspace in config_data['colorSpaces'] if colorspace.name == role_colorspace_prefixed_name]
+            role_colorspaces = [colorspace
+                for colorspace in config_data['colorSpaces']
+                if colorspace.name == role_colorspace_prefixed_name]
             role_colorspace = None
             if len(role_colorspaces) > 0:
                 role_colorspace = role_colorspaces[0]
@@ -729,14 +708,15 @@ def create_config(config_data,
                     role_colorspace = reference_data
 
             if role_colorspace:
-                print( "Adding an alias colorspace named %s, pointing to %s" % (
+                print( 'Adding an alias colorspace named %s, pointing to %s' % (
                     role_name, role_colorspace.name))
 
-                add_colorspace_aliases(config, reference_data, role_colorspace, [role_name], 'Roles')
-        '''
+                add_colorspace_aliases(
+                config, reference_data, role_colorspace, [role_name], 'Roles')
+        """
 
     else:
-        set_config_default_roles(
+        set_config_roles(
             config,
             color_picking=config_data['roles']['color_picking'],
             color_timing=config_data['roles']['color_timing'],
@@ -748,12 +728,16 @@ def create_config(config_data,
             scene_linear=config_data['roles']['scene_linear'],
             texture_paint=config_data['roles']['texture_paint'])
 
-        # Not allowed for the moment. role names can not overlap with colorspace names.
-        '''
+        # TODO: Pending code path reactivation.
+        # Not allowed at the moment as role names can not overlap
+        # with colorspace names.
+        """
         # Add the aliased colorspaces for each role
         for role_name, role_colorspace_name in config_data['roles'].iteritems():
             # Find the colorspace pointed to by the role
-            role_colorspaces = [colorspace for colorspace in config_data['colorSpaces'] if colorspace.name == role_colorspace_name]
+            role_colorspaces = [colorspace
+            for colorspace in config_data['colorSpaces']
+            if colorspace.name == role_colorspace_name]
             role_colorspace = None
             if len(role_colorspaces) > 0:
                 role_colorspace = role_colorspaces[0]
@@ -762,146 +746,146 @@ def create_config(config_data,
                     role_colorspace = reference_data
 
             if role_colorspace:
-                print( "Adding an alias colorspace named %s, pointing to %s" % (
+                print('Adding an alias colorspace named %s, pointing to %s' % (
                     role_name, role_colorspace.name))
 
-                add_colorspace_aliases(config, reference_data, role_colorspace, [role_name], 'Roles')
-        '''
+                add_colorspace_aliases(
+                config, reference_data, role_colorspace, [role_name], 'Roles')
+        """
 
-    print("")
+    print('')
 
-    # We add these at the end as some applications use the order of the colorspaces
-    # definitions in the config to order the colorspaces in their selection lists.
-    # Other go alphabetically. This should keep the alias colorspaces out of the way
-    # for the apps that use the order of definition in the config.
+    # Adding alias colorspaces at the end as some applications use
+    # colorspaces definitions order of the configuration to order
+    # the colorspaces in their selection lists, some applications
+    # use alphabetical ordering.
+    # This should keep the alias colorspaces out of the way for applications
+    # using the configuration order.
     print('Adding the alias colorspaces')
     for reference, colorspace, aliases in alias_colorspaces:
         add_colorspace_aliases(config, reference, colorspace, aliases)
 
-    print("")
+    print('')
 
     print('Adding the diplays and views')
 
-    # Set the color_picking role to be the first Display's Output Transform View
+    # Setting the *color_picking* role to be the first *Display*'s
+    # *Output Transform* *View*.
     default_display_name = config_data['defaultDisplay']
     default_display_views = config_data['displays'][default_display_name]
     default_display_colorspace = default_display_views['Output Transform']
 
-    set_config_default_roles(
+    set_config_roles(
         config,
         color_picking=default_display_colorspace.name)
 
-    # Defining the *views* and *displays*.
-    displays = []
-    views = []
+    # Defining *Displays* and *Views*.
+    displays, views = [], []
 
-    # Defining a *generic* *display* and *view* setup.
+    # Defining a generic *Display* and *View* setup.
     if multiple_displays:
-        # Built list of looks to add to Displays
         looks = config_data['looks'] if ('looks' in config_data) else []
-        looks = ", ".join(looks)
-        print( "Creating multiple displays, with looks : %s" % looks)
+        looks = ', '.join(looks)
+        print('Creating multiple displays, with looks : %s' % looks)
 
-        # Note: We don't reorder the Displays to put the 'defaultDisplay' first
-        # because OCIO will order them alphabetically when the config is written to disk.
-
-        # Create Displays, Views
+        # *Displays* are not reordered to put the *defaultDisplay* first
+        # because *OCIO* will order them alphabetically when the configuration
+        # is written to disk.
         for display, view_list in config_data['displays'].iteritems():
             for view_name, colorspace in view_list.iteritems():
                 config.addDisplay(display, view_name, colorspace.name, looks)
-                if 'Output Transform' in view_name and looks != "":
-                    # Add normal View, without looks
+                if 'Output Transform' in view_name and looks != '':
+                    # *Views* without *Looks*.
                     config.addDisplay(display, view_name, colorspace.name)
 
-                    # Add View with looks
-                    view_name_with_looks = "%s with %s" % (view_name, looks)
-                    config.addDisplay(display, view_name_with_looks, colorspace.name, looks)
+                    # *Views* with *Looks*.
+                    view_name_with_looks = '%s with %s' % (view_name, looks)
+                    config.addDisplay(display, view_name_with_looks,
+                                      colorspace.name, looks)
                 else:
                     config.addDisplay(display, view_name, colorspace.name)
                 if not (view_name in views):
                     views.append(view_name)
             displays.append(display)
 
-    # Defining the set of *views* and *displays* useful in a *GUI* context.
+    # *Displays* and *Views* useful in a *GUI* context.
     else:
         single_display_name = 'ACES'
-        #single_display_name = config_data['roles']['scene_linear']
         displays.append(single_display_name)
 
-        # Make sure the default display is first
+        # Ensuring the *defaultDisplay* is first.
         display_names = sorted(config_data['displays'])
-        display_names.insert(0, display_names.pop(display_names.index(default_display_name)))
+        display_names.insert(0, display_names.pop(
+            display_names.index(default_display_name)))
 
-        # Built list of looks to add to Displays
         looks = config_data['looks'] if ('looks' in config_data) else []
-        look_names = ", ".join(looks)
+        look_names = ', '.join(looks)
 
         displays_views_colorspaces = []
 
-        # Create Displays, Views
         for display in display_names:
             view_list = config_data['displays'][display]
             for view_name, colorspace in view_list.iteritems():
                 if 'Output Transform' in view_name:
-                    #print( "Adding view for %s" % colorspace.name )
 
-                    # We use the Display names as the View names in this case
-                    # as there is a single Display that contains all views.
-                    # This works for more applications than not, as of the time of this implementation.
+                    # We use the *Display* names as the *View* names in this
+                    # case as there is a single *Display* containing all the
+                    # *Views*.
+                    # This works for more applications than not,as of the time
+                    # of this implementation.
 
-                    # Maya 2016 doesn't like parentheses in View names
-                    display_cleaned = replace(display, {')': '', '(': ''})
+                    # Autodesk Maya 2016 doesn't support parentheses in
+                    # *View* names.
+                    sanitised_display = replace(display, {')': '', '(': ''})
 
-                    # If View includes looks
+                    # *View* with *Looks*.
                     if 'with' in view_name:
-                        # Integrate looks into view name
-                        display_cleaned = "%s with %s" % (display_cleaned, look_names)
-
-                        viewsWithLooksAtEnd = False
-                        # Storing combo of display, view and colorspace name in a list so we can
-                        # add them to the end of the list
-                        if viewsWithLooksAtEnd:
-                            displays_views_colorspaces.append([single_display_name, display_cleaned, colorspace.name])
-
-                        # Or add as normal
+                        sanitised_display = '%s with %s' % (
+                            sanitised_display, look_names)
+
+                        views_with_looks_at_end = False
+                        # Storing combo of *Display*, *View* and *Colorspace*
+                        # name so they can be added to the end of the list.
+                        if views_with_looks_at_end:
+                            displays_views_colorspaces.append(
+                                [single_display_name, sanitised_display,
+                                 colorspace.name])
                         else:
-                            config.addDisplay(single_display_name, display_cleaned, colorspace.name)
+                            config.addDisplay(single_display_name,
+                                              sanitised_display,
+                                              colorspace.name)
 
-                            # Add to views list
-                            if not (display_cleaned in views):
-                                views.append(display_cleaned)
+                            if not (sanitised_display in views):
+                                views.append(sanitised_display)
 
-                    # A normal View
+                    # *View* without *Looks*.
                     else:
-                        config.addDisplay(single_display_name, display_cleaned, colorspace.name)
+                        config.addDisplay(single_display_name,
+                                          sanitised_display,
+                                          colorspace.name)
 
-                        # Add to views list
-                        if not (display_cleaned in views):
-                            views.append(display_cleaned)
+                        if not (sanitised_display in views):
+                            views.append(sanitised_display)
 
-        # Add to config any display, view combinations that were saved for later
-        # This list will be empty unless viewsWithLooksAtEnd is set to True above 
+        # Adding to the configuration any *Display*, *View* combinations that
+        # were saved for later.
+        # This list should be empty unless `views_with_looks_at_end` is
+        # set `True` above.
         for display_view_colorspace in displays_views_colorspaces:
-            single_display_name, display_cleaned, colorspace_name = display_view_colorspace
+            single_display_name, sanitised_display, colorspace_name = (
+                display_view_colorspace)
 
-            # Add to config
-            config.addDisplay(single_display_name, display_cleaned, colorspace_name)
+            config.addDisplay(single_display_name,
+                              sanitised_display,
+                              colorspace_name)
 
-            # Add to views list
-            if not (display_cleaned in views):
-                views.append(display_cleaned)
+            if not (sanitised_display in views):
+                views.append(sanitised_display)
 
-
-        # Works with Nuke Studio and Mari, but not Nuke
-        # single_display_name = 'Utility'
-        # displays.append(single_display_name)
-
-        raw_display_space_name = config_data['roles']['data']        
+        raw_display_space_name = config_data['roles']['data']
         log_display_space_name = config_data['roles']['compositing_log']
 
-        # Find the newly-prefixed colorspace names
         if prefix:
-            #print( prefixed_names )
             raw_display_space_name = prefixed_names[raw_display_space_name]
             log_display_space_name = prefixed_names[log_display_space_name]
 
@@ -910,52 +894,48 @@ def create_config(config_data,
         config.addDisplay(single_display_name, 'Log', log_display_space_name)
         views.append('Log')
 
-    # Setting the active *displays* and *views*.
     config.setActiveDisplays(','.join(sorted(displays)))
     config.setActiveViews(','.join(views))
 
-    print("")
+    print('')
 
-    # Make sure we didn't create a bad config
+    # Ensuring the configuration is valid.
     config.sanityCheck()
 
-    # Reset the colorspace names back to their non-prefixed versions
+    # Resetting colorspace names to their non-prefixed versions.
     if prefix:
-        # Build the reverse lookup
         prefixed_names_inverse = {}
         for original, prefixed in prefixed_names.iteritems():
             prefixed_names_inverse[prefixed] = original
 
-        # Reset the reference colorspace name
         reference_data.name = prefixed_names_inverse[reference_data.name]
 
-        # Reset the rest of the colorspace names
         try:
             for colorspace in config_data['colorSpaces']:
                 colorspace.name = prefixed_names_inverse[colorspace.name]
         except:
-            print( "Prefixed names")
+            print('Prefixed names')
             for original, prefixed in prefixed_names.iteritems():
-                print( "%s, %s" % (original, prefixed) )
+                print('%s, %s' % (original, prefixed))
 
-            print( "\n")
+            print('\n')
 
-            print( "Inverse Lookup of Prefixed names")
+            print('Inverse Lookup of Prefixed names')
             for prefixed, original in prefixed_names_inverse.iteritems():
-                print( "%s, %s" % (prefixed, original) )
+                print('%s, %s' % (prefixed, original))
             raise
 
     return config
 
 
-def generate_LUTs(odt_info,
-                  lmt_info,
-                  shaper_name,
-                  aces_ctl_directory,
-                  lut_directory,
-                  lut_resolution_1d=4096,
-                  lut_resolution_3d=64,
-                  cleanup=True):
+def create_config_data(odt_info,
+                       lmt_info,
+                       shaper_name,
+                       aces_ctl_directory,
+                       lut_directory,
+                       lut_resolution_1d=4096,
+                       lut_resolution_3d=64,
+                       cleanup=True):
     """
     Object description.
 
@@ -971,10 +951,9 @@ def generate_LUTs(odt_info,
          the reference colorspace, *ACES*.
     """
 
-    print('generateLUTs - begin')
+    print('create_config_data - begin')
     config_data = {}
 
-    # Initialize a few variables
     config_data['displays'] = {}
     config_data['colorSpaces'] = []
 
@@ -1014,69 +993,99 @@ def generate_LUTs(odt_info,
     # *Camera Input Transforms*
     # -------------------------------------------------------------------------
 
-    # *ARRI Log-C* to *ACES*.
-    arri_colorSpaces = arri.create_colorspaces(lut_directory,
+    # *ARRI Log-C* to *ACES*
+    arri_colorspaces = arri.create_colorspaces(lut_directory,
                                                lut_resolution_1d)
-    for cs in arri_colorSpaces:
+    for cs in arri_colorspaces:
         config_data['colorSpaces'].append(cs)
 
-    # *Canon-Log* to *ACES*.
+    # *Canon-Log* to *ACES*
     canon_colorspaces = canon.create_colorspaces(lut_directory,
                                                  lut_resolution_1d)
     for cs in canon_colorspaces:
         config_data['colorSpaces'].append(cs)
 
-    # *GoPro Protune* to *ACES*.
+    # *GoPro Protune* to *ACES*
     gopro_colorspaces = gopro.create_colorspaces(lut_directory,
                                                  lut_resolution_1d)
     for cs in gopro_colorspaces:
         config_data['colorSpaces'].append(cs)
 
-    # *Panasonic V-Log* to *ACES*.
-    panasonic_colorSpaces = panasonic.create_colorspaces(lut_directory,
+    # *Panasonic V-Log* to *ACES*
+    panasonic_colorspaces = panasonic.create_colorspaces(lut_directory,
                                                          lut_resolution_1d)
-    for cs in panasonic_colorSpaces:
+    for cs in panasonic_colorspaces:
         config_data['colorSpaces'].append(cs)
 
-    # *RED* colorspaces to *ACES*.
+    # *RED* colorspaces to *ACES*
     red_colorspaces = red.create_colorspaces(lut_directory,
                                              lut_resolution_1d)
     for cs in red_colorspaces:
         config_data['colorSpaces'].append(cs)
 
-    # *S-Log* to *ACES*.
-    sony_colorSpaces = sony.create_colorspaces(lut_directory,
+    # *S-Log* to *ACES*
+    sony_colorspaces = sony.create_colorspaces(lut_directory,
                                                lut_resolution_1d)
-    for cs in sony_colorSpaces:
+    for cs in sony_colorspaces:
         config_data['colorSpaces'].append(cs)
 
     # -------------------------------------------------------------------------
-    # General Color Spaces
+    # General Colorspaces
     # -------------------------------------------------------------------------
-    general_colorSpaces = general.create_colorspaces(lut_directory,
-                                                     lut_resolution_1d,
-                                                     lut_resolution_3d)
-    for cs in general_colorSpaces:
+    general_colorspaces = general.create_colorspaces(lut_directory,
+                                                     lut_resolution_1d)
+    for cs in general_colorspaces:
         config_data['colorSpaces'].append(cs)
 
-    # The *Raw* color space
+    # The *Raw* colorspace
     raw = general.create_raw()
     config_data['colorSpaces'].append(raw)
 
-    # Override certain roles, for now
+    # Overriding various roles
     config_data['roles']['data'] = raw.name
     config_data['roles']['reference'] = raw.name
     config_data['roles']['texture_paint'] = raw.name
 
-    print('generateLUTs - end')
+    print('create_config_data - end')
+
     return config_data
 
 
+def write_config(config, config_path, sanity_check=True):
+    """
+    Writes the configuration to given path.
+
+    Parameters
+    ----------
+    config : Config
+        *OCIO* configuration.
+    config_path : str or unicode
+        Path to write the configuration path.
+    sanity_check : bool
+        Performs configuration sanity checking prior to writing it on disk.
+
+    Returns
+    -------
+    bool
+         Definition success.
+    """
+
+    if sanity_check:
+        try:
+            config.sanityCheck()
+        except Exception, e:
+            print e
+            print 'Configuration was not written due to a failed Sanity Check'
+            return
+
+    with open(config_path, mode='w') as fp:
+        fp.write(config.serialize())
+
+
 def generate_baked_LUTs(odt_info,
                         shaper_name,
                         baked_directory,
                         config_path,
-                        lut_resolution_1d,
                         lut_resolution_3d,
                         lut_resolution_shaper=1024,
                         prefix=False):
@@ -1096,9 +1105,9 @@ def generate_baked_LUTs(odt_info,
 
     odt_info_C = dict(odt_info)
 
-    # Uncomment if you would like to support the older behavior where ODTs
-    # that have support for full and legal range output generate a LUT for each.
-    '''
+    # Older behavior for *ODTs* that have support for full and legal ranges,
+    # generating a LUT for both ranges.
+    """
     # Create two entries for ODTs that have full and legal range support
     for odt_ctl_name, odt_values in odt_info.iteritems():
         if odt_values['transformHasFullLegalSwitch']:
@@ -1113,9 +1122,8 @@ def generate_baked_LUTs(odt_info,
             odt_info_C['%s - Full' % odt_ctl_name] = odt_values_full
 
             del (odt_info_C[odt_ctl_name])
-    '''
+    """
 
-    # Generate appropriate LUTs for each ODT
     for odt_ctl_name, odt_values in odt_info_C.iteritems():
         odt_prefix = odt_values['transformUserNamePrefix']
         odt_name = odt_values['transformUserName']
@@ -1125,8 +1133,8 @@ def generate_baked_LUTs(odt_info,
             args = ['--iconfig', config_path,
                     '-v']
             if prefix:
-                args += ['--inputspace', "ACES - %s" % input_space]
-                args += ['--outputspace', "Output - %s" % odt_name]
+                args += ['--inputspace', 'ACES - %s' % input_space]
+                args += ['--outputspace', 'Output - %s' % odt_name]
             else:
                 args += ['--inputspace', input_space]
                 args += ['--outputspace', odt_name]
@@ -1136,7 +1144,7 @@ def generate_baked_LUTs(odt_info,
                                               odt_name,
                                               input_space)]
             if prefix:
-                args += ['--shaperspace', "Utility - %s" % shaper_name,
+                args += ['--shaperspace', 'Utility - %s' % shaper_name,
                          '--shapersize', str(lut_resolution_shaper)]
             else:
                 args += ['--shaperspace', shaper_name,
@@ -1158,8 +1166,8 @@ def generate_baked_LUTs(odt_info,
             args = ['--iconfig', config_path,
                     '-v']
             if prefix:
-                args += ['--inputspace', "ACES - %s" % input_space]
-                args += ['--outputspace', "Output - %s" % odt_name]
+                args += ['--inputspace', 'ACES - %s' % input_space]
+                args += ['--outputspace', 'Output - %s' % odt_name]
             else:
                 args += ['--inputspace', input_space]
                 args += ['--outputspace', odt_name]
@@ -1167,7 +1175,7 @@ def generate_baked_LUTs(odt_info,
                      '%s - %s for %s data' % (
                          odt_prefix, odt_name, input_space)]
             if prefix:
-                args += ['--shaperspace', "Utility - %s" % shaper_name,
+                args += ['--shaperspace', 'Utility - %s' % shaper_name,
                          '--shapersize', str(lut_resolution_shaper)]
             else:
                 args += ['--shaperspace', shaper_name,
@@ -1201,8 +1209,8 @@ def generate_baked_LUTs(odt_info,
             args = ['--iconfig', config_path,
                     '-v']
             if prefix:
-                args += ['--inputspace', "ACES - %s" % input_space]
-                args += ['--outputspace', "Output - %s" % odt_name]
+                args += ['--inputspace', 'ACES - %s' % input_space]
+                args += ['--outputspace', 'Output - %s' % odt_name]
             else:
                 args += ['--inputspace', input_space]
                 args += ['--outputspace', odt_name]
@@ -1210,11 +1218,11 @@ def generate_baked_LUTs(odt_info,
                      '%s - %s for %s data' % (
                          odt_prefix, odt_name, input_space)]
             if input_space == 'ACEScg':
-                lin_shaper_name = "%s - AP1" % shaper_name
+                lin_shaper_name = '%s - AP1' % shaper_name
             else:
                 lin_shaper_name = shaper_name
             if prefix:
-                lin_shaper_name = "Utility - %s" % lin_shaper_name
+                lin_shaper_name = 'Utility - %s' % lin_shaper_name
             args += ['--shaperspace', lin_shaper_name,
                      '--shapersize', str(lut_resolution_shaper)]
 
@@ -1243,9 +1251,9 @@ def generate_baked_LUTs(odt_info,
             bake_lut.execute()
 
 
-def create_config_dir(config_directory, 
-                      bake_secondary_LUTs=False,
-                      custom_lut_dir=None):
+def generate_config_directory(config_directory,
+                              bake_secondary_luts=False,
+                              custom_lut_dir=None):
     """
     Object description.
 
@@ -1263,7 +1271,7 @@ def create_config_dir(config_directory,
     lut_directory = os.path.join(config_directory, 'luts')
     dirs = [config_directory, lut_directory]
 
-    if bake_secondary_LUTs:
+    if bake_secondary_luts:
         dirs.extend([os.path.join(config_directory, 'baked'),
                      os.path.join(config_directory, 'baked', 'flame'),
                      os.path.join(config_directory, 'baked', 'photoshop'),
@@ -1280,16 +1288,16 @@ def create_config_dir(config_directory,
     return lut_directory
 
 
-def create_ACES_config(aces_ctl_directory,
-                       config_directory,
-                       lut_resolution_1d=4096,
-                       lut_resolution_3d=64,
-                       bake_secondary_LUTs=True,
-                       multiple_displays=False,
-                       look_info=[],
-                       copy_custom_luts=True,
-                       cleanup=True,
-                       prefix_colorspaces_with_family_names=True):
+def generate_config(aces_ctl_directory,
+                    config_directory,
+                    lut_resolution_1d=4096,
+                    lut_resolution_3d=64,
+                    bake_secondary_luts=True,
+                    multiple_displays=False,
+                    look_info=None,
+                    copy_custom_luts=True,
+                    cleanup=True,
+                    prefix_colorspaces_with_family_names=True):
     """
     Creates the ACES configuration.
 
@@ -1304,46 +1312,47 @@ def create_ACES_config(aces_ctl_directory,
          Return value description.
     """
 
-    # Directory for custom LUTs
+    if look_info is None:
+        look_info = []
+
     custom_lut_dir = None
     if copy_custom_luts:
-        custom_lut_dir = os.path.join(config_directory, "custom")
+        custom_lut_dir = os.path.join(config_directory, 'custom')
 
-    lut_directory = create_config_dir(config_directory, 
-                                      bake_secondary_LUTs,
-                                      custom_lut_dir)
+    lut_directory = generate_config_directory(config_directory,
+                                              bake_secondary_luts,
+                                              custom_lut_dir)
 
     odt_info = aces.get_ODTs_info(aces_ctl_directory)
     lmt_info = aces.get_LMTs_info(aces_ctl_directory)
 
     shaper_name = 'Output Shaper'
-    config_data = generate_LUTs(odt_info,
-                                lmt_info,
-                                shaper_name,
-                                aces_ctl_directory,
-                                lut_directory,
-                                lut_resolution_1d,
-                                lut_resolution_3d,
-                                cleanup)
+    config_data = create_config_data(odt_info,
+                                     lmt_info,
+                                     shaper_name,
+                                     aces_ctl_directory,
+                                     lut_directory,
+                                     lut_resolution_1d,
+                                     lut_resolution_3d,
+                                     cleanup)
 
     print('Creating config - with prefixes, with aliases')
-    config = create_config(config_data, 
-        prefix=prefix_colorspaces_with_family_names, 
-        aliases=True, 
-        multiple_displays=multiple_displays,
-        look_info=look_info,
-        custom_lut_dir=custom_lut_dir)
+    config = create_config(config_data,
+                           prefix=prefix_colorspaces_with_family_names,
+                           aliases=True,
+                           multiple_displays=multiple_displays,
+                           look_info=look_info,
+                           custom_lut_dir=custom_lut_dir)
     print('\n\n\n')
 
     write_config(config,
                  os.path.join(config_directory, 'config.ocio'))
 
-    if bake_secondary_LUTs:
+    if bake_secondary_luts:
         generate_baked_LUTs(odt_info,
                             shaper_name,
                             os.path.join(config_directory, 'baked'),
                             os.path.join(config_directory, 'config.ocio'),
-                            lut_resolution_1d,
                             lut_resolution_3d,
                             lut_resolution_1d,
                             prefix=prefix_colorspaces_with_family_names)
@@ -1368,50 +1377,74 @@ def main():
 
     import optparse
 
-    usage  = '%prog [options]\n'
+    usage = '%prog [options]\n'
     usage += '\n'
     usage += 'An OCIO config generation script for ACES 1.0\n'
     usage += '\n'
     usage += 'Command line examples'
     usage += '\n'
-    usage += 'Create a GUI-friendly ACES 1.0 config with no secondary, baked LUTs : \n'
-    usage += '\tcreate_aces_config -a /path/to/aces-dev/transforms/ctl --lutResolution1d 1024 --lutResolution3d 33 -c aces_1.0.0 --dontBakeSecondaryLUTs'
+    usage += ('Create a GUI-friendly ACES 1.0 config with no secondary, '
+              'baked LUTs : \n')
+    usage += ('\tcreate_aces_config -a /path/to/aces-dev/transforms/ctl '
+              '--lutResolution1d 1024 --lutResolution3d 33 -c aces_1.0.0 '
+              '--dontBakeSecondaryLUTs')
     usage += '\n'
     usage += 'Create a more OCIO-compliant ACES 1.0 config : \n'
-    usage += '\tcreate_aces_config -a /path/to/aces-dev/transforms/ctl --lutResolution1d 1024 --lutResolution3d 33 -c aces_1.0.0 --createMultipleDisplays'
+    usage += ('\tcreate_aces_config -a /path/to/aces-dev/transforms/ctl '
+              '--lutResolution1d 1024 --lutResolution3d 33 -c aces_1.0.0 '
+              '--createMultipleDisplays')
     usage += '\n'
     usage += '\n'
     usage += 'Adding custom looks'
     usage += '\n'
-    usage += 'Create a GUI-friendly ACES 1.0 config with an ACES-style CDL (will be applied in the ACEScc colorspace): \n'
-    usage += '\tcreate_aces_config -a /path/to/aces-dev/transforms/ctl --lutResolution1d 1024 --lutResolution3d 33 -c aces_1.0.0 \n\t\t--addACESLookCDL ACESCDLName /path/to/SampleCDL.ccc cc03345'
+    usage += ('Create a GUI-friendly ACES 1.0 config with an ACES-style CDL '
+              '(will be applied in the ACEScc colorspace): \n')
+    usage += ('\tcreate_aces_config -a /path/to/aces-dev/transforms/ctl '
+              '--lutResolution1d 1024 --lutResolution3d 33 -c aces_1.0.0 '
+              '\n\t\t--addACESLookCDL ACESCDLName '
+              '/path/to/SampleCDL.ccc cc03345')
     usage += '\n'
     usage += 'Create a GUI-friendly ACES 1.0 config with an general CDL: \n'
-    usage += '\tcreate_aces_config -a /path/to/aces-dev/transforms/ctl --lutResolution1d 1024 --lutResolution3d 33 -c aces_1.0.0 \n\t\t--addCustomLookCDL CustomCDLName "ACES - ACEScc" /path/to/SampleCDL.ccc cc03345'
+    usage += ('\tcreate_aces_config -a /path/to/aces-dev/transforms/ctl '
+              '--lutResolution1d 1024 --lutResolution3d 33 -c aces_1.0.0 '
+              '\n\t\t--addCustomLookCDL CustomCDLName "ACES - ACEScc" '
+              '/path/to/SampleCDL.ccc cc03345')
     usage += '\n'
-    usage += '\tIn this example, the CDL will be applied in the ACEScc colorspace, but the user could choose other spaces by changing the argument after the name of the look. \n'
+    usage += ('\tIn this example, the CDL will be applied in the '
+              'ACEScc colorspace, but the user could choose other spaces '
+              'by changing the argument after the name of the look. \n')
     usage += '\n'
-    usage += 'Create a GUI-friendly ACES 1.0 config with an ACES-style LUT (will be applied in the ACEScc colorspace): \n'
-    usage += '\tcreate_aces_config -a /path/to/aces-dev/transforms/ctl --lutResolution1d 1024 --lutResolution3d 33 -c aces_1.0.0 \n\t\t--addACESLookLUT ACESLUTName /path/to/SampleCDL.ccc cc03345'
+    usage += ('Create a GUI-friendly ACES 1.0 config with an ACES-style LUT '
+              '(will be applied in the ACEScc colorspace): \n')
+    usage += ('\tcreate_aces_config -a /path/to/aces-dev/transforms/ctl '
+              '--lutResolution1d 1024 --lutResolution3d 33 -c aces_1.0.0 '
+              '\n\t\t--addACESLookLUT ACESLUTName '
+              '/path/to/SampleCDL.ccc cc03345')
     usage += '\n'
     usage += 'Create a GUI-friendly ACES 1.0 config with an general LUT: \n'
-    usage += '\tcreate_aces_config -a /path/to/aces-dev/transforms/ctl --lutResolution1d 1024 --lutResolution3d 33 -c aces_1.0.0 \n\t\t--addCustomLookLUT CustomLUTName "ACES - ACEScc" /path/to/SampleCDL.ccc cc03345'
+    usage += ('\tcreate_aces_config -a /path/to/aces-dev/transforms/ctl '
+              '--lutResolution1d 1024 --lutResolution3d 33 -c aces_1.0.0 '
+              '\n\t\t--addCustomLookLUT CustomLUTName "ACES - ACEScc" '
+              '/path/to/SampleCDL.ccc cc03345')
     usage += '\n'
-    usage += '\tIn this example, the LUT will be applied in the ACEScc colorspace, but the user could choose other spaces by changing the argument after the name of the look. \n'
+    usage += ('\tIn this example, the LUT will be applied in the '
+              'ACEScc colorspace, but the user could choose other spaces '
+              'by changing the argument after the name of the look. \n')
     usage += '\n'
 
     look_info = []
+
     def look_info_callback(option, opt_str, value, parser):
-        print( "look_info_callback" )
-        print( option, opt_str, value, parser )
-        if opt_str == "--addCustomLookCDL":
+        print('look_info_callback')
+        print(option, opt_str, value, parser)
+        if opt_str == '--addCustomLookCDL':
             look_info.append(value)
-        elif opt_str == "--addCustomLookLUT":
+        elif opt_str == '--addCustomLookLUT':
             look_info.append(value)
-        elif opt_str == "--addACESLookCDL":
-            look_info.append([value[0], "ACES - ACEScc", value[1], value[2]])
-        elif opt_str == "--addACESLookLUT":
-            look_info.append([value[0], "ACES - ACEScc", value[1]])
+        elif opt_str == '--addACESLookCDL':
+            look_info.append([value[0], 'ACES - ACEScc', value[1], value[2]])
+        elif opt_str == '--addACESLookLUT':
+            look_info.append([value[0], 'ACES - ACEScc', value[1]])
 
     p = optparse.OptionParser(description='',
                               prog='create_aces_config',
@@ -1426,16 +1459,17 @@ def main():
     p.add_option('--dontBakeSecondaryLUTs', action='store_true', default=False)
     p.add_option('--keepTempImages', action='store_true', default=False)
 
-    p.add_option('--createMultipleDisplays', action='store_true', default=False)
-
-    p.add_option('--addCustomLookLUT', '', type='string', nargs=3, 
-        action="callback", callback=look_info_callback)
-    p.add_option('--addCustomLookCDL', '', type='string', nargs=4, 
-        action="callback", callback=look_info_callback)
-    p.add_option('--addACESLookLUT', '', type='string', nargs=2, 
-        action="callback", callback=look_info_callback)
-    p.add_option('--addACESLookCDL', '', type='string', nargs=3, 
-        action="callback", callback=look_info_callback)
+    p.add_option('--createMultipleDisplays', action='store_true',
+                 default=False)
+
+    p.add_option('--addCustomLookLUT', '', type='string', nargs=3,
+                 action='callback', callback=look_info_callback)
+    p.add_option('--addCustomLookCDL', '', type='string', nargs=4,
+                 action='callback', callback=look_info_callback)
+    p.add_option('--addACESLookLUT', '', type='string', nargs=2,
+                 action='callback', callback=look_info_callback)
+    p.add_option('--addACESLookCDL', '', type='string', nargs=3,
+                 action='callback', callback=look_info_callback)
     p.add_option('--copyCustomLUTs', action='store_true', default=False)
 
     options, arguments = p.parse_args()
@@ -1449,15 +1483,7 @@ def main():
     multiple_displays = options.createMultipleDisplays
     copy_custom_luts = options.copyCustomLUTs
 
-    print( look_info )
-
-    # TODO: Investigate the following statements.
-    try:
-        args_start = sys.argv.index('--') + 1
-        args = sys.argv[args_start:]
-    except:
-        args_start = len(sys.argv) + 1
-        args = []
+    print(look_info)
 
     print('command line : \n%s\n' % ' '.join(sys.argv))
 
@@ -1471,15 +1497,16 @@ def main():
         'directory specified'.format(
             ACES_OCIO_CONFIGURATION_DIRECTORY_ENVIRON))
 
-    return create_ACES_config(aces_ctl_directory,
-                              config_directory,
-                              lut_resolution_1d,
-                              lut_resolution_3d,
-                              bake_secondary_luts,
-                              multiple_displays,
-                              look_info,
-                              copy_custom_luts,
-                              cleanup_temp_images)
+    return generate_config(aces_ctl_directory,
+                           config_directory,
+                           lut_resolution_1d,
+                           lut_resolution_3d,
+                           bake_secondary_luts,
+                           multiple_displays,
+                           look_info,
+                           copy_custom_luts,
+                           cleanup_temp_images)
+
 
 if __name__ == '__main__':
     main()
index f94bf34..962881e 100755 (executable)
@@ -10,7 +10,6 @@ from __future__ import division
 
 import array
 import os
-import sys
 
 import OpenImageIO as oiio
 
@@ -25,6 +24,9 @@ __status__ = 'Production'
 
 __all__ = ['generate_1d_LUT_image',
            'write_SPI_1d',
+           'write_CSP_1d',
+           'write_CTL_1d',
+           'write_1d',
            'generate_1d_LUT_from_image',
            'generate_3d_LUT_image',
            'generate_3d_LUT_from_image',
@@ -291,15 +293,15 @@ def write_1d(filename,
          Return value description.
     """
 
-    ocioFormatsToExtensions = {'cinespace': 'csp',
-                               'flame': '3dl',
-                               'icc': 'icc',
-                               'houdini': 'lut',
-                               'lustre': '3dl',
-                               'ctl': 'ctl'}
+    ocio_formats_to_extensions = {'cinespace': 'csp',
+                                  'flame': '3dl',
+                                  'icc': 'icc',
+                                  'houdini': 'lut',
+                                  'lustre': '3dl',
+                                  'ctl': 'ctl'}
 
-    if format in ocioFormatsToExtensions:
-        if ocioFormatsToExtensions[format] == 'csp':
+    if format in ocio_formats_to_extensions:
+        if ocio_formats_to_extensions[format] == 'csp':
             write_CSP_1d(filename,
                          from_min,
                          from_max,
@@ -307,7 +309,7 @@ def write_1d(filename,
                          data_entries,
                          data_channels,
                          lut_components)
-        elif ocioFormatsToExtensions[format] == 'ctl':
+        elif ocio_formats_to_extensions[format] == 'ctl':
             write_CTL_1d(filename,
                          from_min,
                          from_max,
@@ -412,13 +414,13 @@ def generate_3d_LUT_from_image(ramp_3d_path,
     if output_path is None:
         output_path = '%s.%s' % (ramp_3d_path, 'spi3d')
 
-    ocioFormatsToExtensions = {'cinespace': 'csp',
-                               'flame': '3dl',
-                               'icc': 'icc',
-                               'houdini': 'lut',
-                               'lustre': '3dl'}
+    ocio_formats_to_extensions = {'cinespace': 'csp',
+                                  'flame': '3dl',
+                                  'icc': 'icc',
+                                  'houdini': 'lut',
+                                  'lustre': '3dl'}
 
-    if format == 'spi3d' or not (format in ocioFormatsToExtensions):
+    if format == 'spi3d' or not (format in ocio_formats_to_extensions):
         # Extract a spi3d LUT
         args = ['--extract',
                 '--cubesize',
@@ -547,7 +549,7 @@ def convert_bit_depth(input_image, output_image, depth):
 def generate_1d_LUT_from_CTL(lut_path,
                              ctl_paths,
                              lut_resolution=1024,
-                             identity_LUT_bit_depth='half',
+                             identity_lut_bit_depth='half',
                              input_scale=1,
                              output_scale=1,
                              global_params=None,
@@ -576,30 +578,30 @@ def generate_1d_LUT_from_CTL(lut_path,
 
     lut_path_base = os.path.splitext(lut_path)[0]
 
-    identity_LUT_image_float = '%s.%s.%s' % (lut_path_base, 'float', 'tiff')
-    generate_1d_LUT_image(identity_LUT_image_float,
+    identity_lut_image_float = '%s.%s.%s' % (lut_path_base, 'float', 'tiff')
+    generate_1d_LUT_image(identity_lut_image_float,
                           lut_resolution,
                           min_value,
                           max_value)
 
-    if identity_LUT_bit_depth not in ['half', 'float']:
-        identity_LUT_image = '%s.%s.%s' % (lut_path_base, 'uint16', 'tiff')
-        convert_bit_depth(identity_LUT_image_float,
-                          identity_LUT_image,
-                          identity_LUT_bit_depth)
+    if identity_lut_bit_depth not in ['half', 'float']:
+        identity_lut_image = '%s.%s.%s' % (lut_path_base, 'uint16', 'tiff')
+        convert_bit_depth(identity_lut_image_float,
+                          identity_lut_image,
+                          identity_lut_bit_depth)
     else:
-        identity_LUT_image = identity_LUT_image_float
+        identity_lut_image = identity_lut_image_float
 
-    transformed_LUT_image = '%s.%s.%s' % (lut_path_base, 'transformed', 'exr')
-    apply_CTL_to_image(identity_LUT_image,
-                       transformed_LUT_image,
+    transformed_lut_image = '%s.%s.%s' % (lut_path_base, 'transformed', 'exr')
+    apply_CTL_to_image(identity_lut_image,
+                       transformed_lut_image,
                        ctl_paths,
                        input_scale,
                        output_scale,
                        global_params,
                        aces_ctl_directory)
 
-    generate_1d_LUT_from_image(transformed_LUT_image,
+    generate_1d_LUT_from_image(transformed_lut_image,
                                lut_path,
                                min_value,
                                max_value,
@@ -607,14 +609,14 @@ def generate_1d_LUT_from_CTL(lut_path,
                                format)
 
     if cleanup:
-        os.remove(identity_LUT_image)
-        if identity_LUT_image != identity_LUT_image_float:
-            os.remove(identity_LUT_image_float)
-        os.remove(transformed_LUT_image)
+        os.remove(identity_lut_image)
+        if identity_lut_image != identity_lut_image_float:
+            os.remove(identity_lut_image_float)
+        os.remove(transformed_lut_image)
 
 
-def correct_LUT_image(transformed_LUT_image,
-                      corrected_LUT_image,
+def correct_LUT_image(transformed_lut_image,
+                      corrected_lut_image,
                       lut_resolution):
     """
     Object description.
@@ -630,7 +632,7 @@ def correct_LUT_image(transformed_LUT_image,
          Return value description.
     """
 
-    transformed = oiio.ImageInput.open(transformed_LUT_image)
+    transformed = oiio.ImageInput.open(transformed_lut_image)
 
     transformed_spec = transformed.spec()
     width = transformed_spec.width
@@ -644,14 +646,14 @@ def correct_LUT_image(transformed_LUT_image,
                   height,
                   lut_resolution * lut_resolution,
                   lut_resolution))
-        print('Generating %s' % corrected_LUT_image)
+        print('Generating %s' % corrected_lut_image)
 
         # Forcibly read data as float, the Python API doesn't handle half-float
         # well yet.
         type = oiio.FLOAT
         source_data = transformed.read_image(type)
 
-        correct = oiio.ImageOutput.create(corrected_LUT_image)
+        correct = oiio.ImageOutput.create(corrected_lut_image)
 
         correct_spec = oiio.ImageSpec()
         correct_spec.set_format(oiio.FLOAT)
@@ -659,7 +661,7 @@ def correct_LUT_image(transformed_LUT_image,
         correct_spec.height = width
         correct_spec.nchannels = channels
 
-        correct.open(corrected_LUT_image, correct_spec, oiio.Create)
+        correct.open(corrected_lut_image, correct_spec, oiio.Create)
 
         dest_data = array.array('f',
                                 ('\0' * correct_spec.width *
@@ -679,17 +681,17 @@ def correct_LUT_image(transformed_LUT_image,
         correct.close()
     else:
         # shutil.copy(transformedLUTImage, correctedLUTImage)
-        corrected_LUT_image = transformed_LUT_image
+        corrected_lut_image = transformed_lut_image
 
     transformed.close()
 
-    return corrected_LUT_image
+    return corrected_lut_image
 
 
 def generate_3d_LUT_from_CTL(lut_path,
                              ctl_paths,
                              lut_resolution=64,
-                             identity_LUT_bit_depth='half',
+                             identity_lut_bit_depth='half',
                              input_scale=1,
                              output_scale=1,
                              global_params=None,
@@ -715,45 +717,45 @@ def generate_3d_LUT_from_CTL(lut_path,
 
     lut_path_base = os.path.splitext(lut_path)[0]
 
-    identity_LUT_image_float = '%s.%s.%s' % (lut_path_base, 'float', 'tiff')
-    generate_3d_LUT_image(identity_LUT_image_float, lut_resolution)
+    identity_lut_image_float = '%s.%s.%s' % (lut_path_base, 'float', 'tiff')
+    generate_3d_LUT_image(identity_lut_image_float, lut_resolution)
 
-    if identity_LUT_bit_depth not in ['half', 'float']:
-        identity_LUT_image = '%s.%s.%s' % (lut_path_base,
-                                           identity_LUT_bit_depth,
+    if identity_lut_bit_depth not in ['half', 'float']:
+        identity_lut_image = '%s.%s.%s' % (lut_path_base,
+                                           identity_lut_bit_depth,
                                            'tiff')
-        convert_bit_depth(identity_LUT_image_float,
-                          identity_LUT_image,
-                          identity_LUT_bit_depth)
+        convert_bit_depth(identity_lut_image_float,
+                          identity_lut_image,
+                          identity_lut_bit_depth)
     else:
-        identity_LUT_image = identity_LUT_image_float
+        identity_lut_image = identity_lut_image_float
 
-    transformed_LUT_image = '%s.%s.%s' % (lut_path_base, 'transformed', 'exr')
-    apply_CTL_to_image(identity_LUT_image,
-                       transformed_LUT_image,
+    transformed_lut_image = '%s.%s.%s' % (lut_path_base, 'transformed', 'exr')
+    apply_CTL_to_image(identity_lut_image,
+                       transformed_lut_image,
                        ctl_paths,
                        input_scale,
                        output_scale,
                        global_params,
                        aces_ctl_directory)
 
-    corrected_LUT_image = '%s.%s.%s' % (lut_path_base, 'correct', 'exr')
-    corrected_LUT_image = correct_LUT_image(transformed_LUT_image,
-                                            corrected_LUT_image,
+    corrected_lut_image = '%s.%s.%s' % (lut_path_base, 'correct', 'exr')
+    corrected_lut_image = correct_LUT_image(transformed_lut_image,
+                                            corrected_lut_image,
                                             lut_resolution)
 
-    generate_3d_LUT_from_image(corrected_LUT_image,
+    generate_3d_LUT_from_image(corrected_lut_image,
                                lut_path,
                                lut_resolution,
                                format)
 
     if cleanup:
-        os.remove(identity_LUT_image)
-        if identity_LUT_image != identity_LUT_image_float:
-            os.remove(identity_LUT_image_float)
-        os.remove(transformed_LUT_image)
-        if corrected_LUT_image != transformed_LUT_image:
-            os.remove(corrected_LUT_image)
+        os.remove(identity_lut_image)
+        if identity_lut_image != identity_lut_image_float:
+            os.remove(identity_lut_image_float)
+        os.remove(transformed_lut_image)
+        if corrected_lut_image != transformed_lut_image:
+            os.remove(corrected_lut_image)
         if format != 'spi3d':
             lut_path_spi3d = '%s.%s' % (lut_path, 'spi3d')
             os.remove(lut_path_spi3d)
@@ -822,31 +824,24 @@ def main():
         for param in options.ctlRenderParam:
             params[param[0]] = float(param[1])
 
-    try:
-        args_start = sys.argv.index('--') + 1
-        args = sys.argv[args_start:]
-    except:
-        args_start = len(sys.argv) + 1
-        args = []
-
     if generate_1d:
         print('1D LUT generation options')
     else:
         print('3D LUT generation options')
 
-    print('lut                 : %s' % lut)
-    print('format              : %s' % format)
-    print('ctls                : %s' % ctls)
-    print('lut res 1d          : %s' % lut_resolution_1d)
-    print('lut res 3d          : %s' % lut_resolution_3d)
-    print('min value           : %s' % min_value)
-    print('max value           : %s' % max_value)
-    print('input scale         : %s' % input_scale)
-    print('output scale        : %s' % output_scale)
-    print('ctl render params   : %s' % params)
-    print('ctl release path    : %s' % ctl_release_path)
-    print('bit depth of input  : %s' % bit_depth)
-    print('cleanup temp images : %s' % cleanup)
+    print('LUT                 : %s' % lut)
+    print('Format              : %s' % format)
+    print('CTLs                : %s' % ctls)
+    print('LUT Res 1d          : %s' % lut_resolution_1d)
+    print('LUT Res 3d          : %s' % lut_resolution_3d)
+    print('Min Value           : %s' % min_value)
+    print('Max Value           : %s' % max_value)
+    print('Input Scale         : %s' % input_scale)
+    print('Output Scale        : %s' % output_scale)
+    print('CTL Render Params   : %s' % params)
+    print('CTL Release Path    : %s' % ctl_release_path)
+    print('Input Bit Depth     : %s' % bit_depth)
+    print('Cleanup Temp Images : %s' % cleanup)
 
     if generate_1d:
         generate_1d_LUT_from_CTL(lut,
@@ -874,10 +869,9 @@ def main():
                                  ctl_release_path,
                                  format=format)
     else:
-        print(('\n\nNo LUT generated. '
+        print(('\n\nNo LUT generated! '
                'You must choose either 1D or 3D LUT generation\n\n'))
 
 
 if __name__ == '__main__':
     main()
-
index bb8f199..76dd754 100755 (executable)
@@ -41,9 +41,13 @@ def read_text(text_file):
          Return value description.\r
     """\r
 \r
-    if text_file != '':\r
-        with open(text_file, 'rb') as fp:\r
-            text = (fp.read())\r
+    # TODO: Investigate if check is needed.\r
+    if not text_file:\r
+        return\r
+\r
+    with open(text_file, 'rb') as fp:\r
+        text = (fp.read())\r
+\r
     return text\r
 \r
 \r
@@ -62,9 +66,13 @@ def write_text(text, text_file):
          Return value description.\r
     """\r
 \r
-    if text_file != '':\r
-        with open(text_file, 'wb') as fp:\r
-            fp.write(text)\r
+    # TODO: Investigate if check is needed.\r
+    if not text_file:\r
+        return\r
+\r
+    with open(text_file, 'wb') as fp:\r
+        fp.write(text)\r
+\r
     return text\r
 \r
 \r
@@ -722,7 +730,6 @@ def main():
         args_start = sys.argv.index('--') + 1\r
         args = sys.argv[args_start:]\r
     except:\r
-        args_start = len(sys.argv) + 1\r
         args = []\r
 \r
     if cmd is None:\r
index a5682fb..faa18be 100644 (file)
@@ -1,2 +1,2 @@
 #!/usr/bin/env python
-# -*- coding: utf-8 -*-
\ No newline at end of file
+# -*- coding: utf-8 -*-
index f3dab51..fb7524a 100644 (file)
@@ -16,12 +16,12 @@ import tempfile
 import unittest
 
 sys.path.append(os.path.abspath(
os.path.join(os.path.dirname(__file__), '..', '..') ) )
   os.path.join(os.path.dirname(__file__), '..', '..')))
 
 from aces_ocio.utilities import files_walker
-from aces_ocio.aces_config import (
+from aces_ocio.generate_config import (
     ACES_OCIO_CTL_DIRECTORY_ENVIRON,
-    create_ACES_config)
+    generate_config)
 
 __author__ = 'ACES Developers'
 __copyright__ = 'Copyright (C) 2014 - 2015 - ACES Developers'
@@ -39,8 +39,7 @@ __all__ = ['REFERENCE_CONFIG_ROOT_DIRECTORY',
 # TODO: Investigate how the current config has been generated to use it for
 # tests.
 REFERENCE_CONFIG_ROOT_DIRECTORY = os.path.abspath(
- os.path.join(os.path.dirname(__file__), '..', '..', '..'))
-#REFERENCE_CONFIG_ROOT_DIRECTORY = '/colour-science/colour-ramblings/ocio/aces'
+    os.path.join(os.path.dirname(__file__), '..', '..', '..'))
 
 HASH_TEST_PATTERNS = ('\.3dl', '\.lut', '\.csp')
 UNHASHABLE_TEST_PATTERNS = ('\.icc', '\.ocio')
@@ -119,8 +118,8 @@ class TestACESConfig(unittest.TestCase):
         generated configuration and comparing them to the existing one.
         """
 
-        self.assertTrue(create_ACES_config(self.__aces_ocio_ctl_directory,
-                                           self.__temporary_directory))
+        self.assertTrue(generate_config(self.__aces_ocio_ctl_directory,
+                                        self.__temporary_directory))
 
         reference_hashes = self.directory_hashes(
             REFERENCE_CONFIG_ROOT_DIRECTORY,
index e598221..6f30f3a 100644 (file)
@@ -7,6 +7,7 @@ Defines various package utilities objects.
 
 from __future__ import division
 
+import itertools
 import os
 import re
 from collections import OrderedDict
@@ -26,7 +27,9 @@ __all__ = ['ColorSpace',
            'files_walker',
            'replace',
            'sanitize',
-           'compact']
+           'compact',
+           'colorspace_prefixed_name',
+           'unpack_default']
 
 
 class ColorSpace(object):
@@ -36,16 +39,16 @@ class ColorSpace(object):
 
     def __init__(self,
                  name,
-                 aliases=[],
+                 aliases=None,
                  description=None,
                  bit_depth=ocio.Constants.BIT_DEPTH_F32,
                  equality_group='',
                  family=None,
                  is_data=False,
-                 to_reference_transforms=[],
-                 from_reference_transforms=[],
+                 to_reference_transforms=None,
+                 from_reference_transforms=None,
                  allocation_type=ocio.Constants.ALLOCATION_UNIFORM,
-                 allocation_vars=[0, 1],
+                 allocation_vars=None,
                  aces_transform_id=None):
         """
         Object description.
@@ -61,6 +64,18 @@ class ColorSpace(object):
              Return value description.
         """
 
+        if aliases is None:
+            aliases = []
+
+        if to_reference_transforms is None:
+            to_reference_transforms = []
+
+        if from_reference_transforms is None:
+            from_reference_transforms = []
+
+        if allocation_vars is None:
+            allocation_vars = [0, 1]
+
         self.name = name
         self.aliases = aliases
         self.bit_depth = bit_depth
@@ -74,6 +89,7 @@ class ColorSpace(object):
         self.allocation_vars = allocation_vars
         self.aces_transform_id = aces_transform_id
 
+
 def mat44_from_mat33(mat33):
     """
     Creates a 4x4 matrix from given 3x3 matrix.
@@ -177,11 +193,11 @@ def replace(string, data):
 
     Examples
     --------
-    >>> patterns = {"John" : "Luke",
-    ...             "Jane" : "Anakin",
-    ...             "Doe" : "Skywalker",
-    ...             "Z6PO" : "R2D2"}
-    >>> data = "Users are: John Doe, Jane Doe, Z6PO."
+    >>> patterns = {'John' : 'Luke',
+    ...             'Jane' : 'Anakin',
+    ...             'Doe' : 'Skywalker',
+    ...             'Z6PO' : 'R2D2'}
+    >>> data = 'Users are: John Doe, Jane Doe, Z6PO.'
     >>> replace(data,patterns )
     u'Users are: Luke Skywalker, Anakin Skywalker, R2D2.'
     """
@@ -233,3 +249,45 @@ def compact(string):
                                 ('___', '_'),
                                 ('__', '_'),
                                 ('_', ''))))
+
+
+def colorspace_prefixed_name(colorspace):
+    """
+    Returns given *OCIO* colorspace prefixed name with its family name.
+
+    Parameters
+    ----------
+    colorspace : Colorspace
+        Colorspace to prefix.
+
+    Returns
+    -------
+    str or unicode
+         Family prefixed *OCIO* colorspace name.
+    """
+    prefix = colorspace.family.replace('/', ' - ')
+
+    return '%s - %s' % (prefix, colorspace.name)
+
+
+def unpack_default(iterable, length=3, default=None):
+    """
+    Unpacks given iterable maintaining given length and filling missing
+    entries with given default.
+
+    Parameters
+    ----------
+    iterable : object
+        Iterable.
+    length : int
+        Iterable length.
+    default : object
+        Filling default object.
+
+    Returns
+    -------
+    iterable
+    """
+
+    return itertools.islice(
+        itertools.chain(iter(iterable), itertools.repeat(default)), length)
index 8a1a10a..b62606d 100755 (executable)
@@ -12,7 +12,7 @@ import sys
 
 sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
 
-from aces_ocio.aces_config import main
+from aces_ocio.generate_config import main
 
 __author__ = 'ACES Developers'
 __copyright__ = 'Copyright (C) 2014 - 2015 - ACES Developers'