Python
******
->>> import sys
->>> sys.path.append('/path/to/script')
->>> import create_aces_config as cac
->>> acesReleaseCTLDir = '/path/to/github/checkout/releases/v0.7.1/transforms/ctl'
->>> configDir = '/path/to/config/dir'
->>> cac.createACESConfig(acesReleaseCTLDir, configDir, 1024, 33, True)
+>>> from aces_ocio.create_aces_config import create_ACES_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)
Command Line
************
-From the directory with 'create_aces_config.py':
+Using the *create_aces_config* binary:
-$ python create_aces_config.py -a '/path/to/github/checkout/releases/v0.7.1/transforms/ctl' -c '/path/to/config/dir' --lut_resolution_1d 1024 --lut_resolution_3d 33 --keepTempImages
+$ create_aces_config -a '/path/to/github/checkout/releases/v0.7.1/transforms/ctl' -c '/path/to/config/dir' --lutResolution1d 1024 --lutResolution3d 33 --keepTempImages
+
+It is possible to set the following environment variables to avoid passing
+the paths to the binary:
+
+- *ACES_OCIO_CTL_DIRECTORY*
+- *ACES_OCIO_CONFIGURATION_DIRECTORY*
+
+The above command line call would be done as follows:
+
+$ create_aces_config --lutResolution1d 1024 --lutResolution3d 33 --keepTempImages
+
+Testing the generated configuration is needs the
+*ACES_OCIO_CTL_DIRECTORY* environment variable to be set and is done as
+follows:
+
+$ tests_aces_config
Build
-----
import string
import sys
-# TODO: This restores the capability of running the script without having
-# added the package to PYTHONPATH, this is ugly and should ideally replaced by
-# dedicated executable in a /bin directory.
-sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
-
import PyOpenColorIO as ocio
import aces_ocio.create_arri_colorspaces as arri
version='createACESConfig 0.1',
usage='%prog [options]')
p.add_option('--acesCTLDir', '-a', default=os.environ.get(
- 'ACES_OCIO_CTL_DIRECTORY', None))
+ ACES_OCIO_CTL_DIRECTORY_ENVIRON, None))
p.add_option('--configDir', '-c', default=os.environ.get(
- 'ACES_OCIO_CONFIGURATION_DIRECTORY', None))
+ ACES_OCIO_CONFIGURATION_DIRECTORY_ENVIRON, None))
p.add_option('--lutResolution1d', default=4096)
p.add_option('--lutResolution3d', default=64)
p.add_option('--dontBakeSecondaryLUTs', action='store_true')
config_directory = options.configDir
lut_resolution_1d = int(options.lutResolution1d)
lut_resolution_3d = int(options.lutResolution3d)
- bake_secondary_LUTs = not (options.dontBakeSecondaryLUTs)
- cleanup_temp_images = not (options.keepTempImages)
+ bake_secondary_LUTs = not options.dontBakeSecondaryLUTs
+ cleanup_temp_images = not options.keepTempImages
+ # TODO: Investigate the following statements.
try:
args_start = sys.argv.index('--') + 1
args = sys.argv[args_start:]
print('command line : \n%s\n' % ' '.join(sys.argv))
- # TODO: Use assertion and mention environment variables.
- if not aces_CTL_directory:
- print('process: No ACES CTL directory specified')
- return
- if not config_directory:
- print('process: No configuration directory specified')
- return
- #
- # Generate the configuration
- #
+ assert aces_CTL_directory is not None, (
+ 'process: No "{0}" environment variable defined or no "ACES CTL" '
+ 'directory specified'.format(
+ ACES_OCIO_CTL_DIRECTORY_ENVIRON))
+
+ assert config_directory is not None, (
+ 'process: No "{0}" environment variable defined or no configuration '
+ 'directory specified'.format(
+ ACES_OCIO_CONFIGURATION_DIRECTORY_ENVIRON))
+
return create_ACES_config(aces_CTL_directory,
config_directory,
lut_resolution_1d,
p.add_option('--lut', '-l', type='string', default='')
p.add_option('--ctl', '-c', type='string', action='append')
- p.add_option('--lut_resolution_1d', '', type='int', default=1024)
- p.add_option('--lut_resolution_3d', '', type='int', default=33)
+ p.add_option('--lutResolution1d', '', type='int', default=1024)
+ p.add_option('--lutResolution3d', '', type='int', default=33)
p.add_option('--ctlReleasePath', '-r', type='string', default='')
p.add_option('--bitDepth', '-b', type='string', default='float')
p.add_option('--keepTempImages', '', action='store_true')
ctl_release_path = options.ctlReleasePath
generate_1d = options.generate1d is True
generate_3d = options.generate3d is True
- bitdepth = options.bitDepth
+ bit_depth = options.bitDepth
cleanup = not options.keepTempImages
params = {}
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' % bitdepth)
+ print('bit depth of input : %s' % bit_depth)
print('cleanup temp images : %s' % cleanup)
if generate_1d:
generate_1d_LUT_from_CTL(lut,
ctls,
lut_resolution_1d,
- bitdepth,
+ bit_depth,
input_scale,
output_scale,
params,
generate_3d_LUT_from_CTL(lut,
ctls,
lut_resolution_3d,
- bitdepth,
+ bit_depth,
input_scale,
output_scale,
params,
import os
import re
import shutil
-import sys
-
-# TODO: Temporary ugly thing to be discussed, ideally the package should be
-# in PYTHONPATH.
-sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..'))
-
import tempfile
import unittest
# 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__), '..', '..', '..'))
+# os.path.join(os.path.dirname(__file__), '..', '..', '..'))
REFERENCE_CONFIG_ROOT_DIRECTORY = '/colour-science/colour-ramblings/ocio/aces'
HASH_TEST_PATTERNS = ('\.3dl', '\.lut', '\.csp')
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+Creates the *ACES* configuration.
+"""
+
+import os
+import sys
+
+sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+
+from aces_ocio.create_aces_config import main
+
+__author__ = 'ACES Developers'
+__copyright__ = 'Copyright (C) 2014 - 2015 - ACES Developers'
+__license__ = ''
+__maintainer__ = 'ACES Developers'
+__email__ = 'aces@oscars.org'
+__status__ = 'Production'
+
+__all__ = []
+
+if __name__ == '__main__':
+ main()
--- /dev/null
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+"""
+Tests the *ACES* configuration.
+"""
+
+import os
+import unittest
+import sys
+
+sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
+
+from aces_ocio.tests.tests_aces_config import *
+
+__author__ = 'ACES Developers'
+__copyright__ = 'Copyright (C) 2014 - 2015 - ACES Developers'
+__license__ = ''
+__maintainer__ = 'ACES Developers'
+__email__ = 'aces@oscars.org'
+__status__ = 'Production'
+
+if __name__ == '__main__':
+ unittest.main()