Skip to content

Commit 1804a58

Browse files
authored
Fix overflow on combining numpy and python numbers (#160)
1 parent 7fdd73b commit 1804a58

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

clodius/tiles/cooler.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,7 @@ def make_mats(filepath):
495495

496496
# get the genome size
497497
resolution = list(f["resolutions"].keys())[0]
498-
genome_length = int(sum(f["resolutions"][resolution]["chroms"]["length"]))
498+
genome_length = int(np.sum(f["resolutions"][resolution]["chroms"]["length"]))
499499

500500
info["max_pos"] = [genome_length, genome_length]
501501
info["min_pos"] = [1, 1]

clodius/tiles/format.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ def format_dense_tile(data):
3636
tile_data["min_value"] = min_dense if not np.isnan(min_dense) else "NaN"
3737
tile_data["max_value"] = max_dense if not np.isnan(max_dense) else "NaN"
3838

39-
min_f16 = np.finfo("float16").min
40-
max_f16 = np.finfo("float16").max
39+
min_f16 = np.finfo("float16").min.item()
40+
max_f16 = np.finfo("float16").max.item()
4141

4242
has_nan = np.sum(np.isnan(data)) > 0
4343
n_dim = len(data.shape)

0 commit comments

Comments
 (0)