Skip to content

Commit

Permalink
cf in percentages
Browse files Browse the repository at this point in the history
  • Loading branch information
kapoorlab committed Jul 22, 2024
1 parent c2266ab commit c7a9639
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/napatrackmater/Trackvector.py
Original file line number Diff line number Diff line change
Expand Up @@ -4039,14 +4039,16 @@ def sample_subarrays(data, num_samples, tracklet_length, total_duration):
if sub_data.shape[0] == tracklet_length:
subarrays.append(sub_data)

while len(subarrays) < num_samples:
start_index = np.random.randint(0, total_duration - tracklet_length)
end_index = start_index + tracklet_length
if end_index <= total_duration:

if len(subarrays) < num_samples:
additional_subarrays = []
for i in range(num_samples - len(subarrays)):
start_index = np.random.randint(0, total_duration - tracklet_length)
end_index = start_index + tracklet_length
sub_data = data[start_index:end_index, :]
if sub_data.shape[0] == tracklet_length:
subarrays.append(sub_data)

additional_subarrays.append(sub_data)
subarrays.extend(additional_subarrays[: num_samples - len(subarrays)])

return subarrays

Expand Down

0 comments on commit c7a9639

Please sign in to comment.