Updated tests, fixed serious ColMap bug
parent
332276aa6b
commit
29a6924e01
|
@ -2,50 +2,53 @@ image: python:3.5
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
- build
|
- build
|
||||||
- build_docs
|
|
||||||
- test
|
- test
|
||||||
- deploy_docs
|
- deploy
|
||||||
# - review
|
# - review
|
||||||
|
|
||||||
|
|
||||||
|
before_script:
|
||||||
|
#~ - apt-get update && apt-get -y install gcc libmagickwand-dev make
|
||||||
|
- pip3 install -U pip setuptools wheel
|
||||||
|
- pip3 install -r requirements.txt
|
||||||
|
- python3 setup.py build_ext -i #Need the C++ extension only.
|
||||||
|
- mkdir testpath
|
||||||
|
|
||||||
after_script:
|
after_script:
|
||||||
- rm -rf dist build docs/build openlut.egg-info
|
- rm -rf dist build docs/build openlut.egg-info
|
||||||
|
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
before_script:
|
|
||||||
- apt-get update && apt-get -y install gcc libmagickwand-dev make
|
|
||||||
- pip3 install -U pip setuptools wheel
|
|
||||||
- pip3 install -r requirements.txt
|
|
||||||
- ./mkDocs.sh
|
|
||||||
script:
|
script:
|
||||||
- python3 setup.py sdist #Build source distribution.
|
- python3 setup.py sdist #Build source distribution.
|
||||||
- python3 setup.py bdist_wheel #Build Linux wheel.
|
- python3 setup.py bdist_wheel #Build Linux wheel.
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- dist/*
|
- dist
|
||||||
|
|
||||||
|
# run tests using the binary built before.
|
||||||
|
|
||||||
build_docs:
|
build_docs:
|
||||||
stage: build_docs
|
stage: build
|
||||||
before_script:
|
|
||||||
- pip3 install sphinx
|
|
||||||
script:
|
script:
|
||||||
- ./mkDocs.sh
|
- ./mkDocs.sh
|
||||||
artifacts:
|
artifacts:
|
||||||
paths:
|
paths:
|
||||||
- docs/build/html
|
- docs/build/html
|
||||||
|
|
||||||
deploy_docs:
|
|
||||||
stage: deploy_docs
|
|
||||||
environment:
|
|
||||||
name: Documentation
|
|
||||||
url: https://www.sofusrose.com/openlut
|
|
||||||
script:
|
|
||||||
- docs/upload.sh
|
|
||||||
when: manual
|
|
||||||
|
|
||||||
# run tests using the binary built before.
|
|
||||||
test:
|
test:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- python3 tests/suite.py
|
- python3 tests/suite.py
|
||||||
|
|
||||||
|
deploy_docs:
|
||||||
|
stage: deploy
|
||||||
|
environment:
|
||||||
|
name: Documentation
|
||||||
|
url: https://www.sofusrose.com/openlut
|
||||||
|
script:
|
||||||
|
- docs/upload.sh
|
||||||
|
#~ when: manual
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -50,13 +50,13 @@ class ColMap :
|
||||||
|
|
||||||
#Constructors
|
#Constructors
|
||||||
def __init__(self, shape, depth = None) :
|
def __init__(self, shape, depth = None) :
|
||||||
if depth not in ColMap.DEPTHS.values :
|
if depth not in ColMap.DEPTHS.values() :
|
||||||
raise ValueError('Bit depth not supported! Supported bit depths: {}'.format(', '.join(ColMap.DEPTHS.values)))
|
raise ValueError('Bit depth not supported! Supported bit depths: {}'.format(', '.join(ColMap.DEPTHS.values())))
|
||||||
|
|
||||||
if len(shape) not in (2, 3) :
|
if len(shape) not in (2, 3) :
|
||||||
raise ValueError('Please use a valid numpy image array shape!')
|
raise ValueError('Please use a valid numpy image array shape!')
|
||||||
|
|
||||||
self.depth = depth if depth is None else ColMap.DEPTHS['full'] #This represents the real precision of data.
|
self.depth = depth if depth is not None else ColMap.DEPTHS['full'] #This represents the real precision of data.
|
||||||
self.rgbArr = np.zeros((shape[0], shape[1], 3), dtype=np.float32)
|
self.rgbArr = np.zeros((shape[0], shape[1], 3), dtype=np.float32)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -217,8 +217,8 @@ class ColMap :
|
||||||
**NOTE: EXRs are only saveable as 16-bit integer, with no compression options. This is an IM/Wand library limitation.**
|
**NOTE: EXRs are only saveable as 16-bit integer, with no compression options. This is an IM/Wand library limitation.**
|
||||||
'''
|
'''
|
||||||
|
|
||||||
if depth not in ColMap.DEPTHS.values :
|
if depth not in ColMap.DEPTHS.values() :
|
||||||
raise ValueError('Bit depth not supported! Supported bit depths: {}'.format(', '.join(ColMap.DEPTHS.values)))
|
raise ValueError('Bit depth not supported! Supported bit depths: {}'.format(', '.join(ColMap.DEPTHS.values())))
|
||||||
|
|
||||||
try :
|
try :
|
||||||
saveFunction = {
|
saveFunction = {
|
||||||
|
@ -248,8 +248,8 @@ class ColMap :
|
||||||
**NOTE: EXRs are only saveable as 16-bit integer, with no compression options. This is an IM/Wand library limitation.**
|
**NOTE: EXRs are only saveable as 16-bit integer, with no compression options. This is an IM/Wand library limitation.**
|
||||||
'''
|
'''
|
||||||
|
|
||||||
if depth not in ColMap.DEPTHS.values :
|
if depth not in ColMap.DEPTHS.values() :
|
||||||
raise ValueError('Bit depth not supported! Supported bit depths: {}'.format(', '.join(ColMap.DEPTHS.values)))
|
raise ValueError('Bit depth not supported! Supported bit depths: {}'.format(', '.join(ColMap.DEPTHS.values())))
|
||||||
|
|
||||||
data = self.apply(LUT.lutFunc(gamma.sRGB)) if path[path.rfind('.')+1:] == 'dpx' else self
|
data = self.apply(LUT.lutFunc(gamma.sRGB)) if path[path.rfind('.')+1:] == 'dpx' else self
|
||||||
i = data.asWandImg(depth)
|
i = data.asWandImg(depth)
|
||||||
|
@ -311,8 +311,8 @@ class ColMap :
|
||||||
See http://docs.wand-py.org/en/0.4.4/index.html for Wand docs.
|
See http://docs.wand-py.org/en/0.4.4/index.html for Wand docs.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
if depth not in ColMap.DEPTHS.values :
|
if depth not in ColMap.DEPTHS.values() :
|
||||||
raise ValueError('Bit depth not supported! Supported bit depths: {}'.format(', '.join(ColMap.DEPTHS.values)))
|
raise ValueError('Bit depth not supported! Supported bit depths: {}'.format(', '.join(ColMap.DEPTHS.values())))
|
||||||
|
|
||||||
if depth is None :
|
if depth is None :
|
||||||
d = ColMap.DEPTHS['half'] if self.depth >= ColMap.DEPTHS['half'] else self.depth #Highest is half - 16.
|
d = ColMap.DEPTHS['half'] if self.depth >= ColMap.DEPTHS['half'] else self.depth #Highest is half - 16.
|
||||||
|
@ -342,8 +342,8 @@ class ColMap :
|
||||||
**NOTE: Uses Wand's "blob" functionality, and as such incurs Wand's limitations.**
|
**NOTE: Uses Wand's "blob" functionality, and as such incurs Wand's limitations.**
|
||||||
'''
|
'''
|
||||||
|
|
||||||
if depth not in ColMap.DEPTHS.values :
|
if depth not in ColMap.DEPTHS.values() :
|
||||||
raise ValueError('Bit depth not supported! Supported bit depths: {}'.format(', '.join(ColMap.DEPTHS.values)))
|
raise ValueError('Bit depth not supported! Supported bit depths: {}'.format(', '.join(ColMap.DEPTHS.values())))
|
||||||
|
|
||||||
with self.asWandImg(d) as img :
|
with self.asWandImg(d) as img :
|
||||||
img.format = fmt
|
img.format = fmt
|
||||||
|
@ -369,8 +369,8 @@ class ColMap :
|
||||||
:rtype: np.array
|
:rtype: np.array
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if depth not in ColMap.DEPTHS.values :
|
if depth not in ColMap.DEPTHS.values() :
|
||||||
raise ValueError('Bit depth not supported! Supported bit depths: {}'.format(', '.join(ColMap.DEPTHS.values)))
|
raise ValueError('Bit depth not supported! Supported bit depths: {}'.format(', '.join(ColMap.DEPTHS.values())))
|
||||||
|
|
||||||
if depth is None :
|
if depth is None :
|
||||||
d = self.depth #No limits here.
|
d = self.depth #No limits here.
|
||||||
|
|
|
@ -1,3 +1,9 @@
|
||||||
|
import os, sys
|
||||||
|
|
||||||
|
#Script must be called from openlut root.
|
||||||
|
|
||||||
|
sys.path.insert(0, '.')
|
||||||
|
|
||||||
from openlut import *
|
from openlut import *
|
||||||
|
|
||||||
def runTest(inPath, path) :
|
def runTest(inPath, path) :
|
||||||
|
@ -51,4 +57,4 @@ def runTest(inPath, path) :
|
||||||
#Color management is simple: openlut doesn't touch your data, unless you tell it to with a Transform. So, the data that goes in, goes out, unless a Transform was applied.
|
#Color management is simple: openlut doesn't touch your data, unless you tell it to with a Transform. So, the data that goes in, goes out, unless a Transform was applied.
|
||||||
|
|
||||||
if __name__ == "__main__" :
|
if __name__ == "__main__" :
|
||||||
runTest()
|
runTest('img_test', 'testpath')
|
||||||
|
|
Loading…
Reference in New Issue