Commit e18e8a57 by Daniel Boeckenhoff

### disabled warning sysout in doctest

parent 36b6c666
 ... ... @@ -377,14 +377,24 @@ class Triangles3D(tfields.TensorFields): >>> assert ((baric == baric_expected) | (np.isnan(baric) & ... np.isnan(baric_expected))).all() Raises: If you define triangles that have colinear side vectors or in general lead to not invertable matrices [ab, ac, ab x ac] the values will be nan >>> m3 = tfields.Mesh3D([[0,0,0], [2,0,0], [4,0,0], [0,1,0]], faces=[[0, 1, 2], [0, 1, 3]]); >>> bc = m3.triangles()._baricentric(np.array([0.2, 0.2, 0]), delta=0.3) not invertable matrices [ab, ac, ab x ac] the values will be nan and a warning will be triggered: >>> import warnings >>> m3 = tfields.Mesh3D([[0,0,0], [2,0,0], [4,0,0], [0,1,0]], ... maps=[[[0, 1, 2], [0, 1, 3]]]); >>> with warnings.catch_warnings(record=True) as wrn: ... warnings.simplefilter("ignore") ... bc = m3.triangles()._baricentric(np.array([0.2, 0.2, 0]), delta=0.3) >>> bc_exp = np.array([[ np.nan, np.nan, np.nan], [ 0.1, 0.2, 0. ]]) >>> assert ((bc == bc_exp) | (np.isnan(bc) & ... np.isnan(bc_exp))).all() The warning would be: UserWarning('Singular matrix: Could not invert matrix ... ... [[ 2. 4. 0.], [ 0. 0. 0.], [ 0. 0. 0.]]. Return nan matrix.',) Returns: np.ndarray: barycentric coordinates u, v, w of point with respect to each triangle """ ... ... @@ -451,12 +461,6 @@ class Triangles3D(tfields.TensorFields): ... m.triangles()._in_triangles(tfields.Points3D([[0.2, 0.2, 0]])), ... np.array([True], dtype=bool)) wrong format of point will raise a ValueError >>> m.triangles()._in_triangles(tfields.Points3D([[0.2, 0.2, 0], [0.2, 0.2, 0]])) Traceback (most recent call last): ... ValueError: point must be castable to shape 3 but is of shape (2, 3) All Triangles are tested >>> m2 = tfields.Mesh3D([[1,0,0], [0,1,0], [0,0,0], [4,0,0], [4, 4, 0], [8, 0, 0]], ... faces=[[0, 1, 2], [3, 4, 5]]); ... ... @@ -485,6 +489,13 @@ class Triangles3D(tfields.TensorFields): >>> assert np.array_equal(mask, ... np.array([False, True], dtype=bool)) Raises: Wrong format of point will raise a ValueError >>> m.triangles()._in_triangles(tfields.Points3D([[0.2, 0.2, 0], [0.2, 0.2, 0]])) Traceback (most recent call last): ... ValueError: point must be castable to shape 3 but is of shape (2, 3) """ if self.ntriangles() == 0: return np.array([], dtype=bool) ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!