# try cropping off the end first
lbl_tb_cropped = lbl_tb[:cropped_length]
if np.array_equal(np.unique(lbl_tb_cropped), classes):
x_inds[cropped_length:] = WindowDataset.INVALID_WINDOW_VAL
return spect_id_vector[:cropped_length], spect_inds_vector[:cropped_length], x_inds
else:
# try truncating from the back instead
lbl_tb_cropped = lbl_tb_cropped[-cropped_length:] # <-- SHOULD BE `lbl_tb` !!!
if np.array_equal(np.unique(lbl_tb_cropped), classes):
x_inds[:-cropped_length] = WindowDataset.INVALID_WINDOW_VAL
return spect_id_vector[-cropped_length:], spect_inds_vector[-cropped_length:], x_inds
as spotted by @yardencsGitHub
in line 312, the variable
lbl_tb_croppedshould be justlbl_tb-- not the vector that's been cropped already. As currently written, this would have the effect of "cropping" the dataset twicehttps://github.com/NickleDave/vak/blob/68bba5865436ec7d705fdca82b4ee021dc86bf81/src/vak/datasets/window_dataset.py#L312