From c36c443f6e6d7f3c870f0516cf51e31bd84cd8a9 Mon Sep 17 00:00:00 2001
From: LTLA <infinite.monkeys.with.keyboards@gmail.com>
Date: Thu, 19 Dec 2024 16:00:15 -0800
Subject: [PATCH] Silence NumPy warnings about numerical operations with zero.

---
 src/delayedarray/UnaryIsometricOpSimple.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/delayedarray/UnaryIsometricOpSimple.py b/src/delayedarray/UnaryIsometricOpSimple.py
index 92bf643..1437a6f 100644
--- a/src/delayedarray/UnaryIsometricOpSimple.py
+++ b/src/delayedarray/UnaryIsometricOpSimple.py
@@ -1,6 +1,7 @@
 from typing import Callable, Literal, Tuple, Sequence
 import numpy
 from numpy import dtype, zeros
+import warnings
 
 from .DelayedOp import DelayedOp
 from .SparseNdarray import SparseNdarray
@@ -68,7 +69,9 @@ def __init__(self, seed, operation: OP):
                 String specifying the unary operation.
         """
         f = _choose_operator(operation)
-        dummy = f(zeros(1, dtype=seed.dtype))
+        with warnings.catch_warnings():  # silence warnings from divide by zero.
+            warnings.simplefilter("ignore")
+            dummy = f(zeros(1, dtype=seed.dtype))
 
         self._seed = seed
         self._op = operation