DR-DOH / HFO-detector

0 stars 2 forks source link

Replace while loops with for loops #10

Open Aleman-Z opened 3 years ago

Aleman-Z commented 3 years ago

For some while loops used it can be known in advance when they will break, so could be replaced with for loops which have the advantage of possibly being replaced by parfors to speed up the computation.

Aleman-Z commented 3 years ago

https://github.com/Aleman-Z/HFO-detector/blob/main/Scripts%20Updated/threshold_power.m#L13

Aleman-Z commented 3 years ago

https://github.com/Aleman-Z/HFO-detector/blob/main/Scripts%20Updated/moving_window_ripples_power.m#L40

DR-DOH commented 3 years ago

It can't be done for moving_window_ripples_power because the array wouldn't be split equally. We find the first occurrence of a positive event and then keep finding boundaries till conditions are met. In cases like these parfor wouldn't be suitable

DR-DOH commented 3 years ago

I've changed the while to parfor in threshold_powe