From f1430f5cbbc13e0d74a5b1e7ac14b908d9f8d97b Mon Sep 17 00:00:00 2001 From: Volker Bergen <31883718+VolkerBergen@users.noreply.github.com> Date: Tue, 25 Jun 2019 17:33:53 +0200 Subject: [PATCH] allow negative values in sparse data `layers[''].sparse()` would detach all negative values due to `val > 0` in line 123. --- loompy/loom_layer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/loompy/loom_layer.py b/loompy/loom_layer.py index c2f433a..7194582 100644 --- a/loompy/loom_layer.py +++ b/loompy/loom_layer.py @@ -120,7 +120,7 @@ def sparse(self, rows: np.ndarray = None, cols: np.ndarray = None) -> scipy.spar vals = view.layers[self.name][rows, :] else: vals = view.layers[self.name][:, :] - nonzeros = np.where(vals > 0) + nonzeros = np.where(vals != 0) data.append(vals[nonzeros]) row.append(nonzeros[0]) col.append(nonzeros[1] + i)