diff --git a/python/damask/_colormap.py b/python/damask/_colormap.py
index ec4000018..59f3b749d 100644
--- a/python/damask/_colormap.py
+++ b/python/damask/_colormap.py
@@ -10,7 +10,7 @@ import matplotlib.pyplot as plt
from matplotlib import cm
from PIL import Image
-import damask
+from . import util
from . import Table
_eps = 216./24389.
@@ -280,7 +280,7 @@ class Colormap(mpl.colors.ListedColormap):
colors+=[i]+c
out = [{
- 'Creator':f'damask.Colormap v{damask.version}',
+ 'Creator':util.execution_stamp('Colormap'),
'ColorSpace':'RGB',
'Name':colormap.name,
'DefaultMap':True,
@@ -296,7 +296,7 @@ class Colormap(mpl.colors.ListedColormap):
def _export_ASCII(colormap,fhandle=None):
"""Write colormap to ASCII table."""
labels = {'RGBA':4} if colormap.colors.shape[1] == 4 else {'RGB': 3}
- t = Table(colormap.colors,labels,f'Creator: damask.Colormap v{damask.version}')
+ t = Table(colormap.colors,labels,f'Creator: {util.execution_stamp("Colormap")}')
if fhandle is None:
with open(colormap.name.replace(' ','_')+'.txt', 'w') as f:
diff --git a/python/damask/_geom.py b/python/damask/_geom.py
index c4bbbbdef..083e0ec0d 100644
--- a/python/damask/_geom.py
+++ b/python/damask/_geom.py
@@ -1,13 +1,12 @@
import sys
import copy
-from io import StringIO
import multiprocessing
+from io import StringIO
from functools import partial
import numpy as np
from scipy import ndimage,spatial
-from . import version
from . import environment
from . import Rotation
from . import VTK
@@ -83,7 +82,7 @@ class Geom:
"""
if size is not None and autosize:
- raise ValueError('Auto sizing conflicts with explicit size parameter.')
+ raise ValueError('Auto-sizing conflicts with explicit size parameter.')
grid_old = self.get_grid()
dup = self.copy()
@@ -101,67 +100,6 @@ class Geom:
return dup
- def update(self,microstructure=None,size=None,origin=None,autosize=False):
- """
- Update microstructure and size.
-
- Parameters
- ----------
- microstructure : numpy.ndarray, optional
- Microstructure array (3D).
- size : list or numpy.ndarray, optional
- Physical size of the microstructure in meter.
- origin : list or numpy.ndarray, optional
- Physical origin of the microstructure in meter.
- autosize : bool, optional
- Ignore size parameter and rescale according to change of grid points.
-
- """
- grid_old = self.get_grid()
- size_old = self.get_size()
- origin_old = self.get_origin()
- unique_old = self.N_microstructure
- max_old = np.nanmax(self.microstructure)
-
- if size is not None and autosize:
- raise ValueError('Auto sizing conflicts with explicit size parameter.')
-
- self.set_microstructure(microstructure)
- self.set_origin(origin)
-
- if size is not None:
- self.set_size(size)
- elif autosize:
- self.set_size(self.get_grid()/grid_old*self.size)
-
- message = [f'grid a b c: {util.srepr(grid_old," x ")}']
- if np.any(grid_old != self.get_grid()):
- message[-1] = util.delete(message[-1])
- message.append(util.emph(f'grid a b c: {util.srepr(self.get_grid()," x ")}'))
-
- message.append(f'size x y z: {util.srepr(size_old," x ")}')
- if np.any(size_old != self.get_size()):
- message[-1] = util.delete(message[-1])
- message.append(util.emph(f'size x y z: {util.srepr(self.get_size()," x ")}'))
-
- message.append(f'origin x y z: {util.srepr(origin_old," ")}')
- if np.any(origin_old != self.get_origin()):
- message[-1] = util.delete(message[-1])
- message.append(util.emph(f'origin x y z: {util.srepr(self.get_origin()," ")}'))
-
- message.append(f'# microstructures: {unique_old}')
- if unique_old != self.N_microstructure:
- message[-1] = util.delete(message[-1])
- message.append(util.emph(f'# microstructures: {self.N_microstructure}'))
-
- message.append(f'max microstructure: {max_old}')
- if max_old != np.nanmax(self.microstructure):
- message[-1] = util.delete(message[-1])
- message.append(util.emph(f'max microstructure: {np.nanmax(self.microstructure)}'))
-
- return util.return_message(message)
-
-
def diff(self,other):
"""
Report property differences of self relative to other.
@@ -264,10 +202,7 @@ class Geom:
Physical size of the microstructure in meter.
"""
- if size is None:
- grid = np.asarray(self.microstructure.shape)
- self.size = grid/np.max(grid)
- else:
+ if size is not None:
if len(size) != 3 or any(np.array(size) <= 0):
raise ValueError(f'Invalid size {size}')
else:
@@ -348,16 +283,6 @@ class Geom:
return self.comments[:]
- def get_header(self):
- """Return the full header (grid, size, origin, homogenization, comments)."""
- header = [f'{len(self.comments)+4} header'] + self.comments
- header.append('grid a {} b {} c {}'.format(*self.get_grid()))
- header.append('size x {} y {} z {}'.format(*self.get_size()))
- header.append('origin x {} y {} z {}'.format(*self.get_origin()))
- header.append(f'homogenization {self.get_homogenization()}')
- return header
-
-
@staticmethod
def from_file(fname):
"""
@@ -422,31 +347,23 @@ class Geom:
@staticmethod
- def from_vtk(fname):
+ def from_vtr(fname):
"""
- Read a geom from a VTK file.
+ Read a VTK rectilinear grid.
Parameters
----------
- fname : str or file handle
+ fname : str or or pathlib.Path
Geometry file to read.
+ Valid extension is .vtr, it will be appended if not given.
"""
- g = VTK.from_file(fname).geom
- N_cells = g.GetNumberOfCells()
- microstructure = np.zeros(N_cells)
- grid = np.array(g.GetDimensions())-1
- bbox = np.array(g.GetBounds()).reshape(3,2).T
+ v = VTK.from_file(fname if str(fname).endswith('.vtr') else str(fname)+'.vtr')
+ grid = np.array(v.geom.GetDimensions())-1
+ bbox = np.array(v.geom.GetBounds()).reshape(3,2).T
size = bbox[1] - bbox[0]
- celldata = g.GetCellData()
- for a in range(celldata.GetNumberOfArrays()):
- if celldata.GetArrayName(a) == 'microstructure':
- array = celldata.GetArray(a)
- for c in range(N_cells):
- microstructure[c] = array.GetValue(c)
-
- return Geom(microstructure.reshape(grid,order='F'),size,bbox[0])
+ return Geom(v.get('materialpoint').reshape(grid,order='F'),size,bbox[0])
@staticmethod
@@ -495,10 +412,8 @@ class Geom:
else:
microstructure = microstructure.reshape(grid)
- return Geom(microstructure+1,
- size,
- homogenization=1,
- comments=f'geom.py:from_Laguerre_tessellation v{version}',
+ return Geom(microstructure+1,size,homogenization=1,
+ comments=util.execution_stamp('Geom','from_Laguerre_tessellation'),
)
@@ -523,10 +438,8 @@ class Geom:
KDTree = spatial.cKDTree(seeds,boxsize=size) if periodic else spatial.cKDTree(seeds)
devNull,microstructure = KDTree.query(coords)
- return Geom(microstructure.reshape(grid)+1,
- size,
- homogenization=1,
- comments=f'geom.py:from_Voronoi_tessellation v{version}',
+ return Geom(microstructure.reshape(grid)+1,size,homogenization=1,
+ comments=util.execution_stamp('Geom','from_Voronoi_tessellation'),
)
@@ -542,8 +455,13 @@ class Geom:
Compress geometry with 'x of y' and 'a to b'.
"""
- header = self.get_header()
- grid = self.get_grid()
+ header = [f'{len(self.comments)+4} header'] + self.comments
+ header.append('grid a {} b {} c {}'.format(*self.get_grid()))
+ header.append('size x {} y {} z {}'.format(*self.get_size()))
+ header.append('origin x {} y {} z {}'.format(*self.get_origin()))
+ header.append(f'homogenization {self.get_homogenization()}')
+
+ grid = self.get_grid()
if pack is None:
plain = grid.prod()/self.N_microstructure < 250
@@ -574,7 +492,7 @@ class Geom:
reps += 1
else:
if compressType is None:
- f.write('\n'.join(self.get_header())+'\n')
+ f.write('\n'.join(header)+'\n')
elif compressType == '.':
f.write(f'{former}\n')
elif compressType == 'to':
@@ -596,27 +514,28 @@ class Geom:
f.write(f'{reps} of {former}\n')
- def to_vtk(self,fname=None):
+ def to_vtr(self,fname=None):
"""
- Generates vtk file.
+ Generates vtk rectilinear grid.
Parameters
----------
fname : str, optional
- Vtk file to write. If no file is given, a string is returned.
+ Filename to write. If no file is given, a string is returned.
+ Valid extension is .vtr, it will be appended if not given.
"""
v = VTK.from_rectilinearGrid(self.grid,self.size,self.origin)
- v.add(self.microstructure.flatten(order='F'),'microstructure')
+ v.add(self.microstructure.flatten(order='F'),'materialpoint')
if fname:
- v.write(fname)
+ v.write(fname if str(fname).endswith('.vtr') else str(fname)+'.vtr')
else:
sys.stdout.write(v.__repr__())
- def show(self):
- """Show raw content (as in file)."""
+ def as_ASCII(self):
+ """Format geometry as human-readable ASCII."""
f = StringIO()
self.to_file(f)
f.seek(0)
@@ -664,7 +583,7 @@ class Geom:
coords_rot = R.broadcast_to(tuple(self.grid))@coords
with np.errstate(over='ignore',under='ignore'):
- mask = np.where(np.sum(np.abs(coords_rot/r)**(2.0**exponent),axis=-1) <= 1.0,False,True)
+ mask = np.where(np.linalg.norm(coords_rot/r,2.0**exponent,axis=-1) <= 1.0,False,True)
if periodic: # translate back to center
mask = np.roll(mask,((c-np.ones(3)*.5)*self.grid).astype(int),(0,1,2))
@@ -673,7 +592,7 @@ class Geom:
ms = np.ma.MaskedArray(fill_,np.logical_not(mask) if inverse else mask)
return self.duplicate(ms,
- comments=self.get_comments()+[f'geom.py:add_primitive v{version}'],
+ comments=self.get_comments()+[util.execution_stamp('Geom','add_primitive')],
)
@@ -691,9 +610,7 @@ class Geom:
"""
valid = {'x','y','z'}
- if not all(isinstance(d, str) for d in directions):
- raise TypeError('Directions are not of type str.')
- elif not set(directions).issubset(valid):
+ if not set(directions).issubset(valid):
raise ValueError(f'Invalid direction {set(directions).difference(valid)} specified.')
limits = [None,None] if reflect else [-2,0]
@@ -707,7 +624,7 @@ class Geom:
ms = np.concatenate([ms,ms[limits[0]:limits[1]:-1,:,:]],0)
return self.duplicate(ms,
- comments=self.get_comments()+[f'geom.py:mirror {set(directions)} v{version}'],
+ comments=self.get_comments()+[util.execution_stamp('Geom','mirror')],
autosize=True)
@@ -739,11 +656,11 @@ class Geom:
ms = ms[limits[0]:limits[1]:-1,:,:]
return self.duplicate(ms,
- comments=self.get_comments()+[f'geom.py:flip {set(directions)} v{version}'],
+ comments=self.get_comments()+[util.execution_stamp('Geom','flip')],
)
- def scale(self,grid):
+ def scale(self,grid,periodic=True):
"""
Scale microstructure to new grid.
@@ -751,6 +668,8 @@ class Geom:
----------
grid : numpy.ndarray of shape (3)
Number of grid points in x,y,z direction.
+ periodic : Boolean, optional
+ Assume geometry to be periodic. Defaults to True.
"""
return self.duplicate(ndimage.interpolation.zoom(
@@ -758,14 +677,14 @@ class Geom:
grid/self.get_grid(),
output=self.microstructure.dtype,
order=0,
- mode='nearest',
+ mode=('wrap' if periodic else 'nearest'),
prefilter=False
),
- comments=self.get_comments()+[f'geom.py:scale {grid} v{version}'],
+ comments=self.get_comments()+[util.execution_stamp('Geom','scale')],
)
- def clean(self,stencil=3,mode='nearest',selection=None):
+ def clean(self,stencil=3,selection=None,periodic=True):
"""
Smooth microstructure by selecting most frequent index within given stencil at each location.
@@ -773,11 +692,10 @@ class Geom:
----------
stencil : int, optional
Size of smoothing stencil.
- mode : string, optional
- The mode parameter determines how the input array is extended beyond its boundaries.
- Default is 'nearest'. See scipy.ndimage.generic_filter for all options.
selection : list, optional
Field values that can be altered. Defaults to all.
+ periodic : Boolean, optional
+ Assume geometry to be periodic. Defaults to True.
"""
def mostFrequent(arr,selection=None):
@@ -792,10 +710,10 @@ class Geom:
self.microstructure,
mostFrequent,
size=(stencil if selection is None else stencil//2*2+1,)*3,
- mode=mode,
+ mode=('wrap' if periodic else 'nearest'),
extra_keywords=dict(selection=selection),
).astype(self.microstructure.dtype),
- comments=self.get_comments()+[f'geom.py:clean {stencil} {mode} v{version}'],
+ comments=self.get_comments()+[util.execution_stamp('Geom','clean')],
)
@@ -806,7 +724,7 @@ class Geom:
renumbered = np.where(self.microstructure == oldID, i+1, renumbered)
return self.duplicate(renumbered,
- comments=self.get_comments()+[f'geom.py:renumber v{version}'],
+ comments=self.get_comments()+[util.execution_stamp('Geom','renumber')],
)
@@ -843,7 +761,7 @@ class Geom:
return self.duplicate(microstructure_in,
origin=origin,
- comments=self.get_comments()+[f'geom.py:rotate {R.as_quaternion()} v{version}'],
+ comments=self.get_comments()+[util.execution_stamp('Geom','rotate')],
autosize=True,
)
@@ -870,7 +788,7 @@ class Geom:
np.nanmax(self.microstructure)+1 if fill is None else fill,
dtype)
- LL = np.clip( offset, 0,np.minimum(self.grid, grid+offset)) # noqa
+ LL = np.clip( offset, 0,np.minimum(self.grid, grid+offset))
UR = np.clip( offset+grid, 0,np.minimum(self.grid, grid+offset))
ll = np.clip(-offset, 0,np.minimum( grid,self.grid-offset))
ur = np.clip(-offset+self.grid,0,np.minimum( grid,self.grid-offset))
@@ -879,7 +797,7 @@ class Geom:
return self.duplicate(canvas,
origin=self.origin+offset*self.size/self.grid,
- comments=self.get_comments()+[f'geom.py:canvas {grid} {offset} {fill} v{version}'],
+ comments=self.get_comments()+[util.execution_stamp('Geom','canvas')],
autosize=True,
)
@@ -901,7 +819,7 @@ class Geom:
substituted[self.microstructure==from_ms] = to_ms
return self.duplicate(substituted,
- comments=self.get_comments()+[f'geom.py:substitute v{version}'],
+ comments=self.get_comments()+[util.execution_stamp('Geom','substitute')],
)
@@ -948,5 +866,5 @@ class Geom:
microstructure = np.ma.MaskedArray(self.microstructure + offset_, np.logical_not(mask))
return self.duplicate(microstructure,
- comments=self.get_comments()+[f'geom.py:vicinity_offset {vicinity} v{version}'],
+ comments=self.get_comments()+[util.execution_stamp('Geom','vicinity_offset')],
)
diff --git a/python/damask/_vtk.py b/python/damask/_vtk.py
index 00aa2f4e9..15a571f4f 100644
--- a/python/damask/_vtk.py
+++ b/python/damask/_vtk.py
@@ -6,8 +6,10 @@ import numpy as np
import vtk
from vtk.util.numpy_support import numpy_to_vtk as np_to_vtk
from vtk.util.numpy_support import numpy_to_vtkIdTypeArray as np_to_vtkIdTypeArray
+from vtk.util.numpy_support import vtk_to_numpy as vtk_to_np
-import damask
+from . import util
+from . import environment
from . import Table
@@ -204,7 +206,18 @@ class VTK:
# Check https://blog.kitware.com/ghost-and-blanking-visibility-changes/ for missing data
# Needs support for pd.DataFrame and/or table
def add(self,data,label=None):
- """Add data to either cells or points."""
+ """
+ Add data to either cells or points.
+
+ Parameters
+ ----------
+ data : numpy.ndarray
+ Data to add. First dimension need to match either
+ number of cells or number of points
+ label : str
+ Data label.
+
+ """
N_points = self.geom.GetNumberOfPoints()
N_cells = self.geom.GetNumberOfCells()
@@ -232,10 +245,77 @@ class VTK:
raise TypeError
+ def get(self,label):
+ """
+ Get either cell or point data.
+
+ Cell data takes precedence over point data, i.e. this
+ function assumes that labels are unique among cell and
+ point data.
+
+ Parameters
+ ----------
+ label : str
+ Data label.
+
+ """
+ celldata = self.geom.GetCellData()
+ for a in range(celldata.GetNumberOfArrays()):
+ if celldata.GetArrayName(a) == label:
+ return vtk_to_np(celldata.GetArray(a))
+
+ pointdata = self.geom.GetPointData()
+ for a in range(celldata.GetNumberOfArrays()):
+ if pointdata.GetArrayName(a) == label:
+ return vtk_to_np(pointdata.GetArray(a))
+
+ raise ValueError(f'array "{label}" not found')
+
+
+ def get_comments(self):
+ """Return the comments."""
+ fielddata = self.geom.GetFieldData()
+ for a in range(fielddata.GetNumberOfArrays()):
+ if fielddata.GetArrayName(a) == 'comments':
+ comments = fielddata.GetAbstractArray(a)
+ return [comments.GetValue(i) for i in range(comments.GetNumberOfValues())]
+ return []
+
+
+ def set_comments(self,comments):
+ """
+ Set Comments.
+
+ Parameters
+ ----------
+ comments : str or list of str
+ Comments.
+
+ """
+ s = vtk.vtkStringArray()
+ s.SetName('comments')
+ for c in [comments] if isinstance(comments,str) else comments:
+ s.InsertNextValue(c)
+ self.geom.GetFieldData().AddArray(s)
+
+
+ def add_comments(self,comments):
+ """
+ Add Comments.
+
+ Parameters
+ ----------
+ comments : str or list of str
+ Comments to add.
+
+ """
+ self.set_comments(self.get_comments + ([comments] if isinstance(comments,str) else comments))
+
+
def __repr__(self):
"""ASCII representation of the VTK data."""
writer = vtk.vtkDataSetWriter()
- writer.SetHeader(f'# damask.VTK v{damask.version}')
+ writer.SetHeader(f'# {util.execution_stamp("VTK")}')
writer.WriteToOutputStringOn()
writer.SetInputData(self.geom)
writer.Write()
@@ -261,7 +341,7 @@ class VTK:
ren.AddActor(actor)
ren.SetBackground(0.2,0.2,0.2)
- window.SetSize(damask.environment.screen_size[0],damask.environment.screen_size[1])
+ window.SetSize(environment.screen_size[0],environment.screen_size[1])
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(window)
diff --git a/python/damask/solver/_marc.py b/python/damask/solver/_marc.py
index 8e96f1b90..12e36f7ed 100644
--- a/python/damask/solver/_marc.py
+++ b/python/damask/solver/_marc.py
@@ -3,12 +3,12 @@ import shlex
import string
from pathlib import Path
-import damask
+from .. import environment
class Marc:
"""Wrapper to run DAMASK with MSCMarc."""
- def __init__(self,version=damask.environment.options['MARC_VERSION']):
+ def __init__(self,version=environment.options['MARC_VERSION']):
"""
Create a Marc solver object.
@@ -24,7 +24,7 @@ class Marc:
@property
def library_path(self):
- path_MSC = damask.environment.options['MSC_ROOT']
+ path_MSC = environment.options['MSC_ROOT']
path_lib = Path(f'{path_MSC}/mentat{self.version}/shlib/linux64')
return path_lib if path_lib.is_dir() else None
@@ -33,7 +33,7 @@ class Marc:
@property
def tools_path(self):
- path_MSC = damask.environment.options['MSC_ROOT']
+ path_MSC = environment.options['MSC_ROOT']
path_tools = Path(f'{path_MSC}/marc{self.version}/tools')
return path_tools if path_tools.is_dir() else None
@@ -49,7 +49,7 @@ class Marc:
):
- usersub = damask.environment.root_dir/'src/DAMASK_marc'
+ usersub = environment.root_dir/'src/DAMASK_marc'
usersub = usersub.parent/(usersub.name + ('.f90' if compile else '.marc'))
if not usersub.is_file():
raise FileNotFoundError("DAMASK4Marc ({}) '{}' not found".format(('source' if compile else 'binary'),usersub))
diff --git a/python/damask/util.py b/python/damask/util.py
index 733fd0010..a04ee47de 100644
--- a/python/damask/util.py
+++ b/python/damask/util.py
@@ -9,6 +9,8 @@ from optparse import Option
import numpy as np
+from . import version
+
# limit visibility
__all__=[
'srepr',
@@ -20,6 +22,7 @@ __all__=[
'scale_to_coprime',
'return_message',
'extendableOption',
+ 'execution_stamp'
]
####################################################################################################
@@ -175,6 +178,13 @@ def scale_to_coprime(v):
return m
+def execution_stamp(class_name,function_name=None):
+ """Timestamp the execution of a (function within a) class."""
+ now = datetime.datetime.now().astimezone().strftime('%Y-%m-%d %H:%M:%S%z')
+ _function_name = '' if function_name is None else f'.{function_name}'
+ return f'damask.{class_name}{_function_name} v{version} ({now})'
+
+
####################################################################################################
# Classes
####################################################################################################
diff --git a/python/tests/conftest.py b/python/tests/conftest.py
index 87aa9a363..9c58eedd9 100644
--- a/python/tests/conftest.py
+++ b/python/tests/conftest.py
@@ -1,11 +1,38 @@
from pathlib import Path
-import numpy as np
+import datetime
+import numpy as np
import pytest
-# Use to monkeypatch damask.version (for comparsion to reference files that contain version information)
-def pytest_configure():
- pytest.dummy_version = '99.99.99-9999-pytest'
+import damask
+
+
+patched_version = '99.99.99-9999-pytest'
+@pytest.fixture
+def patch_damask_version(monkeypatch):
+ """Set damask.version for reproducible tests results."""
+ monkeypatch.setattr(damask, 'version', patched_version)
+
+
+patched_date = datetime.datetime(2019, 11, 2, 11, 58, 0)
+@pytest.fixture
+def patch_datetime_now(monkeypatch):
+ """Set datetime.datetime.now for reproducible tests results."""
+ class mydatetime:
+ @classmethod
+ def now(cls):
+ return patched_date
+
+ monkeypatch.setattr(datetime, 'datetime', mydatetime)
+
+@pytest.fixture
+def execution_stamp(monkeypatch):
+ """Set damask.util.execution_stamp for reproducible tests results."""
+ def execution_stamp(class_name,function_name=None):
+ _function_name = '' if function_name is None else f'.{function_name}'
+ return f'damask.{class_name}{_function_name} v{patched_version} ({patched_date})'
+
+ monkeypatch.setattr(damask.util, 'execution_stamp', execution_stamp)
def pytest_addoption(parser):
diff --git a/python/tests/reference/Colormap/binary.json b/python/tests/reference/Colormap/binary.json
index c71d3649b..b8b85f80f 100644
--- a/python/tests/reference/Colormap/binary.json
+++ b/python/tests/reference/Colormap/binary.json
@@ -1,6 +1,6 @@
[
{
- "Creator": "damask.Colormap v99.99.99-9999-pytest",
+ "Creator": "damask.Colormap v99.99.99-9999-pytest (2019-11-02 11:58:00)",
"ColorSpace": "RGB",
"Name": "binary",
"DefaultMap": true,
diff --git a/python/tests/reference/Colormap/binary.txt b/python/tests/reference/Colormap/binary.txt
index 976c0202a..ca1d2401f 100644
--- a/python/tests/reference/Colormap/binary.txt
+++ b/python/tests/reference/Colormap/binary.txt
@@ -1,4 +1,4 @@
-# Creator: damask.Colormap v99.99.99-9999-pytest
+# Creator: damask.Colormap v99.99.99-9999-pytest (2019-11-02 11:58:00)
1_RGBA 2_RGBA 3_RGBA 4_RGBA
1.0 1.0 1.0 1.0
0.996078431372549 0.996078431372549 0.996078431372549 1.0
diff --git a/python/tests/reference/Geom/clean_1_1+2+3_False.vtr b/python/tests/reference/Geom/clean_1_1+2+3_False.vtr
new file mode 100644
index 000000000..d8a3d4169
--- /dev/null
+++ b/python/tests/reference/Geom/clean_1_1+2+3_False.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAABQAAYwAAAA==eF7t0scBgkAAAEHBgBEwgDmBsf8GfTANCN/bzzSwUa8pCrYyZp8DDjliwjEnnHLGORdMmTHnkiuuuWHBklvuuOeBR5545oVX3nhnxZoPPvnimx9+GQc7GT5sqvjvhz+ZtAcJ
+
+
+
+
+ AQAAAACAAABIAAAAOgAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2D3IeNxx9YfV6DiN+22x9tFGsbchco/sAMA/fQl6g==
+
+
+ AQAAAACAAAAwAAAAKwAAAA==eF5jYICAvrdbF3w/tsEOQh+wC30iUFisdRLKv2D3MeNxx9YfV+wAD5wZgw==
+
+
+ AQAAAACAAAAoAAAAIwAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2AHAFVBE/w=
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_1_1+2+3_True.vtr b/python/tests/reference/Geom/clean_1_1+2+3_True.vtr
new file mode 100644
index 000000000..d8a3d4169
--- /dev/null
+++ b/python/tests/reference/Geom/clean_1_1+2+3_True.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAABQAAYwAAAA==eF7t0scBgkAAAEHBgBEwgDmBsf8GfTANCN/bzzSwUa8pCrYyZp8DDjliwjEnnHLGORdMmTHnkiuuuWHBklvuuOeBR5545oVX3nhnxZoPPvnimx9+GQc7GT5sqvjvhz+ZtAcJ
+
+
+
+
+ AQAAAACAAABIAAAAOgAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2D3IeNxx9YfV6DiN+22x9tFGsbchco/sAMA/fQl6g==
+
+
+ AQAAAACAAAAwAAAAKwAAAA==eF5jYICAvrdbF3w/tsEOQh+wC30iUFisdRLKv2D3MeNxx9YfV+wAD5wZgw==
+
+
+ AQAAAACAAAAoAAAAIwAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2AHAFVBE/w=
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_1_1_False.vtr b/python/tests/reference/Geom/clean_1_1_False.vtr
new file mode 100644
index 000000000..d8a3d4169
--- /dev/null
+++ b/python/tests/reference/Geom/clean_1_1_False.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAABQAAYwAAAA==eF7t0scBgkAAAEHBgBEwgDmBsf8GfTANCN/bzzSwUa8pCrYyZp8DDjliwjEnnHLGORdMmTHnkiuuuWHBklvuuOeBR5545oVX3nhnxZoPPvnimx9+GQc7GT5sqvjvhz+ZtAcJ
+
+
+
+
+ AQAAAACAAABIAAAAOgAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2D3IeNxx9YfV6DiN+22x9tFGsbchco/sAMA/fQl6g==
+
+
+ AQAAAACAAAAwAAAAKwAAAA==eF5jYICAvrdbF3w/tsEOQh+wC30iUFisdRLKv2D3MeNxx9YfV+wAD5wZgw==
+
+
+ AQAAAACAAAAoAAAAIwAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2AHAFVBE/w=
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_1_1_True.vtr b/python/tests/reference/Geom/clean_1_1_True.vtr
new file mode 100644
index 000000000..d8a3d4169
--- /dev/null
+++ b/python/tests/reference/Geom/clean_1_1_True.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAABQAAYwAAAA==eF7t0scBgkAAAEHBgBEwgDmBsf8GfTANCN/bzzSwUa8pCrYyZp8DDjliwjEnnHLGORdMmTHnkiuuuWHBklvuuOeBR5545oVX3nhnxZoPPvnimx9+GQc7GT5sqvjvhz+ZtAcJ
+
+
+
+
+ AQAAAACAAABIAAAAOgAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2D3IeNxx9YfV6DiN+22x9tFGsbchco/sAMA/fQl6g==
+
+
+ AQAAAACAAAAwAAAAKwAAAA==eF5jYICAvrdbF3w/tsEOQh+wC30iUFisdRLKv2D3MeNxx9YfV+wAD5wZgw==
+
+
+ AQAAAACAAAAoAAAAIwAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2AHAFVBE/w=
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_1_None_False.vtr b/python/tests/reference/Geom/clean_1_None_False.vtr
new file mode 100644
index 000000000..d8a3d4169
--- /dev/null
+++ b/python/tests/reference/Geom/clean_1_None_False.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAABQAAYwAAAA==eF7t0scBgkAAAEHBgBEwgDmBsf8GfTANCN/bzzSwUa8pCrYyZp8DDjliwjEnnHLGORdMmTHnkiuuuWHBklvuuOeBR5545oVX3nhnxZoPPvnimx9+GQc7GT5sqvjvhz+ZtAcJ
+
+
+
+
+ AQAAAACAAABIAAAAOgAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2D3IeNxx9YfV6DiN+22x9tFGsbchco/sAMA/fQl6g==
+
+
+ AQAAAACAAAAwAAAAKwAAAA==eF5jYICAvrdbF3w/tsEOQh+wC30iUFisdRLKv2D3MeNxx9YfV+wAD5wZgw==
+
+
+ AQAAAACAAAAoAAAAIwAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2AHAFVBE/w=
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_1_None_True.vtr b/python/tests/reference/Geom/clean_1_None_True.vtr
new file mode 100644
index 000000000..d8a3d4169
--- /dev/null
+++ b/python/tests/reference/Geom/clean_1_None_True.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAABQAAYwAAAA==eF7t0scBgkAAAEHBgBEwgDmBsf8GfTANCN/bzzSwUa8pCrYyZp8DDjliwjEnnHLGORdMmTHnkiuuuWHBklvuuOeBR5545oVX3nhnxZoPPvnimx9+GQc7GT5sqvjvhz+ZtAcJ
+
+
+
+
+ AQAAAACAAABIAAAAOgAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2D3IeNxx9YfV6DiN+22x9tFGsbchco/sAMA/fQl6g==
+
+
+ AQAAAACAAAAwAAAAKwAAAA==eF5jYICAvrdbF3w/tsEOQh+wC30iUFisdRLKv2D3MeNxx9YfV+wAD5wZgw==
+
+
+ AQAAAACAAAAoAAAAIwAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2AHAFVBE/w=
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_2_1+2+3_False.vtr b/python/tests/reference/Geom/clean_2_1+2+3_False.vtr
new file mode 100644
index 000000000..5400fcdb6
--- /dev/null
+++ b/python/tests/reference/Geom/clean_2_1+2+3_False.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAABQAAZwAAAA==eF7t0rcOgmAAhVEgNmyo2AuoWN//BR04EwsJcfzvcvabL47qxcFOJg177HPAIUdMOeaEU844Z8YFl1wx55obbrnjngceeeKZFxYseeWNd1Z88MkX3/zwy+Z/wf8YOqzX1uEPlgwHCA==
+
+
+
+
+ AQAAAACAAABIAAAAOgAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2D3IeNxx9YfV6DiN+22x9tFGsbchco/sAMA/fQl6g==
+
+
+ AQAAAACAAAAwAAAAKwAAAA==eF5jYICAvrdbF3w/tsEOQh+wC30iUFisdRLKv2D3MeNxx9YfV+wAD5wZgw==
+
+
+ AQAAAACAAAAoAAAAIwAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2AHAFVBE/w=
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_2_1+2+3_True.vtr b/python/tests/reference/Geom/clean_2_1+2+3_True.vtr
new file mode 100644
index 000000000..eb2d1b64a
--- /dev/null
+++ b/python/tests/reference/Geom/clean_2_1+2+3_True.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAABQAAagAAAA==eF7t0rkOglAARFExLrgCKuKuqLj8/w9acCoSY7B+05x+cqNOvSj4l92GPfY54JAxRxxzwilnnDNhyowLLrlizjULbrjljnseeOSJZ15Y8sob76z44JMvvtn8L9jObz2GDuv96vADk5QHBg==
+
+
+
+
+ AQAAAACAAABIAAAAOgAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2D3IeNxx9YfV6DiN+22x9tFGsbchco/sAMA/fQl6g==
+
+
+ AQAAAACAAAAwAAAAKwAAAA==eF5jYICAvrdbF3w/tsEOQh+wC30iUFisdRLKv2D3MeNxx9YfV+wAD5wZgw==
+
+
+ AQAAAACAAAAoAAAAIwAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2AHAFVBE/w=
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_2_1_False.vtr b/python/tests/reference/Geom/clean_2_1_False.vtr
new file mode 100644
index 000000000..e77743025
--- /dev/null
+++ b/python/tests/reference/Geom/clean_2_1_False.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAABQAAZAAAAA==eF7t0scRglAAQEEBAyZUMCuomPtv0ANbgMNw/O+yDbyo1xQFWxkzYZ8DDjliyjEnnHLGOTMuuOSKOQuuueGWO+554JEnnlmy4oVX3ljzzgeffPHND7+Mg50aPmz698MfmvQHCg==
+
+
+
+
+ AQAAAACAAABIAAAAOgAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2D3IeNxx9YfV6DiN+22x9tFGsbchco/sAMA/fQl6g==
+
+
+ AQAAAACAAAAwAAAAKwAAAA==eF5jYICAvrdbF3w/tsEOQh+wC30iUFisdRLKv2D3MeNxx9YfV+wAD5wZgw==
+
+
+ AQAAAACAAAAoAAAAIwAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2AHAFVBE/w=
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_2_1_True.vtr b/python/tests/reference/Geom/clean_2_1_True.vtr
new file mode 100644
index 000000000..d8a3d4169
--- /dev/null
+++ b/python/tests/reference/Geom/clean_2_1_True.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAABQAAYwAAAA==eF7t0scBgkAAAEHBgBEwgDmBsf8GfTANCN/bzzSwUa8pCrYyZp8DDjliwjEnnHLGORdMmTHnkiuuuWHBklvuuOeBR5545oVX3nhnxZoPPvnimx9+GQc7GT5sqvjvhz+ZtAcJ
+
+
+
+
+ AQAAAACAAABIAAAAOgAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2D3IeNxx9YfV6DiN+22x9tFGsbchco/sAMA/fQl6g==
+
+
+ AQAAAACAAAAwAAAAKwAAAA==eF5jYICAvrdbF3w/tsEOQh+wC30iUFisdRLKv2D3MeNxx9YfV+wAD5wZgw==
+
+
+ AQAAAACAAAAoAAAAIwAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2AHAFVBE/w=
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_2_2_False.vtr b/python/tests/reference/Geom/clean_2_2_False.vtr
new file mode 100644
index 000000000..c2ad86f43
--- /dev/null
+++ b/python/tests/reference/Geom/clean_2_2_False.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAALQAAOgAAAA==eF7t1CEOACAMBMHS/z8aXwNJSagYMe6y8jIislgNtTW9d9oD/PL6r6b3AAAAAAAAAAAA4MYGlRYLYA==
+
+
+
+
+ AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q==
+
+
+ AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4=
+
+
+ AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q==
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_2_2_True.vtr b/python/tests/reference/Geom/clean_2_2_True.vtr
new file mode 100644
index 000000000..b4d19ebcf
--- /dev/null
+++ b/python/tests/reference/Geom/clean_2_2_True.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAALQAANwAAAA==eF7t1KERADAMA7Gk+w9dWpYCswiI+R66q6rDzmPa/kj3ALZK/2m6BwAAAAAAAAAAAJMLZrELTQ==
+
+
+
+
+ AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q==
+
+
+ AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4=
+
+
+ AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q==
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_2_None_False.vtr b/python/tests/reference/Geom/clean_2_None_False.vtr
new file mode 100644
index 000000000..068186206
--- /dev/null
+++ b/python/tests/reference/Geom/clean_2_None_False.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAABQAAGwAAAA==eF5jZIAAxlF6lB4AmmmUpogeDUfKaAD7jwDw
+
+
+
+
+ AQAAAACAAABIAAAAOgAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2D3IeNxx9YfV6DiN+22x9tFGsbchco/sAMA/fQl6g==
+
+
+ AQAAAACAAAAwAAAAKwAAAA==eF5jYICAvrdbF3w/tsEOQh+wC30iUFisdRLKv2D3MeNxx9YfV+wAD5wZgw==
+
+
+ AQAAAACAAAAoAAAAIwAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2AHAFVBE/w=
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_2_None_True.vtr b/python/tests/reference/Geom/clean_2_None_True.vtr
new file mode 100644
index 000000000..e72fa97e1
--- /dev/null
+++ b/python/tests/reference/Geom/clean_2_None_True.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAABQAAGQAAAA==eF5jZIAAxlF6lB4AmmmUHqUHkAYA/M8A8Q==
+
+
+
+
+ AQAAAACAAABIAAAAOgAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2D3IeNxx9YfV6DiN+22x9tFGsbchco/sAMA/fQl6g==
+
+
+ AQAAAACAAAAwAAAAKwAAAA==eF5jYICAvrdbF3w/tsEOQh+wC30iUFisdRLKv2D3MeNxx9YfV+wAD5wZgw==
+
+
+ AQAAAACAAAAoAAAAIwAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2AHAFVBE/w=
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_3_1+2+3_False.vtr b/python/tests/reference/Geom/clean_3_1+2+3_False.vtr
new file mode 100644
index 000000000..5400fcdb6
--- /dev/null
+++ b/python/tests/reference/Geom/clean_3_1+2+3_False.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAABQAAZwAAAA==eF7t0rcOgmAAhVEgNmyo2AuoWN//BR04EwsJcfzvcvabL47qxcFOJg177HPAIUdMOeaEU844Z8YFl1wx55obbrnjngceeeKZFxYseeWNd1Z88MkX3/zwy+Z/wf8YOqzX1uEPlgwHCA==
+
+
+
+
+ AQAAAACAAABIAAAAOgAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2D3IeNxx9YfV6DiN+22x9tFGsbchco/sAMA/fQl6g==
+
+
+ AQAAAACAAAAwAAAAKwAAAA==eF5jYICAvrdbF3w/tsEOQh+wC30iUFisdRLKv2D3MeNxx9YfV+wAD5wZgw==
+
+
+ AQAAAACAAAAoAAAAIwAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2AHAFVBE/w=
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_3_1+2+3_True.vtr b/python/tests/reference/Geom/clean_3_1+2+3_True.vtr
new file mode 100644
index 000000000..eb2d1b64a
--- /dev/null
+++ b/python/tests/reference/Geom/clean_3_1+2+3_True.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAABQAAagAAAA==eF7t0rkOglAARFExLrgCKuKuqLj8/w9acCoSY7B+05x+cqNOvSj4l92GPfY54JAxRxxzwilnnDNhyowLLrlizjULbrjljnseeOSJZ15Y8sob76z44JMvvtn8L9jObz2GDuv96vADk5QHBg==
+
+
+
+
+ AQAAAACAAABIAAAAOgAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2D3IeNxx9YfV6DiN+22x9tFGsbchco/sAMA/fQl6g==
+
+
+ AQAAAACAAAAwAAAAKwAAAA==eF5jYICAvrdbF3w/tsEOQh+wC30iUFisdRLKv2D3MeNxx9YfV+wAD5wZgw==
+
+
+ AQAAAACAAAAoAAAAIwAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2AHAFVBE/w=
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_3_1_False.vtr b/python/tests/reference/Geom/clean_3_1_False.vtr
new file mode 100644
index 000000000..e77743025
--- /dev/null
+++ b/python/tests/reference/Geom/clean_3_1_False.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAABQAAZAAAAA==eF7t0scRglAAQEEBAyZUMCuomPtv0ANbgMNw/O+yDbyo1xQFWxkzYZ8DDjliyjEnnHLGOTMuuOSKOQuuueGWO+554JEnnlmy4oVX3ljzzgeffPHND7+Mg50aPmz698MfmvQHCg==
+
+
+
+
+ AQAAAACAAABIAAAAOgAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2D3IeNxx9YfV6DiN+22x9tFGsbchco/sAMA/fQl6g==
+
+
+ AQAAAACAAAAwAAAAKwAAAA==eF5jYICAvrdbF3w/tsEOQh+wC30iUFisdRLKv2D3MeNxx9YfV+wAD5wZgw==
+
+
+ AQAAAACAAAAoAAAAIwAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2AHAFVBE/w=
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_3_1_True.vtr b/python/tests/reference/Geom/clean_3_1_True.vtr
new file mode 100644
index 000000000..d8a3d4169
--- /dev/null
+++ b/python/tests/reference/Geom/clean_3_1_True.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAABQAAYwAAAA==eF7t0scBgkAAAEHBgBEwgDmBsf8GfTANCN/bzzSwUa8pCrYyZp8DDjliwjEnnHLGORdMmTHnkiuuuWHBklvuuOeBR5545oVX3nhnxZoPPvnimx9+GQc7GT5sqvjvhz+ZtAcJ
+
+
+
+
+ AQAAAACAAABIAAAAOgAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2D3IeNxx9YfV6DiN+22x9tFGsbchco/sAMA/fQl6g==
+
+
+ AQAAAACAAAAwAAAAKwAAAA==eF5jYICAvrdbF3w/tsEOQh+wC30iUFisdRLKv2D3MeNxx9YfV+wAD5wZgw==
+
+
+ AQAAAACAAAAoAAAAIwAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2AHAFVBE/w=
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_3_2_False.vtr b/python/tests/reference/Geom/clean_3_2_False.vtr
new file mode 100644
index 000000000..c2ad86f43
--- /dev/null
+++ b/python/tests/reference/Geom/clean_3_2_False.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAALQAAOgAAAA==eF7t1CEOACAMBMHS/z8aXwNJSagYMe6y8jIislgNtTW9d9oD/PL6r6b3AAAAAAAAAAAA4MYGlRYLYA==
+
+
+
+
+ AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q==
+
+
+ AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4=
+
+
+ AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q==
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_3_2_True.vtr b/python/tests/reference/Geom/clean_3_2_True.vtr
new file mode 100644
index 000000000..b4d19ebcf
--- /dev/null
+++ b/python/tests/reference/Geom/clean_3_2_True.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAALQAANwAAAA==eF7t1KERADAMA7Gk+w9dWpYCswiI+R66q6rDzmPa/kj3ALZK/2m6BwAAAAAAAAAAAJMLZrELTQ==
+
+
+
+
+ AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q==
+
+
+ AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4=
+
+
+ AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q==
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_3_None_False.vtr b/python/tests/reference/Geom/clean_3_None_False.vtr
new file mode 100644
index 000000000..f7cd54cc0
--- /dev/null
+++ b/python/tests/reference/Geom/clean_3_None_False.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAABQAAIgAAAA==eF5jZIAAxlGaLJoJjSakntr6hzqN7v9RepSmJw0AC04A9Q==
+
+
+
+
+ AQAAAACAAABIAAAAOgAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2D3IeNxx9YfV6DiN+22x9tFGsbchco/sAMA/fQl6g==
+
+
+ AQAAAACAAAAwAAAAKwAAAA==eF5jYICAvrdbF3w/tsEOQh+wC30iUFisdRLKv2D3MeNxx9YfV+wAD5wZgw==
+
+
+ AQAAAACAAAAoAAAAIwAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2AHAFVBE/w=
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_3_None_True.vtr b/python/tests/reference/Geom/clean_3_None_True.vtr
new file mode 100644
index 000000000..2ebca1695
--- /dev/null
+++ b/python/tests/reference/Geom/clean_3_None_True.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAABQAALwAAAA==eF5jZIAAxlGaLJoJjSakHpc+cvUTUkdrmlL3j9KU0dROF5TqH2iaVPcDAALOANU=
+
+
+
+
+ AQAAAACAAABIAAAAOgAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2D3IeNxx9YfV6DiN+22x9tFGsbchco/sAMA/fQl6g==
+
+
+ AQAAAACAAAAwAAAAKwAAAA==eF5jYICAvrdbF3w/tsEOQh+wC30iUFisdRLKv2D3MeNxx9YfV+wAD5wZgw==
+
+
+ AQAAAACAAAAoAAAAIwAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2AHAFVBE/w=
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_4_1+2+3_False.vtr b/python/tests/reference/Geom/clean_4_1+2+3_False.vtr
new file mode 100644
index 000000000..20f83428f
--- /dev/null
+++ b/python/tests/reference/Geom/clean_4_1+2+3_False.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAABQAAcQAAAA==eF7t0rkOglAUBFAxKu6igvsKrv//gxYcm9fQGEPBNKe6yc1kolaZqPEndthljzH7HHDIEceccMoZE8654JIpM6645oZb7rjngUeeeOaFV+YseOOdDz754pthf+3Aqr7rdv9vw3+/NjssU7XDD0/8BuQ=
+
+
+
+
+ AQAAAACAAABIAAAAOgAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2D3IeNxx9YfV6DiN+22x9tFGsbchco/sAMA/fQl6g==
+
+
+ AQAAAACAAAAwAAAAKwAAAA==eF5jYICAvrdbF3w/tsEOQh+wC30iUFisdRLKv2D3MeNxx9YfV+wAD5wZgw==
+
+
+ AQAAAACAAAAoAAAAIwAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2AHAFVBE/w=
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_4_1+2+3_True.vtr b/python/tests/reference/Geom/clean_4_1+2+3_True.vtr
new file mode 100644
index 000000000..ae1490bce
--- /dev/null
+++ b/python/tests/reference/Geom/clean_4_1+2+3_True.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAABQAAYQAAAA==eF7t0scVglAAAEHgqZgBA2ZExdR/gx6YCpDj38s0sEnUlgR7ccAhR0w55oRTzjjngktmzFlwxTU33LLkjnseeOSJZ15Y8cqaN975YMMnX3zzwy/j4F+GD9u6fvgD+gwHCA==
+
+
+
+
+ AQAAAACAAABIAAAAOgAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2D3IeNxx9YfV6DiN+22x9tFGsbchco/sAMA/fQl6g==
+
+
+ AQAAAACAAAAwAAAAKwAAAA==eF5jYICAvrdbF3w/tsEOQh+wC30iUFisdRLKv2D3MeNxx9YfV+wAD5wZgw==
+
+
+ AQAAAACAAAAoAAAAIwAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2AHAFVBE/w=
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_4_1_False.vtr b/python/tests/reference/Geom/clean_4_1_False.vtr
new file mode 100644
index 000000000..e77743025
--- /dev/null
+++ b/python/tests/reference/Geom/clean_4_1_False.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAABQAAZAAAAA==eF7t0scRglAAQEEBAyZUMCuomPtv0ANbgMNw/O+yDbyo1xQFWxkzYZ8DDjliyjEnnHLGOTMuuOSKOQuuueGWO+554JEnnlmy4oVX3ljzzgeffPHND7+Mg50aPmz698MfmvQHCg==
+
+
+
+
+ AQAAAACAAABIAAAAOgAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2D3IeNxx9YfV6DiN+22x9tFGsbchco/sAMA/fQl6g==
+
+
+ AQAAAACAAAAwAAAAKwAAAA==eF5jYICAvrdbF3w/tsEOQh+wC30iUFisdRLKv2D3MeNxx9YfV+wAD5wZgw==
+
+
+ AQAAAACAAAAoAAAAIwAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2AHAFVBE/w=
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_4_1_True.vtr b/python/tests/reference/Geom/clean_4_1_True.vtr
new file mode 100644
index 000000000..d042cf7b4
--- /dev/null
+++ b/python/tests/reference/Geom/clean_4_1_True.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAABQAAZAAAAA==eF7t0rcSglAARFEHE0bAgBkE8///oAWnF8b2bXP6nRv1mkXBv+xzwCFHHDPmhFPOOOeCSyZMmXHFNTfcMueOex545IlnXliw5JUVa95454NPvvjmh79+DXYzdNisbYdfSqMHMg==
+
+
+
+
+ AQAAAACAAABIAAAAOgAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2D3IeNxx9YfV6DiN+22x9tFGsbchco/sAMA/fQl6g==
+
+
+ AQAAAACAAAAwAAAAKwAAAA==eF5jYICAvrdbF3w/tsEOQh+wC30iUFisdRLKv2D3MeNxx9YfV+wAD5wZgw==
+
+
+ AQAAAACAAAAoAAAAIwAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2AHAFVBE/w=
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_4_2_False.vtr b/python/tests/reference/Geom/clean_4_2_False.vtr
new file mode 100644
index 000000000..7665bdde2
--- /dev/null
+++ b/python/tests/reference/Geom/clean_4_2_False.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAALQAANQAAAA==eF7t1CEOACAMBMGj/380Fk+TQjJi7MqtJHVYlypv9wB+0f2+7h4AAAAAAAAAAABM2HWwC1M=
+
+
+
+
+ AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q==
+
+
+ AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4=
+
+
+ AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q==
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_4_2_True.vtr b/python/tests/reference/Geom/clean_4_2_True.vtr
new file mode 100644
index 000000000..88a8643d9
--- /dev/null
+++ b/python/tests/reference/Geom/clean_4_2_True.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAALQAAJAAAAA==eF7twwEJAAAMBKH7/qWXY6DgqqmqqqqqqqqqqqqqPnhyUwtB
+
+
+
+
+ AQAAAACAAACoAAAAVQAAAA==eF5jYICAWTNBYKU9hN5pb2IMAoeh/JP2EFUXoOKX7dPTQOAaVP6m/dkzIHAHqu4BVPwhVP1jqPwTqL5nUHUvoOpeQtW9hqp7A1X3Dqrugz0ASSZF3Q==
+
+
+ AQAAAACAAACYAAAAVgAAAA==eF5jYIAAmeOFQLTGHkLvsQ8Fg6NQ/hn7IjDjIlT8qr1F32MgugGVv2MPMeUBVN1D+8cQBVD1T+3BymSeQ/W9sF8FBq+g+t/Yg4Ut3kHN+WAPAAVdQE4=
+
+
+ AQAAAACAAABIAAAAIgAAAA==eF5jYEAGB+wh9AUofQNKP4DST6D0Cyj9Bkp/sAcAAU8I6Q==
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_4_None_False.vtr b/python/tests/reference/Geom/clean_4_None_False.vtr
new file mode 100644
index 000000000..686f5a190
--- /dev/null
+++ b/python/tests/reference/Geom/clean_4_None_False.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAABQAAIAAAAA==eF5jZIAAxlF6lB4AmokAPdj1DzRNyP2jNH4aAMufANU=
+
+
+
+
+ AQAAAACAAABIAAAAOgAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2D3IeNxx9YfV6DiN+22x9tFGsbchco/sAMA/fQl6g==
+
+
+ AQAAAACAAAAwAAAAKwAAAA==eF5jYICAvrdbF3w/tsEOQh+wC30iUFisdRLKv2D3MeNxx9YfV+wAD5wZgw==
+
+
+ AQAAAACAAAAoAAAAIwAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2AHAFVBE/w=
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_4_None_True.vtr b/python/tests/reference/Geom/clean_4_None_True.vtr
new file mode 100644
index 000000000..66109b418
--- /dev/null
+++ b/python/tests/reference/Geom/clean_4_None_True.vtr
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+ AQAAAACAAAAABQAAMAAAAA==eF5jYoAAJhw0IwEalz566aeUptT+oa6fUppS+4e6fkppSu0f6voppSm1HwBAngDh
+
+
+
+
+ AQAAAACAAABIAAAAOgAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2D3IeNxx9YfV6DiN+22x9tFGsbchco/sAMA/fQl6g==
+
+
+ AQAAAACAAAAwAAAAKwAAAA==eF5jYICAvrdbF3w/tsEOQh+wC30iUFisdRLKv2D3MeNxx9YfV+wAD5wZgw==
+
+
+ AQAAAACAAAAoAAAAIwAAAA==eF5jYICA3rdbF3w/tsEOQh+wC3kiUFisdRLKv2AHAFVBE/w=
+
+
+
+
+
diff --git a/python/tests/reference/Geom/clean_stencil=1.geom b/python/tests/reference/Geom/clean_stencil=1.geom
deleted file mode 100644
index 3e6f6fe9c..000000000
--- a/python/tests/reference/Geom/clean_stencil=1.geom
+++ /dev/null
@@ -1,25 +0,0 @@
-4 header
-grid a 8 b 5 c 4
-size x 8e-06 y 5e-06 z 4e-06
-origin x 0.0 y 0.0 z 0.0
-homogenization 1
- 1 1 1 1 1 1 1 1
- 1 1 1 1 1 1 1 1
- 1 1 1 1 1 1 1 1
- 1 1 1 1 1 1 1 1
- 1 1 1 1 1 1 1 1
- 2 3 4 5 6 7 8 9
-10 11 12 13 14 15 16 17
-18 19 20 21 22 23 24 25
-26 27 28 29 30 31 32 33
-34 35 36 37 38 39 40 41
- 2 2 2 2 2 2 2 2
- 2 2 2 2 2 2 2 2
- 2 2 2 2 2 2 2 2
- 2 2 2 2 2 2 2 2
- 2 2 2 2 2 2 2 2
- 1 2 3 4 5 6 7 8
- 9 10 11 12 13 14 15 16
-17 18 19 20 21 22 23 24
-25 26 27 28 29 30 31 32
-33 34 35 36 37 38 39 40
diff --git a/python/tests/reference/Geom/clean_stencil=2.geom b/python/tests/reference/Geom/clean_stencil=2.geom
deleted file mode 100644
index 14c1fa5e2..000000000
--- a/python/tests/reference/Geom/clean_stencil=2.geom
+++ /dev/null
@@ -1,25 +0,0 @@
-4 header
-grid a 8 b 5 c 4
-size x 8e-06 y 5e-06 z 4e-06
-origin x 0.0 y 0.0 z 0.0
-homogenization 1
-1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-2 2 2 2 2 2 2 2
-2 2 2 2 2 2 2 2
-2 2 2 2 2 2 2 2
-2 2 2 2 2 2 2 2
-2 2 2 2 2 2 2 2
-1 2 2 2 2 2 2 2
-2 2 2 2 2 2 2 2
-2 2 2 2 2 2 2 2
-2 2 2 2 2 2 2 2
-2 2 2 2 2 2 2 2
diff --git a/python/tests/reference/Geom/clean_stencil=3.geom b/python/tests/reference/Geom/clean_stencil=3.geom
deleted file mode 100644
index 3aea8ffa5..000000000
--- a/python/tests/reference/Geom/clean_stencil=3.geom
+++ /dev/null
@@ -1,25 +0,0 @@
-4 header
-grid a 8 b 5 c 4
-size x 8e-06 y 5e-06 z 4e-06
-origin x 0.0 y 0.0 z 0.0
-homogenization 1
-1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-2 2 1 1 1 1 1 1
-2 2 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-2 2 2 2 2 2 2 2
-2 2 2 2 2 2 2 2
-2 2 2 2 2 2 2 2
-2 2 2 2 2 2 2 2
-2 2 2 2 2 2 2 2
-2 2 2 2 2 2 2 2
-2 2 2 2 2 2 2 2
-2 2 2 2 2 2 2 2
-2 2 2 2 2 2 2 2
-2 2 2 2 2 2 2 2
diff --git a/python/tests/reference/Geom/clean_stencil=4.geom b/python/tests/reference/Geom/clean_stencil=4.geom
deleted file mode 100644
index 595e04b23..000000000
--- a/python/tests/reference/Geom/clean_stencil=4.geom
+++ /dev/null
@@ -1,25 +0,0 @@
-4 header
-grid a 8 b 5 c 4
-size x 8e-06 y 5e-06 z 4e-06
-origin x 0.0 y 0.0 z 0.0
-homogenization 1
-1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-2 2 2 2 1 1 1 1
-2 2 2 2 1 1 1 1
-2 2 2 2 1 1 1 1
-1 1 1 1 1 1 1 1
-1 1 1 1 1 1 1 1
-2 2 2 2 2 2 2 2
-2 2 2 2 2 2 2 2
-2 2 2 2 2 2 2 2
-2 2 2 2 2 2 2 2
-2 2 2 2 2 2 2 2
diff --git a/python/tests/test_Colormap.py b/python/tests/test_Colormap.py
index b3309f12b..22c208551 100644
--- a/python/tests/test_Colormap.py
+++ b/python/tests/test_Colormap.py
@@ -7,7 +7,6 @@ import pytest
from PIL import Image
from PIL import ImageChops
-import damask
from damask import Colormap
@pytest.fixture
@@ -17,8 +16,11 @@ def reference_dir(reference_dir_base):
class TestColormap:
- def test_conversion(self):
+ @pytest.fixture(autouse=True)
+ def _execution_stamp(self, execution_stamp):
+ print('patched damask.util.execution_stamp')
+ def test_conversion(self):
specials = np.array([[0.,0.,0.],
[1.,0.,0.],
[0.,1.,0.],
@@ -29,7 +31,6 @@ class TestColormap:
[1.,1.,1.]
])
rgbs = np.vstack((specials,np.random.rand(100,3)))
- pass # class not integrated
for rgb in rgbs:
print('rgb',rgb)
@@ -150,8 +151,7 @@ class TestColormap:
('GOM','.legend'),
('Gmsh','.msh')
])
- def test_compare_reference(self,format,ext,tmpdir,reference_dir,update,monkeypatch):
- monkeypatch.setattr(damask, 'version', pytest.dummy_version)
+ def test_compare_reference(self,format,ext,tmpdir,reference_dir,update):
name = 'binary'
c = Colormap.from_predefined(name)
if update:
diff --git a/python/tests/test_Geom.py b/python/tests/test_Geom.py
index e568b4a53..d1657f1df 100644
--- a/python/tests/test_Geom.py
+++ b/python/tests/test_Geom.py
@@ -1,6 +1,10 @@
+import os
+import time
+
import pytest
import numpy as np
+from damask import VTK
from damask import Geom
from damask import Rotation
from damask import util
@@ -41,15 +45,6 @@ class TestGeom:
print(modified)
assert geom_equal(default,modified)
- def test_update(self,default):
- modified = default.copy()
- modified.update(
- default.get_microstructure(),
- default.get_size(),
- default.get_origin()
- )
- print(modified)
- assert geom_equal(default,modified)
@pytest.mark.parametrize('masked',[True,False])
def test_set_microstructure(self,default,masked):
@@ -71,16 +66,34 @@ class TestGeom:
new = Geom.from_file(f)
assert geom_equal(default,new)
- def test_write_show(self,default,tmpdir):
+ def test_write_as_ASCII(self,default,tmpdir):
with open(tmpdir/'str.geom','w') as f:
- f.write(default.show())
+ f.write(default.as_ASCII())
with open(tmpdir/'str.geom') as f:
new = Geom.from_file(f)
assert geom_equal(default,new)
def test_export_import_vtk(self,default,tmpdir):
- default.to_vtk(tmpdir/'default')
- assert geom_equal(default,Geom.from_vtk(tmpdir/'default.vtr'))
+ default.to_vtr(tmpdir/'default')
+ assert geom_equal(default,Geom.from_vtr(tmpdir/'default.vtr'))
+
+ def test_read_write_vtr(self,default,tmpdir):
+ default.to_vtr(tmpdir/'default')
+ for _ in range(10):
+ time.sleep(.2)
+ if os.path.exists(tmpdir/'default.vtr'): break
+
+ new = Geom.from_vtr(tmpdir/'default.vtr')
+ assert geom_equal(new,default)
+
+ def test_invalid_vtr(self,tmpdir):
+ v = VTK.from_rectilinearGrid(np.random.randint(5,10,3)*2,np.random.random(3) + 1.0)
+ v.write(tmpdir/'no_materialpoint.vtr')
+ for _ in range(10):
+ time.sleep(.2)
+ if os.path.exists(tmpdir/'no_materialpoint.vtr'): break
+ with pytest.raises(ValueError):
+ Geom.from_vtr(tmpdir/'no_materialpoint.vtr')
@pytest.mark.parametrize('pack',[True,False])
@@ -91,25 +104,25 @@ class TestGeom:
def test_invalid_combination(self,default):
with pytest.raises(ValueError):
- default.update(default.microstructure[1:,1:,1:],size=np.ones(3), autosize=True)
+ default.duplicate(default.microstructure[1:,1:,1:],size=np.ones(3), autosize=True)
def test_invalid_size(self,default):
with pytest.raises(ValueError):
- default.update(default.microstructure[1:,1:,1:],size=np.ones(2))
+ default.duplicate(default.microstructure[1:,1:,1:],size=np.ones(2))
def test_invalid_origin(self,default):
with pytest.raises(ValueError):
- default.update(default.microstructure[1:,1:,1:],origin=np.ones(4))
+ default.duplicate(default.microstructure[1:,1:,1:],origin=np.ones(4))
def test_invalid_microstructure_size(self,default):
microstructure = np.ones((3,3))
with pytest.raises(ValueError):
- default.update(microstructure)
+ default.duplicate(microstructure)
def test_invalid_microstructure_type(self,default):
microstructure = np.random.randint(1,300,(3,4,5))==1
with pytest.raises(TypeError):
- default.update(microstructure)
+ default.duplicate(microstructure)
def test_invalid_homogenization(self,default):
with pytest.raises(TypeError):
@@ -145,14 +158,25 @@ class TestGeom:
assert geom_equal(Geom.from_file(reference),
modified)
+ @pytest.mark.parametrize('directions',[(1,2,'y'),('a','b','x'),[1]])
+ def test_mirror_invalid(self,default,directions):
+ with pytest.raises(ValueError):
+ default.mirror(directions)
+
@pytest.mark.parametrize('stencil',[1,2,3,4])
- def test_clean(self,default,update,reference_dir,stencil):
- modified = default.clean(stencil)
- tag = f'stencil={stencil}'
- reference = reference_dir/f'clean_{tag}.geom'
- if update: modified.to_file(reference)
- assert geom_equal(Geom.from_file(reference),
- modified)
+ @pytest.mark.parametrize('selection',[None,[1],[1,2,3]])
+ @pytest.mark.parametrize('periodic',[True,False])
+ def test_clean(self,default,update,reference_dir,stencil,selection,periodic):
+ current = default.clean(stencil,selection,periodic)
+ reference = reference_dir/f'clean_{stencil}_{"+".join(map(str,[None] if selection is None else selection))}_{periodic}'
+ if update and stencil > 1:
+ current.to_vtr(reference)
+ for _ in range(10):
+ time.sleep(.2)
+ if os.path.exists(reference.with_suffix('.vtr')): break
+ assert geom_equal(Geom.from_vtr(reference) if stencil > 1 else default,
+ current
+ )
@pytest.mark.parametrize('grid',[
(10,11,10),
diff --git a/python/tests/test_Orientation.py b/python/tests/test_Orientation.py
index 4987f1f1f..636eeb0c4 100644
--- a/python/tests/test_Orientation.py
+++ b/python/tests/test_Orientation.py
@@ -4,7 +4,7 @@ from itertools import permutations
import pytest
import numpy as np
-import damask
+from damask import Table
from damask import Rotation
from damask import Orientation
from damask import Lattice
@@ -68,7 +68,7 @@ class TestOrientation:
{'label':'blue', 'RGB':[0,0,1],'direction':[1,1,1]}])
@pytest.mark.parametrize('lattice',['fcc','bcc'])
def test_IPF_cubic(self,color,lattice):
- cube = damask.Orientation(damask.Rotation(),lattice)
+ cube = Orientation(Rotation(),lattice)
for direction in set(permutations(np.array(color['direction']))):
assert np.allclose(cube.IPF_color(np.array(direction)),np.array(color['RGB']))
@@ -104,15 +104,15 @@ class TestOrientation:
eu = np.array([o.rotation.as_Eulers(degrees=True) for o in ori.related(model)])
if update:
coords = np.array([(1,i+1) for i,x in enumerate(eu)])
- table = damask.Table(eu,{'Eulers':(3,)})
+ table = Table(eu,{'Eulers':(3,)})
table.add('pos',coords)
table.to_ASCII(reference)
- assert np.allclose(eu,damask.Table.from_ASCII(reference).get('Eulers'))
+ assert np.allclose(eu,Table.from_ASCII(reference).get('Eulers'))
@pytest.mark.parametrize('lattice',Lattice.lattices)
def test_disorientation360(self,lattice):
R_1 = Orientation(Rotation(),lattice)
- R_2 = Orientation(damask.Rotation.from_Eulers([360,0,0],degrees=True),lattice)
+ R_2 = Orientation(Rotation.from_Eulers([360,0,0],degrees=True),lattice)
assert np.allclose(R_1.disorientation(R_2).as_matrix(),np.eye(3))
@pytest.mark.parametrize('lattice',Lattice.lattices)
@@ -127,6 +127,6 @@ class TestOrientation:
def test_from_average(self,lattice):
R_1 = Orientation(Rotation.from_random(),lattice)
eqs = [r for r in R_1.equivalent]
- R_2 = damask.Orientation.from_average(eqs)
+ R_2 = Orientation.from_average(eqs)
assert np.allclose(R_1.rotation.quaternion,R_2.rotation.quaternion)
diff --git a/python/tests/test_Result.py b/python/tests/test_Result.py
index 53bcdda9d..6000f50f9 100644
--- a/python/tests/test_Result.py
+++ b/python/tests/test_Result.py
@@ -8,8 +8,9 @@ import pytest
import numpy as np
import h5py
-import damask
from damask import Result
+from damask import Rotation
+from damask import Orientation
from damask import mechanics
from damask import grid_filters
@@ -174,7 +175,7 @@ class TestResult:
crystal_structure = default.get_crystal_structure()
in_memory = np.empty((qu.shape[0],3),np.uint8)
for i,q in enumerate(qu):
- o = damask.Orientation(q,crystal_structure).reduced
+ o = Orientation(q,crystal_structure).reduced
in_memory[i] = np.uint8(o.IPF_color(np.array(d))*255)
in_file = default.read_dataset(loc['color'])
assert np.allclose(in_memory,in_file)
@@ -233,7 +234,7 @@ class TestResult:
default.add_pole('orientation',pole,polar)
loc = {'orientation': default.get_dataset_location('orientation'),
'pole': default.get_dataset_location('p^{}_[1 0 0)'.format(u'rφ' if polar else 'xy'))}
- rot = damask.Rotation(default.read_dataset(loc['orientation']).view(np.double))
+ rot = Rotation(default.read_dataset(loc['orientation']).view(np.double))
rotated_pole = rot * np.broadcast_to(pole,rot.shape+(3,))
xy = rotated_pole[:,0:2]/(1.+abs(pole[2]))
in_memory = xy if not polar else \