hglanz / AcousticsApp-Summer2019

GNU General Public License v3.0
0 stars 0 forks source link

Descriptive Stats for Segments #12

Closed mschrothglanz closed 4 years ago

mschrothglanz commented 5 years ago

@hglanz @michalg04

Here are the descriptive stats that could be useful for each of the segments: Max frequency, min frequency, (and thus frequency range: max f - min f), Max time, min time, and thus time range Peak frequency: frequency with the largest amplitude

Of course knowing what type of call would help, but I don't think that is achievable at this point.

michalg04 commented 5 years ago

The new segmentation method I'm using is basing the segmentation on amplitude changes (the screenshots below is what I have so far). I've been working on finding the frequency range using the spectrogram from our exploration tab, since this function doesn't give any frequency details. I'm running into some problems with the frequency and having to use the -29 trick as well as the minimum frequency always showing as 0. Do you have any suggestions? Does what I have so far look good? @mschrothglanz @hglanz

Screen Shot 2019-07-25 at 1 17 16 PM Screen Shot 2019-07-25 at 1 17 28 PM
hglanz commented 5 years ago

@michalg04 this looks amazing! I'm not sure that we care about the peaks/bursts as much as the segments, so for right now let's take the peaks/bursts table off of this page.

Other notes:

Let us know if you have questions or how this goes! Sorry for the delay in response.

michalg04 commented 5 years ago

@hglanz I'm not sure if I can give the segmentation method that specification change but I'll keep working on it and see what I can get for the amplitude (y) vs. frequency (x). Will make the other changes as well. Thanks!

michalg04 commented 5 years ago

I used a similar idea to what @mschrothglanz suggested. Using the spec() function I got a graph that was amplitude (y) vs. frequency (x) and just extracted min and max frequency for a given time frame (the time frame was determined by the segment). I also found a function that returns dominant frequency - dfreq() i.e. the frequency of highest amplitude, which sounded like what we were looking for. This all works much faster than the previous function and barely takes any time to load. Let me know what you think! @hglanz @mschrothglanz

Screen Shot 2019-07-29 at 5 59 51 PM
mschrothglanz commented 5 years ago

@michalg04 This seems great! I'm a little confused that the min frequencies printed are all 0..... Would it be possible to show the "box" around the segment on the spectrogram graph? That way, it can be easily seen that the min frequency is 0. What do you think @hglanz?

hglanz commented 5 years ago

So it sounds like there are (at least) two things to address in @mschrothglanz comment that I agree with:

  1. It sounds like it would be nice to also see the segmentation results on the spectrogram. This could mean that it would be nice to reproduce the spectrogram on the segmentation tab. With this, it could be pretty cool to be able to click on a segment (row in the table) and have the box appear on the spectrogram. Reproducing the spectrogram feels a little redundant right now, but I still think we should try this out and then revise after.

  2. Perhaps only after (1) is done (?), resolve the min freq being 0 “issue”.

mschrothglanz commented 5 years ago

That seems like a good game plan to me.

michalg04 commented 5 years ago

So since I'm getting min/max frequency from a graph that is amplitude (y) vs. frequency (x), it's using a spectrum function and not a spectrogram. Should that graph be plotted so we can see min and max points clearly like where the min freq is 0 or do you want just the spectrogram from the exploration page? I think it would be more clear if we use the spectrum as to why min/max are what they are. @hglanz @mschrothglanz

mschrothglanz commented 5 years ago

@michalg04 Hmmm, that's interesting. I would think that the spectrogram would be the more useful tool for graphing each segment in a box. I understand your point about the spectrum function, but it seems most useful if the viewer can see everything on one graph and the spectrogram graph allows for this. I'm thinking, if you can, to start with the spectrogram and then include the spectrum if need be. Does that work? @hglanz

hglanz commented 5 years ago

Yeah, sounds good to start with.

michalg04 commented 5 years ago

Just to clarify, I should still be finding min/max frequency from the spectrum graph that is amplitude (y) vs. frequency (x), but plotting a spectrogram and using the time axis to find each segment on the spectrogram? Also, for the box, I assume that the length would be the time length of the segment but would the height be frequency range? @mschrothglanz @hglanz

mschrothglanz commented 5 years ago

If I'm understanding you correctly, that all sounds good to me!

michalg04 commented 5 years ago

@hglanz @mschrothglanz Here is an example with the dolphin file and whale files (the highlighted rows were clicked on):

Screen Shot 2019-07-31 at 11 04 45 AM

The dolphin min freq aren't exactly 0 like the whale's so we can see the min freq isn't always just 0.

Screen Shot 2019-07-31 at 11 04 00 AM

These are actually boxes and not just two lines as we can see if we don't set the limits like we do in the exploration page.

Screen Shot 2019-07-31 at 11 37 52 AM

The freq min and max in the exploration page is calculated using spectro() function (spectrogram) and then the min is set to 0 and the max is set with the -29 trick, whereas I get the min and max frequency from the spec() function (spectrum) which gives a wider range of max frequency which is why the red boxes appear as red lines. If we wanted to boxes to be a bit tighter maybe we can decide on an amplitude threshold? or I could go with -29 again? But overall the segmentation tab is working nicely and it's pretty fast so far and no weird bugs!

hglanz commented 5 years ago

@michalg04 this looks so awesome!!! Ideas:

michalg04 commented 5 years ago

@hglanz Most of the segments for dolphin and whale respectively looked like this:

Screen Shot 2019-08-01 at 2 49 04 PM Screen Shot 2019-08-01 at 2 48 53 PM

I'm a little bit confused about the color scale since we can clearly see here and in the spectrum that the amplitude can range beyond -30. I played around with it a bit and got to a threshold (-35) that works well and encloses the segments more but I still can't really explain why -35 works if the scale shows that it only goes to -30. Here is what it looks like with the threshold:

Screen Shot 2019-08-01 at 2 50 13 PM Screen Shot 2019-08-01 at 2 51 08 PM

Lastly, I think what @mschrothglanz suggested looks good:

Screen Shot 2019-08-01 at 3 29 07 PM
hglanz commented 5 years ago

@michalg04 in the whale histogram are you able to see the cluster of really negative amplitudes (-120 to -90) in the spectrogram as some color? That far left hump is puzzling me a lot.

Otherwise everything sounds and looks great!

michalg04 commented 5 years ago

@hglanz I made boxes around -90 to -120 amplitudes and they just look white. We can't see a lot of them since the limits we put on the spectrogram don't go pass frequency of 3 for the whale.

Screen Shot 2019-08-02 at 6 59 00 PM
hglanz commented 5 years ago

@michalg04 ok I think this is a good sign that your threshold of -35 or around there is probably good. I think you’re going down good paths :)