MarineBioAcousticsRC / DetEdit

A graphical user interface for annotating and editing events detected in long-term acoustic monitoring data
https://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1007598
Other
23 stars 12 forks source link

mkLTSAsessions bug if time is found in 2 LTSAs #40

Open kfrasier opened 5 years ago

kfrasier commented 5 years ago

@asolsonaberga on line ~173 in mkLTSAsessions, this code that catches the case where K has multiple items doesn't seem to work right:

if length(K) > 1 K = find(sTime(k) <= sb(k) & eTime(k) >= eb(k)); end

sTime and eTime are generally shorter than k (lowercase) so I'm getting a crash. Should it be stime(K) and eTime(K) instead? But then I think that doesn't change what K ends up being...

Do you remember what the intended output was?

asolsonaberga commented 5 years ago

Ohh!! I see now what you mean. So yes the K will give the index to the ltsas that match the current bout (bout index like k). If multiple ltsas fit in this encounter, then K would be bigger than 1. But even if you put this line like

if length(K) > 1 for i: 1:length(K) K{i} = find(sTime(K{i}) <= sb(k) & eTime(K{i}) >= eb(k)); end end

But still, I do not understand why we need to keep the multiple ltsas, because in theory the encounter should be correlated to one ltsa, and this problem should not happen.