Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
elaubsch committed Jul 19, 2023
1 parent 2a0c859 commit 56f6f63
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions deepcell_spots/applications/polaris_test.py
Expand Up @@ -179,39 +179,39 @@ def test_polaris_app(self):
_ = app.predict(spots_image=spots_image,
segmentation_image=segmentation_image)

# test mask rounds
df_barcodes = pd.DataFrame(
[
["code1", 1, 1, 0, 0, 0, 0],
["code2", 0, 0, 1, 1, 0, 0],
["code3", 0, 0, 0, 0, 1, 0],
["code4", 1, 0, 0, 0, 1, 0],
["code5", 0, 0, 1, 0, 0, 0],
["code6", 0, 1, 0, 0, 1, 0],
["code7", 1, 0, 1, 0, 0, 0],
],
columns=["Gene", "r0c0", "r0c1", "r0c2", "r1c0", "r1c1", "r1c2"],
index=np.arange(7) + 1,
)
r = 2
c = 3
decoding_kwargs = {'df_barcodes': df_barcodes, 'rounds': r,
'channels': c, 'distribution': 'Relaxed Bernoulli',
'params_mode': '2*R*C'}
app = Polaris(image_type='multiplex', decoding_kwargs=decoding_kwargs)
# # test mask rounds
# df_barcodes = pd.DataFrame(
# [
# ["code1", 1, 1, 0, 0, 0, 0],
# ["code2", 0, 0, 1, 1, 0, 0],
# ["code3", 0, 0, 0, 0, 1, 0],
# ["code4", 1, 0, 0, 0, 1, 0],
# ["code5", 0, 0, 1, 0, 0, 0],
# ["code6", 0, 1, 0, 0, 1, 0],
# ["code7", 1, 0, 1, 0, 0, 0],
# ],
# columns=["Gene", "r0c0", "r0c1", "r0c2", "r1c0", "r1c1", "r1c2"],
# index=np.arange(7) + 1,
# )
# r = 2
# c = 3
# decoding_kwargs = {'df_barcodes': df_barcodes, 'rounds': r,
# 'channels': c, 'distribution': 'Relaxed Bernoulli',
# 'params_mode': '2*R*C'}
# app = Polaris(image_type='multiplex', decoding_kwargs=decoding_kwargs)

spots_image = np.random.rand(1, 128, 128, r*c) + 1
segmentation_image = np.random.rand(1, 128, 128, 1)
background_image = np.random.rand(1, 128, 128, 1)
pred = app.predict(spots_image=spots_image,
segmentation_image=segmentation_image,
background_image=background_image)
df_spots = pred[0]
df_intensities = pred[1]
segmentation_result = pred[2]
# spots_image = np.random.rand(1, 128, 128, r*c) + 1
# segmentation_image = np.random.rand(1, 128, 128, 1)
# background_image = np.random.rand(1, 128, 128, 1)
# pred = app.predict(spots_image=spots_image,
# segmentation_image=segmentation_image,
# background_image=background_image)
# df_spots = pred[0]
# df_intensities = pred[1]
# segmentation_result = pred[2]

self.assertEqual(np.sum(df_intensities.values[:,-1]), 0)
self.assertAllGreater(np.sum(df_intensities.values[:,:-1], axis=0), 0)
# self.assertEqual(np.sum(df_intensities.values[:,-1]), 0)
# self.assertAllGreater(np.sum(df_intensities.values[:,:-1], axis=0), 0)

# test prediction type -- singleplex
app = Polaris()
Expand Down

0 comments on commit 56f6f63

Please sign in to comment.