Added documentation for individual functions
authorHaarm-Pieter Duiker <hpd1@duikerresearch.com>
Tue, 1 Sep 2015 07:06:38 +0000 (00:06 -0700)
committerHaarm-Pieter Duiker <hpd1@duikerresearch.com>
Tue, 1 Sep 2015 07:06:38 +0000 (00:06 -0700)
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
aces_1.0.0/python/aces_ocio/generate_lut.py
aces_1.0.0/python/aces_ocio/utilities.py

index 0d51dd8..ce73bee 100644 (file)
@@ -81,17 +81,16 @@ ACES_XYZ_TO_AP0 = [1.0498110175, 0.0000000000, -0.0000974845,
 
 def create_ACES():
     """
-    Object description.
+    Creates the *ACES2065-1* reference color space
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    None
 
     Returns
     -------
-    type
-         Return value description.
+    ColorSpace
+         *ACES2065-1* and all its identifying information
     """
 
     # Defining the reference colorspace.
@@ -117,17 +116,31 @@ def create_ACEScc(aces_ctl_directory,
                   max_value=1,
                   input_scale=1):
     """
-    Creates the *ACEScc* colorspace.
+    Creates the *ACEScc* reference color space
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    aces_ctl_directory : str or unicode
+        The path to the aces 'transforms/ctl/utilities'
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_1d : int
+        The resolution of generated 1D LUTs
+    cleanup : bool
+        Whether or not to clean up the intermediate images 
+    name : str or unicode, optional
+        The name of the ColorSpace
+    min_value : float, optional
+        The minimum value to consider for the space
+    max_value : float, optional
+        The maximum value to consider for the space
+    input_scale : float, optional
+        A scale factor to divide input values
 
     Returns
     -------
-    Colorspace
-         *ACEScc* colorspace.
+    ColorSpace
+         *ACEScc* and all its identifying information
     """
 
     cs = ColorSpace(name)
@@ -190,17 +203,25 @@ def create_ACESproxy(aces_ctl_directory,
                      cleanup,
                      name='ACESproxy'):
     """
-    Creates the *ACESproxy* colorspace.
+    Creates the *ACESproxy* color space
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    aces_ctl_directory : str or unicode
+        The path to the aces 'transforms/ctl/utilities'
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_1d : int
+        The resolution of generated 1D LUTs
+    cleanup : bool
+        Whether or not to clean up the intermediate images 
+    name : str or unicode, optional
+        The name of the ColorSpace
 
     Returns
     -------
-    Colorspace
-         *ACESproxy* colorspace.
+    ColorSpace
+         *ACESproxy* and all its identifying information
     """
 
     cs = ColorSpace(name)
@@ -261,17 +282,16 @@ def create_ACESproxy(aces_ctl_directory,
 # -------------------------------------------------------------------------
 def create_ACEScg():
     """
-    Creates the *ACEScg* colorspace.
+    Creates the *ACEScg* color space
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    None
 
     Returns
     -------
-    Colorspace
-         *ACEScg* colorspace.
+    ColorSpace
+         *ACEScg* and all its identifying information
     """
 
     name = 'ACEScg'
@@ -317,17 +337,21 @@ def create_ADX(lut_directory,
                bit_depth=10,
                name='ADX'):
     """
-    Creates the *ADX* colorspace.
+    Creates the *ADX* color space
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    bit_depth : int
+        Choose either 10 or 16 bit ADX
+    name : str or unicode, optional
+        The name of the ColorSpace
 
     Returns
     -------
-    Colorspace
-         *ADX* colorspace.
+    ColorSpace
+         *ADX* and all its identifying information
     """
 
     name = '%s%s' % (name, bit_depth)
@@ -486,12 +510,36 @@ def create_generic_log(aces_ctl_directory,
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    aces_ctl_directory : str or unicode
+        The path to the aces 'transforms/ctl/utilities'
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_1d : int
+        The resolution of generated 1D LUTs
+    cleanup : bool
+        Whether or not to clean up the intermediate images 
+    name : str or unicode, optional
+        The name of the ColorSpace
+    aliases : list of str or unicode, optional
+        The alias names to use for the ColorSpace
+    min_value : float, optional
+        The minimum value to consider for the space
+    max_value : float, optional
+        The maximum value to consider for the space
+    input_scale : float, optional
+        A scale factor to divide input values
+    middle_grey : float, optional
+        The middle of the dynamic range covered by the transfer function
+    min_exposure : float, optional
+        The offset from middle grey, in stops, that defines the low end of the dynamic 
+        range covered by the transfer function
+    max_exposure : float, optional
+        The offset from middle grey, in stops, that defines the high end of the dynamic 
+        range covered by the transfer function
 
     Returns
     -------
-    Colorspace
+    ColorSpace
          *Generic Log* colorspace.
     """
 
@@ -552,6 +600,36 @@ def create_Dolby_PQ(aces_ctl_directory,
                     min_value=0.0,
                     max_value=1.0,
                     input_scale=1.0):
+    """
+    Creates the generic *Dolby PQ* colorspace.
+
+    Parameters
+    ----------
+    aces_ctl_directory : str or unicode
+        The path to the aces 'transforms/ctl/utilities'
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_1d : int
+        The resolution of generated 1D LUTs
+    cleanup : bool
+        Whether or not to clean up the intermediate images 
+    name : str or unicode, optional
+        The name of the ColorSpace
+    aliases : list of str or unicode, optional
+        The alias names to use for the ColorSpace
+    min_value : float, optional
+        The minimum value to consider for the space
+    max_value : float, optional
+        The maximum value to consider for the space
+    input_scale : float, optional
+        A scale factor to divide input values
+
+    Returns
+    -------
+    ColorSpace
+         Generic *Dolby PQ* colorspace.
+    """
+
     if aliases is None:
         aliases = []
 
@@ -609,6 +687,44 @@ def create_Dolby_PQ_shaper(aces_ctl_directory,
                            middle_grey=0.18,
                            min_exposure=-6.5,
                            max_exposure=6.5):
+    """
+    Creates a *Dolby PQ* colorspace that covers a specific dynamic range
+
+    Parameters
+    ----------
+    aces_ctl_directory : str or unicode
+        The path to the aces 'transforms/ctl/utilities'
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_1d : int
+        The resolution of generated 1D LUTs
+    cleanup : bool
+        Whether or not to clean up the intermediate images 
+    name : str or unicode, optional
+        The name of the ColorSpace
+    aliases : list of str or unicode, optional
+        The alias names to use for the ColorSpace
+    min_value : float, optional
+        The minimum value to consider for the space
+    max_value : float, optional
+        The maximum value to consider for the space
+    input_scale : float, optional
+        A scale factor to divide input values
+    middle_grey : float, optional
+        The middle of the dynamic range covered by the transfer function
+    min_exposure : float, optional
+        The offset from middle grey, in stops, that defines the low end of the dynamic 
+        range covered by the transfer function
+    max_exposure : float, optional
+        The offset from middle grey, in stops, that defines the high end of the dynamic 
+        range covered by the transfer function
+
+    Returns
+    -------
+    ColorSpace
+         A *Dolby PQ* colorspace that covers a specific dynamic range
+    """
+
     if aliases is None:
         aliases = []
 
@@ -665,17 +781,32 @@ def create_ACES_LMT(lmt_name,
                     cleanup=True,
                     aliases=None):
     """
-    Creates the *ACES LMT* colorspace.
+    Creates an *ACES Look Transform (LMT)* colorspace.
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    lmt_name : str or unicode
+        The name of the Look Transform (LMT)
+    lmt_values : dict
+        A collection of values that define the Look Transform's attributes and behavior
+    shaper_info : dict
+        A collection of values that define the Shaper to use when generating LUTs to
+        represent the Look Transform
+    aces_ctl_directory : str or unicode
+        The path to the aces 'transforms/ctl/utilities'
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_3d : int, optional
+        The resolution of generated 3D LUTs
+    cleanup : bool, optional
+        Whether or not to clean up the intermediate images 
+    aliases : list of str or unicode, optional
+        The alias names to use for the ColorSpace
 
     Returns
     -------
-    Colorspace
-         *ACES LMT* colorspace.
+    ColorSpace
+         An *ACES LMT* colorspace.
     """
 
     if aliases is None:
@@ -784,17 +915,30 @@ def create_LMTs(aces_ctl_directory,
                 lmt_info,
                 cleanup):
     """
-    Object description.
+    Create ColorSpaces representing the *ACES Look Transforms*
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    aces_ctl_directory : str or unicode
+        The path to the aces 'transforms/ctl/utilities'
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_1d : int
+        The resolution of generated 1D LUTs
+    lut_resolution_3d : int
+        The resolution of generated 3D LUTs
+    cleanup : bool
+        Whether or not to clean up the intermediate images 
+    aliases : list of str or unicode, optional
+        The alias names to use for the ColorSpace
+    lmt_info : dict
+        A collection of values that define the Look Transforms that need to be 
+        generated
 
     Returns
     -------
-    type
-         Return value description.
+    list of ColorSpaces
+         ColorSpaces representing the *ACES Look Transforms*
     """
 
     colorspaces = []
@@ -869,17 +1013,32 @@ def create_ACES_RRT_plus_ODT(odt_name,
                              cleanup=True,
                              aliases=None):
     """
-    Object description.
+    Creates an *ACES Output Transform (RRT + ODT)* colorspace.
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    odt_name : str or unicode
+        The name of the Output Transform (RRT + ODT)
+    odt_values : dict
+        A collection of values that define the Output Transform's attributes and behavior
+    shaper_info : dict
+        A collection of values that define the Shaper to use when generating LUTs to
+        represent the Output Transform
+    aces_ctl_directory : str or unicode
+        The path to the aces 'transforms/ctl/utilities'
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_3d : int, optional
+        The resolution of generated 3D LUTs
+    cleanup : bool, optional
+        Whether or not to clean up the intermediate images 
+    aliases : list of str or unicode, optional
+        The alias names to use for the ColorSpace
 
     Returns
     -------
-    type
-         Return value description.
+    ColorSpace
+         An *ACES Output Transform (RRT + ODT)* colorspace.
     """
 
     if aliases is None:
@@ -1028,6 +1187,36 @@ def create_shapers_log2(aces_ctl_directory,
                         middle_grey,
                         min_exposure,
                         max_exposure):
+    """
+    Creates a *Log base 2* colorspace that covers a specific dynamic range
+
+    Parameters
+    ----------
+    aces_ctl_directory : str or unicode
+        The path to the aces 'transforms/ctl/utilities'
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_1d : int
+        The resolution of generated 1D LUTs
+    cleanup : bool
+        Whether or not to clean up the intermediate images 
+    shaper_name : str or unicode, optional
+        The name of the ColorSpace
+    middle_grey : float
+        The middle of the dynamic range covered by the transfer function
+    min_exposure : float
+        The offset from middle grey, in stops, that defines the low end of the dynamic 
+        range covered by the transfer function
+    max_exposure : float
+        The offset from middle grey, in stops, that defines the high end of the dynamic 
+        range covered by the transfer function
+
+    Returns
+    -------
+    ColorSpace
+         A *Log base 2* colorspace that covers a specific dynamic range
+    """
+
     colorspaces = []
     shaper_data = {}
 
@@ -1099,6 +1288,38 @@ def create_shapers_dolbypq(aces_ctl_directory,
                            middle_grey,
                            min_exposure,
                            max_exposure):
+    """
+    Creates two *Dolby PQ* colorspaces, one with now gamut conversion, the other with
+    the conversion from *ACES* *AP0* to *AP1*
+
+    Parameters
+    ----------
+    aces_ctl_directory : str or unicode
+        The path to the aces 'transforms/ctl/utilities'
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_1d : int
+        The resolution of generated 1D LUTs
+    cleanup : bool
+        Whether or not to clean up the intermediate images 
+    shaper_name : str or unicode, optional
+        The name of the ColorSpace
+    middle_grey : float
+        The middle of the dynamic range covered by the transfer function
+    min_exposure : float
+        The offset from middle grey, in stops, that defines the low end of the dynamic 
+        range covered by the transfer function
+    max_exposure : float
+        The offset from middle grey, in stops, that defines the high end of the dynamic 
+        range covered by the transfer function
+
+    Returns
+    -------
+    dict
+        Values defining a Shaper
+    list of ColorSpaces
+         A list of *Dolby PQ* colorspaces that covers a specific dynamic range
+    """
     colorspaces = []
     shaper_data = {}
 
@@ -1137,7 +1358,7 @@ def create_shapers_dolbypq(aces_ctl_directory,
 
     shaper_data[dolby_pq_shaper_name] = dolby_pq_shaper_data
 
-    # Defining the *Log2 shaper that includes the AP1* primaries.
+    # Defining the *Dolby PQ shaper that includes the AP1* primaries.
     dolby_pq_shaper_api1_name = '%s - AP1' % dolby_pq_shaper_name
     dolby_pq_shaper_api1_colorspace = copy.deepcopy(dolby_pq_shaper_colorspace)
 
@@ -1167,6 +1388,31 @@ def create_shapers(aces_ctl_directory,
                    lut_resolution_1d,
                    cleanup):
 
+    """
+    Creates sets of shaper colorspaces covering the *Log 2* and *Dolby PQ* 
+    transfer functions and dynamic ranges suitable of use with the 48 nit, 
+    1000 nit, 2000 nit and 4000 nit *ACES Output Transforms*
+
+    Parameters
+    ----------
+    aces_ctl_directory : str or unicode
+        The path to the aces 'transforms/ctl/utilities'
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_1d : int
+        The resolution of generated 1D LUTs
+    cleanup : bool
+        Whether or not to clean up the intermediate images 
+
+    Returns
+    -------
+    list of dicts
+        Values defining a set of Shapers
+    list of ColorSpaces
+         A list of Shaper colorspaces that covers a varying dynamic ranges and
+         transfer functions
+    """
+
     colorspaces = []
     shaper_data = {}
 
@@ -1325,17 +1571,37 @@ def create_ODTs(aces_ctl_directory,
                 linear_display_space,
                 log_display_space):
     """
-    Object description.
+    Create ColorSpaces representing the *ACES Output Transforms*
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    aces_ctl_directory : str or unicode
+        The path to the aces 'transforms/ctl/utilities'
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_1d : int
+        The resolution of generated 1D LUTs
+    lut_resolution_3d : int
+        The resolution of generated 3D LUTs
+    odt_info : dict
+        A collection of values that define the Output Transforms that need to be 
+        generated
+    shaper_name : str or unicode, optional
+        The name of Shaper ColorSpace to use when generating LUTs
+    cleanup : bool
+        Whether or not to clean up the intermediate images 
+    linear_display_space : lstr or unicode
+        The name of the ColorSpace to use for the raw or linear View
+    log_display_space : lstr or unicode
+        The name of the ColorSpace to use for the log View
 
     Returns
     -------
-    type
-         Return value description.
+    list of ColorSpaces
+         ColorSpaces representing the *ACES Output Transforms*
+    list of dicts
+        Collections of names and ColorSpaces corresponding to the Displays and
+        Views
     """
 
     colorspaces = []
@@ -1401,17 +1667,19 @@ def create_ODTs(aces_ctl_directory,
 
 def get_transform_info(ctl_transform):
     """
-    Object description.
+    Returns the information stored in first couple of lines of an official
+    *ACES Transform* CTL file
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    ctl_transform : str or unicode
+        The path to the CTL file to be scraped.
 
     Returns
     -------
-    type
-         Return value description.
+    tuple
+         Combination of Transform ID, User Name, User Name Prefix and Full/Legal
+         switch
     """
 
     with open(ctl_transform, 'rb') as fp:
@@ -1441,19 +1709,18 @@ def get_transform_info(ctl_transform):
 
 def get_ODTs_info(aces_ctl_directory):
     """
-    Object description.
-
-    For versions after WGR9.
+    Returns the information describing the names and CTL files associated with 
+    the *ACES Output Transforms* in a given ACES release
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    aces_ctl_directory : str or unicode
+        The path to the base *ACES* CTL directory
 
     Returns
     -------
-    type
-         Return value description.
+    dict of dicts
+         Collecton of dicts, one describing each *ACES Output Transform*
     """
 
     # TODO: Investigate usage of *files_walker* definition here.
@@ -1531,19 +1798,18 @@ def get_ODTs_info(aces_ctl_directory):
 
 def get_LMTs_info(aces_ctl_directory):
     """
-    Object description.
-
-    For versions after WGR9.
+    Returns the information describing the names and CTL files associated with 
+    the *ACES Look Transforms* in a given ACES release
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    aces_ctl_directory : str or unicode
+        The path to the base *ACES* CTL directory
 
     Returns
     -------
-    type
-         Return value description.
+    dict of dicts
+         Collecton of dicts, one describing each *ACES Look Transform*
     """
 
     # TODO: Investigate refactoring with previous definition.
@@ -1625,17 +1891,39 @@ def create_colorspaces(aces_ctl_directory,
                        shaper_name,
                        cleanup):
     """
-    Generates the colorspace conversions.
+    Generates the *ACES* colorspaces, displays and views
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    aces_ctl_directory : str or unicode
+        The path to the aces 'transforms/ctl/utilities'
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_1d : int
+        The resolution of generated 1D LUTs
+    lut_resolution_3d : int
+        The resolution of generated 3D LUTs
+    lmt_info : dict
+        A collection of values that define the Look Transforms that need to be 
+        generated
+    odt_info : dict
+        A collection of values that define the Output Transforms that need to be 
+        generated
+    shaper_name : str or unicode, optional
+        The name of Shaper ColorSpace to use when generating LUTs
+    cleanup : bool
+        Whether or not to clean up the intermediate images 
 
     Returns
     -------
-    type
-         Return value description.
+    tuple
+         A collection of values defining
+            the reference colorspace : ACES
+            a list of the colorspaces created
+            a list of the displays created
+            a list of the general log colorspace
+            a list of the role assignments
+            the name of the default display
     """
 
     colorspaces = []
index 58f52cb..d4cd531 100644 (file)
@@ -172,13 +172,15 @@ def create_colorspaces(lut_directory, lut_resolution_1d):
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_1d : int
+        The resolution of generated 1D LUTs
 
     Returns
     -------
-    type
-         Return value description.
+    list
+         A list of colorspaces for ARRI cameras and encodings 
     """
 
     colorspaces = []
index 64ffb60..bbb5c8a 100644 (file)
@@ -32,19 +32,27 @@ def create_c_log(gamut,
                  lut_resolution_1d,
                  aliases):
     """
-    Object description.
-
-    Canon-Log to ACES.
+    Creates colorspace covering the conversion from CLog to ACES, with various transfer 
+    functions and encoding gamuts covered
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    gamut : str
+        The name of the encoding gamut to use.
+    transfer_function : str
+        The name of the transfer function to use
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_1d : int
+        The resolution of generated 1D LUTs
+    aliases : list of str
+        Aliases for this colorspace
 
     Returns
     -------
-    type
-         Return value description.
+    ColorSpace
+         A ColorSpace container class referencing the LUTs, matrices and identifying
+         information for the requested colorspace.    
     """
 
     name = '%s - %s' % (transfer_function, gamut)
@@ -161,13 +169,15 @@ def create_colorspaces(lut_directory, lut_resolution_1d):
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_1d : int
+        The resolution of generated 1D LUTs
 
     Returns
     -------
-    type
-         Return value description.
+    list
+         A list of colorspaces for Canon cameras and encodings 
     """
 
     colorspaces = []
index cb935f7..8872870 100644 (file)
@@ -43,17 +43,23 @@ def create_matrix_colorspace(name='matrix',
                              to_reference_values=None,
                              aliases=None):
     """
-    Object description.
+    Creates a ColorSpace that only uses *Matrix Transforms*
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    name : str, optional
+        Aliases for this colorspace
+    from_reference_values : list of matrices
+        List of matrices to convert from the reference colorspace to this space        
+    to_reference_values : list of matrices
+        List of matrices to convert to the reference colorspace from this space
+    aliases : list of str, optional
+        Aliases for this colorspace
 
     Returns
     -------
-    type
-         Return value description.
+    ColorSpace
+         A *Matrix Transform*-based ColorSpace
     """
 
     if from_reference_values is None:
@@ -105,17 +111,27 @@ def create_transfer_colorspace(name='transfer',
                                lut_resolution_1d=1024,
                                aliases=None):
     """
-    Object description.
+    Creates a ColorSpace that only uses transfer functions encoded as 1D LUTs
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    name : str, optional
+        Aliases for this colorspace
+    transfer_function_name : str, optional
+        The name of the transfer function
+    transfer_function : function, optional
+        The transfer function to be evaluated
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_1d : int
+        The resolution of generated 1D LUTs
+    aliases : list of str
+        Aliases for this colorspace
 
     Returns
     -------
-    type
-         Return value description.
+    ColorSpace
+         A *LUT1D Transform*-based ColorSpace representing a transfer function
     """
 
     if aliases is None:
@@ -174,17 +190,33 @@ def create_matrix_plus_transfer_colorspace(
         to_reference_values=None,
         aliases=None):
     """
-    Object description.
+    Creates a ColorSpace that uses transfer functions encoded as 1D LUTs and
+    matrice
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    name : str, optional
+        Aliases for this colorspace
+    transfer_function_name : str, optional
+        The name of the transfer function
+    transfer_function : function, optional
+        The transfer function to be evaluated
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_1d : int
+        The resolution of generated 1D LUTs
+    from_reference_values : list of matrices
+        List of matrices to convert from the reference colorspace to this space        
+    to_reference_values : list of matrices
+        List of matrices to convert to the reference colorspace from this space
+    aliases : list of str
+        Aliases for this colorspace
 
     Returns
     -------
-    type
-         Return value description.
+    ColorSpace
+         A *Matrx and LUT1D Transform*-based ColorSpace representing a transfer 
+         function and matrix
     """
 
     if from_reference_values is None:
@@ -257,6 +289,19 @@ def create_matrix_plus_transfer_colorspace(
 
 # Transfer functions for standard colorspaces.
 def transfer_function_sRGB_to_linear(v):
+    """
+    The sRGB (IEC 61966-2-1) transfer function
+
+    Parameters
+    ----------
+    v : float
+        The normalized value to pass through the function
+
+    Returns
+    -------
+    float
+        A converted value
+    """
     a = 1.055
     b = 0.04045
     d = 12.92
@@ -268,6 +313,19 @@ def transfer_function_sRGB_to_linear(v):
 
 
 def transfer_function_Rec709_to_linear(v):
+    """
+    The Rec.709 transfer function
+
+    Parameters
+    ----------
+    v : float
+        The normalized value to pass through the function
+
+    Returns
+    -------
+    float
+        A converted value
+    """
     a = 1.099
     b = 0.018
     d = 4.5
@@ -280,6 +338,19 @@ def transfer_function_Rec709_to_linear(v):
 
 
 def transfer_function_Rec2020_10bit_to_linear(v):
+    """
+    The Rec.2020 10-bit transfer function
+
+    Parameters
+    ----------
+    v : float
+        The normalized value to pass through the function
+
+    Returns
+    -------
+    float
+        A converted value
+    """
     a = 1.099
     b = 0.018
     d = 4.5
@@ -292,6 +363,19 @@ def transfer_function_Rec2020_10bit_to_linear(v):
 
 
 def transfer_function_Rec2020_12bit_to_linear(v):
+    """
+    The Rec.2020 12-bit transfer function
+
+    Parameters
+    ----------
+    v : float
+        The normalized value to pass through the function
+
+    Returns
+    -------
+    float
+        A converted value
+    """
     a = 1.0993
     b = 0.0181
     d = 4.5
@@ -304,6 +388,19 @@ def transfer_function_Rec2020_12bit_to_linear(v):
 
 
 def transfer_function_Rec1886_to_linear(v):
+    """
+    The Rec.1886 transfer function
+
+    Parameters
+    ----------
+    v : float
+        The normalized value to pass through the function
+
+    Returns
+    -------
+    float
+        A converted value
+    """
     g = 2.4
     Lw = 1
     Lb = 0
@@ -325,13 +422,15 @@ def create_colorspaces(lut_directory,
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_1d : int
+        The resolution of generated 1D LUTs
 
     Returns
     -------
-    type
-         Return value description.
+    list
+         A list of colorspaces for general colorspaces and encodings 
     """
 
     colorspaces = []
@@ -560,6 +659,18 @@ def create_colorspaces(lut_directory,
 
 
 def create_raw():
+    """
+    Creates the *raw* color space
+
+    Parameters
+    ----------
+    None
+
+    Returns
+    -------
+    ColorSpace
+         *raw* and all its identifying information
+    """
     # *Raw* utility space
     name = 'Raw'
     raw = ColorSpace(name)
index 44b5858..fbcafb8 100644 (file)
@@ -32,19 +32,27 @@ def create_protune(gamut,
                    lut_resolution_1d,
                    aliases):
     """
-    Object description.
-
-    Protune to ACES.
+    Creates colorspace covering the conversion from ProTune to ACES, with various transfer 
+    functions and encoding gamuts covered
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    gamut : str
+        The name of the encoding gamut to use.
+    transfer_function : str
+        The name of the transfer function to use
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_1d : int
+        The resolution of generated 1D LUTs
+    aliases : list of str
+        Aliases for this colorspace
 
     Returns
     -------
-    type
-         Return value description.
+    ColorSpace
+         A ColorSpace container class referencing the LUTs, matrices and identifying
+         information for the requested colorspace.
     """
 
     # The gamut should be marked as experimental until  matrices are fully
@@ -117,13 +125,15 @@ def create_colorspaces(lut_directory, lut_resolution_1d):
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_1d : int
+        The resolution of generated 1D LUTs
 
     Returns
     -------
-    type
-         Return value description.
+    list
+         A list of colorspaces for GoPro cameras and encodings 
     """
 
     colorspaces = []
index 2d32131..9e5e094 100644 (file)
@@ -31,19 +31,27 @@ def create_v_log(gamut,
                  lut_resolution_1d,
                  aliases):
     """
-    Object description.
-
-    Panasonic V-Log to ACES.
+    Creates colorspace covering the conversion from VLog to ACES, with various transfer 
+    functions and encoding gamuts covered
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    gamut : str
+        The name of the encoding gamut to use.
+    transfer_function : str
+        The name of the transfer function to use
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_1d : int
+        The resolution of generated 1D LUTs
+    aliases : list of str
+        Aliases for this colorspace
 
     Returns
     -------
-    type
-         Return value description.
+    ColorSpace
+         A ColorSpace container class referencing the LUTs, matrices and identifying
+         information for the requested colorspace.
     """
 
     name = '%s - %s' % (transfer_function, gamut)
@@ -116,13 +124,15 @@ def create_colorspaces(lut_directory, lut_resolution_1d):
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_1d : int
+        The resolution of generated 1D LUTs
 
     Returns
     -------
-    type
-         Return value description.
+    list
+         A list of colorspaces for Panasonic cameras and encodings 
     """
 
     colorspaces = []
index 0614a7f..eefe9ef 100644 (file)
@@ -32,19 +32,27 @@ def create_red_log_film(gamut,
                         lut_resolution_1d,
                         aliases=None):
     """
-    Object description.
-
-    RED colorspaces to ACES.
+    Creates colorspace covering the conversion from RED spaces to ACES, with various 
+    transfer functions and encoding gamuts covered
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    gamut : str
+        The name of the encoding gamut to use.
+    transfer_function : str
+        The name of the transfer function to use
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_1d : int
+        The resolution of generated 1D LUTs
+    aliases : list of str
+        Aliases for this colorspace
 
     Returns
     -------
-    type
-         Return value description.
+    ColorSpace
+         A ColorSpace container class referencing the LUTs, matrices and identifying
+         information for the requested colorspace.
     """
 
     if aliases is None:
@@ -156,13 +164,15 @@ def create_colorspaces(lut_directory, lut_resolution_1d):
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_1d : int
+        The resolution of generated 1D LUTs
 
     Returns
     -------
-    type
-         Return value description.
+    list
+         A list of colorspaces for RED cameras and encodings 
     """
 
     colorspaces = []
index a19d2e5..981b687 100644 (file)
@@ -32,19 +32,27 @@ def create_s_log(gamut,
                  lut_resolution_1d,
                  aliases):
     """
-    Object description.
-
-    SLog to ACES.
+    Creates colorspace covering the conversion from Sony spaces to ACES, with various 
+    transfer functions and encoding gamuts covered
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    gamut : str
+        The name of the encoding gamut to use.
+    transfer_function : str
+        The name of the transfer function to use
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_1d : int
+        The resolution of generated 1D LUTs
+    aliases : list of str
+        Aliases for this colorspace
 
     Returns
     -------
-    type
-         Return value description.
+    ColorSpace
+         A ColorSpace container class referencing the LUTs, matrices and identifying
+         information for the requested colorspace.
     """
 
     name = '%s - %s' % (transfer_function, gamut)
@@ -220,13 +228,15 @@ def create_colorspaces(lut_directory, lut_resolution_1d):
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    lut_directory : str or unicode 
+        The directory to use when generating LUTs
+    lut_resolution_1d : int
+        The resolution of generated 1D LUTs
 
     Returns
     -------
-    type
-         Return value description.
+    list
+         A list of colorspaces for Sony cameras and encodings 
     """
 
     colorspaces = []
index 13022c0..4f01818 100755 (executable)
@@ -75,23 +75,27 @@ def set_config_roles(config,
     config : Config
         *OCIO* configuration.
     color_picking : str or unicode, optional
-        Color picking role title.
+        Color Picking role title.
     color_timing : str or unicode, optional
-        Color timing role title.
+        Color Timing role title.
     compositing_log : str or unicode, optional
-        Compositing log role title.
+        Compositing Log role title.
     data : str or unicode, optional
         Data role title.
     default : str or unicode, optional
         Default role title.
     matte_paint : str or unicode, optional
-        Matte painting role title.
+        Matte Painting role title.
     reference : str or unicode, optional
         Reference role title.
     scene_linear : str or unicode, optional
-        Scene linear role title.
+        Scene Linear role title.
     texture_paint : str or unicode, optional
-        Texture painting role title.
+        Texture Painting role title.
+    rendering : str or unicode, optional
+        Rendering role title.
+    compositing_linear : str or unicode, optional
+        Compositing Linear role title.
     Returns
     -------
     bool
@@ -427,17 +431,26 @@ def add_looks_to_views(looks,
                        config_data,
                        multiple_displays=False):
     """
-    Object description.
+    Integrates a set of looks into the *OCIO* config's Displays and Views
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    looks : array of str or unicode
+        Names of looks
+    reference_name : str or unicode
+        The name of the *OCIO* reference colorspace
+    config_data : dict
+        Colorspaces and transforms converting between those colorspaces and
+        the reference colorspace, *ACES*.
+    multiple_displays : bool
+        If true, looks are added to the config_data looks list
+        If false, looks are integrated directly into the list of displays and 
+        views. This may be necessary due to limitations of some applications' 
+        currently implementation of OCIO, ex. Maya 2016.
 
     Returns
     -------
-    type
-         Return value description.
+    None
     """
     look_names = [look[0] for look in looks]
 
@@ -522,17 +535,30 @@ def create_config(config_data,
                   look_info=None,
                   custom_lut_dir=None):
     """
-    Object description.
+    Create the *OCIO* config based on the configuration data
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    config_data : dict
+        Colorspaces and transforms converting between those colorspaces and
+        the reference colorspace, *ACES*, along with other data needed to 
+        generate a complete *OCIO* configuration
+    aliases : bool, optional
+        Whether or not to include Alias colorspaces 
+    prefix : bool, optional
+        Whether or not to prefix the colorspace names with their Family names
+    multiple_displays : bool, optional
+        Whether to create a single display named *ACES* with Views for each
+        Output Transform or multiple displays, one for each Output Transform
+    look_info : array of str or unicode, optional
+        Paths and names for look data
+    custom_lut_dir : str or unicode, optional
+        Directory to use for storing custom look files
 
     Returns
     -------
-    type
-         Return value description.
+    *OCIO* config
+         The constructed OCIO configuration
     """
 
     if look_info is None:
@@ -942,18 +968,34 @@ def create_config_data(odt_info,
                        lut_resolution_3d=64,
                        cleanup=True):
     """
-    Object description.
+    Create the *ACES* LUTs and data structures needed for later *OCIO* 
+    configuration generation
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    odt_info : array of dicts of str or unicode
+        Descriptions of the *ACES* Output Transforms
+    lmt_info : array of dicts of str or unicode
+        Descriptions of the *ACES* Look Transforms
+    shaper_name : str or unicode
+        The name of the Shaper function to use when generating LUTs. 
+        Options: Log2, DolbyPQ
+    aces_ctl_directory : str or unicode
+        The path to the aces 'transforms/ctl/utilities'
+    lut_directory : str or unicode
+        The path to use when writing LUTs
+    lut_resolution_1d : int, optional
+        The resolution of generated 1D LUTs
+    lut_resolution_3d : int, optional
+        The resolution of generated 3D LUTs
+    cleanup : bool
+        Whether or not to clean up the intermediate images 
 
     Returns
     -------
     dict
-         Colorspaces and transforms converting between those colorspaces and
-         the reference colorspace, *ACES*.
+         Colorspaces, LUT paths and transforms converting between those 
+         colorspaces and the reference colorspace, *ACES*.
     """
 
     print('create_config_data - begin')
@@ -1095,17 +1137,31 @@ def generate_baked_LUTs(odt_info,
                         lut_resolution_shaper=1024,
                         prefix=False):
     """
-    Object description.
+    Generate baked representations of the transforms from the *ACES* *OCIO*
+    configuration
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    odt_info : array of dicts of str or unicode
+        Descriptions of the *ACES* Output Transforms
+    shaper_name : str or unicode
+        The name of the Shaper function to use when generating LUTs. 
+        Options: Log2, DolbyPQ
+    baked_directory : str or unicode
+        The path to use when writing baked LUTs
+    config_path : str or unicode
+        The path to the *OCIO* configuration
+    lut_resolution_3d : int, optional
+        The resolution of generated 3D LUTs
+    lut_resolution_shaper : int, optional
+        The resolution of shaper used as part of some 3D LUTs
+    prefix : bool, optional
+        Whether or not colorspace names will use their Family names as prefixes
+        in the *OCIO* config
 
     Returns
     -------
-    type
-         Return value description.
+    None
     """
 
     odt_info_C = dict(odt_info)
@@ -1269,17 +1325,20 @@ def generate_config_directory(config_directory,
                               bake_secondary_luts=False,
                               custom_lut_dir=None):
     """
-    Object description.
+    Create the directories needed for configuration generation
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    config_directory : str or unicode
+        The base config directory
+    bake_secondary_luts : bool, optional
+        Whether or not to create directories for baked LUTs
+    custom_lut_dir : bool, optional
+        Whether or not to create directories for custom Look LUTs
 
     Returns
     -------
-    type
-         Return value description.
+    None
     """
 
     lut_directory = os.path.join(config_directory, 'luts')
@@ -1318,13 +1377,37 @@ def generate_config(aces_ctl_directory,
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    aces_ctl_directory : str or unicode
+        The path to the aces 'transforms/ctl/utilities'
+    config_directory : str or unicode
+        The directory that will hold the generated configuration and LUTs
+    lut_resolution_1d : int, optional
+        The resolution of generated 1D LUTs
+    lut_resolution_3d : int, optional
+        The resolution of generated 3D LUTs
+    bake_secondary_luts : bool, optional
+        Whether or not to create directories for baked LUTs
+    multiple_displays : bool, optional
+        Whether to create a single display named *ACES* with Views for each
+        Output Transform or multiple displays, one for each Output Transform
+    look_info : array of str or unicode, optional
+        Paths and names for look data
+    copy_custom_luts : bool, optional
+        Whether to reference custom look LUTs directly or to copy them into a 
+        directory within the generated configuration
+    cleanup : bool, optional
+        Whether or not to clean up the intermediate images 
+    prefix_colorspaces_with_family_names : bool, optional
+        Whether or not colorspace names will use their Family names as prefixes
+        in the *OCIO* config
+    shaper_base_name : str or unicode
+        The name of the Shaper function to use when generating LUTs. 
+        Options: Log2, DolbyPQ
 
     Returns
     -------
-    type
-         Return value description.
+    bool
+         Success or failure of configuration generation process
     """
 
     if look_info is None:
@@ -1337,7 +1420,6 @@ def generate_config(aces_ctl_directory,
     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)
 
@@ -1381,17 +1463,16 @@ def generate_config(aces_ctl_directory,
 
 def main():
     """
-    Object description.
+    A simple main that allows the user to exercise the various functions
+    defined in this file
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    None
 
     Returns
     -------
-    type
-         Return value description.
+    None
     """
 
     import optparse
index ac42d58..94bd735 100755 (executable)
@@ -2,7 +2,7 @@
 # -*- coding: utf-8 -*-
 
 """
-Defines objects to generate various kind of 1d, 2d and 3d LUTs in various file
+Defines objects to generate various kind of 1D and 3D LUTs in various file
 formats.
 """
 
@@ -43,17 +43,23 @@ def generate_1d_LUT_image(ramp_1d_path,
                           min_value=0,
                           max_value=1):
     """
-    Object description.
+    Generates a 1D LUT image, i.e. a simple ramp, going from the min_value to 
+    the max_value.
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    ramp_1d_path : str or unicode
+        The path of the 1D ramp image to be written
+    resolution : int, optional
+        The resolution of the 1D ramp image to be written
+    min_value : float, optional
+        The lowest value in the 1D ramp
+    max_value : float, optional
+        The highest value in the 1D ramp
 
     Returns
     -------
-    type
-         Return value description.
+    None
     """
 
     ramp = oiio.ImageOutput.create(ramp_1d_path)
@@ -88,20 +94,31 @@ def write_SPI_1d(filename,
                  channels,
                  components=3):
     """
-    Object description.
+    Writes a 1D LUT in the Sony Pictures Imageworks .spi1d format.
 
     Credit to *Alex Fry* for the original single channel version of the spi1d
     writer.
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    filename : str or unicode
+        The path of the 1D LUT to be written
+    from_min : float
+        The lowest value in the 1D ramp
+    from_max : float
+        The highest value in the 1D ramp
+    data : array of floats
+        The entries in the LUT
+    entries : int
+        The resolution of the LUT, i.e. number of entries in the data set
+    channels : int
+        The number of channels in the data
+    components : int, optional
+        The number of channels in the data to actually write
 
     Returns
     -------
-    type
-         Return value description.
+    None
     """
 
     # May want to use fewer components than there are channels in the data
@@ -130,17 +147,28 @@ def write_CSP_1d(filename,
                  channels,
                  components=3):
     """
-    Object description.
+    Writes a 1D LUT in the Rising Sun Research Cinespace .csp format.
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    filename : str or unicode
+        The path of the 1D LUT to be written
+    from_min : float
+        The lowest value in the 1D ramp
+    from_max : float
+        The highest value in the 1D ramp
+    data : array of floats
+        The entries in the LUT
+    entries : int
+        The resolution of the LUT, i.e. number of entries in the data set
+    channels : int
+        The number of channels in the data
+    components : int, optional
+        The number of channels in the data to actually write
 
     Returns
     -------
-    type
-         Return value description.
+    None
     """
 
     # May want to use fewer components than there are channels in the data
@@ -192,17 +220,28 @@ def write_CTL_1d(filename,
                  channels,
                  components=3):
     """
-    Object description.
+    Writes a 1D LUT in the Academy Color Transformation Language .ctl format.
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    filename : str or unicode
+        The path of the 1D LUT to be written
+    from_min : float
+        The lowest value in the 1D ramp
+    from_max : float
+        The highest value in the 1D ramp
+    data : array of floats
+        The entries in the LUT
+    entries : int
+        The resolution of the LUT, i.e. number of entries in the data set
+    channels : int
+        The number of channels in the data
+    components : int, optional
+        The number of channels in the data to actually write
 
     Returns
     -------
-    type
-         Return value description.
+    None
     """
 
     # May want to use fewer components than there are channels in the data
@@ -280,17 +319,30 @@ def write_1d(filename,
              lut_components=3,
              format='spi1d'):
     """
-    Object description.
+    Writes a 1D LUT in the specified format.
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    filename : str or unicode
+        The path of the 1D LUT to be written
+    from_min : float
+        The lowest value in the 1D ramp
+    from_max : float
+        The highest value in the 1D ramp
+    data : array of floats
+        The entries in the LUT
+    data_entries : int
+        The resolution of the LUT, i.e. number of entries in the data set
+    data_channels : int
+        The number of channels in the data
+    lut_components : int, optional
+        The number of channels in the data to actually use when writing
+    format : str or unicode, optional
+        The format of the the 1D LUT that will be written
 
     Returns
     -------
-    type
-         Return value description.
+    None
     """
 
     ocio_formats_to_extensions = {'cinespace': 'csp',
@@ -334,17 +386,26 @@ def generate_1d_LUT_from_image(ramp_1d_path,
                                channels=3,
                                format='spi1d'):
     """
-    Object description.
+    Reads a 1D LUT image and writes a 1D LUT in the specified format.
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    ramp_1d_path : str or unicode
+        The path of the 1D ramp image to be read
+    output_path : str or unicode, optional
+        The path of the 1D LUT to be written
+    min_value : float, optional
+        The lowest value in the 1D ramp
+    max_value : float, optional
+        The highest value in the 1D ramp
+    channels : int, optional
+        The number of channels in the data
+    format : str or unicode, optional
+        The format of the the 1D LUT that will be written
 
     Returns
     -------
-    type
-         Return value description.
+    None
     """
 
     if output_path is None:
@@ -367,17 +428,19 @@ def generate_1d_LUT_from_image(ramp_1d_path,
 
 def generate_3d_LUT_image(ramp_3d_path, resolution=32):
     """
-    Object description.
+    Generates a 3D LUT image covering the specified resolution
+    Relies on OCIO's ociolutimage command
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    ramp_3d_path : str or unicode
+        The path of the 3D ramp image to be written
+    resolution : int, optional
+        The resolution of the 3D ramp image to be written
 
     Returns
     -------
-    type
-         Return value description.
+    None
     """
 
     args = ['--generate',
@@ -398,17 +461,23 @@ def generate_3d_LUT_from_image(ramp_3d_path,
                                resolution=32,
                                format='spi3d'):
     """
-    Object description.
+    Reads a 3D LUT image and writes a 3D LUT in the specified format.
+    Relies on OCIO's ociolutimage command
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    ramp_3d_path : str or unicode
+        The path of the 3D ramp image to be read
+    output_path : str or unicode, optional
+        The path of the 1D LUT to be written
+    resolution : int, optional
+        The resolution of the 3D LUT represented in the image
+    format : str or unicode, optional
+        The format of the the 3D LUT that will be written
 
     Returns
     -------
-    type
-         Return value description.
+    None
     """
 
     if output_path is None:
@@ -474,17 +543,39 @@ def apply_CTL_to_image(input_image,
                        global_params=None,
                        aces_ctl_directory=None):
     """
-    Object description.
+    Applies a set of Academy Color Transformation Language .ctl files to 
+    an input image and writes a new image.
+    Relies on the ACES ctlrender command
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    input_image : str or unicode
+        The path to the image to transform using the CTL files
+    output_image : str or unicode
+        The path to write the result of the transforms
+    ctl_paths : array of str or unicode, optional
+        The path to write the result of the transforms
+    input_scale : float, optional
+        The argument to the ctlrender -input_scale parameter
+        For images with integer bit depths, this divides image code values 
+        before they are sent to the ctl commands
+        For images with float or half bit depths, this multiplies image code 
+        values before they are sent to the ctl commands
+    output_scale : float, optional
+        The argument to the ctlrender -output_scale parameter
+        For images with integer bit depths, this multiplies image code values 
+        before they are written to a file.
+        For images with float or half bit depths, this divides image code values 
+        before they are sent to the ctl commands
+    global_params : dict of key value pairs, optional
+        The set of parameter names and values to pass to the ctlrender 
+        -global_param1 parameter
+    aces_ctl_directory : str or unicode, optional
+        The path to the aces 'transforms/ctl/utilities'
 
     Returns
     -------
-    type
-         Return value description.
+    None
     """
 
     if ctl_paths is None:
@@ -526,17 +617,22 @@ def apply_CTL_to_image(input_image,
 
 def convert_bit_depth(input_image, output_image, depth):
     """
-    Object description.
+    Convert the input image to the specified bit depth and write a new image
+    Relies on the OIIO oiiotool command
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    input_image : str or unicode
+        The path to the image to transform using the CTL files
+    output_image : str or unicode
+        The path to write the result of the transforms
+    depth : str or unicode
+        The bit depth of the output image
+        Data types include: uint8, sint8, uint10, uint12, uint16, sint16, half, float, double
 
     Returns
     -------
-    type
-         Return value description.
+    None
     """
 
     args = [input_image,
@@ -564,17 +660,51 @@ def generate_1d_LUT_from_CTL(lut_path,
                              channels=3,
                              format='spi1d'):
     """
-    Object description.
+    Creates a 1D LUT from the specified CTL files by creating a 1D LUT image,
+    applying the CTL files and then extracting and writing a LUT based on the
+    resulting image
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    lut_path : str or unicode
+        The path to write the 1D LUT
+    ctl_paths : array of str or unicode
+        The CTL files to apply
+    lut_resolution : int, optional
+        The resolution of the 1D LUT to generate
+    identity_lut_bit_depth : string, optional
+        The bit depth to use for the intermediate 1D LUT image
+    input_scale : float, optional
+        The argument to the ctlrender -input_scale parameter
+        For images with integer bit depths, this divides image code values 
+        before they are sent to the ctl commands
+        For images with float or half bit depths, this multiplies image code 
+        values before they are sent to the ctl commands
+    output_scale : float, optional
+        The argument to the ctlrender -output_scale parameter
+        For images with integer bit depths, this multiplies image code values 
+        before they are written to a file.
+        For images with float or half bit depths, this divides image code values 
+        before they are sent to the ctl commands
+    global_params : dict of key, value pairs, optional
+        The set of parameter names and values to pass to the ctlrender 
+        -global_param1 parameter
+    cleanup : bool, optional
+        Whether or not to clean up the intermediate images 
+    aces_ctl_directory : str or unicode, optional
+        The path to the aces 'transforms/ctl/utilities'
+    min_value : float, optional
+        The minimum value to consider as input to the LUT
+    max_value : float, optional
+        The maximum value to consider as input to the LUT
+    channels : int, optional
+        The number of channels to use for the LUT. 1 or 3 are valid.
+    format : str or unicode, optional
+        The format to use when writing the LUT
 
     Returns
     -------
-    type
-         Return value description.
+    None
     """
 
     if global_params is None:
@@ -623,17 +753,27 @@ def correct_LUT_image(transformed_lut_image,
                       corrected_lut_image,
                       lut_resolution):
     """
-    Object description.
+    For some combinations of resolution and bit depth, ctlrender would generate
+    images with the right number of pixels but with the values for width and 
+    height transposed. This function generating a new, corrected image based on
+    the original. The function acts as a pass through if the problem is not
+    detected.
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    transformed_lut_image : str or unicode
+        The path to an image generated by cltrender
+    corrected_lut_image : str or unicode
+        The path to an 'corrected' image to be generated
+    lut_resolution : int
+        The resolution of the 3D LUT that should be contained in 
+        transformed_lut_image
 
     Returns
     -------
-    type
-         Return value description.
+    str or unicode
+        The path to the corrected image, or the original, if no correction was
+        needed.
     """
 
     transformed = oiio.ImageInput.open(transformed_lut_image)
@@ -703,17 +843,45 @@ def generate_3d_LUT_from_CTL(lut_path,
                              aces_ctl_directory=None,
                              format='spi3d'):
     """
-    Object description.
+    Creates a 3D LUT from the specified CTL files by creating a 3D LUT image,
+    applying the CTL files and then extracting and writing a LUT based on the
+    resulting image
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    lut_path : str or unicode
+        The path to write the 1D LUT
+    ctl_paths : array of str or unicode
+        The CTL files to apply
+    lut_resolution : int, optional
+        The resolution of the 1D LUT to generate
+    identity_lut_bit_depth : string, optional
+        The bit depth to use for the intermediate 1D LUT image
+    input_scale : float, optional
+        The argument to the ctlrender -input_scale parameter
+        For images with integer bit depths, this divides image code values 
+        before they are sent to the ctl commands
+        For images with float or half bit depths, this multiplies image code 
+        values before they are sent to the ctl commands
+    output_scale : float, optional
+        The argument to the ctlrender -output_scale parameter
+        For images with integer bit depths, this multiplies image code values 
+        before they are written to a file.
+        For images with float or half bit depths, this divides image code values 
+        before they are sent to the ctl commands
+    global_params : dict of key, value pairs, optional
+        The set of parameter names and values to pass to the ctlrender 
+        -global_param1 parameter
+    cleanup : bool, optional
+        Whether or not to clean up the intermediate images 
+    aces_ctl_directory : str or unicode, optional
+        The path to the aces 'transforms/ctl/utilities'
+    format : str or unicode, optional
+        The format to use when writing the LUT
 
     Returns
     -------
-    type
-         Return value description.
+    None
     """
 
     if global_params is None:
@@ -767,17 +935,16 @@ def generate_3d_LUT_from_CTL(lut_path,
 
 def main():
     """
-    Object description.
+    A simple main that allows the user to exercise the various functions
+    defined in this file
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    None
 
     Returns
     -------
-    type
-         Return value description.
+    None
     """
 
     import optparse
index 6f30f3a..947bf93 100644 (file)
@@ -51,17 +51,17 @@ class ColorSpace(object):
                  allocation_vars=None,
                  aces_transform_id=None):
         """
-        Object description.
+        Constructor for ColorSpace container class
 
         Parameters
         ----------
-        parameter : type
-            Parameter description.
+        name : str or unicode
+            Name of the colorspace
+        All other arguments are optional
 
         Returns
         -------
-        type
-             Return value description.
+        None
         """
 
         if aliases is None:
@@ -96,13 +96,13 @@ def mat44_from_mat33(mat33):
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    mat33 : array of float
+        A 3x3 matrix
 
     Returns
     -------
-    type
-         Return value description.
+    array of float
+         A 4x4 matrix
     """
 
     return [mat33[0], mat33[1], mat33[2], 0,
@@ -113,17 +113,23 @@ def mat44_from_mat33(mat33):
 
 def filter_words(words, filters_in=None, filters_out=None, flags=0):
     """
-    Object description.
+    A function to filter strings in an array
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    words : array of str or unicode
+        Array of strings
+    filters_in : array of str or unicode, optional
+        Words to match
+    filters_out : array of str or unicode, optional
+        Words to NOT match
+    flags : int, optional
+        Flags for re.search
 
     Returns
     -------
-    type
-         Return value description.
+    array of str or unicode
+         An array of matched or unmatched strings
     """
 
     filtered_words = []
@@ -151,17 +157,24 @@ def filter_words(words, filters_in=None, filters_out=None, flags=0):
 
 def files_walker(directory, filters_in=None, filters_out=None, flags=0):
     """
-    Object description.
+    A function to walk a directory hierarchy, only returning items that do or
+    do not match the specified filters
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    directory : str or unicode
+        The starting point for directory walking
+    filters_in : array of str or unicode, optional
+        File or directory names to match
+    filters_out : array of str or unicode, optional
+        File or directory names to NOT match
+    flags : int, optional
+        Flags for re.search
 
     Returns
     -------
-    type
-         Return value description.
+    iterable
+         The next matching file or directory name
     """
 
     for parent_directory, directories, files in os.walk(
@@ -209,17 +222,17 @@ def replace(string, data):
 
 def sanitize(path):
     """
-    Object description.
+    Replaces occurrences of ' ', '(', or ')' in the string with an underscore.
 
     Parameters
     ----------
-    parameter : type
-        Parameter description.
+    path : str or unicode
+        Path string to manipulate.
 
     Returns
     -------
-    type
-         Return value description.
+    unicode
+        Manipulated string.
     """
 
     return replace(path, {' ': '_', ')': '_', '(': '_'})