From e5cd878309421fec25ac5973e7074bdf9e29a5a4 Mon Sep 17 00:00:00 2001 From: Brian Long Date: Mon, 14 Mar 2022 10:59:28 -0700 Subject: [PATCH] change Codebook data default dtype to float --- starfish/core/codebook/codebook.py | 4 ++-- starfish/core/codebook/test/test_from_code_array.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/starfish/core/codebook/codebook.py b/starfish/core/codebook/codebook.py index ef665470a..d383d81aa 100644 --- a/starfish/core/codebook/codebook.py +++ b/starfish/core/codebook/codebook.py @@ -110,7 +110,7 @@ def zeros(cls, code_names: Sequence[str], n_round: int, n_channel: int): codebook whose values are all zero """ - data = np.zeros((len(code_names), n_round, n_channel), dtype=np.uint8) + data = np.zeros((len(code_names), n_round, n_channel), dtype=float) return cls.from_numpy(code_names, n_round, n_channel, data) @classmethod @@ -295,7 +295,7 @@ def from_code_array( target_names = [w[Features.TARGET] for w in code_array] # fill the codebook - data = np.zeros((len(target_names), n_round, n_channel), dtype=np.uint8) + data = np.zeros((len(target_names), n_round, n_channel), dtype=float) for i, code_dict in enumerate(code_array): for bit in code_dict[Features.CODEWORD]: ch = int(bit[Axes.CH]) diff --git a/starfish/core/codebook/test/test_from_code_array.py b/starfish/core/codebook/test/test_from_code_array.py index f667d82c9..8c7c82dfc 100644 --- a/starfish/core/codebook/test/test_from_code_array.py +++ b/starfish/core/codebook/test/test_from_code_array.py @@ -137,7 +137,7 @@ def test_create_codebook(): targets = [x[Features.TARGET] for x in code_array] # Loop performed by from_code_array - data = np.zeros((2, 2, 3), dtype=np.uint8) + data = np.zeros((2, 2, 3), dtype=float) for i, code_dict in enumerate(code_array): for bit in code_dict[Features.CODEWORD]: ch = int(bit[Axes.CH])