Skip to content

Commit

Permalink
truncate loaded samples to available region
Browse files Browse the repository at this point in the history
  • Loading branch information
Chilipp committed Apr 5, 2019
1 parent a3c3492 commit 03fb21c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion straditize/widgets/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,13 @@ def load_samples(self, fname=None):
samples = self.straditizer.data2px_y(samples)
except ValueError:
pass
self.straditizer.data_reader.add_samples(samples.astype(int))
# HACK: truncate to the available data region
# This could be better solved through a dialog with the user...
maxy = len(self.reader._full_df) - 1
samples[samples < 0] = 0
samples[samples > maxy] = maxy
self.straditizer.data_reader.add_samples(
np.unique(samples.astype(int)))
self.straditizer_widgets.refresh()

def edit_samples(self):
Expand Down

0 comments on commit 03fb21c

Please sign in to comment.