From 3f19bb5d1b1fd5d8fe21e4e41ac69b0a967960fe Mon Sep 17 00:00:00 2001 From: SimonRohou Date: Tue, 12 Apr 2022 22:30:53 +0200 Subject: [PATCH] [3rd] cleaning --- .../transfer/pyIbex/pyibex/examples/Catan2.py | 68 - .../pyIbex/pyibex/examples/__init__.py | 0 .../pyIbex/pyibex/examples/ex_ctcRaster.py | 51 - .../pyIbex/pyibex/examples/example1.py | 26 - .../pyIbex/pyibex/examples/example2.py | 63 - .../pyIbex/pyibex/examples/example3.py | 79 - .../examples/example_paving_transform.py | 19 - .../pyIbex/pyibex/examples/example_polar.py | 13 - .../pyibex/examples/example_projection1.py | 100 -- .../pyIbex/pyibex/examples/sphereProj.py | 17 - .../transfer/pyIbex/pyibex/examples/test.png | Bin 276 -> 0 bytes .../pyIbex/pyibex/examples/test_Img.py | 38 - .../pyIbex/pyibex/tests/CMakeLists.txt | 17 - .../transfer/pyIbex/pyibex/tests/__init__.py | 0 .../transfer/pyIbex/pyibex/tests/test_Bsc.py | 41 - .../pyIbex/pyibex/tests/test_Catan2.py | 1340 ----------------- .../pyIbex/pyibex/tests/test_Contractors.py | 157 -- .../pyIbex/pyibex/tests/test_CustomCtc.py | 150 -- .../pyIbex/pyibex/tests/test_Image.py | 49 - .../pyIbex/pyibex/tests/test_Interval.py | 493 ------ .../pyibex/tests/test_IntervalMatrix.py | 411 ----- .../pyibex/tests/test_IntervalVector.py | 450 ------ .../pyIbex/pyibex/tests/test_SepPaving.py | 34 - .../pyIbex/pyibex/tests/test_Separators.py | 247 --- .../pyIbex/pyibex/tests/test_image.py | 243 --- .../pyIbex/pyibex/tests/test_inheritance.py | 62 - .../pyIbex/pyibex/tests/test_polar.py | 55 - .../pyIbex/pyibex/tests/test_polygon.py | 82 - .../pyIbex/pyibex/tests/test_thickBox.py | 114 -- .../pyIbex/pyibex/tests/test_thickFunction.py | 32 - .../pyIbex/pyibex/tests/test_thickInterval.py | 171 --- .../pyIbex/pyibex/tests/test_thickPaving.py | 114 -- 32 files changed, 4736 deletions(-) delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/examples/Catan2.py delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/examples/__init__.py delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/examples/ex_ctcRaster.py delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/examples/example1.py delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/examples/example2.py delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/examples/example3.py delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/examples/example_paving_transform.py delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/examples/example_polar.py delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/examples/example_projection1.py delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/examples/sphereProj.py delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/examples/test.png delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/examples/test_Img.py delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/tests/CMakeLists.txt delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/tests/__init__.py delete mode 100755 src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_Bsc.py delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_Catan2.py delete mode 100755 src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_Contractors.py delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_CustomCtc.py delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_Image.py delete mode 100755 src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_Interval.py delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_IntervalMatrix.py delete mode 100755 src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_IntervalVector.py delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_SepPaving.py delete mode 100755 src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_Separators.py delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_image.py delete mode 100755 src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_inheritance.py delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_polar.py delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_polygon.py delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_thickBox.py delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_thickFunction.py delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_thickInterval.py delete mode 100644 src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_thickPaving.py diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/Catan2.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/Catan2.py deleted file mode 100644 index cb7f3e620..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/Catan2.py +++ /dev/null @@ -1,68 +0,0 @@ -from pyibex import Interval, tan, bwd_imod, atan -import math - -def Cmod(x,y): - xx = Interval(x) - yy = Interval(y) - bwd_imod(xx,yy,2*math.pi) - return yy - - -def Catan2(x,y,th): - iZeroPi2 = Interval(0)| Interval.PI/2. - iPi2Pi = Interval.PI/2. | Interval.PI - if x.is_empty() or y.is_empty() or th.is_empty(): - return Interval.EMPTY_SET, Interval.EMPTY_SET, Interval.EMPTY_SET - if x.is_subset(Interval.POS_REALS) and y.is_subset(Interval.POS_REALS) and th.is_subset(iZeroPi2): - th_tmp = Cmod(th, iZeroPi2) - tan_lb = tan(Interval(th_tmp.lb())) - tan_ub = Interval(1e10) if th_tmp.ub() == Interval.HALF_PI.ub() else tan(Interval(th_tmp.ub())) - tanTh = tan_lb | tan_ub - # xx, yy = Interval(x), Interval(y) - # bwd_mul(yy, tan(th_tmp), xx) - xx = x & y/tanTh#tan(th_tmp) - yy = y & x*tanTh#tan(th_tmp) - thr = th_tmp & atan(y/x) - # print("RESULT : ",x, y, th_tmp, tan(th_tmp), tan_lb, tan_ub, y/tanTh) - if xx.is_empty() or yy.is_empty() or thr.is_empty(): - return Interval.EMPTY_SET, Interval.EMPTY_SET, Interval.EMPTY_SET - # print(yy,xx,thr) - bwd_imod(th, thr, 2*Interval.PI.ub()) - return xx, yy, thr - - else: - # th_tmp = Interval(th) - # bwd_imod( th_tmp, th ,2*math.pi) - x1 = x & Interval.POS_REALS - y1 = y & Interval.POS_REALS - th1 = Cmod(th,iZeroPi2) - x1, y1, th1 = Catan2(x1, y1, th1) - th11 = Interval(th) - bwd_imod(th11, th1, 2*Interval.PI.ub()) - - x2 = x & Interval.POS_REALS - y2 = y & Interval.NEG_REALS - th2 = -Cmod(th, -iZeroPi2) - x2, y2, th2 = Catan2(x2, -y2, th2) - th22 = Interval(th) - bwd_imod(th22, -th2, 2*Interval.PI.ub()) - - x3 = x & Interval.NEG_REALS - y3 = y & Interval.NEG_REALS - th3 = Interval.PI + Cmod(th, -iPi2Pi) - x3, y3, th3 = Catan2(-x3, -y3, (th3 & iZeroPi2) ) - th33 = Interval(th) - bwd_imod(th33, th3 - Interval.PI, 2*Interval.PI.ub()) - - # - x4 = x & Interval.NEG_REALS - y4 = y & Interval.POS_REALS - th4 = Interval.PI - Cmod( th,iPi2Pi) - x4, y4, th4 = Catan2(-x4, y4, ( th4 & iZeroPi2) ) - th44 = Interval(th) - bwd_imod(th44, Interval.PI - th4, 2*Interval.PI.ub()) - - xx = ( x1 | x2 | (-x3) | (-x4) ) - yy = ( y1 | (-y2) | (-y3) | (y4) ) - thh = ( th11 | (th22) | ( th33 ) | ( th44 ) ) - return xx,yy,thh diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/__init__.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/ex_ctcRaster.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/ex_ctcRaster.py deleted file mode 100644 index 20714a656..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/ex_ctcRaster.py +++ /dev/null @@ -1,51 +0,0 @@ -from pyibex.image import * -from pyibex import Interval, IntervalVector, SepCtcPair, pySIVIA -from vibes import vibes -import os -import scipy.misc -import scipy.ndimage as ndimage -import numpy as np - -ain = np.zeros((200, 200), dtype=np.int64) -ain[75:125, 50:125] = 1 -ain[25:100, 25:50] = 1 - -# over approximation of the set X -aout = np.zeros((200, 200), dtype=np.int64) -aout[74:126, 49:126] = 1 -aout[24:101, 24:51] = 1 - -img_out = aout.cumsum(0).cumsum(1) -img_in = (1 - ain).cumsum(0).cumsum(1) - - -img = 127*(aout+ain).T -scipy.misc.imsave('test.png', img.astype(np.uint8)) - - - -ctcOut = CtcRaster(img_out, -5, 5, 0.1, -0.1) -ctcIn = CtcRaster(img_in, -5, 5, 0.1, -0.1) -sep = SepCtcPair(ctcIn, ctcOut) - - -vibes.beginDrawing() -vibes.newFigure('CtcImage') -X0 = IntervalVector(2, [-15,15]) -# X0 = IntervalVector([[4, 10], [-6, -4]]) -# X0 = IntervalVector([[-2.47, -2.17], [-0.5, 0.17]]) -# X0 = IntervalVector([[-2.47, -2.17], [-0.1, 0.17]]) -# X0_res = IntervalVector([[-2.47, -2.17], [-0.1, 0]) -# X0 = IntervalVector([ [2.05, 2.15], [-0.08, -0.02] ]) -# X0 = IntervalVector([ [2.05, 2.15], [-0.08, -0.0] ]) -# -vibes.drawRaster(os.path.abspath('test.png'), -5,5, 0.1, -0.1) -# vibes.drawBox(X0[0][0], X0[0][1], X0[1][0], X0[1][1], '[#FF000055]') -# self.ctcOut.contract(X0) -# vibes.drawBox(X0[0][0], X0[0][1], X0[1][0], X0[1][1], '[#0000FF55]') - -pySIVIA(X0, sep, 0.2, color_out='[#00FF00AA]', color_maybe="[#00FFFF55]", color_in="[#FF000055]") -# pySIVIA(X0, sep, 0.05, use_patch=True) - - -vibes.axisEqual() diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/example1.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/example1.py deleted file mode 100644 index dae6a581f..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/example1.py +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env python -#============================================================================ -# P Y I B E X -# File : example1.py -# Author : Benoit Desrochers -# Copyright : Benoit Desrochers -# License : See the LICENSE file -# Created : May 28, 2015 -#============================================================================ - -#example 1, simple sivia - -from pyibex import * -from vibes import * - -f = Function('x', 'y', 'x*cos(x-y)+y') - -sep = SepFwdBwd(f, CmpOp.LEQ) - -box = IntervalVector(2, [-10, 10]) - -vibes.beginDrawing() - -pySIVIA(box, sep, 0.3) - -vibes.endDrawing() diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/example2.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/example2.py deleted file mode 100644 index 4c72bff40..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/example2.py +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/bin/env python -#============================================================================ -# P Y I B E X -# File : example2.py -# Author : Benoit Desrochers -# Copyright : Benoit Desrochers -# License : See the LICENSE file -# Created : May 28, 2015 -#============================================================================ - -#example 2, Custom contractor - -""" -Write a custom contractor for the equation -(x - x0)^2 + (y - y0)^2 \in R^2 - -This example uses: - - Interval and IntervalVector - - Ctc - - pySIVIA -""" -from pyibex import * -from vibes import * - -class myCtc(Ctc): - def __init__(self, x0, y0, R): - Ctc.__init__(self, 2) - self.x0 = Interval(x0) - self.y0 = Interval(y0) - self.R = R - - def contract(self, X): - a1 = X[0] - Interval(self.x0) - a2 = X[1] - Interval(self.y0) - - a3 = sqr(a1) - a4 = sqr(a2) - - a5 = a3 + a4 - a5 &= sqr(self.R) - - bwd_add(a5, a3, a4) - bwd_sqr(a4, a2) - bwd_sqr(a3, a1) - - bwd_sub(a1, X[0], (self.x0)) - bwd_sub(a2, X[1], (self.y0)) - - -# instanciate out new contractor -ctc = myCtc(1, 2, Interval(1, 2)) -# set the inital box -box = IntervalVector(2, [-10, 10]) - -# init vibes display and resize the new figure -vibes.beginDrawing() -vibes.newFigure("Example 2") -vibes.setFigureSize(500,500) - -# run the paver -pySIVIA(box, ctc, 0.3) - -vibes.endDrawing() diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/example3.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/example3.py deleted file mode 100644 index 0d7787cad..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/example3.py +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/env python -#============================================================================ -# P Y I B E X -# File : example3.py -# Author : Benoit Desrochers -# Copyright : Benoit Desrochers -# License : See the LICENSE file -# Created : May 28, 2015 -#============================================================================ - -#example 3, simple range only localisation - -from pyibex import * -import numpy as np -from vibes import vibes - -""" -We consider the localisation of a robot which measures distances -w.r.t three landmaks. -This example uses: - - Interval and IntervalVector - - Function - - SepFwdBwd - - SepQInter (Q intersection of separators) -""" - -if __name__ == '__main__': - - # theorical position of the robot - robot = [-2, 4] - - #position of the landmarks - landmarks = [[6, 12], [-2, -5], [-3, 10]] - - # distances measured w r t to landmaks i - dist = [Interval(11, 12), Interval(8, 10), Interval(5, 7)] - - - # Creation of a separator with - seps = [] # empty list of separator - # iterate over landmarks and distances - for (m_x, m_y), d in zip(landmarks, dist): - # create the constraint function - f = Function("x_1", "x_2", "(x_1 - %f)^2 + (x_2 - %f)^2"%(m_x, m_y)) - # create the fwdbwf separator f(x) in d - sep = SepFwdBwd(f, sqr(d)) - seps.append(sep) - - # create the separator using the QIntersection - sep = SepQInterProjF(seps) - sep.q = 0 - - # init drawing area - vibes.beginDrawing() - vibes.newFigure('Result') - vibes.setFigureProperties({'x': 0, 'y': 0, 'width': 1000, 'height': 1000}) - - #configure pySIVIA output - params = {'color_in': '#888888[#444444]', 'color_out': - '#888888[#DDDDDD]', 'color_maybe': '#888888[w]', 'use_patch' : True} - - # create the initial box X0 = [-10, 10] x [-10, 10] - X0 = IntervalVector([[-12, 11], [-6, 17]]) # '#888888[#DDDDDD]' - - # run SIVIA - (res_in, res_out, res_y) = pySIVIA(X0, sep, 0.1, **params) - - - vibes.drawAUV(robot[0], robot[1], np.rad2deg(0.3), 1, color='[y]') - for (x, y), d in zip(landmarks, dist): - vibes.drawCircle(x,y, 0.1, "[k]") - vibes.drawCircle(x,y, d.lb(), "k") - vibes.drawCircle(x,y, d.ub(), "k") - - #equalize axis lenght - vibes.axisEqual() - - - vibes.endDrawing() diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/example_paving_transform.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/example_paving_transform.py deleted file mode 100644 index 14694abd8..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/example_paving_transform.py +++ /dev/null @@ -1,19 +0,0 @@ -from pyibex import * -from pyibex.paving import * -from pyibex.sepvisitor import * -from vibes import vibes - -X0 = IntervalVector(2, [-5, 5]) -sep = SepFwdBwd(Function("x[2]", "x[0]^2 + x[1]^2"), Interval(-oo, 4)) -P = SepPaving(X0, sep, 0.1) - -vibes.beginDrawing() -vibes.newFigure("test") -P.visit(SepToVibes("test")) - -vibes.newFigure("test2") -f = Function("x", 'y', '(0.5*x, 2*y)') -sep2 = SepInverse(P, f) -P2 = SepPaving(X0, sep2, 0.1) -P2.visit(SepToVibes("test2")) - diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/example_polar.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/example_polar.py deleted file mode 100644 index ebd37cd89..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/example_polar.py +++ /dev/null @@ -1,13 +0,0 @@ -from pyibex import * -from pyibex.geometry import SepPolarXY -import numpy as np -from vibes import vibes -sep1 = SepPolarXY(Interval(4,5), Interval(np.deg2rad(-570), np.deg2rad(-450))) - -f1 = Function("x", 'y', '(x + 2; y - 2)') -f2 = Function("x", 'y', '(x - 2; y + 2)') -sep = SepTransform(sep1, f1, f2) - -box = IntervalVector([[-10,10],[-10,10]]) -vibes.beginDrawing() -pySIVIA(box, sep1, 0.1) diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/example_projection1.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/example_projection1.py deleted file mode 100644 index 050d3bee0..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/example_projection1.py +++ /dev/null @@ -1,100 +0,0 @@ -#!/usr/bin/env python -#============================================================================ -# P Y I B E X -# File : example_projection1.py -# Author : Benoit Desrochers -# Copyright : Benoit Desrochers -# License : See the LICENSE file -# Created : Jun 28, 2017 -#============================================================================ - -""" -Projection example using SepProj algorithm and SepCtcPairProj -Taken from Applied Interval Analysis (L. Jaulin and Al. ) ยง6.3.4 -""" - -from pyibex import * -import math -from vibes import vibes - -def export_data(Y, T): - vibes.newFigure('Data') - vibes.setFigureProperties({'x': 0, 'y': 0, 'width': 1000, 'height': 1000}) - print("#"*50) - print("Data to use") - for i,(y,t) in enumerate(zip(Y[::-1], T[::-1])): - # print(" %d & %s & %s \\\\ \\hline"%(i+1,t,y)) - print("\\draw[boxColor] (%f, %f) rectangle (%f, %f);"%(t[0], y[0], t[1], y[1])) - # vibes.drawBox(t[0], t[1], y[0], y[1], 'k[lightGray]') - print("#"*50) - - -def test_paramEstim( useSepProj=False): - - f = Function("p1", "p2", "t", "20*exp(-p1*t)-8*exp(-p2*t)"); - - Y = [ - Interval(2.7,12.1), - Interval(1.04,7.14), - Interval(-0.13,3.61), - Interval(-0.95,1.15), - Interval(-4.85,-0.29), - Interval(-5.06,-0.36), - Interval(-4.1,-0.04), - Interval(-3.16,0.3), - Interval(-2.5,0.51), - Interval(-2,0.67) - ] - - T = [ - Interval(-0.25,1.75), - Interval(0.5,2.5), - Interval(1.25,3.25), - Interval(2,4), - Interval(5,7), - Interval(8,10), - Interval(12,14), - Interval(16,18), - Interval(20,22), - Interval(24,26) - ] - - seps = [] - - for y_i,t_i in zip(Y, T): - if useSepProj == False: - seps.append( SepCtcPairProj( SepFwdBwd(f, y_i ), t_i, 1e-3) ) - else: - seps.append( SepProj( SepFwdBwd(f, y_i ), t_i, 1e-3) ) - - sep = SepInter(seps) - - X0 = IntervalVector(2,Interval(0,1.2)); - X0[1] = Interval(0,0.5); - - - return sep, X0, 0.01 - -if __name__ == '__main__': - vibes.beginDrawing() - - sep, X0, eps = test_paramEstim(True) - - - - - # init drawing area - vibes.newFigure('Result') - vibes.setFigureProperties({'x': 0, 'y': 0, 'width': 1000, 'height': 1000}) - - #configure pySIVIA output - params = {'color_in': '#888888[#444444]', 'color_out': - '#888888[#DDDDDD]', 'color_maybe': '#888888[q]', 'use_patch' : True} - - # run SIVIA - (res_in, res_out, res_y) = pySIVIA(X0, sep, eps, use_patch=True, display_stats=True)#, color_out='transparent', color_in='transparent') - - #equalize axis lenght - vibes.axisEqual() - vibes.endDrawing() -# diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/sphereProj.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/sphereProj.py deleted file mode 100644 index 9d65b1575..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/sphereProj.py +++ /dev/null @@ -1,17 +0,0 @@ -""" -Simple example of the projection of a sphere -""" - -from pyibex import * -from vibes import vibes -f = Function("x1","x2","y", "x1^2+x2^2+y^2") -S1=SepFwdBwd(f,Interval(4,9)) -Y=IntervalVector([[-1,1]]) -#S2=SepCtcPairProj(S1,Y,0.01) -S2=SepProj(S1,Y,0.01) -X0 =IntervalVector([[-10,10],[-10,10]]); -vibes.beginDrawing() -vibes.newFigure('Proj') -vibes.setFigureSize(500,500) -pySIVIA(X0,S2,0.1, use_patch=True) -vibes.axisEqual() diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/test.png b/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/test.png deleted file mode 100644 index 031a7a2aeb322b4b47955f82bbdd168fa006d15f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 276 zcmeAS@N?(olHy`uVBq!ia0vp^CqS43NHBC5e{=#;w>@1PLn`LHz3s@=>>$A4DE#UD zjQP)*Zyr9RAiHvx-n$DO(;54jK^p#@PcHp1Z_cNgd){on{^`jaX`_m(mp(U1P8SGL zUgGA_J3&g()G4dw3dc%8u)x`>^`@CS-_E{$$2U*v{9pBFPSf&J>W{pbRC+sipCGDQ r49z47%={DnU1kqA$dPc+aQhe2&GYQRf?21Qf&@KX{an^LB{Ts5!0TzP diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/test_Img.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/test_Img.py deleted file mode 100644 index 6b5bbac5d..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/examples/test_Img.py +++ /dev/null @@ -1,38 +0,0 @@ -import numpy as np -import scipy.ndimage as ndi - -from pyibex import * -from pyibex.image import * - -from vibes import vibes -import os - -import matplotlib.pyplot as plt -# load image data -img_gray = ndi.imread('./test.png', 'L').T -img_out = np.zeros(img_gray.shape, dtype=np.uint64) -img_in = np.zeros(img_gray.shape, dtype=np.uint64) - - -img_out[img_gray >= 127 ] = 1 -img_in[img_gray != 255] = 1 - -# compute summed tables -img_out = img_out.cumsum(0).cumsum(1) -img_in = img_in.cumsum(0).cumsum(1) - -# create contractors with CtcRaster -# top left corner is at position (-5, 5) -# pixel size is 0.1 by -0.1 -ctcOut = CtcRaster(img_out, -5, 5, 0.1, -0.1) -ctcIn = CtcRaster(img_in, -5, 5, 0.1, -0.1) -sep = SepCtcPair(ctcIn, ctcOut) - -vibes.beginDrawing() -vibes.newFigure('CtcImage') - -X0 = IntervalVector(2, [-15,15]) -vibes.drawRaster(os.path.abspath('test.png'), -5,5, 0.1, -0.1) -pySIVIA(X0, sep, 0.2, color_out='[#00FF00AA]', color_maybe="[#00FFFF55]", color_in="[#FF000055]") - -vibes.axisEqual() diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/CMakeLists.txt b/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/CMakeLists.txt deleted file mode 100644 index 9c9c60c92..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -#CMakeLists.txt -file(GLOB TESTS_FILES "*.py") - -foreach(TEST_FILE ${TESTS_FILES}) - FILE(COPY ${TEST_FILE} DESTINATION .) - GET_FILENAME_COMPONENT(baseName ${TEST_FILE} NAME_WE) - ADD_TEST(${baseName} ${PYTHON_EXECUTABLE} ${TEST_FILE}) - SET_TESTS_PROPERTIES(${baseName} - PROPERTIES ENVIRONMENT "PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}/../../src/python_package") - -# PROPERTIES ENVIRONMENT "PYTHONPATH=${PYTHON_INSTDIR}:${CMAKE_CURRENT_BINARY_DIR}/../src/python_package") - # SET_TESTS_PROPERTIES(${baseName} - # PROPERTIES ENVIRONMENT "LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${LIBRARY_OUTPUT_PATH}") - endforeach() - -# install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION "${PYTHON_INSTDIR}/pyIbex" -# FILES_MATCHING PATTERN "*.py") diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/__init__.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_Bsc.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_Bsc.py deleted file mode 100755 index 349849eb0..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_Bsc.py +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env python -#============================================================================ -# P Y I B E X -# File : test_Bsc.py -# Author : Benoit Desrochers -# Copyright : Benoit Desrochers -# License : See the LICENSE file -# Created : Dec 28, 2014 -#============================================================================ - -import unittest -import pyibex -from pyibex import * - -class TestBsc(unittest.TestCase): - - def assertApproxItvVec(self, first, second): - for i in range(len(first)): - self.assertAlmostEqual(first[i][0], second[i][0]) - self.assertAlmostEqual(first[i][1], second[i][1]) - - def test_LargestFirst(self): - bsc = LargestFirst(0.1) - a = IntervalVector([[1,2], [2,6]]) - (c,b) = bsc.bisect(a) - self.assertApproxItvVec(c, IntervalVector([[1,2],[2,3.8]])) - self.assertApproxItvVec(b, IntervalVector([[1,2],[3.8,6]])) - self.assertTrue(True) - - def test_LargestFirst2(self): - bsc = LargestFirst([0.1, 1]) - a = IntervalVector([[1,2], [2,6]]) - (c,b) = bsc.bisect(a) - self.assertApproxItvVec(c, IntervalVector([[1,1.45],[2,6]])) - self.assertApproxItvVec(b, IntervalVector([[1.45,2],[2,6]])) - self.assertTrue(True) - - -if __name__ == '__main__': - - unittest.main() diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_Catan2.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_Catan2.py deleted file mode 100644 index 444005469..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_Catan2.py +++ /dev/null @@ -1,1340 +0,0 @@ -#!/usr/bin/env python -# ============================================================================ -# P Y I B E X -# File : test_Catan2.py -# Author : Benoit Desrochers -# Copyright : Benoit Desrochers -# License : See the LICENSE file -# Created : Feb 05, 2016 -# ============================================================================ -import unittest -from pyibex import Interval -from pyibex.geometry import Catan2 - - -def hex2Itv(lb, ub): - if lb == "NAN" or ub == "NAN": - return Interval.EMPTY_SET - return Interval(float.fromhex(lb), float.fromhex(ub)) - - -def print2(itv): - return "[%s, %s]" % (itv.lb().hex(), itv.ub().hex()) - - -def print3(itv): - return "[%3.16f, %3.16f]" % (itv.lb(), itv.ub()) - - -Interval.__str__ = print3 -Interval.__repr__ = print3 - - -class TestCatan2(unittest.TestCase): - - def assertSubset(self, x, x_ref): - # return self.assertEqual(x, x_ref) - return x.is_subset(x_ref) - - def assertAlmostItvEqual(self, x, y): - # self.assertAlmostEqual(x.lb(), y.lb()) - # self.assertAlmostEqual(x.ub(), y.ub()) - return self.assertSubset(x, y) - - def test_POS_REALS(self): - x, y, th = Interval.POS_REALS, Interval.POS_REALS, Interval.HALF_PI | Interval(0) - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, Interval.POS_REALS) - self.assertSubset(yy, Interval.POS_REALS) - self.assertSubset(thh, Interval.HALF_PI| Interval(0) ) - - def test_ZEROS(self): - x, y, th = Interval(0), Interval(0), Interval.HALF_PI | Interval(0) - xx, yy, thh = Catan2(x, y, th) - # print(xx,yy,thh) - self.assertSubset(xx, Interval.EMPTY_SET) - self.assertSubset(yy, Interval.EMPTY_SET) - self.assertSubset(thh, Interval.EMPTY_SET) - - def test_HALF_PI(self): - x, y, th = Interval(0), Interval(1,4), Interval.HALF_PI - xx, yy, thh = Catan2(x, y, th) - # print(xx,yy,thh) - self.assertSubset(xx, Interval(0)) - self.assertSubset(yy, Interval(1,4)) - self.assertSubset(thh, Interval.HALF_PI) - - def test_000(self): - x = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y = hex2Itv('0x1.999999999998cp-1', '0x1.6666666666672p+1') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('NAN', 'NAN') - y_ref = hex2Itv('NAN', 'NAN') - th_ref = hex2Itv('NAN', 'NAN') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_001(self): - x = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y = hex2Itv('0x1.3333333333313p-2', '0x1.2666666666679p+1') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.85e1b9e6d304cp+1', '0x1.1333333333336p+2') - y_ref = hex2Itv('0x1.3333333333313p-2', '0x1.b1ad66a153796p-2') - th_ref = hex2Itv('0x1.1d4e1d42e573ep-4', '0x1.921fb54442d18p-4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_002(self): - x = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y = hex2Itv('0x1.9999999999959p-3', '0x1.19999999999adp+1') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.03ebd1448cacfp+1', '0x1.1333333333336p+2') - y_ref = hex2Itv('0x1.9999999999959p-3', '0x1.b1ad66a153796p-2') - th_ref = hex2Itv('0x1.7cbfb4c43746ep-5', '0x1.921fb54442d18p-4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_003(self): - x = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y = hex2Itv('0x1.9999999999918p-4', '0x1.0cccccccccce1p+1') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y_ref = hex2Itv('0x1.9999999999918p-4', '0x1.b1ad66a153796p-2') - th_ref = hex2Itv('0x1.7cf45fe330f7ep-6', '0x1.921fb54442d18p-4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_004(self): - x = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y = hex2Itv('-0x1.9999999999a1cp-4', '0x1.e666666666691p+0') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y_ref = hex2Itv('-0x1.9999999999a1cp-4', '0x1.b1ad66a153796p-2') - th_ref = hex2Itv('-0x1.c6a4cd203b564p-5', '0x1.921fb54442d18p-4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_005(self): - x = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y = hex2Itv('-0x1.99999999999bbp-2', '0x1.99999999999c6p+0') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y_ref = hex2Itv('-0x1.99999999999bbp-2', '0x1.b1ad66a153796p-2') - th_ref = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_006(self): - x = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y = hex2Itv('-0x1.99999999999a7p+0', '0x1.9999999999a5cp-2') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y_ref = hex2Itv('-0x1.b1ad66a153796p-2', '0x1.9999999999a5cp-2') - th_ref = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_007(self): - x = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y = hex2Itv('-0x1.e666666666675p+0', '0x1.9999999999ca4p-4') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y_ref = hex2Itv('-0x1.b1ad66a153796p-2', '0x1.9999999999ca4p-4') - th_ref = hex2Itv('-0x1.921fb54442d18p-4', '0x1.c6a4cd203b831p-5') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_008(self): - x = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y = hex2Itv('-0x1.0ccccccccccd5p+1', '-0x1.9999999999690p-4') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y_ref = hex2Itv('-0x1.b1ad66a153796p-2', '-0x1.9999999999690p-4') - th_ref = hex2Itv('-0x1.921fb54442d18p-4', '-0x1.7cf45fe330d23p-6') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_009(self): - x = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y = hex2Itv('-0x1.19999999999a2p+1', '-0x1.9999999999815p-3') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.03ebd1448ca02p+1', '0x1.1333333333336p+2') - y_ref = hex2Itv('-0x1.b1ad66a153796p-2', '-0x1.9999999999815p-3') - th_ref = hex2Itv('-0x1.921fb54442d18p-4', '-0x1.7cbfb4c437340p-5') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_010(self): - x = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y = hex2Itv('-0x1.266666666666fp+1', '-0x1.3333333333271p-2') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.85e1b9e6d2f7ep+1', '0x1.1333333333336p+2') - y_ref = hex2Itv('-0x1.b1ad66a153796p-2', '-0x1.3333333333271p-2') - th_ref = hex2Itv('-0x1.921fb54442d18p-4', '-0x1.1d4e1d42e56a8p-4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_011(self): - x = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y = hex2Itv('-0x1.333333333333cp+1', '-0x1.99999999998d7p-2') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.03ebd1448ca7dp+2', '0x1.1333333333336p+2') - y_ref = hex2Itv('-0x1.b1ad66a153796p-2', '-0x1.99999999998d7p-2') - th_ref = hex2Itv('-0x1.921fb54442d18p-4', '-0x1.7bee0d1b49326p-4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_012(self): - x = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y = hex2Itv('-0x1.4000000000009p+1', '-0x1.fffffffffff3dp-2') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('NAN', 'NAN') - y_ref = hex2Itv('NAN', 'NAN') - th_ref = hex2Itv('NAN', 'NAN') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_013(self): - x = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y = hex2Itv('-0x1.9999999999a1cp-2', '-0x1.99999999998b2p-2') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.03ebd1448ca65p+2', '0x1.1333333333336p+2') - y_ref = hex2Itv('-0x1.9999999999a1cp-2', '-0x1.99999999998b2p-2') - th_ref = hex2Itv('-0x1.921fb54442d18p-4', '-0x1.7bee0d1b49303p-4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_014(self): - x = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y = hex2Itv('-0x1.33333333333b6p-2', '-0x1.333333333324bp-2') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.85e1b9e6d2f4ep+1', '0x1.1333333333336p+2') - y_ref = hex2Itv('-0x1.33333333333b6p-2', '-0x1.333333333324bp-2') - th_ref = hex2Itv('-0x1.921fb54442d18p-4', '-0x1.1d4e1d42e5685p-4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_015(self): - x = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y = hex2Itv('-0x1.9999999999a9fp-3', '-0x1.99999999997c9p-3') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.03ebd1448c9d1p+1', '0x1.1333333333336p+2') - y_ref = hex2Itv('-0x1.9999999999a9fp-3', '-0x1.99999999997c9p-3') - th_ref = hex2Itv('-0x1.921fb54442d18p-4', '-0x1.7cbfb4c4372fap-5') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_016(self): - x = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y = hex2Itv('-0x1.9999999999ba4p-4', '-0x1.99999999995f8p-4') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y_ref = hex2Itv('-0x1.9999999999ba4p-4', '-0x1.99999999995f8p-4') - th_ref = hex2Itv('-0x1.c6a4cd203b715p-5', '-0x1.7cf45fe330c96p-6') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_017(self): - x = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y = hex2Itv('-0x1.0500000000000p-47', '0x1.d100000000000p-47') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y_ref = hex2Itv('-0x1.0500000000000p-47', '0x1.d100000000000p-47') - th_ref = hex2Itv('-0x1.2200000000004p-48', '0x1.0255555555559p-47') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_018(self): - x = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y = hex2Itv('0x1.9999999999790p-4', '0x1.9999999999d3cp-4') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y_ref = hex2Itv('0x1.9999999999790p-4', '0x1.9999999999d3cp-4') - th_ref = hex2Itv('0x1.7cf45fe330e12p-6', '0x1.c6a4cd203b8d9p-5') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_019(self): - x = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y = hex2Itv('0x1.9999999999895p-3', '0x1.9999999999b6bp-3') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.03ebd1448ca53p+1', '0x1.1333333333336p+2') - y_ref = hex2Itv('0x1.9999999999895p-3', '0x1.9999999999b6bp-3') - th_ref = hex2Itv('0x1.7cbfb4c4373b7p-5', '0x1.921fb54442d18p-4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_020(self): - x = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y = hex2Itv('0x1.33333333332b1p-2', '0x1.333333333341cp-2') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.85e1b9e6d2fcfp+1', '0x1.1333333333336p+2') - y_ref = hex2Itv('0x1.33333333332b1p-2', '0x1.333333333341cp-2') - th_ref = hex2Itv('0x1.1d4e1d42e56e3p-4', '0x1.921fb54442d18p-4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_021(self): - x = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y = hex2Itv('0x1.9999999999917p-2', '0x1.9999999999a83p-2') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.03ebd1448caa5p+2', '0x1.1333333333336p+2') - y_ref = hex2Itv('0x1.9999999999917p-2', '0x1.9999999999a83p-2') - th_ref = hex2Itv('0x1.7bee0d1b49360p-4', '0x1.921fb54442d18p-4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_022(self): - x = hex2Itv('0x1.cccccccccccc8p+0', '0x1.1333333333336p+2') - y = hex2Itv('0x1.fffffffffff7dp-2', '0x1.0000000000075p-1') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('NAN', 'NAN') - y_ref = hex2Itv('NAN', 'NAN') - th_ref = hex2Itv('NAN', 'NAN') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_023(self): - x = hex2Itv('0x1.bfffffffffff0p+1', '0x1.c000000000002p+1') - y = hex2Itv('0x1.fffffffffff7bp-2', '0x1.800000000003dp+0') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('NAN', 'NAN') - y_ref = hex2Itv('NAN', 'NAN') - th_ref = hex2Itv('NAN', 'NAN') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_024(self): - x = hex2Itv('0x1.bfffffffffff0p+1', '0x1.c000000000002p+1') - y = hex2Itv('0x1.999999999988dp-3', '0x1.3333333333372p+0') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.bfffffffffff0p+1', '0x1.c000000000002p+1') - y_ref = hex2Itv('0x1.999999999988dp-3', '0x1.60fe41acfc807p-2') - th_ref = hex2Itv('0x1.d39b13b547971p-5', '0x1.921fb54442d18p-4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_025(self): - x = hex2Itv('0x1.bfffffffffff0p+1', '0x1.c000000000002p+1') - y = hex2Itv('-0x1.0d00000000000p-47', '0x1.0000000000040p+0') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.bfffffffffff0p+1', '0x1.c000000000002p+1') - y_ref = hex2Itv('-0x1.0d00000000000p-47', '0x1.60fe41acfc807p-2') - th_ref = hex2Itv('-0x1.336db6db6db79p-49', '0x1.921fb54442d18p-4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_026(self): - x = hex2Itv('0x1.bfffffffffff0p+1', '0x1.c000000000002p+1') - y = hex2Itv('-0x1.9999999999aa7p-3', '0x1.9999999999a1ap-1') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.bfffffffffff0p+1', '0x1.c000000000002p+1') - y_ref = hex2Itv('-0x1.9999999999aa7p-3', '0x1.60fe41acfc807p-2') - th_ref = hex2Itv('-0x1.d39b13b547c0ap-5', '0x1.921fb54442d18p-4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_027(self): - x = hex2Itv('0x1.bfffffffffff0p+1', '0x1.c000000000002p+1') - y = hex2Itv('-0x1.9999999999a21p-2', '0x1.33333333333b4p-1') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.bfffffffffff0p+1', '0x1.c000000000002p+1') - y_ref = hex2Itv('-0x1.60fe41acfc807p-2', '0x1.60fe41acfc807p-2') - th_ref = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_028(self): - x = hex2Itv('0x1.bfffffffffff0p+1', '0x1.c000000000002p+1') - y = hex2Itv('-0x1.3333333333378p-1', '0x1.9999999999a9cp-2') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.bfffffffffff0p+1', '0x1.c000000000002p+1') - y_ref = hex2Itv('-0x1.60fe41acfc807p-2', '0x1.60fe41acfc807p-2') - th_ref = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_029(self): - x = hex2Itv('0x1.bfffffffffff0p+1', '0x1.c000000000002p+1') - y = hex2Itv('-0x1.99999999999e0p-1', '0x1.9999999999b9fp-3') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.bfffffffffff0p+1', '0x1.c000000000002p+1') - y_ref = hex2Itv('-0x1.60fe41acfc807p-2', '0x1.9999999999b9fp-3') - th_ref = hex2Itv('-0x1.921fb54442d18p-4', '0x1.d39b13b547d25p-5') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_030(self): - x = hex2Itv('0x1.bfffffffffff0p+1', '0x1.c000000000002p+1') - y = hex2Itv('-0x1.0000000000024p+0', '0x1.0280000000000p-46') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.bfffffffffff0p+1', '0x1.c000000000002p+1') - y_ref = hex2Itv('-0x1.60fe41acfc807p-2', '0x1.0280000000000p-46') - th_ref = hex2Itv('-0x1.921fb54442d18p-4', '0x1.276db6db6db79p-48') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_031(self): - x = hex2Itv('0x1.bfffffffffff0p+1', '0x1.c000000000002p+1') - y = hex2Itv('-0x1.3333333333358p+0', '-0x1.9999999999795p-3') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.bfffffffffff0p+1', '0x1.c000000000002p+1') - y_ref = hex2Itv('-0x1.60fe41acfc807p-2', '-0x1.9999999999795p-3') - th_ref = hex2Itv('-0x1.921fb54442d18p-4', '-0x1.d39b13b547856p-5') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_032(self): - x = hex2Itv('0x1.bfffffffffff0p+1', '0x1.c000000000002p+1') - y = hex2Itv('-0x1.666666666668cp+0', '-0x1.9999999999897p-2') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('NAN', 'NAN') - y_ref = hex2Itv('NAN', 'NAN') - th_ref = hex2Itv('NAN', 'NAN') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_033(self): - x = hex2Itv('-0x1.6100000000000p-47', '0x1.1500000000000p-47') - y = hex2Itv('-0x1.0000000000028p+0', '0x1.0380000000000p-46') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x0.0p+0', '0x1.1500000000000p-47') - y_ref = hex2Itv('-0x1.b4838eedea87ep-51', '0x1.b4838eedea87ep-51') - th_ref = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_034(self): - x = hex2Itv('-0x1.6100000000000p-47', '0x1.1500000000000p-47') - y = hex2Itv('-0x1.66666666666b7p-1', '0x1.3333333333437p-2') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x0.0p+0', '0x1.1500000000000p-47') - y_ref = hex2Itv('-0x1.b4838eedea87ep-51', '0x1.b4838eedea87ep-51') - th_ref = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_035(self): - x = hex2Itv('-0x1.6100000000000p-47', '0x1.1500000000000p-47') - y = hex2Itv('-0x1.9999999999a3cp-2', '0x1.33333333333b7p-1') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x0.0p+0', '0x1.1500000000000p-47') - y_ref = hex2Itv('-0x1.b4838eedea87ep-51', '0x1.b4838eedea87ep-51') - th_ref = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_036(self): - x = hex2Itv('-0x1.6100000000000p-47', '0x1.1500000000000p-47') - y = hex2Itv('-0x1.9999999999adfp-3', '0x1.9999999999a1fp-1') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x0.0p+0', '0x1.1500000000000p-47') - y_ref = hex2Itv('-0x1.b4838eedea87ep-51', '0x1.b4838eedea87ep-51') - th_ref = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_037(self): - x = hex2Itv('0x1.9999999999839p-3', '0x1.9999999999aafp-3') - y = hex2Itv('-0x1.9999999999a3dp-2', '0x1.33333333333bcp-1') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.9999999999839p-3', '0x1.9999999999aafp-3') - y_ref = hex2Itv('-0x1.42bc93d15bf0cp-6', '0x1.42bc93d15bf0cp-6') - th_ref = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_038(self): - x = hex2Itv('0x1.3333333333317p+1', '0x1.3333333333349p+1') - y = hex2Itv('-0x1.4700000000000p-47', '0x1.1580000000000p-46') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.3333333333317p+1', '0x1.3333333333349p+1') - y_ref = hex2Itv('-0x1.4700000000000p-47', '0x1.1580000000000p-46') - th_ref = hex2Itv('-0x1.108000000001ap-48', '0x1.ce8000000002bp-48') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_039(self): - x = hex2Itv('0x1.3333333333317p+1', '0x1.3333333333349p+1') - y = hex2Itv('-0x1.9999999999c28p-4', '-0x1.9999999999544p-4') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.3333333333317p+1', '0x1.3333333333349p+1') - y_ref = hex2Itv('-0x1.9999999999c28p-4', '-0x1.9999999999544p-4') - th_ref = hex2Itv('-0x1.5522d16b2f7f5p-5', '-0x1.5522d16b2f1e9p-5') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_040(self): - x = hex2Itv('0x1.3333333333317p+1', '0x1.3333333333349p+1') - y = hex2Itv('0x1.999999999970cp-4', '0x1.9999999999df0p-4') - th = hex2Itv('-0x1.921fb54442d18p-4', '0x1.921fb54442d18p-4') - x_ref = hex2Itv('0x1.3333333333317p+1', '0x1.3333333333349p+1') - y_ref = hex2Itv('0x1.999999999970cp-4', '0x1.9999999999df0p-4') - th_ref = hex2Itv('0x1.5522d16b2f364p-5', '0x1.5522d16b2f970p-5') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_041(self): - x = hex2Itv('0x1.3333333333317p+1', '0x1.3333333333317p+1') - y = hex2Itv('0x1.999999999970cp-4', '0x1.0ccccccccccf1p+1') - th = hex2Itv('-0x1.921fb54442d1bp-1', '0x1.0b090e5f5461ap+2') - x_ref = hex2Itv('0x1.3333333333317p+1', '0x1.3333333333317p+1') - y_ref = hex2Itv('0x1.999999999970cp-4', '0x1.0ccccccccccf1p+1') - th_ref = hex2Itv('0x1.5522d16b2f39bp-5', '0x1.700a7c578467bp-1') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_042(self): - x = hex2Itv('0x1.3333333333317p+1', '0x1.b333333333317p+1') - y = hex2Itv('0x1.999999999970cp-4', '0x1.19999999999e3p+0') - th = hex2Itv('-0x1.921fb54442d1bp-1', '0x1.0b090e5f5461ap+2') - x_ref = hex2Itv('0x1.3333333333317p+1', '0x1.b333333333317p+1') - y_ref = hex2Itv('0x1.999999999970cp-4', '0x1.19999999999e3p+0') - th_ref = hex2Itv('0x1.e1be544ec993fp-6', '0x1.b8139a5719550p-2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_043(self): - x = hex2Itv('0x1.199999999995cp+0', '0x1.0ccccccccccbbp+1') - y = hex2Itv('0x1.999999999996dp+0', '0x1.4ccccccccccf5p+1') - th = hex2Itv('-0x1.921fb54442d1bp-1', '0x1.0b090e5f5461ap+2') - x_ref = hex2Itv('0x1.199999999995cp+0', '0x1.0ccccccccccbbp+1') - y_ref = hex2Itv('0x1.999999999996dp+0', '0x1.4ccccccccccf5p+1') - th_ref = hex2Itv('0x1.4d59ed9394f52p-1', '0x1.2ba9894fc544cp+0') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_044(self): - x = hex2Itv('0x1.fffffffffff01p-2', '0x1.7ffffffffffe0p+0') - y = hex2Itv('0x1.999999999996dp+0', '0x1.4ccccccccccf5p+1') - th = hex2Itv('-0x1.921fb54442d1bp-1', '0x1.0b090e5f5461ap+2') - x_ref = hex2Itv('0x1.fffffffffff01p-2', '0x1.7ffffffffffe0p+0') - y_ref = hex2Itv('0x1.999999999996dp+0', '0x1.4ccccccccccf5p+1') - th_ref = hex2Itv('0x1.a2a25f172cfd0p-1', '0x1.617ca2b906f25p+0') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_045(self): - x = hex2Itv('-0x1.0080000000000p-46', '0x1.fffffffffffc5p-1') - y = hex2Itv('0x1.999999999996dp+0', '0x1.4ccccccccccf5p+1') - th = hex2Itv('-0x1.921fb54442d1bp-1', '0x1.0b090e5f5461ap+2') - x_ref = hex2Itv('-0x1.0080000000000p-46', '0x1.fffffffffffc5p-1') - y_ref = hex2Itv('0x1.999999999996dp+0', '0x1.4ccccccccccf5p+1') - th_ref = hex2Itv('0x1.031f57e54adb7p+0', '0x1.921fb54442d4fp+0') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_046(self): - x = hex2Itv('-0x1.0080000000000p-46', '0x1.fffffffffffc5p-1') - y = hex2Itv('0x1.e666666666638p+0', '0x1.733333333335cp+1') - th = hex2Itv('-0x1.921fb54442d1bp-1', '0x1.0b090e5f5461ap+2') - x_ref = hex2Itv('-0x1.0080000000000p-46', '0x1.fffffffffffc5p-1') - y_ref = hex2Itv('0x1.e666666666638p+0', '0x1.733333333335cp+1') - th_ref = hex2Itv('0x1.1618f66769c62p+0', '0x1.921fb54442d49p+0') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_047(self): - x = hex2Itv('-0x1.0080000000000p-46', '-0x1.d200000000000p-48') - y = hex2Itv('0x1.e666666666638p+0', '0x1.733333333335cp+1') - th = hex2Itv('-0x1.921fb54442d1bp-1', '0x1.0b090e5f5461ap+2') - x_ref = hex2Itv('-0x1.0080000000000p-46', '-0x1.d200000000000p-48') - y_ref = hex2Itv('0x1.e666666666638p+0', '0x1.733333333335cp+1') - th_ref = hex2Itv('0x1.921fb54442d17p+0', '0x1.921fb54442d49p+0') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_048(self): - x = hex2Itv('-0x1.4000000000025p+1', '-0x1.800000000003bp+0') - y = hex2Itv('-0x1.0000000000072p-1', '0x1.7fffffffffffep+0') - th = hex2Itv('-0x1.921fb54442d1bp-1', '0x1.0b090e5f5461ap+2') - x_ref = hex2Itv('-0x1.4000000000025p+1', '-0x1.800000000003bp+0') - y_ref = hex2Itv('-0x1.0000000000072p-1', '0x1.7fffffffffffep+0') - th_ref = hex2Itv('0x1.2d97c7f3321d8p+1', '0x1.bb4ed48a90101p+1') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_049(self): - x = hex2Itv('-0x1.e66666666668ep+1', '-0x1.666666666667cp+1') - y = hex2Itv('-0x1.0000000000072p-1', '0x1.7fffffffffffep+0') - th = hex2Itv('-0x1.921fb54442d1bp-1', '0x1.0b090e5f5461ap+2') - x_ref = hex2Itv('-0x1.e66666666668ep+1', '-0x1.666666666667cp+1') - y_ref = hex2Itv('-0x1.0000000000072p-1', '0x1.7fffffffffffep+0') - th_ref = hex2Itv('0x1.532c1ae0e390ap+1', '0x1.a8be1a9720d24p+1') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_050(self): - x = hex2Itv('-0x1.e66666666668ep+1', '-0x1.666666666667cp+1') - y = hex2Itv('-0x1.0000000000072p-1', '-0x1.0000000000002p-1') - th = hex2Itv('-0x1.921fb54442d1bp-1', '0x1.0b090e5f5461ap+2') - x_ref = hex2Itv('-0x1.e66666666668ep+1', '-0x1.666666666667cp+1') - y_ref = hex2Itv('-0x1.0000000000072p-1', '-0x1.0000000000002p-1') - th_ref = hex2Itv('0x1.a2dea9020a5bcp+1', '0x1.a8be1a9720d24p+1') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_051(self): - x = hex2Itv('-0x1.e66666666668ep+1', '-0x1.666666666667cp+1') - y = hex2Itv('-0x1.c900000000000p-47', '-0x1.4000000000000p-53') - th = hex2Itv('-0x1.921fb54442d1bp-1', '0x1.0b090e5f5461ap+2') - x_ref = hex2Itv('-0x1.e66666666668ep+1', '-0x1.666666666667cp+1') - y_ref = hex2Itv('-0x1.c900000000000p-47', '-0x1.4000000000000p-53') - th_ref = hex2Itv('0x1.921fb54442d17p+1', '0x1.921fb54442d23p+1') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_052(self): - x = hex2Itv('-0x1.0000000000014p+2', '-0x1.8000000000014p+1') - y = hex2Itv('-0x1.c900000000000p-47', '-0x1.4000000000000p-53') - th = hex2Itv('-0x1.921fb54442d1bp-1', '0x1.0b090e5f5461ap+2') - x_ref = hex2Itv('-0x1.0000000000014p+2', '-0x1.8000000000014p+1') - y_ref = hex2Itv('-0x1.c900000000000p-47', '-0x1.4000000000000p-53') - th_ref = hex2Itv('0x1.921fb54442d17p+1', '0x1.921fb54442d22p+1') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_053(self): - x = hex2Itv('-0x1.0000000000014p+2', '-0x1.000000000000ap+2') - y = hex2Itv('-0x1.c900000000000p-47', '0x1.ffffffffffffep-1') - th = hex2Itv('-0x1.921fb54442d1bp-1', '0x1.0b090e5f5461ap+2') - x_ref = hex2Itv('-0x1.0000000000014p+2', '-0x1.000000000000ap+2') - y_ref = hex2Itv('-0x1.c900000000000p-47', '0x1.ffffffffffffep-1') - th_ref = hex2Itv('0x1.72c43f4b1650ap+1', '0x1.921fb54442d20p+1') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_054(self): - x = hex2Itv('-0x1.0000000000014p+2', '-0x1.000000000000ap+2') - y = hex2Itv('-0x1.0000000000073p-1', '0x1.ffffffffffffep-2') - th = hex2Itv('-0x1.921fb54442d1bp-1', '0x1.0b090e5f5461ap+2') - x_ref = hex2Itv('-0x1.0000000000014p+2', '-0x1.000000000000ap+2') - y_ref = hex2Itv('-0x1.0000000000073p-1', '0x1.ffffffffffffep-2') - th_ref = hex2Itv('0x1.8234d7f6ecb9cp+1', '0x1.a20a929198e9bp+1') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_055(self): - x = hex2Itv('-0x1.3333333333420p-1', '-0x1.3333333333368p-1') - y = hex2Itv('-0x1.0000000000073p-1', '0x1.ffffffffffffep-2') - th = hex2Itv('-0x1.921fb54442d1bp-1', '0x1.0b090e5f5461ap+2') - x_ref = hex2Itv('-0x1.3333333333420p-1', '-0x1.3333333333368p-1') - y_ref = hex2Itv('-0x1.0000000000073p-1', '0x1.ffffffffffffep-2') - th_ref = hex2Itv('0x1.393286347d27dp+1', '0x1.eb0ce454087d0p+1') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_056(self): - x = hex2Itv('-0x1.b3333333333aep+0', '-0x1.b333333333349p+0') - y = hex2Itv('-0x1.0000000000020p+1', '-0x1.fffffffffffffp-1') - th = hex2Itv('-0x1.921fb54442d1bp-1', '0x1.0b090e5f5461ap+2') - x_ref = hex2Itv('-0x1.b3333333333aep+0', '-0x1.b333333333349p+0') - y_ref = hex2Itv('-0x1.0000000000020p+1', '-0x1.fffffffffffffp-1') - th_ref = hex2Itv('0x1.d62f3e07f2841p+1', '0x1.008159ada8be1p+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_057(self): - x = hex2Itv('-0x1.9999999999a15p+0', '-0x1.3333333333428p-1') - y = hex2Itv('-0x1.19999999999bap+1', '-0x1.3333333333332p+0') - th = hex2Itv('-0x1.921fb54442d1bp-1', '0x1.0b090e5f5461ap+2') - x_ref = hex2Itv('-0x1.9999999999a15p+0', '-0x1.7041d7138976cp-1') - y_ref = hex2Itv('-0x1.19999999999bap+1', '-0x1.3333333333332p+0') - th_ref = hex2Itv('0x1.e47df3d0dd4bap+1', '0x1.0b090e5f5461ap+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_058(self): - x = hex2Itv('-0x1.800000000007cp+0', '-0x1.00000000000f4p-1') - y = hex2Itv('-0x1.3333333333354p+1', '-0x1.6666666666664p+0') - th = hex2Itv('-0x1.921fb54442d1bp-1', '0x1.0b090e5f5461ap+2') - x_ref = hex2Itv('-0x1.800000000007cp+0', '-0x1.ada22596cb0a7p-1') - y_ref = hex2Itv('-0x1.3333333333354p+1', '-0x1.6666666666664p+0') - th_ref = hex2Itv('0x1.f23e26ce918b6p+1', '0x1.0b090e5f5461ap+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_059(self): - x = hex2Itv('-0x1.4cccccccccd4ap+0', '-0x1.333333333351ap-2') - y = hex2Itv('-0x1.4cccccccccceep+1', '-0x1.9999999999996p+0') - th = hex2Itv('-0x1.921fb54442d1bp-1', '0x1.0b090e5f5461ap+2') - x_ref = hex2Itv('-0x1.4cccccccccd4ap+0', '-0x1.eb02741a0c9e3p-1') - y_ref = hex2Itv('-0x1.159f2300067a1p+1', '-0x1.9999999999996p+0') - th_ref = hex2Itv('0x1.01ecb4e504e60p+2', '0x1.0b090e5f5461ap+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_060(self): - x = hex2Itv('-0x1.33333333333b1p+0', '-0x1.9999999999d67p-3') - y = hex2Itv('-0x1.6666666666688p+1', '-0x1.cccccccccccc8p+0') - th = hex2Itv('-0x1.921fb54442d1bp-1', '0x1.0b090e5f5461ap+2') - x_ref = hex2Itv('-0x1.33333333333b1p+0', '-0x1.1431614ea718fp+0') - y_ref = hex2Itv('-0x1.0044204ecae76p+1', '-0x1.cccccccccccc8p+0') - th_ref = hex2Itv('0x1.07f5f24725550p+2', '0x1.0b090e5f5461ap+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_061(self): - x = hex2Itv('-0x1.33333333333b1p+0', '-0x1.9999999999d67p-3') - y = hex2Itv('-0x1.7333333333355p+1', '-0x1.e666666666661p+0') - th = hex2Itv('-0x1.921fb54442d1bp-1', '0x1.0b090e5f5461ap+2') - x_ref = hex2Itv('-0x1.33333333333b1p+0', '-0x1.238974ef777dep+0') - y_ref = hex2Itv('-0x1.0044204ecae76p+1', '-0x1.e666666666661p+0') - th_ref = hex2Itv('0x1.098a684d17addp+2', '0x1.0b090e5f5461ap+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_062(self): - x = hex2Itv('-0x1.1999999999a18p+0', '-0x1.999999999a134p-4') - y = hex2Itv('-0x1.7333333333355p+1', '-0x1.e666666666661p+0') - th = hex2Itv('-0x1.921fb54442d1bp-1', '0x1.0b090e5f5461ap+2') - x_ref = hex2Itv('NAN', 'NAN') - y_ref = hex2Itv('NAN', 'NAN') - th_ref = hex2Itv('NAN', 'NAN') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_063(self): - x = hex2Itv('-0x1.1999999999a18p+0', '-0x1.999999999a134p-4') - y = hex2Itv('-0x1.7333333333355p+1', '-0x1.e666666666661p+0') - th = hex2Itv('-0x1.921fb54442d1bp-1', '0x1.2d97c7f332205p+2') - x_ref = hex2Itv('-0x1.1999999999a18p+0', '-0x1.999999999a134p-4') - y_ref = hex2Itv('-0x1.7333333333355p+1', '-0x1.e666666666661p+0') - th_ref = hex2Itv('0x1.0c0186f21dde0p+2', '0x1.2b630a0fd1205p+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_064(self): - x = hex2Itv('-0x1.000000000007fp+0', '-0x1.e680000000000p-46') - y = hex2Itv('-0x1.7333333333355p+1', '-0x1.e666666666661p+0') - th = hex2Itv('-0x1.921fb54442d1bp-1', '0x1.2d97c7f332205p+2') - x_ref = hex2Itv('-0x1.000000000007fp+0', '-0x1.e680000000000p-46') - y_ref = hex2Itv('-0x1.7333333333355p+1', '-0x1.e666666666661p+0') - th_ref = hex2Itv('0x1.0e96183bfbd96p+2', '0x1.2d97c7f3321ccp+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_065(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.6666666666575p-1') - y = hex2Itv('-0x1.7333333333355p+1', '-0x1.e666666666661p+0') - th = hex2Itv('-0x1.921fb54442d1bp-1', '0x1.2d97c7f332205p+2') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x1.6666666666575p-1') - y_ref = hex2Itv('-0x1.7333333333355p+1', '-0x1.e666666666661p+0') - th_ref = hex2Itv('0x1.2392041229ca7p+2', '0x1.2d97c7f332205p+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_066(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.6666666666575p-1') - y = hex2Itv('-0x1.7333333333355p+1', '-0x1.e666666666661p+0') - th = hex2Itv('0x1.c463abeccb2b2p-1', '0x1.9868341953e2ap+2') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x1.6666666666575p-1') - y_ref = hex2Itv('-0x1.7333333333355p+1', '-0x1.e666666666661p+0') - th_ref = hex2Itv('0x1.2392041229ca7p+2', '0x1.442f2cf21352bp+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_067(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.6666666666575p-1') - y = hex2Itv('-0x1.7333333333355p+1', '-0x1.e666666666661p+0') - th = hex2Itv('0x1.c463abeccb2b2p-1', '0x1.2d97c7f33225ap+2') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x1.8a99950860f20p-42') - y_ref = hex2Itv('-0x1.7333333333355p+1', '-0x1.e666666666661p+0') - th_ref = hex2Itv('0x1.2392041229ca7p+2', '0x1.2d97c7f33225ap+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_068(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.6666666666575p-1') - y = hex2Itv('-0x1.7333333333355p+1', '-0x1.cccccccccccc0p-1') - th = hex2Itv('0x1.c463abeccb2b2p-1', '0x1.2d97c7f33225ap+2') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x1.8a99950860f20p-42') - y_ref = hex2Itv('-0x1.7333333333355p+1', '-0x1.cccccccccccc0p-1') - th_ref = hex2Itv('0x1.190038500b7c0p+2', '0x1.2d97c7f33225ap+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_069(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.6666666666575p-1') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.199999999999ep+0') - th = hex2Itv('0x1.c463abeccb2b2p-1', '0x1.2d97c7f33225ap+2') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x1.6666666666575p-1') - y_ref = hex2Itv('-0x1.7333333333355p+1', '0x1.199999999999ep+0') - th_ref = hex2Itv('0x1.c463abeccb2b2p-1', '0x1.2d97c7f33225ap+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_070(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th = hex2Itv('0x1.c463abeccb2b2p-1', '0x1.2d97c7f33225ap+2') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y_ref = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th_ref = hex2Itv('0x1.c463abeccb2b2p-1', '0x1.2d97c7f33225ap+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_071(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th = hex2Itv('0x1.2106ca491005dp+1', '0x1.858eb79a20c4ep+2') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y_ref = hex2Itv('-0x1.7333333333355p+1', '0x1.76530436f436dp-2') - th_ref = hex2Itv('0x1.2106ca491005dp+1', '0x1.858eb79a20c4ep+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_072(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th = hex2Itv('0x1.a4f931c375f21p+1', '0x1.c787eb5753bc5p+2') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y_ref = hex2Itv('-0x1.7333333333355p+1', '0x1.e02b510c34544p+0') - th_ref = hex2Itv('0x1.a4f931c375f21p+1', '0x1.c787eb5753bc5p+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_073(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th = hex2Itv('0x1.fcf0216a648f9p+1', '0x1.c13f6c8242b1fp+2') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y_ref = hex2Itv('-0x1.7333333333355p+1', '0x1.8a7139c897db1p+0') - th_ref = hex2Itv('0x1.fcf0216a648f9p+1', '0x1.c13f6c8242b1fp+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_074(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th = hex2Itv('0x1.fcf0216a648f9p+1', '0x1.baf6edad31a6bp+2') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y_ref = hex2Itv('-0x1.7333333333355p+1', '0x1.42c42d6635c45p+0') - th_ref = hex2Itv('0x1.fcf0216a648f9p+1', '0x1.baf6edad31a6bp+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_075(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th = hex2Itv('0x1.fcf0216a648f9p+1', '0x1.ae65f0030f903p+2') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y_ref = hex2Itv('-0x1.7333333333355p+1', '0x1.9bab257fb0135p-1') - th_ref = hex2Itv('0x1.fcf0216a648f9p+1', '0x1.ae65f0030f903p+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_076(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th = hex2Itv('0x1.fcf0216a648f9p+1', '0x1.a1d4f258ed79bp+2') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y_ref = hex2Itv('-0x1.7333333333355p+1', '0x1.b40c3616423e4p-2') - th_ref = hex2Itv('0x1.fcf0216a648f9p+1', '0x1.a1d4f258ed79bp+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_077(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th = hex2Itv('0x1.fcf0216a648f9p+1', '0x1.6c6cbc45dc9a1p+2') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y_ref = hex2Itv('-0x1.7333333333355p+1', '0x0.0p+0') - th_ref = hex2Itv('0x1.fcf0216a648f9p+1', '0x1.6c6cbc45dc9a1p+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_078(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th = hex2Itv('0x1.fcf0216a648f9p+1', '0x1.502681870fe77p+2') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y_ref = hex2Itv('-0x1.7333333333355p+1', '0x0.0p+0') - th_ref = hex2Itv('0x1.fcf0216a648f9p+1', '0x1.502681870fe77p+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_079(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th = hex2Itv('0x1.fcf0216a648f9p+1', '0x1.49de02b1fedc3p+2') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x1.5f21096561873p+0') - y_ref = hex2Itv('-0x1.7333333333355p+1', '0x0.0p+0') - th_ref = hex2Itv('0x1.fcf0216a648f9p+1', '0x1.49de02b1fedc3p+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_080(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th = hex2Itv('0x1.fcf0216a648f9p+1', '0x1.40714472654b5p+2') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x1.c268be6f93e40p-1') - y_ref = hex2Itv('-0x1.7333333333355p+1', '0x0.0p+0') - th_ref = hex2Itv('0x1.fcf0216a648f9p+1', '0x1.40714472654b5p+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_081(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th = hex2Itv('0x1.fcf0216a648f9p+1', '0x1.37048632cbba7p+2') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x1.b87fa0e1747b0p-2') - y_ref = hex2Itv('-0x1.7333333333355p+1', '0x0.0p+0') - th_ref = hex2Itv('0x1.fcf0216a648f9p+1', '0x1.37048632cbba7p+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_082(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th = hex2Itv('0x1.fcf0216a648f9p+1', '0x1.30bc075dbaaf3p+2') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x1.23c631104b50bp-3') - y_ref = hex2Itv('-0x1.7333333333355p+1', '0x0.0p+0') - th_ref = hex2Itv('0x1.fcf0216a648f9p+1', '0x1.30bc075dbaaf3p+2') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_083(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th = hex2Itv('0x1.3bbae55298756p+3', '0x1.54dce0a6dcae9p+3') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x0.0p+0') - y_ref = hex2Itv('-0x1.ad488289c817ep-1', '0x0.0p+0') - th_ref = hex2Itv('0x1.3bbae55298756p+3', '0x1.54dce0a6dcae9p+3') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_084(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th = hex2Itv('0x1.46b9c34776491p+3', '0x1.5fdbbe9bba82bp+3') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x1.07f3320ee50aep-40') - y_ref = hex2Itv('-0x1.7333333333355p+1', '0x0.0p+0') - th_ref = hex2Itv('0x1.46b9c34776491p+3', '0x1.5fdbbe9bba82bp+3') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_085(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th = hex2Itv('0x1.566f005c20e53p+3', '0x1.6f90fbb0651f7p+3') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x1.8cd23177f3008p+0') - y_ref = hex2Itv('-0x1.7333333333355p+1', '0x0.0p+0') - th_ref = hex2Itv('0x1.566f005c20e53p+3', '0x1.6f90fbb0651f7p+3') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_086(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th = hex2Itv('0x1.67b65d260fc42p+3', '0x1.80d8587a53ff1p+3') - x_ref = hex2Itv('0x0.0p+0', '0x1.b3333333332bcp+0') - y_ref = hex2Itv('-0x1.7333333333355p+1', '0x0.0p+0') - th_ref = hex2Itv('0x1.67b65d260fc42p+3', '0x1.80d8587a53ff1p+3') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_087(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th = hex2Itv('0x1.78fdb9effea31p+3', '0x1.921fb54442debp+3') - x_ref = hex2Itv('0x0.0p+0', '0x1.b3333333332bcp+0') - y_ref = hex2Itv('-0x1.b333333333520p+0', '0x1.66b33333332d2p-41') - th_ref = hex2Itv('0x1.78fdb9effea31p+3', '0x1.921fb54442debp+3') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_088(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th = hex2Itv('0x1.8a4516b9ed820p+3', '0x1.a367120e31be5p+3') - x_ref = hex2Itv('0x0.0p+0', '0x1.b3333333332bcp+0') - y_ref = hex2Itv('-0x1.b40c36164134ap-2', '0x1.04d94dadd7c89p+0') - th_ref = hex2Itv('0x1.8a4516b9ed820p+3', '0x1.a367120e31be5p+3') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_089(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th = hex2Itv('0x1.a042d2a3a9296p+3', '0x1.b964cdf7ed669p+3') - x_ref = hex2Itv('0x0.0p+0', '0x1.b3333333332bcp+0') - y_ref = hex2Itv('0x0.0p+0', '0x1.0cccccccccccfp+1') - th_ref = hex2Itv('0x1.a042d2a3a9296p+3', '0x1.b964cdf7ed669p+3') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_090(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th = hex2Itv('0x1.b4ae6ed8208dfp+3', '0x1.cdd06a2c64cbfp+3') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x1.1f5a6a7156cf6p+0') - y_ref = hex2Itv('0x0.0p+0', '0x1.0cccccccccccfp+1') - th_ref = hex2Itv('0x1.b4ae6ed8208dfp+3', '0x1.cdd06a2c64cbfp+3') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_091(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th = hex2Itv('0x1.c463abeccb2a1p+3', '0x1.dd85a7410f68bp+3') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x1.b5610d40e0466p-44') - y_ref = hex2Itv('0x0.0p+0', '0x1.0cccccccccccfp+1') - th_ref = hex2Itv('0x1.c463abeccb2a1p+3', '0x1.dd85a7410f68bp+3') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_092(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th = hex2Itv('0x1.d73d286bfe4bdp+3', '0x1.f05f23c0428b3p+3') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x0.0p+0') - y_ref = hex2Itv('0x0.0p+0', '0x1.cbc1ddc6c9214p-2') - th_ref = hex2Itv('0x1.d73d286bfe4bdp+3', '0x1.f05f23c0428b3p+3') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_093(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th = hex2Itv('0x1.fb5e01b5204c8p+3', '0x1.0a3ffe84b246bp+4') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x0.0p+0') - y_ref = hex2Itv('-0x1.9e36147ea1a60p-2', '0x0.0p+0') - th_ref = hex2Itv('0x1.fb5e01b5204c8p+3', '0x1.0a3ffe84b246bp+4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_094(self): - x = hex2Itv('-0x1.3333333333532p-2', '0x1.b3333333332bcp+0') - y = hex2Itv('-0x1.7333333333355p+1', '0x1.0cccccccccccfp+1') - th = hex2Itv('0x1.0652af3f87957p+4', '0x1.12e3ace9a9b68p+4') - x_ref = hex2Itv('-0x1.3333333333532p-2', '0x0.0p+0') - y_ref = hex2Itv('-0x1.7333333333355p+1', '0x0.0p+0') - th_ref = hex2Itv('0x1.0652af3f87957p+4', '0x1.12e3ace9a9b68p+4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_095(self): - x = hex2Itv('0x1.999999999959dp-3', '0x1.a33333333333ep+4') - y = hex2Itv('-0x1.4ccccccccccf1p+1', '0x1.cccccccccccdbp+3') - th = hex2Itv('0x1.0652af3f87957p+4', '0x1.12e3ace9a9b68p+4') - x_ref = hex2Itv('NAN', 'NAN') - y_ref = hex2Itv('NAN', 'NAN') - th_ref = hex2Itv('NAN', 'NAN') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_096(self): - x = hex2Itv('0x1.999999999959dp-3', '0x1.a33333333333ep+4') - y = hex2Itv('-0x1.4ccccccccccf1p+1', '0x1.cccccccccccdbp+3') - th = hex2Itv('0x1.0652af3f87957p+4', '0x1.18631be418a09p+4') - x_ref = hex2Itv('0x1.999999999959dp-3', '0x1.4d72bff2e9a20p-1') - y_ref = hex2Itv('-0x1.4ccccccccccf1p+1', '-0x1.98cdc04bd35f2p-1') - th_ref = hex2Itv('0x1.15b041c892076p+4', '0x1.18631be418a09p+4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_097(self): - x = hex2Itv('0x1.999999999959dp-3', '0x1.a33333333333ep+4') - y = hex2Itv('-0x1.4ccccccccccf1p+1', '0x1.cccccccccccdbp+3') - th = hex2Itv('0x1.0652af3f87957p+4', '0x1.28e168d3655ecp+4') - x_ref = hex2Itv('0x1.999999999959dp-3', '0x1.12460d7774138p+3') - y_ref = hex2Itv('-0x1.4ccccccccccf1p+1', '-0x1.f100d222d212cp-5') - th_ref = hex2Itv('0x1.15b041c892076p+4', '0x1.28e168d3655ecp+4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_098(self): - x = hex2Itv('0x1.999999999959dp-3', '0x1.a33333333333ep+4') - y = hex2Itv('-0x1.4ccccccccccf1p+1', '0x1.cccccccccccdbp+3') - th = hex2Itv('0x1.16d0fc2ed4525p+4', '0x1.445e93b78ff11p+4') - x_ref = hex2Itv('0x1.999999999959dp-3', '0x1.a33333333333ep+4') - y_ref = hex2Itv('-0x1.4ccccccccccf1p+1', '0x1.cccccccccccdbp+3') - th_ref = hex2Itv('0x1.16d0fc2ed4525p+4', '0x1.445e93b78ff11p+4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_099(self): - x = hex2Itv('0x1.999999999959dp-3', '0x1.a33333333333ep+4') - y = hex2Itv('-0x1.4ccccccccccf1p+1', '0x1.cccccccccccdbp+3') - th = hex2Itv('0x1.16d0fc2ed4525p+4', '0x1.2ff2f783188d5p+4') - x_ref = hex2Itv('0x1.999999999959dp-3', '0x1.a33333333333ep+4') - y_ref = hex2Itv('-0x1.4ccccccccccf1p+1', '0x1.f175a63c6e423p+1') - th_ref = hex2Itv('0x1.16d0fc2ed4525p+4', '0x1.2ff2f783188d5p+4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_100(self): - x = hex2Itv('0x1.999999999959dp-3', '0x1.a33333333333ep+4') - y = hex2Itv('-0x1.4ccccccccccf1p+1', '0x1.cccccccccccdbp+3') - th = hex2Itv('0x1.2d97c7f3321a3p+4', '0x1.46b9c34776570p+4') - x_ref = hex2Itv('0x1.999999999959dp-3', '0x1.a33333333333ep+4') - y_ref = hex2Itv('-0x1.33d99999999a3p-38', '0x1.cccccccccccdbp+3') - th_ref = hex2Itv('0x1.2d97c7f3321a3p+4', '0x1.4680e0a8f100bp+4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_101(self): - x = hex2Itv('0x1.999999999959dp-3', '0x1.a33333333333ep+4') - y = hex2Itv('-0x1.4ccccccccccf1p+1', '0x1.cccccccccccdbp+3') - th = hex2Itv('0x1.30bc075dba9fbp+4', '0x1.49de02b1fedccp+4') - x_ref = hex2Itv('0x1.999999999959dp-3', '0x1.a33333333333ep+4') - y_ref = hex2Itv('0x1.45e5e4d10dc92p-5', '0x1.cccccccccccdbp+3') - th_ref = hex2Itv('0x1.30bc075dba9fbp+4', '0x1.4680e0a8f100bp+4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_102(self): - x = hex2Itv('0x1.999999999959dp-3', '0x1.a33333333333ep+4') - y = hex2Itv('-0x1.4ccccccccccf1p+1', '0x1.cccccccccccdbp+3') - th = hex2Itv('0x1.331736eda103dp+4', '0x1.4c393241e5411p+4') - x_ref = hex2Itv('0x1.999999999959dp-3', '0x1.a33333333333ep+4') - y_ref = hex2Itv('0x1.251d4c645f6a4p-4', '0x1.cccccccccccdbp+3') - th_ref = hex2Itv('0x1.331736eda103dp+4', '0x1.4680e0a8f100bp+4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_103(self): - x = hex2Itv('0x1.999999999959dp-3', '0x1.a33333333333ep+4') - y = hex2Itv('-0x1.4ccccccccccf1p+1', '0x1.cccccccccccdbp+3') - th = hex2Itv('0x1.363b765829895p+4', '0x1.4f5d71ac6dc6dp+4') - x_ref = hex2Itv('0x1.999999999959dp-3', '0x1.8066307630e3fp+4') - y_ref = hex2Itv('0x1.eb02741a0b978p-4', '0x1.cccccccccccdbp+3') - th_ref = hex2Itv('0x1.363b765829895p+4', '0x1.4680e0a8f100bp+4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_104(self): - x = hex2Itv('0x1.8cccccccccc81p+1', '0x1.e1999999999b1p+4') - y = hex2Itv('-0x1.4ccccccccccf1p+1', '0x1.cccccccccccdbp+3') - th = hex2Itv('0x1.3896a5e80fed7p+4', '0x1.51b8a13c542b2p+4') - x_ref = hex2Itv('0x1.8cccccccccc81p+1', '0x1.18be43293782fp+4') - y_ref = hex2Itv('0x1.45a535470c943p+1', '0x1.cccccccccccdbp+3') - th_ref = hex2Itv('0x1.3896a5e80fed7p+4', '0x1.43553d7e8a4cbp+4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - - def test_105(self): - x = hex2Itv('0x1.8cccccccccc81p+1', '0x1.e1999999999b1p+4') - y = hex2Itv('-0x1.4ccccccccccf1p+1', '0x1.1d999999999b9p+6') - th = hex2Itv('0x1.3896a5e80fed7p+4', '0x1.51b8a13c542b2p+4') - x_ref = hex2Itv('0x1.8cccccccccc81p+1', '0x1.e1999999999b1p+4') - y_ref = hex2Itv('0x1.45a535470c943p+1', '0x1.1d999999999b9p+6') - th_ref = hex2Itv('0x1.3896a5e80fed7p+4', '0x1.46080971d558ep+4') - xx, yy, thh = Catan2(x, y, th) - self.assertSubset(xx, x_ref) - self.assertSubset(yy, y_ref) - self.assertSubset(thh, th_ref) - -if __name__ == '__main__': - unittest.main() diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_Contractors.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_Contractors.py deleted file mode 100755 index 4c1221b9c..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_Contractors.py +++ /dev/null @@ -1,157 +0,0 @@ -#!/usr/bin/env python -#============================================================================ -# P Y I B E X -# File : test_Bsc.cpp -# Author : Benoit Desrochers -# Copyright : Benoit Desrochers -# License : See the LICENSE file -# Created : Dec 28, 2014 -#============================================================================ -import unittest -import pyibex -from pyibex import * -import sys -import math -import tempfile -class TestContractors(unittest.TestCase): - - def assertApproxItvVec(self, first, second): - for i in range(len(first)): - self.assertAlmostEqual(first[i][0], second[i][0]) - self.assertAlmostEqual(first[i][1], second[i][1]) - - - def test_Function(self): - # generate memory leak !!! - try: - f = Function("x", "y", "sqr(x) + sqr(y)") - except RuntimeError as err: - self.assertTrue(str(err) == "\n############# IBEX FUNCTION PARSER ###############\nSyntax error near \"sqr\" line 2: syntax error") - - def test_Function_vector(self): - f = Function("x[2]", "y[3]", "(x[1]^2 - y[1]*y[0], y[0])") - del f - - # def test_function_matrix(self): - # try: - # f = Function("x[2]", "y[3]", "(( x[1]^2 - y[1]*y[0], y[0]);(x[0] + y[2], x[0]))") - # except: - # print("Unexpected error:", sys.exc_info()[0]) - - def test_Function_string(self): - fp = tempfile.NamedTemporaryFile(mode="w", delete=False) - fp.write("""function f(x,y,z) - return (x^2-y, y-2*z, z^3-sqrt(y-x)); - end""") - filename = fp.name - fp.close() - f = Function(filename) - self.assertEqual(str(f), "f:(x,y,z)->((x^2-y),(y-(2*z)),(z^3-sqrt((y-x))))") - - - def test_CtcFwdBwd_default_arg(self): - f = Function("x", "y", "(x)^2 + (y)^2 - [3.61, 4.41]") - ctc1 = CtcFwdBwd(f) - ctc1 = CtcFwdBwd(f, CmpOp.LEQ) - - def test_CtcFwdBwd_default_arg_with_list(self): - f = Function("x", "y", "(x)^2 + (y)^2 - [3.61, 4.41]") - ctc1 = CtcFwdBwd(f) - ctc1 = CtcFwdBwd(f, [-oo,0]) - - - def test_CtcUnion_2_arguments(self): - f = Function("x", "y", "(x)^2 + (y)^2 - [3.61, 4.41]") - ctc1 = CtcFwdBwd(f, CmpOp.EQ) - f2 = Function("x", "y", "(x-1)^2 + (y-1)^2 - [3.61, 4.41]") - ctc2 = CtcFwdBwd(f2, CmpOp.EQ) - ctc = CtcUnion([ctc1, ctc2]) - del f, ctc1, f2, ctc2 # delete tmp object - a = IntervalVector(2) - ctc.contract(a) - self.assertApproxItvVec(a, IntervalVector(2, Interval(-2.1, 3.1))) - - def test_CtcUnion_Array(self): - f = Function("x", "y", "(x)^2 + (y)^2 - [3.61, 4.41]") - ctc1 = CtcFwdBwd(f, CmpOp.EQ) - f2 = Function("x", "y", "(x-1)^2 + (y-1)^2 - [3.61, 4.41]") - ctc2 = CtcFwdBwd(f2, CmpOp.EQ) - ctc = ctc1 | ctc2 | ctc1 - del ctc2, ctc1 , f, f2 # Test if references are kept by python - a = IntervalVector(2) - ctc.contract(a) - self.assertApproxItvVec(a, IntervalVector(2, Interval(-2.1, 3.1))) - - def test_CtcCompo(self): - f = Function("x", "y", "(x)^2 + (y)^2 - [3.61, 4.41]") - ctc1 = CtcFwdBwd(f, CmpOp.EQ) - f2 = Function("x", "y", "(x-1)^2 + (y-1)^2 - [3.61, 4.41]") - ctc2 = CtcFwdBwd(f2, CmpOp.EQ) - f3 = Function("x", "y", "(x-1)^2 + (y-1)^2 - [3.61, 4.41]") - ctc3 = CtcFwdBwd(f3, CmpOp.EQ) - ctc = ctc1 & ctc2 & ctc3 - del ctc1, ctc2, ctc3 # optionnal test if references are kept by python - a = IntervalVector(2) - ctc.contract(a) - self.assertApproxItvVec(a, IntervalVector(2, Interval(-1.1, 2.1))) - - def test_CtcArray(self): - f = Function("x", "y", "(x)^2 + (y)^2 - [3.61, 4.41]") - ctc1 = CtcFwdBwd(f, CmpOp.EQ) - f2 = Function("x", "y", "(x-1)^2 + (y-1)^2 - [3.61, 4.41]") - ctc2 = CtcFwdBwd(f2, CmpOp.EQ) - f , f2 = None, None - lst = [ctc1, ctc2, ctc2, ctc1,ctc1, ctc2, ctc2, ctc1] - ctc = CtcUnion( lst) - del lst, ctc1, ctc2 - a = IntervalVector(2) - ctc.contract(a) - self.assertApproxItvVec(a, IntervalVector(2, Interval(-2.1, 3.1))) - - # def test_CtcPolar(self): - # ctc = CtcPolar() - # x, y, rho, theta = Interval(3,4), Interval(3,6), Interval(2,6), Interval(0, math.pi/4.0) - # ctc.contract(x,y,rho, theta) - # [3, 4], [3, 4], [4.24264, 5.65685], [0.643501, 0.785398] - - def test_CtcQInter_withRefereces(self): - data = [Interval(3.61, 4.41), Interval(3.61, 4.41)] - cx = [0, 1] - cy = [0, 1] - ctcs = [] - - for x, y, r in zip(cx, cy, data): - f = Function('x', 'y', '(x-%f)^2 + (y-%f)^2 - %s'%(x,y,r)) - ctcs.append(CtcFwdBwd(f, CmpOp.LEQ)) - - ctc = CtcQInter(ctcs, len(ctcs)-1) # Union - ctcs = None - a = IntervalVector(2, Interval(-20, 20)) - ctc.contract(a) - self.assertApproxItvVec(a, IntervalVector(2, Interval(-2.1, 3.1))) - - - def test_CtcExist(self): - f = Function("x", "y", "sqrt(x^2+y^2)-1") - ctc = CtcFwdBwd(f, CmpOp.EQ) - y = IntervalVector(1, [-0.5, -0.4]) - ctc_exist = CtcExist(ctc, y) - X = IntervalVector(1, [0, 3]) - ctc_exist.contract(X) - xres = sin(acos(Interval(-0.5, -0.4))) - self.assertTrue( X.is_subset(IntervalVector([xres]))) - - - def test_CtcForAll(self): - f = Function("x", "y", "sqrt(x^2+y^2)-1") - ctc = CtcFwdBwd(f, CmpOp.EQ) - y = IntervalVector(1, [-0.5, -0.4]) - ctc_forall = CtcForAll(ctc, y) - X = IntervalVector(1, [0, 3]) - ctc_forall.contract(X) - xres = sin(acos(Interval(-0.5, -0.4))) - self.assertTrue( X.is_subset(IntervalVector([xres]))) - -if __name__ == '__main__': - - unittest.main() diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_CustomCtc.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_CustomCtc.py deleted file mode 100644 index 207733961..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_CustomCtc.py +++ /dev/null @@ -1,150 +0,0 @@ -#!/usr/bin/env python -#============================================================================ -# P Y I B E X -# File : test_CtcOpaque.cpp -# Author : Benoit Desrochers -# Copyright : Benoit Desrochers -# License : See the LICENSE file -# Created : Dec 28, 2014 -#============================================================================ -import unittest -import pyibex -from pyibex import Ctc, IntervalVector, CtcFwdBwd, CtcQInter, CtcCompo -from pyibex import CtcUnion, CtcInverse, Function - - -class MyCtc(Ctc): - def __init__(self): - Ctc.__init__(self, 2) - - def contract(self, box): - # print("MyCtc ", box, end=" ") - box &= IntervalVector.empty(2) - box.set_empty() - # box &= IntervalVector(2, [0,0]) - # print("--> ", box) - return box - -class MyCtc_noReturn(Ctc): - def __init__(self): - Ctc.__init__(self, 2) - - def contract(self, box): - # print("MyCtc ", box, end=" ") - box &= IntervalVector.empty(2) - box.set_empty() - # box &= IntervalVector(2, [0,0]) - # print("--> ", box) - # return box - -class MyCtc2(Ctc): - def __init__(self, ctc, f): - Ctc.__init__(self, 2) - self.ctc = ctc - self.f = f - - def contract(self, box): - # print(box) - # self.ctc.contract(box) - # print(box) - Y = self.f.eval_vector(box) - self.ctc.contract(box) - print(box, Y) - return box - -class TestCtcOpaque(unittest.TestCase): - - def setUp(self): - ctc1 = MyCtc() - ctc2 = MyCtc() - ctc3 = MyCtc() - self.ctcs = [ctc1, ctc2, ctc3] - - def test_customCtc01(self): - # ------------------------------------------------- - # Intersection of the 3 contractors with CtcQInter - # ------------------------------------------------- - - v = IntervalVector(2, [-30, 30]) - # print('Original box: ', v) - ctc = CtcQInter(self.ctcs, 3) - ctc.contract(v) - # print("After QInter: ", v, '>>>> NOT CORRECT, we get the original box back') - self.assertEqual(v, IntervalVector.empty(v.size())) - - def test_customCtc02(self): - # ------------------------------------------------- - # Intersection of the 3 contractors with CtcCompo - # ------------------------------------------------- - v = IntervalVector(2, [-30, 30]) - ctc = CtcCompo(self.ctcs) - ctc.contract(v) - self.assertEqual(v, IntervalVector.empty(v.size())) - - def test_customCtc02_noReturn(self): - ctc1 = MyCtc_noReturn() - ctc2 = MyCtc_noReturn() - ctc3 = MyCtc_noReturn() - v = IntervalVector(2, [-30, 30]) - ctc = CtcQInter([ctc1, ctc2, ctc3], 3) - ctc.contract(v) - self.assertNotEqual(v, IntervalVector.empty(v.size())) - - - def test_customCtc03(self): - # ------------------------------------------------- - # Intersection of the 3 contractors with CtcCompo - # ------------------------------------------------- - v = IntervalVector(2, [-30, 30]) - ctc = CtcUnion(self.ctcs) - ctc.contract(v) - self.assertEqual(v, IntervalVector.empty(v.size())) - - # - def test_customCtc04(self): - # ------------------------------------------------- - # Intersection of the 3 contractors with CtcCompo - # ------------------------------------------------- - f = Function("x[2]", "(x[0], x[1])") - v = IntervalVector(2, [-30, 30]) - ctc = MyCtc2(CtcUnion(self.ctcs), f) - - ctc.contract(v) - self.assertEqual(v, IntervalVector.empty(v.size())) - - - def test_customCtc05(self): - # ------------------------------------------------- - # Intersection of the 3 contractors with CtcCompo - # ------------------------------------------------- - f = Function("x[2]", "(x[0], x[1])") - v = IntervalVector(2, [-30, 30]) - ctc = CtcInverse(CtcUnion(self.ctcs), f) - - ctc.contract(v) - self.assertEqual(v, IntervalVector.empty(v.size())) - - def test_customCtc06(self): - # ------------------------------------------------- - # Intersection of the 3 contractors with CtcCompo - # ------------------------------------------------- - f = Function("x[2]", "(x[0], x[1])") - v = IntervalVector(2, [-30, 30]) - ctc = CtcCompo([CtcInverse(c, f) for c in self.ctcs]) - - ctc.contract(v) - self.assertEqual(v, IntervalVector.empty(v.size())) - - def test_customCtc07(self): - # ------------------------------------------------- - # Intersection of the 3 contractors with CtcCompo - # ------------------------------------------------- - f = Function("x[2]", "(x[0], x[1])") - v = IntervalVector(2, [-30, 30]) - ctc = CtcInverse(self.ctcs[0], f) - ctc.contract(v) - self.assertEqual(v, IntervalVector.empty(v.size())) - -if __name__ == '__main__': - - unittest.main() diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_Image.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_Image.py deleted file mode 100644 index 13527d63d..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_Image.py +++ /dev/null @@ -1,49 +0,0 @@ -#!/usr/bin/env python -#============================================================================ -# P Y I B E X -# File : test_Image.py -# Author : Benoit Desrochers -# Copyright : Benoit Desrochers -# License : See the LICENSE file -# Created : Dec 28, 2015 -#============================================================================ - -import unittest -import pyibex -from pyibex import * -from pyibex.thickset.thickimage import * -from pyibex.thickset import * -try: - import numpy as np - has_np = True -except ImportError: - print("NUMPY NOT FOUND") - has_np = False - -@unittest.skipUnless(has_np, "Numpy not found") -class TestThickImage(unittest.TestCase): - - def setUp(self): - a = np.zeros((499,499)) - a[100:400, 100:400] = 1 - a = a.cumsum(0).cumsum(1) - self.im = ThickGeoImage(a, a, -5,5,0.02, -0.02) - - - def test_world_to_grid(self): - X0 = IntervalVector([[-7, -6], [0,1]]) - self.assertEqual(self.im.test(X0), MAYBE) - - - - # def test_SIVIA(self): - - - - - # SIVIA(x, ctc, 1) - - -if __name__ == '__main__': - - unittest.main() diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_Interval.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_Interval.py deleted file mode 100755 index 7c06f72c1..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_Interval.py +++ /dev/null @@ -1,493 +0,0 @@ -#!/usr/bin/env python -#============================================================================ -# P Y I B E X -# File : test_Interval.py -# Author : Benoit Desrochers -# Copyright : Benoit Desrochers -# License : See the LICENSE file -# Created : Dec 28, 2014 -#============================================================================ -import unittest -import pyibex -from pyibex import Interval, oo - -try: - import cPickle as pickle # Use cPickle on Python 2.7 -except ImportError: - import pickle - -class TestBoolInterval(unittest.TestCase): - def test_import(self): - pyibex.YES - pyibex.NO - pyibex.MAYBE - pyibex.EMPTY_BOOL - -class TestInterval(unittest.TestCase): - - def setUp(self): - Interval.__str__ = interval_str - self.a = Interval(-2,3) - - def test_Interal2array(self): - self.assertEqual(self.a[0], -2) - self.assertEqual(self.a[1], 3) - # self.assertEqual(self.a[4], np.nan) - - - def test_constructor(self): - c1 = Interval() - c2 = Interval(-2) - c3 = Interval(-2,4) - - - def test_ConstantItv(self): - L = [ "PI", - "TWO_PI", - "HALF_PI", - "ALL_REALS", - "ZERO", - "ONE", - "POS_REALS", - "NEG_REALS"] - for name in L: - a = getattr(Interval, name) - a.set_empty() - self.assertEqual(a, Interval.EMPTY_SET) - self.assertFalse(getattr(Interval, name).is_empty()) - - - def test_constructor_oo(self): - self.assertEqual(oo, float('inf')) - self.assertEqual(Interval(0, oo), Interval.POS_REALS) - self.assertEqual(Interval(-oo, 0), Interval.NEG_REALS) - - # def test_constructor_with_list(self): - # self.assertEqual( Interval([1,2]), Interval(1,2)) - - def test_pickling(self): - Lp = [Interval(0, 5), Interval(0, oo), Interval.EMPTY_SET] - for p in Lp: - data = pickle.dumps(p, 2) # Must use pickle protocol >= 2 - p2 = pickle.loads(data) - self.assertEqual(p, p2) - - - def test_inflate(self): - c1 = Interval(0).inflate(1) - self.assertTrue(c1 == Interval(-1, 1)) - - def test_set_empty(self): - self.a.set_empty() - self.assertTrue(self.a.is_empty()) - - def test_mid(self): - self.assertEqual(self.a.mid(),0.5) - - def test_rad(self): - self.assertEqual(self.a.rad(),2.5) - - def test_diam(self): - self.assertEqual(self.a.diam(),5) - - def test_mig(self): - self.assertEqual(self.a.mig(),0) - - def test_mag(self): - self.assertEqual(self.a.mag(),3) - - def test_is_subset(self): - c = Interval(-2,1) - self.assertFalse(self.a.is_subset(c)) - self.assertTrue(c.is_subset(self.a)) - - def test_is_strict_subset(self): - c = Interval(-2,1) - self.assertTrue(c.is_strict_subset(self.a)) - d = Interval(-1.9,1) - self.assertTrue(d.is_strict_subset(self.a)) - - - def test_is_interior_subset(self): - c = Interval(-2,1) - self.assertFalse(c.is_interior_subset(self.a)) - d = Interval(-1.9,1) - self.assertTrue(d.is_interior_subset(self.a)) - - def test_is_strict_interior_subset(self): - c = Interval(-2,1) - self.assertFalse(c.is_strict_interior_subset(self.a)) - d = Interval(-1.9,1) - self.assertTrue(d.is_strict_interior_subset(self.a)) - - def test_is_superset(self): - c = Interval(1) - self.assertTrue(self.a.is_superset(c)) - - def test_is_strict_superset(self): - c = Interval(1) - self.assertTrue(self.a.is_superset(c)) - - def test_contains(self): - self.assertTrue(self.a.contains(0)) - self.assertTrue( 0 in self.a) - - def test_interior_contains(self): - self.assertTrue(self.a.interior_contains(0)) - self.assertFalse(self.a.interior_contains(-2)) - - - def test_intersects(self): - c1 = Interval(0,10) - self.assertTrue(self.a.intersects(c1)) - - def test_overlaps(self): - c1 = Interval(3) - self.assertTrue(self.a.intersects(c1)) - - def test_is_disjoint(self): - c1 = Interval(-1, 2) - c2 = Interval(2.01,4) - self.assertTrue(c1.is_disjoint(c2)) - - - def test_is_degenerated(self): - c = Interval(-1) - self.assertTrue(c.is_degenerated) - - def test_is_unbounded(self): - c = Interval.POS_REALS - self.assertTrue(c.is_unbounded()) - - def test_is_bisectable(self): - self.assertTrue(self.a.is_bisectable()) - c = Interval(0) - self.assertFalse(c.is_bisectable()) - - def test_rel_distance(self): - c = Interval(-1, 2) - - def test_complementary(self): - - b, c = self.a.complementary() - self.assertEqual(Interval(float('-inf'), -2),b) - self.assertEqual(Interval(3, float('inf')), c) - - - def test_diff(self): - c, d = self.a.diff(Interval(2,4)) - self.assertEqual( Interval(-2, 2), c) - self.assertTrue(d.is_empty()) - - - def test_bisect(self): - a = Interval(3,5) - (c,d) = a.bisect() - - def test_ops(self): - c = Interval(2,3) - d = Interval(1,2) - res = c + d - self.assertEqual(res, Interval(3,5), " test + ops") - res = c - d - self.assertEqual(res, Interval(0,2) , " test - ops") - res = c * d - self.assertEqual(res, Interval(2, 6) , " test * ops") - res = c / d - self.assertEqual(res, Interval(1, 3) , " test / ops") - res = c & d - self.assertEqual(res, Interval(2) , " test & ops") - res = c | d - self.assertEqual(res, Interval(1, 3) , " test | ops") - - res = c - res += Interval(-2, 3) - self.assertEqual(res, Interval(0, 6) , " test += ops") - res = Interval(2,3) - res -= Interval(-2, 3) - self.assertEqual(res, Interval(-1, 5) , " test -= ops") - res = Interval(2,3) - res *= Interval(-2, 3) - self.assertEqual(res, Interval(-6, 9) , " test *= ops") - res = Interval(2,3) - res /= Interval(-2, 3) - self.assertEqual(res, Interval.ALL_REALS , " test /= ops") - - def test_ops_float(self): - c = Interval(2,3) - res = c + 1 - self.assertEqual(res, Interval(3, 4) , " test + 1 ops") - res = 1.0 + c - self.assertEqual(res, Interval(3, 4) , " test + 1 ops") - res = c + 1.0 - self.assertEqual(res, Interval(3, 4) , " test + 1 ops") - - res = c - 1 - self.assertEqual(res, Interval(1, 2) ) - res = 1.0 - c - self.assertEqual(res, Interval(-2, -1)) - res = c - 1.0 - self.assertEqual(res, Interval(1, 2)) - - res = c * 3 - self.assertEqual(res, Interval(6, 9) ) - res = 3.0 * c - self.assertEqual(res, Interval(6, 9) ) - res = c * 3.0 - self.assertEqual(res, Interval(6, 9) ) - - res = c / 2 - self.assertEqual(res, Interval(1, 1.5) ) - res = 2.0 / c - self.assertEqual(res, Interval(2)/3.0 | Interval(1) ) - res = c / 2.0 - self.assertEqual(res, Interval(1, 1.5) ) - - - def test_abs(self): - c = Interval(-2,4) - self.assertEqual(abs(c), Interval(0, 4)) - def test_sqr(self): - c = Interval(-2,4) - self.assertEqual(pyibex.sqr(c), Interval(0,16)) - def test_root(self): - c = Interval(-2,4) - pyibex.root(c,3) - def test_exp(self): - c = Interval(-2,4) - pyibex.exp(c) - def test_log(self): - c = Interval(-2,4) - pyibex.log(c) - def test_cos(self): - c = Interval(-2,4) - pyibex.cos(c) - def test_sin(self): - c = Interval(-2,4) - pyibex.sin(c) - def test_tan(self): - c = Interval(-2,4) - pyibex.tan(c) - def test_acos(self): - c = Interval(-2,4) - pyibex.acos(c) - def test_asin(self): - c = Interval(-2,4) - pyibex.asin(c) - - def test_atan(self): - c = Interval(-2,4) - pyibex.atan(c) - - def test_atan2(self): - c = Interval(-2,4) - pyibex.atan2(c,self.a) - - def test_cosh(self): - c = Interval(-2,4) - pyibex.cosh(c) - - def test_sinh(self): - c = Interval(-2,4) - pyibex.sinh(c) - - def test_tanh(self): - c = Interval(-2,4) - pyibex.tanh(c) - - def test_acosh(self): - c = Interval(-2,4) - pyibex.acosh(c) - - def test_asinh(self): - c = Interval(-2,4) - pyibex.asinh(c) - - def test_atanh(self): - c = Interval(-2,4) - pyibex.atanh(c) - - def test_max(self): - c = Interval(-2,4) - pyibex.max(c,self.a) - - def test_min(self): - c = Interval(-2,4) - pyibex.min(c,self.a) - - def test_sign(self): - c = Interval(-2,4) - pyibex.sign(c) - - def test_chi(self): - c = Interval(-2,4) - b = Interval(-2,4) - pyibex.chi(c,self.a,b) - - def test_integer(self): - c = Interval(-2,4) - pyibex.integer(c) - - def test_pow(self): - a = Interval(2, 3) - self.assertEqual(a**2, Interval(4, 9)) - a**3 - a**2.3 - a**Interval(2,3) - - - def test_bwd_add(self): - c = Interval(-2,4) - b = Interval(4,2) - pyibex.bwd_add(c,self.a,b) - - def test_bwd_sub(self): - c = Interval(-2,4) - b = Interval(4,2) - pyibex.bwd_sub(c,self.a,b) - - def test_bwd_mul(self): - c = Interval(-2,4) - b = Interval(4,2) - pyibex.bwd_mul(c,self.a,b) - - def test_bwd_div(self): - b = Interval(4,2) - c = Interval(-2,4) - pyibex.bwd_div(c,self.a,b) - - def test_bwd_sqr(self): - c = Interval(-2,4) - pyibex.bwd_sqr(c,self.a) - - def test_bwd_sqrt(self): - c = Interval(-2,4) - pyibex.bwd_sqrt(c,self.a) - - def test_bwd_pow(self): - c = Interval(-2,4) - b = Interval(4,2) - pyibex.bwd_pow(c,b, self.a) - - def test_bwd_pow(self): - c = Interval(-2,4) - pyibex.bwd_pow(c, 3, self.a) - - def test_bwd_root(self): - c = Interval(-2,4) - pyibex.bwd_root(c,3, self.a) - - def test_bwd_exp(self): - c = Interval(-2,4) - pyibex.bwd_exp(c,self.a) - - def test_bwd_log(self): - c = Interval(-2,4) - pyibex.bwd_log(c,self.a) - - def test_bwd_cos(self): - c = Interval(-2,4) - pyibex.bwd_cos(c,self.a) - - def test_bwd_sin(self): - c = Interval(-2,4) - pyibex.bwd_sin(c,self.a) - - def test_bwd_tan(self): - c = Interval(-2,4) - pyibex.bwd_tan(c,self.a) - - def test_bwd_acos(self): - c = Interval(-2,4) - pyibex.bwd_acos(c,self.a) - - def test_bwd_asin(self): - c = Interval(-2,4) - pyibex.bwd_asin(c,self.a) - - def test_bwd_atan(self): - c = Interval(-2,4) - pyibex.bwd_atan(c,self.a) - - # def test_bwd_atan2(self): - # c = Interval(-2,4) - # b = Interval(-2,4) - # pyibex.bwd_atan2(c,self.a,b) - - def test_bwd_cosh(self): - c = Interval(-2,4) - pyibex.bwd_cosh(c,self.a) - - def test_bwd_sinh(self): - c = Interval(-2,4) - pyibex.bwd_sinh(c,self.a) - - def test_bwd_tanh(self): - c = Interval(-2,4) - pyibex.bwd_tanh(c,self.a) - - def test_bwd_acosh(self): - c = Interval(-2,4) - pyibex.bwd_acosh(c,self.a) - - def test_bwd_asinh(self): - c = Interval(-2,4) - pyibex.bwd_asinh(c,self.a) - - def test_bwd_atanh(self): - c = Interval(-2,4) - pyibex.bwd_atanh(c,self.a) - - def test_bwd_abs(self): - c = Interval(-2,4) - pyibex.bwd_abs(c,self.a) - - def test_bwd_max(self): - c = Interval(-2,4) - b = Interval(2,10) - pyibex.bwd_max(c,self.a,b) - - def test_bwd_min(self): - c = Interval(-2,4) - b = Interval(2,10) - pyibex.bwd_min(c,self.a,b) - - def test_bwd_sign(self): - c = Interval(-2,4) - pyibex.bwd_sign(c,self.a) - - def test_bwd_chi(self): - c = Interval(-2,4) - b = Interval(4,2) - d = Interval(-2,1) - pyibex.bwd_chi(c,self.a,b,d) - - def test_bwd_floor(self): - x = Interval(0.01,2.99) - pyibex.bwd_floor(Interval(1,2), x) - self.assertEqual(x, Interval(1,2.99)) - - def test_bwd_ceil(self): - x = Interval(0.01,2.99) - pyibex.bwd_ceil(Interval(1,2), x) - self.assertEqual(x, Interval(0.01,2)) - - - -# a regular function -def interval_str(self): - return "[ %f, %f ]" % ( self.lb(), self.ub() ) - -if __name__ == '__main__': - - unittest.main() - - -# c1 = Interval() -# c2 = Interval(-2) -# c3 = Interval(-2,4) - -# c4 = c2 + c3 -# c2 += c2 - -# print(c1.lb(), c1.ub(),c4.lb(), c4.ub(),c2.lb(), c2.ub()) diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_IntervalMatrix.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_IntervalMatrix.py deleted file mode 100644 index e5540a736..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_IntervalMatrix.py +++ /dev/null @@ -1,411 +0,0 @@ -#!/usr/bin/env python -#============================================================================ -# P Y I B E X -# File : test_IntervalVector.py -# Author : Benoit Desrochers -# Copyright : Benoit Desrochers -# License : See the LICENSE file -# Created : Dec 28, 2014 -#============================================================================ - - -import unittest -import pyibex -from pyibex import IntervalMatrix, IntervalVector, Interval - -class TestIntervalVector(unittest.TestCase): - - - def test_constructor(self): - a = IntervalMatrix(3,3, Interval(3,4)) - b = IntervalVector([[1,1], [1,1], [1,1]]) - c = a*b - self.assertEqual(c,IntervalVector(3, [9, 12])) - - - def test_contructor(self): - lst = [Interval(i) for i in range(0,9)] - M = IntervalMatrix(3,3,lst) - # print(M) - - def test_get_set(self): - a = IntervalMatrix(3,3, Interval(3,4)) - self.assertEqual(a[1], IntervalVector(3, Interval(3,4))) - self.assertEqual(a[0][2], Interval(3,4)) - a[0][2] = Interval(0,0) - self.assertEqual(a[0][2], Interval(0,0)) - - def test_shape(self): - a = IntervalMatrix(3,3, Interval(3,4)) - self.assertEqual(a.shape(), (3,3)) - - # print(a[1]) - # print(a[1][1]) - # a[0][2] = Interval(0,0) - # print(a) - # def test_constructor2(self): - # c =IntervalVector(3, [1,2]) - # self.assertEqual(c[0], Interval(1,2)) - - # def test_constructor3(self): - # c = IntervalVector( (Interval(1, 3), Interval(float('inf'), 4))) - # self.assertEqual(c[0], Interval(1, 3)) - # self.assertEqual(c[1], Interval(float('inf'), 4)) - - # def test_gettiem1(self): - # """ - # check if gettiem returns a non constant reference on an Interval - # """ - # c = IntervalVector((1,2,3)) - # b = c[1] - # self.assertEqual(b, Interval(2)) - # b.assign(Interval(-1, 2)) - # self.assertEqual(b, Interval(-1, 2)) - # self.assertEqual(c[1], Interval(-1, 2)) - - # def test_gettiem2(self): - # """ - # check if gettiem returns a non constant reference on an Interval - # """ - # c = IntervalVector((1,2,3)) - # b = c[1] - # self.assertEqual(b, Interval(2)) - # c[1] = Interval(-1, 2) - # self.assertEqual(c[1], Interval(-1, 2)) - # self.assertEqual(b, Interval(-1, 2)) - - - # def test_assignement(self): - # a = IntervalVector(2) - # a[1] = Interval(2,1) - # self.assertEqual(a[1], Interval(2,1)) - - # def test_empty(self): - # a = IntervalVector.empty(3) - # self.assertEqual(a.size(), 3) - # self.assertEqual(len(a), 3) - # self.assertTrue(a.is_empty()) - - # def test_set_empty(self): - # a = IntervalVector(3) - # a.set_empty() - # self.assertTrue(a.is_empty()) - - # def test_clear(self): - # a = IntervalVector(3, Interval(-2,4)) - # a.clear() - # self.assertEqual(a[0], Interval(0)) - - # def test_init(self): - # a = IntervalVector(3, Interval(-2,4)) - # a.init(Interval(2,4)) - # self.assertEqual(a[0], Interval(2,4)) - - # def test_inflate(self): - # a = IntervalVector(3, Interval(-2,4)) - # a.inflate(2) - # b = IntervalVector(3, Interval(-4,6)) - - - # def test_resize(self): - # a = IntervalVector(3, Interval(-2,4)) - # self.assertEqual(a.size(),3) - # a.resize(1000) - # self.assertEqual(a.size(),1000) - - # def test_subvector(self): - # a = IntervalVector(list(range(0,10))) - # self.assertEqual(len(a), 10) - # b = a.subvector(3,6) - # self.assertEqual(len(b), 4) - # b[0] = Interval(-2,3) - # self.assertEqual(b[0], Interval(-2,3)) - - # def test_put(self): - # a = IntervalVector(list(range(0,10))) - # self.assertEqual(len(a), 10) - # a.put(3, IntervalVector([1,2,3])) - # self.assertEqual(a[3], Interval(1)) - # self.assertEqual(a[4], Interval(2)) - # self.assertEqual(a[5], Interval(3)) - # self.assertEqual(a[6], Interval(6)) - - - # def test_size(self): - # a = IntervalVector(list(range(0,10))) - # self.assertTrue(a.size() == 10) - - # def test_lb(self): - # a = IntervalVector(list(range(0,7))).inflate(1) - # test = [-1,0,1,2,3,4,5] - # self.assertEqual(test, a.lb()) - # # self.assertTrue(False) - - # def test_ub(self): - # a = IntervalVector(list(range(0,7))).inflate(1) - # test = [1,2,3,4,5,6,7] - # self.assertEqual(test, a.ub()) - - # def test_mid(self): - # a = IntervalVector(list(range(0,7))).inflate(1) - # test = list(range(0,7)) - # self.assertEqual(test, a.mid()) - - # def test_mig(self): - # a = IntervalVector(list(range(0,7))).inflate(1) - # self.assertEqual([0.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0], a.mig()) - - # def test_mag(self): - # a = IntervalVector(list(range(0,7))).inflate(1) - # self.assertEqual([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0], a.mag()) - - # # def test_is_empty(self): - # # self.assertTrue(False) - - # def test_is_flat(self): - # a = IntervalVector(list(range(1,5))) - # self.assertTrue(a.is_flat()) - - # def test_is_unbounded(self): - # a = IntervalVector(3, Interval(-2,3)) - # self.assertFalse(a.is_unbounded()) - # a[1] = Interval.POS_REALS - # self.assertTrue(a.is_unbounded()) - - # def test_is_subset(self): - # a = IntervalVector(3, Interval(-2,3)) - # b = IntervalVector([-2.0, -1, 2]) - # self.assertTrue(b.is_subset(a)) - - # def test_is_strict_subset(self): - # a = IntervalVector(3, Interval(-2,3)) - # b = IntervalVector([-1.9, -1, 2]).inflate(0.1) - # self.assertTrue(b.is_strict_subset(a)) - - - # def test_is_interior_subset(self): - # a = IntervalVector(3, Interval(-2,3)) - # b = IntervalVector([-1.8, -1, 2]).inflate(0.1) - # self.assertTrue(b.is_interior_subset(a)) - - - # def test_is_strict_interior_subset(self): - # a = IntervalVector(3, Interval(-2,3)) - # b = IntervalVector([-1.8, -1, 2]).inflate(0.1) - # self.assertTrue(b.is_strict_interior_subset(a)) - - - # def test_is_superset(self): - # a = IntervalVector(3, Interval(-2,3)) - # b = IntervalVector([-2.0, -1, 2]) - # self.assertTrue(a.is_superset(b)) - - - # def test_is_strict_superset(self): - # a = IntervalVector(3, Interval(-2,3)) - # b = IntervalVector([-2.0, -1, 2]) - # self.assertTrue(a.is_strict_superset(b)) - - - # def test_contains(self): - # a = IntervalVector(list(range(0,7))).inflate(1) - # self.assertTrue(a.contains(list(range(0,7)))) - - # def test_interior_contains(self): - # a = IntervalVector(list(range(0,7))).inflate(1) - # self.assertTrue(a.contains(list(range(0,7)))) - - # def test_intersects(self): - # a = IntervalVector(list(range(0,7))).inflate(2) - # b = IntervalVector(list(range(0,7))).inflate(1) - # self.assertTrue(a.intersects(b)) - - # def test_overlaps(self): - # a = IntervalVector(2, Interval(-2,4)) - # b = IntervalVector(2, Interval(1,3)) - # self.assertTrue(a.overlaps(b)) - - # def test_is_disjoint(self): - # a = IntervalVector(2, Interval(-2,4)) - # b = IntervalVector(2, Interval(1,3)) - # c = IntervalVector(2, Interval(-4,-2.5)) - # self.assertFalse(a.is_disjoint(b)) - # self.assertTrue(a.is_disjoint(c)) - - - # def test_is_zero(self): - # a = IntervalVector(list(range(0,3))) - # self.assertFalse(a.is_zero()) - # a = IntervalVector([0,0,0]) - # self.assertTrue(a.is_zero()) - - - # def test_is_bisectable(self): - # a = IntervalVector(2, Interval(-2,4)) - # self.assertTrue(a.is_bisectable()) - # b = IntervalVector(2, Interval(1,3)) - # self.assertTrue(b.is_bisectable()) - # b[0] = Interval(0) - # self.assertTrue(b.is_bisectable()) - # b[1] = Interval(0) - # self.assertFalse(b.is_bisectable()) - - - # def test_rad(self): - # a = IntervalVector(list(range(0,3))).inflate(1) - # self.assertEqual(a.rad(),[1,1,1]) - - # def test_diam(self): - # a = IntervalVector(list(range(0,3))).inflate(1) - # self.assertEqual(a.rad(),[1,1,1]) - - - # # def test_sort_indices(self): - # # a = IntervalVector(list(range(0,3))).inflate(1) - # # a.sort_indices() - - # def test_min_max_diam(self): - # a = IntervalVector(list(range(0,3))).inflate(1) - # a[1] = a[1].inflate(0.2) - # a[2] = a[2].inflate(0.5) - # self.assertEqual(a.max_diam(),3) - # self.assertEqual(a.min_diam(),2) - - - - # def test_volume(self): - # a = IntervalVector(list(range(0,3))).inflate(1) - # self.assertEqual(round(a.volume()), 8) - - # def test_perimeter(self): - # a = IntervalVector(list(range(0,3))).inflate(1) - # self.assertEqual(a.perimeter(), 6.0) - - - # def test_rel_distance(self): - # a = IntervalVector(list(range(0,3))).inflate(1) - # b = IntervalVector(list(range(0,3))) - # self.assertEqual(a.rel_distance(b), 0.5) - - # def test_diff(self): - # a = IntervalVector([[-1,1], [0,2], [1, 5]]) - # b = IntervalVector(list(range(0,3))).inflate(1) - # l = a.diff(b) - # self.assertEqual(len(l), 1) - # self.assertEqual(l[0], IntervalVector([[-1,1], [0,2], [3, 5]])) - - # def test_diff_2(self): - # a = IntervalVector([[-1,1], [0,2], [1, 5]]) - # b = IntervalVector(a) - # l = a.diff(b) - # self.assertEqual(len(l), 0) - # #self.assertEqual(l[0], IntervalVector.empty(3)) - - # # self.assertEqual(l[0], IntervalVector([[-1,1], [0,2], [3, 5]])) - - - # def test_complementary(self): - # a = IntervalVector(list(range(0,1))).inflate(1) - # l = a.complementary() - # self.assertEqual(l[0], IntervalVector(1, Interval(float("-inf"), -1))) - # self.assertEqual(l[1], IntervalVector(1, Interval(1, float("inf")))) - - - # def test_bisect(self): - # a = IntervalVector(list(range(0,3))).inflate(1) - # (c,d) = a.bisect(2) - - - # def test_ops_plus(self): - # a = IntervalVector(2, Interval(-1,1)) - # b = IntervalVector(2, Interval(-3, 1)) - # self.assertEqual(a + b, IntervalVector(2, Interval(-4, 2))) - # self.assertEqual(a - b, IntervalVector(2, Interval(-2, 4))) - # self.assertEqual(a & b, IntervalVector(2, Interval(-1,1))) - # self.assertEqual(a | b, IntervalVector(2, Interval(-3,1))) - # self.assertTrue(a != b) - - # def test_ops_2(self): - # a = IntervalVector(2, Interval(-1,1)) - # b = IntervalVector(2, Interval(-3, 1)) - # a += b - # self.assertEqual(a, IntervalVector(2, Interval(-4, 2))) - # a = IntervalVector(2, Interval(-1,1)) - # a -= b - # self.assertEqual(a, IntervalVector(2, Interval(-2, 4))) - # a = IntervalVector(2, Interval(-1,1)) - # a &= b - # self.assertEqual(a, IntervalVector(2, Interval(-1,1))) - # a = IntervalVector(2, Interval(-1,1)) - # a |= b - # self.assertEqual(a, IntervalVector(2, Interval(-3,1))) - - - # def test_ops_3(self): - # a = IntervalVector(2, Interval(-1,1)) - # a += [2,2] - # self.assertEqual(a, IntervalVector(2, Interval(1, 3))) - - # a = IntervalVector(2, Interval(-1,1)) - # a -= [2,2] - # self.assertEqual(a, IntervalVector(2, Interval(-3, -1))) - - # a = IntervalVector(2, Interval(-1,1)) - # a *= Interval(2,3) - # self.assertEqual(a, IntervalVector(2, Interval(-3, 3))) - - # a = IntervalVector(2, Interval(-1,1)) - # a *= 3.0 - # self.assertEqual(a, IntervalVector(2, Interval(-3, 3))) - - - # def test_ops_4(self): - # a = IntervalVector(2, Interval(-1,1)) - # b = IntervalVector(2, Interval(-3, 1)) - # self.assertEqual(a*b, Interval(-6,6)) - # self.assertEqual(3*a, IntervalVector(2, Interval(-3,3))) - # self.assertEqual(a*[2,2], Interval(-4,4)) - # self.assertEqual(Interval(2,3)*a, IntervalVector(2, Interval(-3,3))) - - # def test_ops_5(self): - # a = IntervalVector(2, Interval(-1,1)) - # self.assertEqual(a+[1,1], IntervalVector(2,Interval(0,2))) - # self.assertEqual([1,1] + a, IntervalVector(2, Interval(0,2))) - - # def test_ops_6(self): - # a = IntervalVector(2, Interval(-1,1)) - # self.assertEqual(a-[1,1], IntervalVector(2,Interval(-2,0))) - # self.assertEqual([1,1] - a, IntervalVector(2, Interval(0,2))) - - # def test_abs(self): - # a = IntervalVector(2, Interval(-2,4)) - # self.assertEqual(pyIbex.abs(a), IntervalVector(2, Interval(0,4))) - - # def test_bwd_add(self): - # a = IntervalVector(2, Interval(2,4)) - # b = IntervalVector(2, Interval(-3, 4)) - # c = IntervalVector(2) - # pyIbex.bwd_add(c, a,b) - - # def test_bwd_sub(self): - # a = IntervalVector(2, Interval(2,4)) - # b = IntervalVector(2, Interval(-3, 4)) - # c = IntervalVector(2) - # pyIbex.bwd_sub(c,a,b) - - # def test_bwd_mul(self): - # a = IntervalVector(2, Interval(2,4)) - # b = IntervalVector(2, Interval(-3, 4)) - # c = IntervalVector(2) - # pyIbex.bwd_mul(c, a, b) - - # def test_bwd_mul(self): - # a = IntervalVector(2, Interval(2,4)) - # b = Interval(1,2) - # c = IntervalVector(2) - # pyIbex.bwd_mul(a,b,c) - # pyIbex.bwd_mul(b,a,c) - - -if __name__ == '__main__': - unittest.main() diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_IntervalVector.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_IntervalVector.py deleted file mode 100755 index 087a6b574..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_IntervalVector.py +++ /dev/null @@ -1,450 +0,0 @@ -#!/usr/bin/env python -#============================================================================ -# P Y I B E X -# File : test_IntervalVector.py -# Author : Benoit Desrochers -# Copyright : Benoit Desrochers -# License : See the LICENSE file -# Created : Dec 28, 2014 -#============================================================================ - - -import unittest -import pyibex -from pyibex import IntervalVector, Interval, oo -import math - -try: - import cPickle as pickle # Use cPickle on Python 2.7 -except ImportError: - import pickle - -class TestIntervalVector(unittest.TestCase): - - - def test_constructor(self): - a = IntervalVector(3) - a = IntervalVector(3, Interval(-2, 3)) - self.assertEqual(a[0], Interval(-2, 3)) - a = IntervalVector([1,2,3]) - self.assertEqual(a[0], Interval(1)) - a = IntervalVector((1,2,3)) - self.assertEqual(a[1], Interval(2)) - b = IntervalVector(a) - self.assertEqual(a[1], b[1]) - c = IntervalVector([[1,2], [5,6]]) - self.assertEqual(c[0], Interval(1,2)) - - def test_constructor2(self): - c =IntervalVector(3, [1,2]) - self.assertEqual(c[0], Interval(1,2)) - - def test_constructor3(self): - c = IntervalVector( [Interval(1, 3), Interval(float('-inf'), 4) ] ) - self.assertEqual(c[0], Interval(1, 3)) - self.assertEqual(c[1], Interval(float('-inf'), 4)) - - - def test_constructor33(self): - l = (Interval(1, 3), Interval(float('-inf'), 4) ) - c = IntervalVector( l ) - self.assertEqual(c[0], Interval(1, 3)) - self.assertEqual(c[1], Interval(float('-inf'), 4)) - - - def test_pickling(self): - p = IntervalVector([Interval(0, 5), Interval(0, oo), Interval.EMPTY_SET]) - - data = pickle.dumps(p, 2) # Must use pickle protocol >= 2 - p2 = pickle.loads(data) - self.assertEqual(p, p2) - - - def test_constructor4(self): - with self.assertRaises(ValueError): - x = IntervalVector([list(range(10))]) - - def test_constuctor_lst_itv(self): - x = IntervalVector([[1,2], [2, 4]]) - - - def test_gettiem1(self): - """ - check if gettiem returns a non constant reference on an Interval - """ - c = IntervalVector((1,2,3)) - b = c[1] - self.assertEqual(b, Interval(2)) - b.assign(Interval(-1, 2)) - self.assertEqual(b, Interval(-1, 2)) - self.assertEqual(c[1], Interval(-1, 2)) - - def test_gettiem2(self): - """ - check if gettiem returns a non constant reference on an Interval - """ - c = IntervalVector((1,2,3)) - b = c[1] - self.assertEqual(b, Interval(2)) - c[1] = Interval(-1, 2) - self.assertEqual(c[1], Interval(-1, 2)) - self.assertEqual(b, Interval(-1, 2)) - - - def test_bounds(self): - x = IntervalVector(4) - with self.assertRaises(IndexError): - x[5] - with self.assertRaises(TypeError): - x[-1] - - def test_iterable(self): - x = IntervalVector(list(range(10))) - for b,i in zip(x, range(10)): - self.assertEqual(b,Interval(i)) - - - def test_assignement(self): - a = IntervalVector(2) - a[1] = Interval(2,1) - self.assertEqual(a[1], Interval(2,1)) - - def test_empty(self): - a = IntervalVector.empty(3) - self.assertEqual(a.size(), 3) - self.assertEqual(len(a), 3) - self.assertTrue(a.is_empty()) - - def test_set_empty(self): - a = IntervalVector(3) - a.set_empty() - self.assertTrue(a.is_empty()) - - def test_clear(self): - a = IntervalVector(3, Interval(-2,4)) - a.clear() - self.assertEqual(a[0], Interval(0)) - - def test_init(self): - a = IntervalVector(3, Interval(-2,4)) - a.init(Interval(2,4)) - self.assertEqual(a[0], Interval(2,4)) - - def test_inflate(self): - a = IntervalVector(3, Interval(-2,4)) - a.inflate(2) - b = IntervalVector(3, Interval(-4,6)) - - - def test_resize(self): - a = IntervalVector(3, Interval(-2,4)) - self.assertEqual(a.size(),3) - a.resize(1000) - self.assertEqual(a.size(),1000) - - def test_subvector(self): - a = IntervalVector(list(range(0,10))) - self.assertEqual(len(a), 10) - b = a.subvector(3,6) - self.assertEqual(len(b), 4) - b[0] = Interval(-2,3) - self.assertEqual(b[0], Interval(-2,3)) - - def test_put(self): - a = IntervalVector(list(range(0,10))) - self.assertEqual(len(a), 10) - a.put(3, IntervalVector([1,2,3])) - self.assertEqual(a[3], Interval(1)) - self.assertEqual(a[4], Interval(2)) - self.assertEqual(a[5], Interval(3)) - self.assertEqual(a[6], Interval(6)) - - - def test_size(self): - a = IntervalVector(list(range(0,10))) - self.assertTrue(a.size() == 10) - - def test_lb(self): - a = IntervalVector(list(range(0,7))).inflate(1) - test = [-1,0,1,2,3,4,5] - self.assertEqual(test, a.lb()) - # self.assertTrue(False) - - def test_ub(self): - a = IntervalVector(list(range(0,7))).inflate(1) - test = [1,2,3,4,5,6,7] - self.assertEqual(test, a.ub()) - - def test_mid(self): - a = IntervalVector(list(range(0,7))).inflate(1) - test = list(range(0,7)) - self.assertEqual(test, a.mid()) - - def test_mig(self): - a = IntervalVector(list(range(0,7))).inflate(1) - self.assertEqual([0.0, 0.0, 1.0, 2.0, 3.0, 4.0, 5.0], a.mig()) - - def test_mag(self): - a = IntervalVector(list(range(0,7))).inflate(1) - self.assertEqual([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0], a.mag()) - - # def test_is_empty(self): - # self.assertTrue(False) - - def test_is_flat(self): - a = IntervalVector(list(range(1,5))) - self.assertTrue(a.is_flat()) - - def test_is_unbounded(self): - a = IntervalVector(3, Interval(-2,3)) - self.assertFalse(a.is_unbounded()) - a[1] = Interval.POS_REALS - self.assertTrue(a.is_unbounded()) - - def test_is_subset(self): - a = IntervalVector(3, Interval(-2,3)) - b = IntervalVector([-2.0, -1, 2]) - self.assertTrue(b.is_subset(a)) - - def test_is_strict_subset(self): - a = IntervalVector(3, Interval(-2,3)) - b = IntervalVector([-1.89, -1, 2]).inflate(0.1) - self.assertTrue(b.is_strict_subset(a)) - - - def test_is_interior_subset(self): - a = IntervalVector(3, Interval(-2,3)) - b = IntervalVector([-1.8, -1, 2]).inflate(0.1) - self.assertTrue(b.is_interior_subset(a)) - - - def test_is_strict_interior_subset(self): - a = IntervalVector(3, Interval(-2,3)) - b = IntervalVector([-1.8, -1, 2]).inflate(0.1) - self.assertTrue(b.is_strict_interior_subset(a)) - - - def test_is_superset(self): - a = IntervalVector(3, Interval(-2,3)) - b = IntervalVector([-2.0, -1, 2]) - self.assertTrue(a.is_superset(b)) - - - def test_is_strict_superset(self): - a = IntervalVector(3, Interval(-2,3)) - b = IntervalVector([-2.0, -1, 2]) - self.assertTrue(a.is_strict_superset(b)) - - - def test_contains(self): - a = IntervalVector(list(range(0,7))).inflate(1) - self.assertTrue(a.contains(list(range(0,7)))) - self.assertTrue(list(range(0,7)) in a ) - - def test_interior_contains(self): - a = IntervalVector(list(range(0,7))).inflate(1) - self.assertTrue(a.contains(list(range(0,7)))) - - def test_intersects(self): - a = IntervalVector(list(range(0,7))).inflate(2) - b = IntervalVector(list(range(0,7))).inflate(1) - self.assertTrue(a.intersects(b)) - - def test_overlaps(self): - a = IntervalVector(2, Interval(-2,4)) - b = IntervalVector(2, Interval(1,3)) - self.assertTrue(a.overlaps(b)) - - def test_is_disjoint(self): - a = IntervalVector(2, Interval(-2,4)) - b = IntervalVector(2, Interval(1,3)) - c = IntervalVector(2, Interval(-4,-2.5)) - self.assertFalse(a.is_disjoint(b)) - self.assertTrue(a.is_disjoint(c)) - - - def test_is_zero(self): - a = IntervalVector(list(range(0,3))) - self.assertFalse(a.is_zero()) - a = IntervalVector([0,0,0]) - self.assertTrue(a.is_zero()) - - - def test_is_bisectable(self): - a = IntervalVector(2, Interval(-2,4)) - self.assertTrue(a.is_bisectable()) - b = IntervalVector(2, Interval(1,3)) - self.assertTrue(b.is_bisectable()) - b[0] = Interval(0) - self.assertTrue(b.is_bisectable()) - b[1] = Interval(0) - self.assertFalse(b.is_bisectable()) - - - def test_rad(self): - a = IntervalVector(list(range(0,3))).inflate(1) - self.assertEqual(a.rad(),[1,1,1]) - - def test_diam(self): - a = IntervalVector(list(range(0,3))).inflate(1) - self.assertEqual(a.rad(),[1,1,1]) - - - # def test_sort_indices(self): - # a = IntervalVector(list(range(0,3))).inflate(1) - # a.sort_indices() - - def test_min_max_diam(self): - a = IntervalVector(list(range(0,3))).inflate(1) - a[1] = a[1].inflate(0.2) - a[2] = a[2].inflate(0.5) - self.assertEqual(a.max_diam(),3) - self.assertEqual(a.min_diam(),2) - - - - def test_volume(self): - a = IntervalVector(list(range(0,3))).inflate(1) - self.assertEqual(round(a.volume()), 8) - - def test_perimeter(self): - a = IntervalVector(list(range(0,3))).inflate(1) - self.assertEqual(a.perimeter(), 6.0) - - - def test_rel_distance(self): - a = IntervalVector(list(range(0,3))).inflate(1) - b = IntervalVector(list(range(0,3))) - self.assertEqual(a.rel_distance(b), 0.5) - - def test_diff(self): - a = IntervalVector([[-1,1], [0,2], [1, 5]]) - b = IntervalVector(list(range(0,3))).inflate(1) - l = a.diff(b) - self.assertEqual(len(l), 1) - self.assertEqual(l[0], IntervalVector([[-1,1], [0,2], [3, 5]])) - - def test_diff_2(self): - a = IntervalVector([[-1,1], [0,2], [1, 5]]) - b = IntervalVector(a) - l = a.diff(b) - self.assertEqual(len(l), 0) - #self.assertEqual(l[0], IntervalVector.empty(3)) - - # self.assertEqual(l[0], IntervalVector([[-1,1], [0,2], [3, 5]])) - - - def test_complementary(self): - a = IntervalVector(list(range(0,1))).inflate(1) - l = a.complementary() - self.assertEqual(l[0], IntervalVector(1, Interval(float("-inf"), -1))) - self.assertEqual(l[1], IntervalVector(1, Interval(1, float("inf")))) - - - def test_bisect(self): - a = IntervalVector(list(range(0,3))).inflate(1) - (c,d) = a.bisect(2) - - - def test_ops_plus(self): - a = IntervalVector(2, Interval(-1,1)) - b = IntervalVector(2, Interval(-3, 1)) - self.assertEqual(a + b, IntervalVector(2, Interval(-4, 2))) - self.assertEqual(a - b, IntervalVector(2, Interval(-2, 4))) - self.assertEqual(a & b, IntervalVector(2, Interval(-1,1))) - self.assertEqual(a | b, IntervalVector(2, Interval(-3,1))) - self.assertTrue(a != b) - - def test_ops_2(self): - a = IntervalVector(2, Interval(-1,1)) - b = IntervalVector(2, Interval(-3, 1)) - a += b - self.assertEqual(a, IntervalVector(2, Interval(-4, 2))) - a = IntervalVector(2, Interval(-1,1)) - a -= b - self.assertEqual(a, IntervalVector(2, Interval(-2, 4))) - a = IntervalVector(2, Interval(-1,1)) - a &= b - self.assertEqual(a, IntervalVector(2, Interval(-1,1))) - a = IntervalVector(2, Interval(-1,1)) - a |= b - self.assertEqual(a, IntervalVector(2, Interval(-3,1))) - - - def test_ops_3(self): - a = IntervalVector(2, Interval(-1,1)) - a += [2,2] - self.assertEqual(a, IntervalVector(2, Interval(1, 3))) - - a = IntervalVector(2, Interval(-1,1)) - a -= [2,2] - self.assertEqual(a, IntervalVector(2, Interval(-3, -1))) - - a = IntervalVector(2, Interval(-1,1)) - a *= Interval(2,3) - self.assertEqual(a, IntervalVector(2, Interval(-3, 3))) - - a = IntervalVector(2, Interval(-1,1)) - a *= 3.0 - self.assertEqual(a, IntervalVector(2, Interval(-3, 3))) - - - def test_ops_4(self): - a = IntervalVector(2, Interval(-1,1)) - b = IntervalVector(2, Interval(-3, 1)) - self.assertEqual(a*b, Interval(-6,6)) - self.assertEqual(3*a, IntervalVector(2, Interval(-3,3))) - self.assertEqual(a*[2,2], Interval(-4,4)) - self.assertEqual(Interval(2,3)*a, IntervalVector(2, Interval(-3,3))) - - def test_ops_5(self): - a = IntervalVector(2, Interval(-1,1)) - self.assertEqual(a+[1,1], IntervalVector(2,Interval(0,2))) - self.assertEqual([1,1] + a, IntervalVector(2, Interval(0,2))) - - def test_ops_6(self): - a = IntervalVector(2, Interval(-1,1)) - self.assertEqual(a-[1,1], IntervalVector(2,Interval(-2,0))) - self.assertEqual([1,1] - a, IntervalVector(2, Interval(0,2))) - - def test_abs(self): - a = IntervalVector(2, Interval(-2,4)) - self.assertEqual(pyibex.abs(a), IntervalVector(2, Interval(0,4))) - - def test_bwd_add(self): - a = IntervalVector(2, Interval(2,4)) - b = IntervalVector(2, Interval(-3, 4)) - c = IntervalVector(2) - pyibex.bwd_add(c, a,b) - - def test_bwd_sub(self): - a = IntervalVector(2, Interval(2,4)) - b = IntervalVector(2, Interval(-3, 4)) - c = IntervalVector(2) - pyibex.bwd_sub(c,a,b) - - def test_bwd_mul(self): - a = IntervalVector(2, Interval(2,4)) - b = IntervalVector(2, Interval(-3, 4)) - c = IntervalVector(2) - pyibex.bwd_mul(c, a, b) - - def test_bwd_mul(self): - a = IntervalVector(2, Interval(2,4)) - b = Interval(1,2) - c = IntervalVector(2) - pyibex.bwd_mul(a,b,c) - pyibex.bwd_mul(b,a,c) - - def test_tolist(self): - a = IntervalVector([[1,2], [3, 4], [5, 6]]) - L = a.tolist() - self.assertEqual(L, [1, 2, 3, 4, 5, 6]) - - - def test_width(self): - a = IntervalVector([[1,2], [3, 4], [5, 8]]) - self.assertEqual(a.width(), math.sqrt(11)) - -if __name__ == '__main__': - unittest.main() diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_SepPaving.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_SepPaving.py deleted file mode 100644 index a990013b2..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_SepPaving.py +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env python -#============================================================================ -# P Y I B E X -# File : test_thickPaving.py -# Author : Benoit Desrochers -# Copyright : Benoit Desrochers -# License : See the LICENSE file -# Created : Dec 28, 2015 -#============================================================================ -import unittest -import pyibex -from pyibex import Interval, IntervalVector, LargestFirst, Function, SepFwdBwd -from pyibex.sepvisitor import SepToVibes -from pyibex.paving import SepPaving -import math -from vibes import vibes - - -class TestSepPaving(unittest.TestCase): - - def test_constructor_01(self): - X0 = IntervalVector(2,[-5, 5]); - A = SepPaving(X0); - sep = SepFwdBwd(Function("x", "y", "(x^2+y^2)"), Interval(-1e-10, 4)) - # sep = SepFwdBwd(Function("x", "y", "(x^2+y^2)"), Interval(-1, 4)) - # sep = SepFwdBwd(Function("x", "y", "(x^2+y^2)"), Interval(-1, 4)) - A.Sivia(sep, 0.1) - vibes.beginDrawing() - A.visit(SepToVibes("Titi")) - vibes.endDrawing() - -if __name__ == '__main__': - - unittest.main() diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_Separators.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_Separators.py deleted file mode 100755 index 2e93c91c4..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_Separators.py +++ /dev/null @@ -1,247 +0,0 @@ -#!/usr/bin/env python -#============================================================================ -# P Y I B E X -# File : test_Separators.py -# Author : Benoit Desrochers -# Copyright : Benoit Desrochersss -# License : See the LICENSE file -# Created : Dec 28, 2014 -#============================================================================ - - -import unittest -import pyibex -from pyibex import * -import sys -import math -class TestSeparator(unittest.TestCase): - - def test_SepCtcPair(self): - f = Function("x", "y", "x^2 + y^2 - 25") - ctcIn = CtcFwdBwd(f, CmpOp.GEQ) - ctcOut = CtcFwdBwd(f, CmpOp.LEQ) - sep = SepCtcPair(ctcIn, ctcOut) - self.assertEqual(sep.nb_var, 2) - b0 = IntervalVector([[-10, -6], [-10, 10]]) - b1 = IntervalVector([[-2, 2], [-2, 2]]) - - xin = IntervalVector(b0) - xout = IntervalVector(b0) - sep.separate(xin, xout) - self.assertFalse(xin.is_empty()) - self.assertTrue(xout.is_empty()) - - - xin = IntervalVector(b1) - xout = IntervalVector(b1) - sep.separate(xin, xout) - self.assertFalse(xout.is_empty()) - self.assertTrue(xin.is_empty()) - - def test_SepFwdBwd_CmdOp(self): - f = Function("x", "y", "x^2 + y^2 - 25") - sep = SepFwdBwd(f, CmpOp.LEQ) - b0 = IntervalVector([[-10, -6], [-10, 10]]) - b1 = IntervalVector([[-2, 2], [-2, 2]]) - - xin = IntervalVector(b0) - xout = IntervalVector(b0) - sep.separate(xin, xout) - self.assertFalse(xin.is_empty()) - self.assertTrue(xout.is_empty()) - - - xin = IntervalVector(b1) - xout = IntervalVector(b1) - sep.separate(xin, xout) - self.assertFalse(xout.is_empty()) - self.assertTrue(xin.is_empty()) - - - def test_SepFwdBwd_Interval(self): - f = Function("x", "y", "x^2 + y^2") - sep = SepFwdBwd(f, Interval(0, 16)) - b0 = IntervalVector([[-10, -6], [-10, 10]]) - b1 = IntervalVector([[1, 2], [1, 2]]) - - xin = IntervalVector(b0) - xout = IntervalVector(b0) - sep.separate(xin, xout) - self.assertFalse(xin.is_empty()) - self.assertTrue(xout.is_empty()) - - - xin = IntervalVector(b1) - xout = IntervalVector(b1) - sep.separate(xin, xout) - self.assertFalse(xout.is_empty()) - # print(xin) - self.assertTrue(xin.is_empty()) - - def test_SepFwdBwd_IntervalAsList(self): - f = Function("x", "y", "x^2 + y^2") - sep = SepFwdBwd(f, [0., oo]) - - - def test_SepFwdBwd_IntervalVector(self): - f = Function("x", "y", "(x^2 + y^2, x^2 + y^2)") - sep = SepFwdBwd(f, IntervalVector(2, Interval(0, 16))) - b0 = IntervalVector([[-10, -6], [-10, 10]]) - b1 = IntervalVector([[1, 2], [1, 2]]) - - xin = IntervalVector(b0) - xout = IntervalVector(b0) - sep.separate(xin, xout) - self.assertFalse(xin.is_empty()) - self.assertTrue(xout.is_empty()) - - - xin = IntervalVector(b1) - xout = IntervalVector(b1) - sep.separate(xin, xout) - self.assertFalse(xout.is_empty()) - # print(xin) - self.assertTrue(xin.is_empty()) - - - def test_SepNot(self): - - f = Function("x", "y", "x^2 + y^2 - 25") - sep = SepFwdBwd(f, CmpOp.LEQ) - sepN = SepNot(sep) - del sep # [optionnal] test for memory manadgment - b0 = IntervalVector([[-10, -6], [-10, 10]]) - b1 = IntervalVector([[-2, 2], [-2, 2]]) - - xin = IntervalVector(b0) - xout = IntervalVector(b0) - sepN.separate(xin, xout) - self.assertTrue(xin.is_empty()) - self.assertFalse(xout.is_empty()) - - - xin = IntervalVector(b1) - xout = IntervalVector(b1) - sepN.separate(xin, xout) - self.assertTrue(xout.is_empty()) - self.assertFalse(xin.is_empty()) - - pass - - def test_SepUnionInter(self): - f1 = Function("x", "y", "x^2 + y^2 - 25") - f2 = Function("x", "y", "(x-2)^2 + (y+2)^2 - 25") - f3 = Function("x", "y", "(x+2)^2 + (y-2)^2 - 25") - - sep1 = SepFwdBwd(f1, CmpOp.LEQ) - sep2 = SepFwdBwd(f2, Interval(4, 16)) - sep3 = SepFwdBwd(f3, CmpOp.LEQ) - - sepU = SepUnion([sep1, sep2, sep3]) - sepI = SepInter([sep1, sep2, sep3]) - - # [optionnal] test for memory manadgment - del f1, f2, f3, sep1, sep2, sep3 - - b00 = IntervalVector([[-10, -6], [-10, 10]]) - b01 = IntervalVector(b00) - - b10 = IntervalVector([[-10, -6], [-10, 10]]) - b11 = IntervalVector(b10) - - sepU.separate(b00, b01) - sepI.separate(b10, b11) - - - # def test_SepProj(self): - # f = Function('x', 'y', 'x^2 + y^2 - 4') - # sep = SepFwdBwd(f,CmpOp.LEQ) - # y_init = IntervalVector(1, Interval(1/math.sqrt(2), 0.9)) - # sep2 = SepProj(sep, y_init, 0.1, 10) - # # [optionnal] test for memory manadgment - # del sep, f - # Xin = IntervalVector([[-10,0]]) - # Xout = IntervalVector([[-10,0]]) - # sep2.separate(Xin, Xout) - # print(Xin, Xout) - - - def test_UnionInter_with_array(self): - cx = [3, 7,-3] - cy = [4, 3, 7] - d = IntervalVector([3, 6, 6]).inflate(0.5) - seps = [] - for i,(x,y) in enumerate(zip(cx,cy)): - f = Function('x', 'y', '(x - %f)^2 + (y - %f)^2'%(x,y)) - seps.append(SepFwdBwd(f, sqr(d[i]))) - - sepUnion = SepUnion(seps) - sepInter = SepInter(seps) - del seps - - - Xin = IntervalVector(2, Interval(-10,10)) - Xout = IntervalVector(2, Interval(-10,10)) - sepUnion.separate(Xin, Xout) - # print(Xin, Xout) - - Xin = IntervalVector(2, Interval(-10,10)) - Xout = IntervalVector(2, Interval(-10,10)) - sepInter.separate(Xin, Xout) - - - def test_SepFixPoint(self): - class FakeSep(Sep): - def __init__(self): - Sep.__init__(self, 1) - - def separate(self, x_in, x_out): - # print(x_in, x_out) - xpos = (x_in & x_out) & IntervalVector(1, Interval.POS_REALS) - xneg = (x_in & x_out) & IntervalVector(1, Interval.NEG_REALS) - - x_in &= (IntervalVector(1, Interval.NEG_REALS) | IntervalVector(xpos.mid()) ) #| IntervalVector([0]).inflate(1e-10) - x_out &= (IntervalVector(1, Interval.POS_REALS) | IntervalVector(xneg.mid()) ) #| IntervalVector([0]).inflate(1e-10) - # print(x_in, x_out) - return x_in, x_out - - - sep = SepFixPoint(FakeSep()) - x_in, x_out = IntervalVector(1, [-10, 10]), IntervalVector(1, [-10, 10]) - - sep.separate(x_in, x_out) - self.assertTrue([0] in x_out) - self.assertTrue([0] in x_in) - self.assertTrue((x_in | x_out) == IntervalVector(1, [-10, 10])) - self.assertTrue((x_in & x_out) == IntervalVector(1, [0, 0])) - self.assertTrue(x_out == IntervalVector(1, [0, 10])) - self.assertTrue(x_in == IntervalVector(1, [-10, 0])) - - - def test_sepproj(self): - f = Function('x', 'y', 'z', 'x^2 + y^2 + 2*x*y + z^2 + 3*z*x -3') - sepfb = SepFwdBwd(f, LEQ) - yinit = IntervalVector(1, [1, 2]) - sep = SepProj(sepfb, yinit, 0.01) - - sep = SepProj(sepfb, [1, 2]) - - - def test_SepFixPoint(self): - class WrongSep(Sep): - def __init__(self): - Sep.__init__(self, 1) - - def separate(self, x_in, x_out): - return tuple(x_in) - - sep = SepFixPoint(WrongSep()) - x_in, x_out = IntervalVector(1, [-10, 10]), IntervalVector(1, [-10, 10]) - sep.separate(x_in, x_out) - - - - -if __name__ == '__main__': - - unittest.main() diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_image.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_image.py deleted file mode 100644 index 1dc17386c..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_image.py +++ /dev/null @@ -1,243 +0,0 @@ -#!/usr/bin/env python -#============================================================================ -# P Y I B E X -# File : test_Image.py -# Author : Benoit Desrochers -# Copyright : Benoit Desrochers -# License : See the LICENSE file -# Created : Dec 28, 2015 -#============================================================================ - -import unittest -import pyibex -from pyibex import * -from pyibex.image import * -import sys -try: - import numpy as np - has_np = True -except ImportError: - print("NUMPY NOT FOUND") - has_np = False - - -# Interval.__str__=lambda x: "("+str(x[0])+', '+str(x[1])+")" -# Interval.__repr__=lambda x: "("+x[0]+', '+x[1]+")" -# IntervalVector.__str__=lambda x: "[ "+ ';'.join([b for b in x])+ " ]" -# IntervalVector.__repr__=lambda x: "[ " + ';'.join([str(b) for b in x])+ " ]" -# IntervalVector.__repr__=lambda x: 'titi' - - -class TestGeoMapper(unittest.TestCase): - def setUp(self): - self.mapper = GeoMapper(-5, 5, 10,10, 1, -1) - # print(self.mapper.boundingBox, file=sys.stderr) - def test_boxes(self): - # pass - res = self.mapper.world_to_grid(IntervalVector(2, [-5.0, 5-0.01])) - self.assertEqual(res, [0,9,0,9]) - res = self.mapper.world_to_grid(IntervalVector( [[-5, -4], [-5, 5]])) - self.assertEqual(res, [0,1,0,9]) - - def test_points_upperLeft(self): - # res = self.mapper.world_to_grid(IntervalVector([-5, 5])) - # self.assertEqual(res, [0,0,0,0]) - # res = self.mapper.world_to_grid(IntervalVector([-4, 5])) - # self.assertEqual(res, [-1, -1, -1, -1]) - # res = self.mapper.world_to_grid(IntervalVector([-5, 6])) - # self.assertEqual(res, [-1, -1, -1, -1]) - res = self.mapper.world_to_grid(IntervalVector([-4-0.01, 4+0.01])) - self.assertEqual(res, [0,0,0,0]) - - self.assertEqual(self.mapper.grid_to_world([0, 0, 0, 0]), - IntervalVector([[-5, -4], [4, 5]]) - ) - - -@unittest.skipUnless(has_np, "Numpy not found") -class TestImage(unittest.TestCase): - - def test_world_to_grid(self): - - A = np.zeros((5,10), dtype=np.uint) - im = GeoImage(A,0,0,1,1) - - X = IntervalVector([[1,2], [1,2]]) - # print(X.is_subse t(im.boundingBox)) - self.assertEqual(im.world_to_grid(X), [0,2,0,2]) - X = IntervalVector([[1,2], [1,3]]) - self.assertEqual(im.world_to_grid(X), [0,2,0,3]) - X = IntervalVector([[1,1.1], [1,2.5]]) - self.assertEqual(im.world_to_grid(X), [0,1,0,2]) - - - - def test_II_values(self): - A = np.zeros((5,10), dtype=np.uint) - A[2,5] = 1 - A = A.cumsum(axis=0).cumsum(axis=1) - im = GeoImage(A,0,5,1,-1) - - # self.assertEqual(im.test(IntervalVector([[5.1,5.1], [2,3]])), UNK) - # self.assertEqual(im.test(IntervalVector([[2,3], [1,2]])), OUT) - # self.assertEqual(im.test(IntervalVector([[5,6], [2,4]])), UNK) - - def test_1(self): - - A = np.zeros((5,10), dtype=np.uint) - A[2,5] = 1 - A = A.cumsum(axis=0).cumsum(axis=1) - im = GeoImage(A,0,0,1,0.5) - # for i in range(5): - # for j in range(10): - # print(im.pixelAt(i,j), end=' ') - # print('') - -@unittest.skipUnless(has_np, "Numpy not found") -class TestWorldToGrid(unittest.TestCase): - - def setUp(self): - a = np.zeros((500,500)) - # IMage (x0, y0)=(-5,5) - self.im = GeoImage(a, -5,5,0.02, -0.02) - - def intervalAlmostEqual(self, itv1, itv2 ): - self.assertAlmostEqual(itv1[0], itv2[0]) - self.assertAlmostEqual(itv1[1], itv2[1]) - - def intervalVectorAlmostEqual(self, itv1, itv2): - for i in range(itv1.size()): - self.intervalAlmostEqual(itv1[i], itv2[i]) - - - - - - def test_world_to_grid(self): - """ - 0 1 2 3 4 5 6 7 8 9 - +---+---+---+---+---+---+---+---+---+---+... - 0 | | | | | | | | | | | - +---+---+---+---+---+---+---+---+---+---+... - 1 | | | | | | | | | | | - +---+---+---+---+---+---+---+---+---+---+... - 2 | | | | | | | | | | | - +---+---+---+---+---+---+---+---+---+---+... - 3 | | | | | | | | | | | - +---+---+---+---+---+---+---+---+---+---+... - 4 | | | | | | | | | | | - +---+---+---+---+---+---+---+---+---+---+... - - """ - b = IntervalVector([-5, 5]) - self.assertEqual(self.im.world_to_grid(b), [0,0,0,0]) - - def test_boundingBox(self): - b = self.im.boundingBox - # print(b.ub()[0].hex(), 5.02.hex()) - self.intervalVectorAlmostEqual(self.im.boundingBox, IntervalVector([[-5,5], [-5,5]])) - # self.assertEqual(self.im.boundingBox, IntervalVector([[-5,5.02], [-5.02,5]])) - - # def test_Grid_to_world01(self): - # a = IntervalVector.empty(2) - # L = self.im.world_to_grid(a) - # # self.assertEqual(L, [-1, -1, -1, -1]) - # a = IntervalVector(2, Interval.ALL_REALS) - # L = self.im.world_to_grid(a) - # self.assertEqual(L, [0, 499, 0, 499]) - - # a = IntervalVector([[-6, -5], [-10,-9]]) - # L = self.im.world_to_grid(IntervalVector([[-6, -5], [-10,-9]])) - # print(L) - - # def test_world_to_grid(self): - # X0 = IntervalVector([[-7, -6], [0,1]]) - # self.assertEqual(self.im.test(X0), MAYBE) -@unittest.skipUnless(has_np, "Numpy not found") -class TestCtcRaster(unittest.TestCase): - - def setUp(self): - - # under approximation of the set X - ain = np.zeros((200, 200), dtype=np.int64) - ain[75:125, 50:125] = 1 - ain[25:100, 25:50] = 1 - - # over approximation of the set X - aout = np.zeros((200, 200), dtype=np.int64) - aout[74:126, 49:125] = 1 - aout[24:101, 24:51] = 1 - - img_out = aout.cumsum(0).cumsum(1) - img_in = (1 - ain).cumsum(0).cumsum(1) - - self.ctcOut = CtcRaster(img_out, -5, 5, 0.1, -0.1) - self.ctcIn = CtcRaster(img_in, -5, 5, 0.1, -0.1) - self.sep = SepCtcPair(self.ctcIn, self.ctcOut) - - - def test_ctcOut_01(self): - X = IntervalVector(2, [-oo, oo]) - self.ctcOut.contract(X) - self.assertTrue(IntervalVector([ [-2.6, 7.6], [-7.5, 2.6] ]).is_subset(X)) - - def test_ctcOut_02(self): - X = IntervalVector([ [-2, 0], [-2, 1] ]) - self.ctcOut.contract(X) - self.assertTrue(IntervalVector([ [-2, 0], [-0.1, 1] ]).is_subset(X) ) - - def test_ctcOut_03(self): - X = IntervalVector([ [-4, 2], [1, 2] ]) - self.ctcOut.contract(X) - self.assertEqual(X, IntervalVector([ [-2.6, 2], [1, 2] ]) ) - - def test_ctcOut_04(self): - X = IntervalVector([ [-2.85, -2.18], [2.15, 2.85] ]) - self.ctcOut.contract(X) - self.assertEqual(X, IntervalVector([ [-2.6, -2.18], [2.15, 2.6] ]) ) - - def test_ctcOut_05(self): - X = IntervalVector([ [-2, -1], [3, 4] ]) - self.ctcOut.contract(X) - self.assertTrue(X.is_empty()) - - def test_ctcIn_01(self): - X = IntervalVector([ [-2, -1], [1, 2] ]) - self.ctcIn.contract(X) - self.assertTrue(X.is_empty()) - - def test_ctcIn_02(self): - X = IntervalVector([ [-2, -1], [1, 3.5] ]) - self.ctcIn.contract(X) - self.assertTrue( IntervalVector([ [-2, -1], [2.5, 3.5] ]).is_subset(X) ) - - def test_ctcIn_03(self): - X = IntervalVector([ [-3, -1], [1, 2] ]) - self.ctcIn.contract(X) - self.assertTrue( IntervalVector([ [-3, -2.5], [1, 2] ]).is_subset(X) ) - - def test_border_01(self): - X0 = IntervalVector([ [2.05, 2.15], [-0.08, -0.02] ]) - xin, xout = IntervalVector(X0),IntervalVector(X0) - self.sep.separate(xin, xout) - self.assertEqual(xin, X0) - self.assertEqual(xout, X0) - - def test_border_02(self): - X0 = IntervalVector([ [2.05, 2.15], [-0.08, -0.0] ]) - X = IntervalVector(X0) - self.ctcOut.contract(X0) - self.assertEqual(X, X0) - self.ctcIn.contract(X0) - self.assertEqual(X, X0) - - - - - - - - -if __name__ == '__main__': - - unittest.main() diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_inheritance.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_inheritance.py deleted file mode 100755 index dba3d4d13..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_inheritance.py +++ /dev/null @@ -1,62 +0,0 @@ -#!/usr/bin/env python -#============================================================================ -# P Y I B E X -# File : test_inheritance.py -# Author : Benoit Desrochers -# Copyright : Benoit Desrochers -# License : See the LICENSE file -# Created : Dec 28, 2014 -#============================================================================ - -import unittest -import pyibex -from pyibex import * - -class myCtc(pyibex.Ctc): - def __init__(self, x=0, y=0, R=2): - pyibex.Ctc.__init__(self, 2) - self.f = Function('x', 'y', '(x-%f)^2+(y-%f)^2-%f'%(x,y,R**2)) - self.ctc = CtcFwdBwd(self.f, CmpOp.LEQ) - - def contract(self, box): - # tmp = IntervalVector(box) - self.ctc.contract(box) - # box.assign(tmp) - -class mySep(pyibex.Sep): - def __init__(self, x=0, y=0, R=2): - pyibex.Sep.__init__(self, 2) - self.f = Function('x', 'y', '(x-%f)^2+(y-%f)^2-%f'%(x,y,R**2)) - self.sep = SepFwdBwd(self.f, CmpOp.LEQ) - - def separate(self, xin, xout): - # tmp_in= IntervalVector(xin) - # tmp_out = IntervalVector(xout) - self.sep.separate(xin, xout) - # xin.assign(tmp_in) - # xout.assign(tmp_out) - -class TestInheritance(unittest.TestCase): - - def test_myCtc(self): - ctc1 = myCtc() - ctc2 = myCtc(1,1) - ctc = CtcUnion([ctc1, ctc2]) - x = IntervalVector(2, [-10,10]) - ctc.contract(x) - # SIVIA(x, ctc, 1) - - def test_mySep(self): - - sep1 = mySep() - sep2 = mySep(1,1) - sep = SepUnion([sep1, sep2]) - x = IntervalVector(2, [-10,10]) - xin, xout = map(IntervalVector, [x, x]) - sep.separate(xin, xout) - # SIVIA(x, sep, 1) - - -if __name__ == '__main__': - - unittest.main() diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_polar.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_polar.py deleted file mode 100644 index 3abaaadfe..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_polar.py +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env python -# ============================================================================ -# P Y I B E X -# File : test_polar.py -# Author : Benoit Desrochers -# Copyright : Benoit Desrochers -# License : See the LICENSE file -# Created : Dec 28, 2014 -# ============================================================================ -from pyibex import Interval, IntervalVector -from pyibex.geometry import SepPolarXY -from pyibex import Interval, IntervalVector -import unittest - - -def hex2Itv(lb, ub): - if lb == "NAN" or ub == "NAN": - return Interval.EMPTY_SET - return Interval(float.fromhex(lb), float.fromhex(ub)) - - -class TestPolar(unittest.TestCase): - def test_Polar01(self): - self.assertTrue(True) - - def test_sepPolar(self): - sep = SepPolarXY(Interval(1, 2), Interval(0.1, 2.1)) - - def test_SepPolarXY_01(self): - x = hex2Itv('-0x1.9032ae28d8664p+4', '-0x1.9032ae28d8664p+4') - y = hex2Itv('-0x1.68d6cf2e8c8b8p+0', '-0x1.68d6cf2e8c8b8p+0') - rho = Interval(25.0607, 25.1231) - theta = Interval(-3.14159, -2.79253) - S = SepPolarXY(rho, theta) - xin, xout = IntervalVector([x, y]), IntervalVector([x, y]) - S.separate(xin, xout) - self.assertTrue(xout.is_empty()) - self.assertEqual(xin, IntervalVector([x, y])) - - def test_SepPolarXY_02(self): - rho = hex2Itv('0x1.b9adea897635fp+2', '0x1.c01450efdc9c5p+2') - theta = hex2Itv('-0x1.95b92733b853ep+2', '-0x1.690af69de9cacp+2') - S = SepPolarXY(rho, theta) - X = IntervalVector(2) - X[0] = hex2Itv('0x1.be002da3cfcc6p+2', '0x1.be002da3cfcc6p+2') - X[1] = hex2Itv('-0x1.32b8f5d87284bp-2', '-0x1.32b8f5d87284bp-2') - xin, xout = X.copy(), X.copy() - S.separate(xin, xout) - - self.assertFalse(xin.is_empty() and xout.is_empty()) - - -if __name__ == '__main__': - - unittest.main() diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_polygon.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_polygon.py deleted file mode 100644 index 57c03bd2a..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_polygon.py +++ /dev/null @@ -1,82 +0,0 @@ -#!/usr/bin/env python -#============================================================================ -# P Y I B E X -# File : test_polygon.py -# Author : Benoit Desrochers -# Copyright : Benoit Desrochers -# License : See the LICENSE file -# Created : Dec 28, 2014 -#============================================================================ -from pyibex import Interval, IntervalVector, Function, SepInverse, pySIVIA - -from pyibex.geometry import * - -import unittest - -class TestPolygon(unittest.TestCase): - - def test_CtcSegment01(self): - c = CtcSegment(0,0,10,20); - box = IntervalVector([[-5,50], [-5,50]]); - resbox = IntervalVector([[0,10], [0, 20]]); - - c.contract(box); - self.assertEqual(box , resbox) - - def test_CtcSegment02(self): - c = CtcSegment(0,0,10,20); - box = IntervalVector([[10,50], [20,50]]); - resbox = IntervalVector([[10,10], [20, 20]]); - - c.contract(box); - self.assertEqual(box , resbox) - - def test_contract_degenerate(self): - c = CtcSegment(5, 5, 5, 5); - box = IntervalVector([[-5,50], [-5,50]]); - resbox = IntervalVector([[5, 5], [5, 5]]); - - c.contract(box); - self.assertEqual(box , resbox) - - def test_contract_empty(self): - c = CtcSegment(0,0,10,20); - box = IntervalVector([[-5,-2], [-5,50]]); - resbox = IntervalVector.empty(2); - - c.contract(box); - self.assertEqual(box , resbox) - - - def test_call_with_empty_box(self): - c = CtcSegment(0,0,10,20) - box = IntervalVector(2, Interval.ALL_REALS) - resbox = IntervalVector([[0,10], [0, 20]]); - - c.contract(box); - self.assertEqual(box , resbox) - - -class TestSepPolygon(unittest.TestCase): - def test_SIVIA(self): - # l = [[-1, 1, 0], [-1, -2, 1]] - l = [[-1, -1], [1, -2], [0, 1]] - - - sep = SepPolygon(l) - f = Function('x', 'y', '(2*x-y, 2*y - x)') - finv = Function('x', 'y', '(1/3.0*(2*x+y),1/3.0*(2*y+x))') - # sepInv = SepInverse(sep, f) - # sepTrans = SepTransform(sep, f, finv) - - Xin = IntervalVector(2, Interval(-10, 10)) - Xout = IntervalVector(2, Interval(-10, 10)) - - eps = 0.05 - # sep.separate(Xin, Xout) - pySIVIA(Xin, sep, eps, figureName='Sep', draw_boxes=False, ) - # SIVIA(Xin, sepInv, figureName='SepInv', eps=eps) - # SIVIA(Xin, sepTrans, eps=eps, figureName='sepTransfrom') -if __name__ == '__main__': - - unittest.main() diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_thickBox.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_thickBox.py deleted file mode 100644 index dc969038f..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_thickBox.py +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/env python -#============================================================================ -# P Y I B E X -# File : test_thickBox.py -# Author : Benoit Desrochers -# Copyright : Benoit Desrochers -# License : See the LICENSE file -# Created : Dec 28, 2015 -#============================================================================ -import unittest -import pyibex -from pyibex import Interval, IntervalVector -from pyibex.thickset import ThickInterval, ThickBox -class TestThickInterval(unittest.TestCase): - - def check_thickinterval(self, y, res_lb, res_ub): - self.assertEqual(y.lb(), res_lb) - self.assertEqual(y.ub(), res_ub) - - def check_thickBox(self, y, res_lb, res_ub): - for i in range(y.size): - self.check_thickinterval(y[i], res_lb[i], res_ub[i]) - - def test_constructor_01(self): - a = ThickInterval([1,2], [2,3]) - b = ThickBox(3, a) - self.check_thickBox(b, - [Interval(1,2), Interval(1,2), Interval(1,2)], - [Interval(2,3), Interval(2,3), Interval(2,3)]) - - def test_Assign(self): - a = ThickInterval([1,2], [2,3]) - b = ThickBox(2, a) - b[1] = ThickInterval([-2,0], [10,20]) - self.check_thickBox(b, - [Interval(1,2), Interval(-2,0)], - [Interval(2,3), Interval(10,20)]) - - def test_Init(self): - lb = IntervalVector([1,2,3,4,5]) - ub = IntervalVector([2,3,4,5,6]) - a = ThickBox(lb, ub) - self.check_thickBox(a, [ Interval(i) for i in [1,2,3,4,5]], - [ Interval(i) for i in [2,3,4,5,6]]) - - def test_inner_box01(self): - lb = IntervalVector(2, [1, 3]) - ub = IntervalVector(2, [2, 4]) - a = ThickBox(lb, ub) - X, b = a.inner_box() - self.assertEqual(X, IntervalVector(2, [2,3])) - self.assertEqual(b , [True, True]) - - def test_equal(self): - res = ThickBox(IntervalVector([[-3, -1], [-1,1]]), IntervalVector([[2,4],[3,5]])) - res2 = ThickBox(IntervalVector([[-3, -1], [-1,1]]), IntervalVector([[2,4],[3,5]])) - self.assertTrue( res2 == res) - self.assertEqual( res2 , res) - - def test_inner_box02(self): - lb = IntervalVector([[1, 2], [1,5]]) - ub = IntervalVector([[4,5], [2,7]]) - a = ThickBox(lb, ub) - X, b = a.inner_box() - self.assertEqual(X, IntervalVector([[2,4], [2,5]])) - self.assertEqual(b , [False, True]) - - def test_inner_box03(self): - lb = IntervalVector([[1, 2], [1,2]]) - ub = IntervalVector([[4,5], [3,7]]) - a = ThickBox(lb, ub) - X, b = a.inner_box() - self.assertEqual(X, IntervalVector([[2,4], [2,3]])) - self.assertEqual(b , [False, False]) - - def test_inner_box04(self): - lb = IntervalVector([[-9, 11], [-8,12]]) - ub = IntervalVector([[-9, 11], [-8,12]]) - - a = ThickBox(lb, ub) - X, b = a.inner_box() - self.assertEqual(X, IntervalVector([[-9,11], [-8,12]])) - self.assertEqual(b , [True, True]) - -class TestIntersectThickBox(unittest.TestCase): - def setUp(self): - - self.a = ThickBox( IntervalVector([[-6, -4],[-3, -1]]),IntervalVector([[2,4],[3,5]]) ) - self.b = ThickBox( IntervalVector([[-3, -1], [-1,1]]), IntervalVector([[7,9], [6,8]]) ) - - - def test_intersect_01(self): - res = ThickBox(IntervalVector([[-3, -1], [-1,1]]), IntervalVector([[2,4],[3,5]])) - self.assertEqual(self.a.inter(self.b) , res) - - def test_intersect_02(self): - res = ThickBox(IntervalVector([[-3, -1], [-1,1]]), IntervalVector([[2,4],[3,5]])) - res2 = ThickBox(IntervalVector([[-3, -1], [-1,1]]), IntervalVector([[2,4],[3,5]])) - self.assertEqual( res2 , res) - self.assertEqual( ( self.a & self.b ) , res) - - -if __name__ == '__main__': - - unittest.main() - - # - # def test_constructor_02(self): - # a = ThickInterval(1,2) - # self.check_thickinterval(a, Interval(1), Interval(2)) - # - # def test_constructor_03(self): - # a = ThickInterval(Interval(0, 3), Interval.POS_REALS); - # self.assertEqual(a.lb() , Interval(0, 3)); diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_thickFunction.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_thickFunction.py deleted file mode 100644 index 87acab8f7..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_thickFunction.py +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/bin/env python -#============================================================================ -# P Y I B E X -# File : test_thickFunction.py -# Author : Benoit Desrochers -# Copyright : Benoit Desrochers -# License : See the LICENSE file -# Created : Dec 28, 2015 -#============================================================================ -import unittest -import pyibex -from pyibex import Interval, IntervalVector -from pyibex.thickset import ThickInterval, ThickBox, ThickFunction - -class TestThickInterval(unittest.TestCase): - - def test_thickFunction0(self): - f = ThickFunction(lambda x: 2*x, lambda x: 4*x) - a = IntervalVector( [1,2,3] ) - print( f.eval( a ) ) - - # def test_constructor_02(self): - # a = ThickInterval(1,2) - # self.check_thickinterval(a, Interval(1), Interval(2)) - # - # def test_constructor_03(self): - # a = ThickInterval(Interval(0, 3), Interval.POS_REALS); - # self.assertEqual(a.lb() , Interval(0, 3)); - - if __name__ == '__main__': - - unittest.main() diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_thickInterval.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_thickInterval.py deleted file mode 100644 index 0f14ebf73..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_thickInterval.py +++ /dev/null @@ -1,171 +0,0 @@ -#!/usr/bin/env python -#============================================================================ -# P Y I B E X -# File : test_thickInterval.py -# Author : Benoit Desrochers -# Copyright : Benoit Desrochers -# License : See the LICENSE file -# Created : Dec 28, 2015 -#============================================================================ -import unittest -import pyibex -from pyibex import Interval -from pyibex.thickset import ThickInterval -from pyibex.thickset import MAYBE, MAYBE_IN, MAYBE_OUT, IN, OUT, UNK - -class TestThickInterval(unittest.TestCase): - - def check_thickinterval(self, y, res_lb, res_ub): - self.assertEqual(y.lb(), res_lb) - self.assertEqual(y.ub(), res_ub) - - def test_constructor_01(self): - a = ThickInterval([1,2], [2,3]) - self.check_thickinterval(a, Interval(1,2), Interval(2,3)) - - def test_constructor_02(self): - a = ThickInterval(1,2) - self.check_thickinterval(a, Interval(1), Interval(2)) - - def test_constructor_03(self): - a = ThickInterval(Interval(0, 3), Interval.POS_REALS); - self.assertEqual(a.lb() , Interval(0, 3)); - self.assertEqual(a.ub() , Interval.POS_REALS); - - def test_constructor_04(self): - a = ThickInterval(Interval.NEG_REALS, Interval(-4, 0)); - self.assertEqual(a.lb() , Interval.NEG_REALS); - self.assertEqual(a.ub() , Interval(-4, 0)); - - def test_constructor_05(self): - a = ThickInterval(Interval.NEG_REALS, Interval(-4, 0)); - self.assertEqual(a.lb() , Interval.NEG_REALS); - self.assertEqual(a.ub() , Interval(-4, 0)); - - def test_constructor_06(self): - a = ThickInterval(Interval.ALL_REALS, Interval.ALL_REALS); - self.assertEqual(a.lb() , Interval.ALL_REALS); - self.assertEqual(a.ub() , Interval.ALL_REALS); - - def test_constructor_07(self): - a = ThickInterval(Interval.EMPTY_SET, Interval.EMPTY_SET); - self.assertTrue( a.is_empty() ); - - - def test_invalid_constructor_01(self): - a = ThickInterval(Interval(2,-2)); - self.assertTrue( a.is_empty() ); - - - def test_invalid_constructor_02(self): - a = ThickInterval(Interval(2,3), Interval(1, 2)); - self.assertTrue( a.is_empty() ); - - - def test_invalid_constructor_03(self): - a = ThickInterval(Interval(1,3), Interval(1, 2)); - self.assertTrue( a.is_empty() ); - - - def test_invalid_constructor_04(self): - a = ThickInterval(Interval(1,2), Interval(1, 2)); - self.assertEqual(a.lb(), Interval(1,2)); - self.assertEqual(a.ub(), Interval(1,2)); - - - - def test_invalid_constructor_01(self): - a = ThickInterval(Interval.POS_REALS, Interval.NEG_REALS); - self.assertTrue(a.is_empty() ); - - - - def test_intersect(self): - - a = ThickInterval(Interval(-2, 1), Interval(0, 3)); - b = ThickInterval(Interval(-2, 1), Interval(2, 3)); - c = ThickInterval(Interval(1, 2), Interval(1, 2)); - self.assertTrue( a.intersects( Interval(0, 1) ) == True ); - self.assertTrue( a.intersects( Interval(1,2) ) == False); - self.assertTrue( b.intersects( Interval(1,2) ) == True); - self.assertTrue( c.intersects( Interval.EMPTY_SET) == False); - self.assertTrue( c.intersects( Interval(1,2) ) ==True ); - - self.assertTrue( a.intersects( ThickInterval( Interval(-0.0001, 0.5),Interval(2, 3) ) ) == False ); - self.assertTrue( a.intersects( ThickInterval( Interval(-1, 0), Interval(2, 3) ) ) == True ); - - - def test_is_degenerated(self): - - self.assertTrue( ThickInterval(Interval(-2,-2),Interval(-1,3)).is_degenerated()); - self.assertFalse( ThickInterval(Interval(-2,-2),Interval(-1,3)).is_interval() ); - - self.assertTrue( ThickInterval(Interval(-3,-1),Interval(4,4)).is_degenerated() ); - self.assertFalse( ThickInterval(Interval(-3,-1),Interval(4,4)).is_interval() ); - - self.assertTrue( ThickInterval(Interval(-1,-1),Interval(4,4)).is_degenerated() ); - self.assertTrue( ThickInterval(Interval(-1,-1),Interval(4,4)).is_interval() ); - - - - def test_superset(self): - self.assertEqual( ThickInterval(Interval(-2, 1), Interval(0, 4)).superset(), Interval(-2, 4) ); - # empty set - self.assertEqual( ThickInterval(Interval(-2, 1), Interval(5, 4)).superset(), Interval.EMPTY_SET ); - - # - def test_subset(self): - self.assertEqual( ThickInterval(Interval(-2, 1), Interval(0, 4)).subset(), Interval.EMPTY_SET ); - self.assertEqual( ThickInterval(Interval(-2, 1), Interval(4, 5)).subset(), Interval(1, 4) ); - -class TestIntersectThickInterval(unittest.TestCase): - def setUp(self): - self.a = ThickInterval( Interval(0, 2), Interval(4, 5)); - self.b = ThickInterval( Interval(1,2), Interval(4, 10)); - - def test_intersect_01(self): - res = ThickInterval([1,2], [4, 5]) - self.assertEqual(self.a.inter(self.b) , res) - - def test_intersect_02(self): - res = ThickInterval([1,2], [4, 5]) - self.assertEqual( ( self.a & self.b ) , res) - - -class TestisSubsetThickInterval(unittest.TestCase): - def setUp(self): - self.a = ThickInterval( Interval(0, 2), Interval(4, 5)); - self.b = ThickInterval( Interval(1,2), Interval(4, 10)); - - def test_isSubset_01(self): - res = self.a.is_inside(Interval(-1, 6)) - self.assertEqual(res , IN) - - res = self.a.is_inside(Interval(0, 5)) - self.assertEqual(res , IN) - - - def test_isSubset_02(self): - - res = self.a.is_inside(Interval(-4, -1)) - self.assertEqual(res , OUT) - - def test_isSubset_03(self): - res = self.a.is_inside(Interval(3, 5)) - self.assertEqual(res , MAYBE) - - def test_isSubset_04(self): - res = self.a.is_inside(Interval(1, 5)) - self.assertEqual(res , MAYBE_IN) - - def test_isSubset_05(self): - res = self.a.is_inside(Interval(-1, 1)) - self.assertEqual(res , MAYBE_OUT) - - res = self.a.is_inside(Interval(-1, 0)) - self.assertEqual(res , MAYBE_OUT) - - -if __name__ == '__main__': - - unittest.main() diff --git a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_thickPaving.py b/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_thickPaving.py deleted file mode 100644 index 2a148ffc5..000000000 --- a/src/3rd/pyibex/transfer/pyIbex/pyibex/tests/test_thickPaving.py +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/env python -#============================================================================ -# P Y I B E X -# File : test_thickPaving.py -# Author : Benoit Desrochers -# Copyright : Benoit Desrochers -# License : See the LICENSE file -# Created : Dec 28, 2015 -#============================================================================ -import unittest -import pyibex -from pyibex import Interval, IntervalVector, LargestFirst, Function -from pyibex.thickset import * -import math - - -class TestThickPaving(unittest.TestCase): - - def test_constructor_01(self): - X0 = IntervalVector(2,[-2, 3]); - A = ThickPaving(X0, UNK); - self.assertEqual(A.X0, IntervalVector(2, [-2, 3]) ); - del A - A = ThickPaving(X0, IN); - self.assertEqual(A.X0, X0 ); - - -class TestThickPavingBisection(unittest.TestCase): - def setUp(self): - X0 = IntervalVector(2,[0, 1]); - self.f = lambda x: UNK - self.A = ThickPaving(X0, UNK, LargestFirst(0, 0.5)); - - - def test_eps_05(self): - self.A.Sivia(self.f, 0.5, opInter); - self.assertEqual(self.A.size, 4); - - - def test_eps_025(self): - self.A.Sivia(self.f, 0.25, opInter); - self.assertEqual(self.A.size, 16); - - - def test_eps_0125(self): - self.A.Sivia(self.f, 0.125, opInter); - self.assertEqual(self.A.size, 64); - - def test_eps_1_n(self): - n = 8 - self.A.Sivia(self.f, 1.0/math.pow(2,n), opInter); - self.assertEqual(self.A.size, math.pow(2,2*n)); - # // SECTION(" test eps = 1/2**n"){ - # // A.Sivia(f, 1.0/std::pow(2,10)); - # // CHECK(A.root.countLeaves() == std::pow(2,10)*std::pow(2,10) ); - # // } - -class TestThickTest(unittest.TestCase): - - def test_ThickfInLambda(self): - flb = lambda x: x + [1., 1.] - fub = lambda x: x + [2., 2.] - test = ThickfIn(flb, fub, IntervalVector(2, [0, 2])) - flb, fub = None, None - P = ThickPaving( IntervalVector(2, [-10,10])+[1,1], test, 0.1, opInter, False) - from vibes import vibes - vibes.beginDrawing() - P.visit(ToVibes("Test")) - vibes.endDrawing() - - def test_ThickfIn(self): - - flb = Function("x1", "x2","( x1 + 1, x2 + 1)") - fub = Function("x1", "x2","( x1 + 2, x2 + 2)") - test = ThickfIn(flb, fub, IntervalVector(2, [0, 2])) - flb, fub = None, None - P = ThickPaving( IntervalVector(2, [-10,10]) , test, 0.5, opInter, False) - from vibes import vibes - vibes.beginDrawing() - P.visit(ToVibes("Test2")) - vibes.endDrawing() - - -class TestThickSetSave(unittest.TestCase): - - def test_ThickfInLambda(self): - # flb = lambda x: x + [1., 1.] - # fub = lambda x: x + [2., 2.] - # flb, fub = None, None - # test = ThickfIn(flb, fub, IntervalVector(2, [0, 2])) - from vibes import vibes - vibes.beginDrawing() - test = ThickDisk(Interval(0),Interval(0), Interval(0,3), Interval(0,4)) - P = ThickPaving( IntervalVector(2, [-10,10])+[1,1], test, 0.1, opInter, False) - P.save("Test.paving") - P2 = ThickPaving("Test.paving") - P2.visit(ToVibes("Test3")) - vibes.endDrawing() - - - # - # TEST_CASE( " THICK DISk"){ - # IntervalVector X0(2,Interval(-5, 5)); - # Interval mx(0); - # Interval my(0); - # Interval Rmin(0, 4); - # Interval Rmax(0, 6); - # ThickDisk t(mx, my, Rmin, Rmax); - # ThickPaving A(X0, UNK); - # A.Sivia(t, 0.5); - # } -if __name__ == '__main__': - - unittest.main()