Better handling of scalebar failure in sortingview timeseries
@@ -150,14 +150,14 @@ def array_to_image(data,
fontsize = int(0.8 * spacing)
row_ms = (num_timepoints_per_row / sampling_frequency) * 1000
- font = None
+ try:
if platform.system() == "Linux":
font = ImageFont.truetype("/usr/share/fonts/truetype/freefont/FreeMono.ttf", fontsize)
else:
- try:
font = ImageFont.truetype("arial.ttf", fontsize)
- except OSError:
+ except:
print(f"Could not load font to use in scalebar. Scalebar will not be drawn.")
+ font = None
if font is not None:
image = Image.fromarray(output_image)
