caiostringari / pywavelearn

Tools for machine learning in wave science
GNU General Public License v2.0
17 stars 2 forks source link

newUserSpinup #1

Open SBFRF opened 5 years ago

SBFRF commented 5 years ago

Hey, read the paper, really interested in using this to track wave breaking across the surfzone. I'm trying to use the detect_breaking_events function from the scripts library, but i don't seem to see a way. Am i missing something? Do i have to redefine function as you have it or is there a way to import the function and start using it?

Thanks,

Spicer

caiostringari commented 5 years ago

Hi Spicer,

You could either redefine the function (see this notebook https://github.com/caiostringari/pywavelearn/blob/master/notebooks/wave-tracking/wave-tracking-omb.ipynb) or import it.

I've just pushed some updates that should make it easier. Try re-installing and then:

from pywavelearn.tracking import detect_breaking_events

If you are getting errors let me know and I will try to fix them. Please notice that I am finishing my PhD project this month and may not have time to work on fixing bugs promptly.

I am also planning a full re-factorization of the code in October.

Cheers,

Caio

SBFRF commented 5 years ago

Hey Caio, yea i had just copied the function and made a little library, locally to solve my problem. I tried your notebook with a timestack of mine and i don't seem to be getting good results, modifying your notebook (changing the colors the method is trained on and the analysis bounds) with my image i got the below image.

while it's not the initial issue, i am happy to open a new one on topic, but any pointers or help are appreciated.

image

caiostringari commented 5 years ago

Hi,

The residual foam in the surf zone seems to be being picked up by the algorithm.

You can try few different parameters to see if the results improve. For example:

# define which algorithm is used to detect breaking events
brk_alg = 'colour'  # -> change to edges and/or edges_and_colour
# metric used for pixel intensity definition
px_mtrc = 'lightness'
# colour quantization - We will NOT use this for now
qnt_cl = False
n_clrs = None
# peak detection method
pxp_mtd = 'local_maxima'  # -> change to differential
# threshold for peak detection
px_trsh = 0.2 # -> try to increase/reduce this value
# pixel window for denoise_bilateral
px_wndw = 5 # -> try to increase this value
# time window for peak detection
ts_wndw = 11 # -> try to increase this value
# minimum number of samples to be used for the DBSCAN clustering step
dbs_msp = 15 
# minimum distance be used for the DBSCAN clustering step
dbs_eps = 0.0015

and then call

detect_breaking_events(time, crx_dist, rgb, crx_start=None,
                           crx_end=None, px_mtrc="lightness", colours=None,
                           resample_rule="100L", algorithm="peaks",
                           peak_detection="local_maxima", posterize=False,
                           ncolours=0, threshold=0.1, tswindow=11,
                           denoise=True, pxwindow=3, mask_drysand=False)