Updated tests, fixed serious ColMap bug

master
Sofus Albert Høgsbro Rose 2017-01-26 18:24:38 -05:00
parent 332276aa6b
commit 29a6924e01
Signed by: so-rose
GPG Key ID: 3D01BE95F3EFFEB9
3 changed files with 45 additions and 36 deletions

View File

@ -2,50 +2,53 @@ image: python:3.5
stages:
- build
- build_docs
- test
- deploy_docs
- deploy
# - 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:
- rm -rf dist build docs/build openlut.egg-info
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 bdist_wheel #Build Linux wheel.
artifacts:
paths:
- dist/*
- dist
# run tests using the binary built before.
build_docs:
stage: build_docs
before_script:
- pip3 install sphinx
stage: build
script:
- ./mkDocs.sh
artifacts:
paths:
- 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:
stage: test
script:
- python3 tests/suite.py
deploy_docs:
stage: deploy
environment:
name: Documentation
url: https://www.sofusrose.com/openlut
script:
- docs/upload.sh
#~ when: manual

View File

@ -50,13 +50,13 @@ class ColMap :
#Constructors
def __init__(self, shape, depth = None) :
if depth not in ColMap.DEPTHS.values :
raise ValueError('Bit depth not supported! Supported bit depths: {}'.format(', '.join(ColMap.DEPTHS.values)))
if depth not in ColMap.DEPTHS.values() :
raise ValueError('Bit depth not supported! Supported bit depths: {}'.format(', '.join(ColMap.DEPTHS.values())))
if len(shape) not in (2, 3) :
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)
@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.**
'''
if depth not in ColMap.DEPTHS.values :
raise ValueError('Bit depth not supported! Supported bit depths: {}'.format(', '.join(ColMap.DEPTHS.values)))
if depth not in ColMap.DEPTHS.values() :
raise ValueError('Bit depth not supported! Supported bit depths: {}'.format(', '.join(ColMap.DEPTHS.values())))
try :
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.**
'''
if depth not in ColMap.DEPTHS.values :
raise ValueError('Bit depth not supported! Supported bit depths: {}'.format(', '.join(ColMap.DEPTHS.values)))
if depth not in 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
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.
'''
if depth not in ColMap.DEPTHS.values :
raise ValueError('Bit depth not supported! Supported bit depths: {}'.format(', '.join(ColMap.DEPTHS.values)))
if depth not in ColMap.DEPTHS.values() :
raise ValueError('Bit depth not supported! Supported bit depths: {}'.format(', '.join(ColMap.DEPTHS.values())))
if depth is None :
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.**
'''
if depth not in ColMap.DEPTHS.values :
raise ValueError('Bit depth not supported! Supported bit depths: {}'.format(', '.join(ColMap.DEPTHS.values)))
if depth not in ColMap.DEPTHS.values() :
raise ValueError('Bit depth not supported! Supported bit depths: {}'.format(', '.join(ColMap.DEPTHS.values())))
with self.asWandImg(d) as img :
img.format = fmt
@ -369,8 +369,8 @@ class ColMap :
:rtype: np.array
"""
if depth not in ColMap.DEPTHS.values :
raise ValueError('Bit depth not supported! Supported bit depths: {}'.format(', '.join(ColMap.DEPTHS.values)))
if depth not in ColMap.DEPTHS.values() :
raise ValueError('Bit depth not supported! Supported bit depths: {}'.format(', '.join(ColMap.DEPTHS.values())))
if depth is None :
d = self.depth #No limits here.

View File

@ -1,3 +1,9 @@
import os, sys
#Script must be called from openlut root.
sys.path.insert(0, '.')
from openlut import *
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.
if __name__ == "__main__" :
runTest()
runTest('img_test', 'testpath')