Skip to content

Commit

Permalink
tissue segmentation: don't crash when no coordinates are found
Browse files Browse the repository at this point in the history
  • Loading branch information
ilia-kats committed Oct 1, 2021
1 parent f9ff81f commit 37e22ad
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion SpatialDE/dp_hmrf.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,6 @@ def tissue_segmentation(
fnclasses = tf.cast(nclasses, dtype=dtype)

sizefactors = tf.convert_to_tensor(sizefactors[np.newaxis, :], dtype=dtype)
X = tf.convert_to_tensor(X, dtype=dtype)

gamma_1 = tf.convert_to_tensor(params.gamma_1, dtype=dtype)
gamma_2 = tf.convert_to_tensor(params.gamma_2, dtype=dtype)
Expand All @@ -270,6 +269,7 @@ def tissue_segmentation(

distances = None
if X is not None and (params.neighbors is None or params.neighbors > 0):
X = tf.convert_to_tensor(X, dtype=dtype)
distances = square_distance(X, None)
if params.neighbors is not None and params.neighbors < nsamples:
distances, indices = tf.math.top_k(-distances, k=params.neighbors + 1, sorted=True)
Expand Down

0 comments on commit 37e22ad

Please sign in to comment.