Skip to content

Commit 5bf67cc

Browse files
committed
Do atlas float conversion to avoid overflows
1 parent 6683481 commit 5bf67cc

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/murfey/workflows/spa/atlas.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ def atlas_jpg_from_mrc(instrument_name: str, visit_name: str, atlas_mrc: Path):
3838
)
3939
atlas_jpg_file.parent.mkdir(parents=True, exist_ok=True)
4040

41-
im = PIL.Image.fromarray(data)
42-
im.convert(mode="L").save(atlas_jpg_file)
41+
data = data - data.min()
42+
data = data.astype(float) * 255 / data.max()
43+
data = data.astype("uint8")
44+
PIL.Image.fromarray(data).save(atlas_jpg_file)
4345
logger.debug(f"JPG image of atlas saved as {str(atlas_jpg_file)!r}")

0 commit comments

Comments
 (0)