Commit 1bf619d2 authored by Félix Hartmann's avatar Félix Hartmann
Browse files

[bugfix] Remove problems with spatiotemporal heatmaps in corner cases.

parent d04bbc18
......@@ -1564,6 +1564,11 @@ def show_heatmaps():
radii = tiges_data.diam[cur_tige] / 2
s, angles = load_postprocessed_data(hdf5file, tige_hdf_id)[2:5:2]
if len(s) <= 1: # if the time series is too short, no heatmap
msg = _("Heatmaps cannot be created from a series of less then two images.")
messagebox.showerror(_("Not enough images"), msg)
return
# Scaling
length_unit, inv_length_unit = "pix", r"pix$^{-1}$"
scale_cmpix = h5store.get_pixelscale(hdf5file)
......@@ -1597,7 +1602,10 @@ def show_heatmaps():
R = zeros_like(angles) - 3000 # radii
cutoff_left, cutoff_right = 2, 2
for i in range(len(angles)):
imax = flatnonzero(angles[i].mask == False).max() + 1
angles_i_bool = angles[i].mask == False
if not angles_i_bool.any(): # if no measurement at time i
continue
imax = flatnonzero(angles_i_bool).max() + 1
angles_i = angles[i, cutoff_left:imax-cutoff_right]
s_i = s[i, cutoff_left:imax-cutoff_right]
R_i = radii[i, cutoff_left:imax-cutoff_right]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment