[Scilab-users] find and locate local maxima

classic Classic list List threaded Threaded
13 messages Options
David Chèze David Chèze
Reply | Threaded
Open this post in threaded view
|

[Scilab-users] find and locate local maxima

Hi all,

 

I’m looking for function that could find and locate every local maxima of any discrete time signal (timeseries), similar to Matlab or Octave function findpeaks(), scipy find_peaks(). Is anyone aware if something similar is already available in Scilab ? (I already browsed a little bit and it don’t seem so…)

If not in Scilab macros, any hint to use the Octave or scipy function directly from Scilab?

More globally it seems that Octave Forge could be linked with Python (from oct2py import octave

# Load the Octage-Forge signal package.

octave.eval("pkg load signal")), does someone ever tried to bridge similarly in Scilab ? oct2sci

 

Kind regards,

 

David

 


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Clément David-3 Clément David-3
Reply | Threaded
Open this post in threaded view
|

Re: find and locate local maxima

Hello David,

 

After reading the Matlab documentation page, it seems pretty simple to implement using Scilab : and $ symbols:

 

function [pks, locs]=findpeaks(data)

    ii = find(d(1:$-2) < d(2:$-1) & d(2:$-1) >= d(3:$));

    pks = data(ii+2);

    locs = ii + 2;

endfunction

 

data = [25 8 15 5 6 10 10 3 1 20 7];

plot(data)

 

[pks,locs] = findpeaks(data);

plot(locs, pks, 'xr');

 

Note: using oct2py and pims might also be an option for simple cases but these wrappers are complex to use and data need to be copied at language boundaries.

 

Regards,

 

Clément

 

From: users <[hidden email]> On Behalf Of CHEZE David 227480
Sent: Tuesday, March 16, 2021 2:53 PM
To: Users mailing list for Scilab <[hidden email]>
Subject: [Scilab-users] find and locate local maxima

 

Hi all,

 

I’m looking for function that could find and locate every local maxima of any discrete time signal (timeseries), similar to Matlab or Octave function findpeaks(), scipy find_peaks(). Is anyone aware if something similar is already available in Scilab ? (I already browsed a little bit and it don’t seem so…)

If not in Scilab macros, any hint to use the Octave or scipy function directly from Scilab?

More globally it seems that Octave Forge could be linked with Python (from oct2py import octave

# Load the Octage-Forge signal package.

octave.eval("pkg load signal")), does someone ever tried to bridge similarly in Scilab ? oct2sci

 

Kind regards,

 

David

 


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
David Chèze David Chèze
Reply | Threaded
Open this post in threaded view
|

Re: find and locate local maxima

Hi Clément,

 

Thank you for your quick reply and solution ! Actually it’s working for simple data but with noisy experimental timeseries, some filtering is required to get perfect regular signal (between the ‘true’ extrema) that could be then managed by the routine. I suppose this is something the Matlab/Octave is handling internally, with some parameters as function’s argument to tune it, maybe it’s not the case .

 

Regards,

 

David

 

 

De : users <[hidden email]> De la part de Clément David
Envoyé : mardi 16 mars 2021 16:27
À : Users mailing list for Scilab <[hidden email]>
Objet : Re: [Scilab-users] find and locate local maxima

 

Hello David,

 

After reading the Matlab documentation page, it seems pretty simple to implement using Scilab : and $ symbols:

 

function [pks, locs]=findpeaks(data)

    ii = find(d(1:$-2) < d(2:$-1) & d(2:$-1) >= d(3:$));

    pks = data(ii+2);

    locs = ii + 2;

endfunction

 

data = [25 8 15 5 6 10 10 3 1 20 7];

plot(data)

 

[pks,locs] = findpeaks(data);

plot(locs, pks, 'xr');

 

Note: using oct2py and pims might also be an option for simple cases but these wrappers are complex to use and data need to be copied at language boundaries.

 

Regards,

 

Clément

 

From: users <[hidden email]> On Behalf Of CHEZE David 227480
Sent: Tuesday, March 16, 2021 2:53 PM
To: Users mailing list for Scilab <[hidden email]>
Subject: [Scilab-users] find and locate local maxima

 

Hi all,

 

I’m looking for function that could find and locate every local maxima of any discrete time signal (timeseries), similar to Matlab or Octave function findpeaks(), scipy find_peaks(). Is anyone aware if something similar is already available in Scilab ? (I already browsed a little bit and it don’t seem so…)

If not in Scilab macros, any hint to use the Octave or scipy function directly from Scilab?

More globally it seems that Octave Forge could be linked with Python (from oct2py import octave

# Load the Octage-Forge signal package.

octave.eval("pkg load signal")), does someone ever tried to bridge similarly in Scilab ? oct2sci

 

Kind regards,

 

David

 


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
mottelet mottelet
Reply | Threaded
Open this post in threaded view
|

Re: find and locate local maxima

Hi

For real life signals you should rather use something like this (Savitsky-Golay filters)

https://codereview.scilab.org/#/c/21499/

S.

Le 16/03/2021 à 17:09, CHEZE David 227480 a écrit :

Hi Clément,

 

Thank you for your quick reply and solution ! Actually it’s working for simple data but with noisy experimental timeseries, some filtering is required to get perfect regular signal (between the ‘true’ extrema) that could be then managed by the routine. I suppose this is something the Matlab/Octave is handling internally, with some parameters as function’s argument to tune it, maybe it’s not the case .

 

Regards,

 

David

 

 

De : users [hidden email] De la part de Clément David
Envoyé : mardi 16 mars 2021 16:27
À : Users mailing list for Scilab [hidden email]
Objet : Re: [Scilab-users] find and locate local maxima

 

Hello David,

 

After reading the Matlab documentation page, it seems pretty simple to implement using Scilab : and $ symbols:

 

function [pks, locs]=findpeaks(data)

    ii = find(d(1:$-2) < d(2:$-1) & d(2:$-1) >= d(3:$));

    pks = data(ii+2);

    locs = ii + 2;

endfunction

 

data = [25 8 15 5 6 10 10 3 1 20 7];

plot(data)

 

[pks,locs] = findpeaks(data);

plot(locs, pks, 'xr');

 

Note: using oct2py and pims might also be an option for simple cases but these wrappers are complex to use and data need to be copied at language boundaries.

 

Regards,

 

Clément

 

From: users <[hidden email]> On Behalf Of CHEZE David 227480
Sent: Tuesday, March 16, 2021 2:53 PM
To: Users mailing list for Scilab <[hidden email]>
Subject: [Scilab-users] find and locate local maxima

 

Hi all,

 

I’m looking for function that could find and locate every local maxima of any discrete time signal (timeseries), similar to Matlab or Octave function findpeaks(), scipy find_peaks(). Is anyone aware if something similar is already available in Scilab ? (I already browsed a little bit and it don’t seem so…)

If not in Scilab macros, any hint to use the Octave or scipy function directly from Scilab?

More globally it seems that Octave Forge could be linked with Python (from oct2py import octave

# Load the Octage-Forge signal package.

octave.eval("pkg load signal")), does someone ever tried to bridge similarly in Scilab ? oct2sci

 

Kind regards,

 

David

 


_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Claus Futtrup Claus Futtrup
Reply | Threaded
Open this post in threaded view
|

Re: find and locate local maxima

Hi Stéphane

It looks very nice and I hope it will be added to Scilab as proposed by your code review. Why does it say in red print "Cannot Merge" ?

/Claus

On 16-03-2021 17:45, Stéphane Mottelet wrote:

Hi

For real life signals you should rather use something like this (Savitsky-Golay filters)

https://codereview.scilab.org/#/c/21499/

S.

Le 16/03/2021 à 17:09, CHEZE David 227480 a écrit :

Hi Clément,

 

Thank you for your quick reply and solution ! Actually it’s working for simple data but with noisy experimental timeseries, some filtering is required to get perfect regular signal (between the ‘true’ extrema) that could be then managed by the routine. I suppose this is something the Matlab/Octave is handling internally, with some parameters as function’s argument to tune it, maybe it’s not the case .

 

Regards,

 

David

 

 

De : users [hidden email] De la part de Clément David
Envoyé : mardi 16 mars 2021 16:27
À : Users mailing list for Scilab [hidden email]
Objet : Re: [Scilab-users] find and locate local maxima

 

Hello David,

 

After reading the Matlab documentation page, it seems pretty simple to implement using Scilab : and $ symbols:

 

function [pks, locs]=findpeaks(data)

    ii = find(d(1:$-2) < d(2:$-1) & d(2:$-1) >= d(3:$));

    pks = data(ii+2);

    locs = ii + 2;

endfunction

 

data = [25 8 15 5 6 10 10 3 1 20 7];

plot(data)

 

[pks,locs] = findpeaks(data);

plot(locs, pks, 'xr');

 

Note: using oct2py and pims might also be an option for simple cases but these wrappers are complex to use and data need to be copied at language boundaries.

 

Regards,

 

Clément

 

From: users <[hidden email]> On Behalf Of CHEZE David 227480
Sent: Tuesday, March 16, 2021 2:53 PM
To: Users mailing list for Scilab <[hidden email]>
Subject: [Scilab-users] find and locate local maxima

 

Hi all,

 

I’m looking for function that could find and locate every local maxima of any discrete time signal (timeseries), similar to Matlab or Octave function findpeaks(), scipy find_peaks(). Is anyone aware if something similar is already available in Scilab ? (I already browsed a little bit and it don’t seem so…)

If not in Scilab macros, any hint to use the Octave or scipy function directly from Scilab?

More globally it seems that Octave Forge could be linked with Python (from oct2py import octave

# Load the Octage-Forge signal package.

octave.eval("pkg load signal")), does someone ever tried to bridge similarly in Scilab ? oct2sci

 

Kind regards,

 

David

 


_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
fmiyara fmiyara
Reply | Threaded
Open this post in threaded view
|

Re: find and locate local maxima

In reply to this post by David Chèze

David:

Just in case it is useful for your purpose, I'm attaching a flexible localmax function.

To filter out noisy signals you could use a low-pass filter or lsq_splin() which can also remove multivalued data from replicated experiments.

Regards,

Federico Miyara

On 16/03/2021 10:52, CHEZE David 227480 wrote:

Hi all,

 

I’m looking for function that could find and locate every local maxima of any discrete time signal (timeseries), similar to Matlab or Octave function findpeaks(), scipy find_peaks(). Is anyone aware if something similar is already available in Scilab ? (I already browsed a little bit and it don’t seem so…)

If not in Scilab macros, any hint to use the Octave or scipy function directly from Scilab?

More globally it seems that Octave Forge could be linked with Python (from oct2py import octave

# Load the Octage-Forge signal package.

octave.eval("pkg load signal")), does someone ever tried to bridge similarly in Scilab ? oct2sci

 

Kind regards,

 

David

 


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users


Libre de virus. www.avast.com

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

localmax.sci (2K) Download Attachment
Dang Ngoc Chan, Christophe Dang Ngoc Chan, Christophe
Reply | Threaded
Open this post in threaded view
|

Re: find and locate local maxima

In reply to this post by David Chèze
Hello,

> De : users <[hidden email]> De la part de CHEZE David
> 227480 Envoyé : mardi 16 mars 2021 14:53
>
> I'm looking for function that could find and locate every local maxima
> of any discrete time signal

I suggest you to detect the local minima of the second derivative obtained by the Savitzky-Golay algorithm (to reduce the problem of the noise).

You can find an implementation here:

https://commons.wikimedia.org/wiki/File:Savitzky-golay_pic_gaussien_bruite.svg

HTH

Regards


--
Christophe Dang Ngoc Chan
Mechanical calculation engineer


General
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
David Chèze David Chèze
Reply | Threaded
Open this post in threaded view
|

Re: find and locate local maxima

In reply to this post by fmiyara

Thank you all for your quick and rich solutions !

Indeed the Savitsky-Golay filters look especially good to properly smooth the data before hunting the remaining true extrema. Waiting for the coming next Scilab 6.1.0 that will include this feature, meanwhile I will give a try with more common filters.

 

Kind regards,

 

David


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Clément David-3 Clément David-3
Reply | Threaded
Open this post in threaded view
|

Re: find and locate local maxima

In reply to this post by Claus Futtrup

Hello all,

 

I take your question as a way to explain / remind how we validate user contributions into the Scilab source code. Any change to the source code should be pushed to the codereview.scilab.org website (this is a gerrit instant, a git server that help reviewing changes). This help testing on multiple machines/OS/compilers and review the content ; any user can comment and give +1/-1 on a change. After there is no disagreement, we merge it into the Scilab source code.

 

The “Cannot merge” error is an alert to the reviewer, this commit need to be rebase (refreshed) against the latest source code ; this is not a blocker for the review but rather for a one-click merge 😊.

 

Regards,

 

Clément

 

From: users <[hidden email]> On Behalf Of Claus Futtrup
Sent: Tuesday, March 16, 2021 7:40 PM
To: [hidden email]
Subject: Re: [Scilab-users] find and locate local maxima

 

Hi Stéphane

 

It looks very nice and I hope it will be added to Scilab as proposed by your code review. Why does it say in red print "Cannot Merge" ?

 

/Claus

 

On 16-03-2021 17:45, Stéphane Mottelet wrote:

Hi

For real life signals you should rather use something like this (Savitsky-Golay filters)

https://codereview.scilab.org/#/c/21499/

S.

Le 16/03/2021 à 17:09, CHEZE David 227480 a écrit :

Hi Clément,

 

Thank you for your quick reply and solution ! Actually it’s working for simple data but with noisy experimental timeseries, some filtering is required to get perfect regular signal (between the ‘true’ extrema) that could be then managed by the routine. I suppose this is something the Matlab/Octave is handling internally, with some parameters as function’s argument to tune it, maybe it’s not the case .

 

Regards,

 

David

 

 

De : users [hidden email] De la part de Clément David
Envoyé : mardi 16 mars 2021 16:27
À : Users mailing list for Scilab [hidden email]
Objet : Re: [Scilab-users] find and locate local maxima

 

Hello David,

 

After reading the Matlab documentation page, it seems pretty simple to implement using Scilab : and $ symbols:

 

function [pks, locs]=findpeaks(data)

    ii = find(d(1:$-2) < d(2:$-1) & d(2:$-1) >= d(3:$));

    pks = data(ii+2);

    locs = ii + 2;

endfunction

 

data = [25 8 15 5 6 10 10 3 1 20 7];

plot(data)

 

[pks,locs] = findpeaks(data);

plot(locs, pks, 'xr');

 

Note: using oct2py and pims might also be an option for simple cases but these wrappers are complex to use and data need to be copied at language boundaries.

 

Regards,

 

Clément

 

From: users <[hidden email]> On Behalf Of CHEZE David 227480
Sent: Tuesday, March 16, 2021 2:53 PM
To: Users mailing list for Scilab <[hidden email]>
Subject: [Scilab-users] find and locate local maxima

 

Hi all,

 

I’m looking for function that could find and locate every local maxima of any discrete time signal (timeseries), similar to Matlab or Octave function findpeaks(), scipy find_peaks(). Is anyone aware if something similar is already available in Scilab ? (I already browsed a little bit and it don’t seem so…)

If not in Scilab macros, any hint to use the Octave or scipy function directly from Scilab?

More globally it seems that Octave Forge could be linked with Python (from oct2py import octave

# Load the Octage-Forge signal package.

octave.eval("pkg load signal")), does someone ever tried to bridge similarly in Scilab ? oct2sci

 

Kind regards,

 

David

 



_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

 


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
mottelet mottelet
Reply | Threaded
Open this post in threaded view
|

Re: find and locate local maxima

Thanks Clément.

Interested users can readily download the files if they want to test the implementation even if it has not been reviewed. Particularly, it has not been discussed if we want to stick to the Matlab's implementation and API for this particular feature. Comments are welcome.

S.

Le 17/03/2021 à 10:19, Clément David a écrit :

Hello all,

 

I take your question as a way to explain / remind how we validate user contributions into the Scilab source code. Any change to the source code should be pushed to the codereview.scilab.org website (this is a gerrit instant, a git server that help reviewing changes). This help testing on multiple machines/OS/compilers and review the content ; any user can comment and give +1/-1 on a change. After there is no disagreement, we merge it into the Scilab source code.

 

The “Cannot merge” error is an alert to the reviewer, this commit need to be rebase (refreshed) against the latest source code ; this is not a blocker for the review but rather for a one-click merge 😊.

 

Regards,

 

Clément

 

From: users [hidden email] On Behalf Of Claus Futtrup
Sent: Tuesday, March 16, 2021 7:40 PM
To: [hidden email]
Subject: Re: [Scilab-users] find and locate local maxima

 

Hi Stéphane

 

It looks very nice and I hope it will be added to Scilab as proposed by your code review. Why does it say in red print "Cannot Merge" ?

 

/Claus

 

On 16-03-2021 17:45, Stéphane Mottelet wrote:

Hi

For real life signals you should rather use something like this (Savitsky-Golay filters)

https://codereview.scilab.org/#/c/21499/

S.

Le 16/03/2021 à 17:09, CHEZE David 227480 a écrit :

Hi Clément,

 

Thank you for your quick reply and solution ! Actually it’s working for simple data but with noisy experimental timeseries, some filtering is required to get perfect regular signal (between the ‘true’ extrema) that could be then managed by the routine. I suppose this is something the Matlab/Octave is handling internally, with some parameters as function’s argument to tune it, maybe it’s not the case .

 

Regards,

 

David

 

 

De : users [hidden email] De la part de Clément David
Envoyé : mardi 16 mars 2021 16:27
À : Users mailing list for Scilab [hidden email]
Objet : Re: [Scilab-users] find and locate local maxima

 

Hello David,

 

After reading the Matlab documentation page, it seems pretty simple to implement using Scilab : and $ symbols:

 

function [pks, locs]=findpeaks(data)

    ii = find(d(1:$-2) < d(2:$-1) & d(2:$-1) >= d(3:$));

    pks = data(ii+2);

    locs = ii + 2;

endfunction

 

data = [25 8 15 5 6 10 10 3 1 20 7];

plot(data)

 

[pks,locs] = findpeaks(data);

plot(locs, pks, 'xr');

 

Note: using oct2py and pims might also be an option for simple cases but these wrappers are complex to use and data need to be copied at language boundaries.

 

Regards,

 

Clément

 

From: users <[hidden email]> On Behalf Of CHEZE David 227480
Sent: Tuesday, March 16, 2021 2:53 PM
To: Users mailing list for Scilab <[hidden email]>
Subject: [Scilab-users] find and locate local maxima

 

Hi all,

 

I’m looking for function that could find and locate every local maxima of any discrete time signal (timeseries), similar to Matlab or Octave function findpeaks(), scipy find_peaks(). Is anyone aware if something similar is already available in Scilab ? (I already browsed a little bit and it don’t seem so…)

If not in Scilab macros, any hint to use the Octave or scipy function directly from Scilab?

More globally it seems that Octave Forge could be linked with Python (from oct2py import octave

# Load the Octage-Forge signal package.

octave.eval("pkg load signal")), does someone ever tried to bridge similarly in Scilab ? oct2sci

 

Kind regards,

 

David

 



_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

 


_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
David Chèze David Chèze
Reply | Threaded
Open this post in threaded view
|

Re: find and locate local maxima

Hi all,

 

I’d be glad obviously to download the whole package to test it and report my experience :  I’m not use with the ‘review interface’ is there any way to download the whole package or I just retrieve files one by one ?

 

Thanks,

 

David

 

 

 

De : users <[hidden email]> De la part de Stéphane Mottelet
Envoyé : mercredi 17 mars 2021 10:40
À : [hidden email]
Objet : Re: [Scilab-users] find and locate local maxima

 

Thanks Clément.

Interested users can readily download the files if they want to test the implementation even if it has not been reviewed. Particularly, it has not been discussed if we want to stick to the Matlab's implementation and API for this particular feature. Comments are welcome.

S.

Le 17/03/2021 à 10:19, Clément David a écrit :

Hello all,

 

I take your question as a way to explain / remind how we validate user contributions into the Scilab source code. Any change to the source code should be pushed to the codereview.scilab.org website (this is a gerrit instant, a git server that help reviewing changes). This help testing on multiple machines/OS/compilers and review the content ; any user can comment and give +1/-1 on a change. After there is no disagreement, we merge it into the Scilab source code.

 

The “Cannot merge” error is an alert to the reviewer, this commit need to be rebase (refreshed) against the latest source code ; this is not a blocker for the review but rather for a one-click merge 😊.

 

Regards,

 

Clément

 

From: users [hidden email] On Behalf Of Claus Futtrup
Sent: Tuesday, March 16, 2021 7:40 PM
To: [hidden email]
Subject: Re: [Scilab-users] find and locate local maxima

 

Hi Stéphane

 

It looks very nice and I hope it will be added to Scilab as proposed by your code review. Why does it say in red print "Cannot Merge" ?

 

/Claus

 

On 16-03-2021 17:45, Stéphane Mottelet wrote:

Hi

For real life signals you should rather use something like this (Savitsky-Golay filters)

https://codereview.scilab.org/#/c/21499/

S.

Le 16/03/2021 à 17:09, CHEZE David 227480 a écrit :

Hi Clément,

 

Thank you for your quick reply and solution ! Actually it’s working for simple data but with noisy experimental timeseries, some filtering is required to get perfect regular signal (between the ‘true’ extrema) that could be then managed by the routine. I suppose this is something the Matlab/Octave is handling internally, with some parameters as function’s argument to tune it, maybe it’s not the case .

 

Regards,

 

David

 

 

De : users [hidden email] De la part de Clément David
Envoyé : mardi 16 mars 2021 16:27
À : Users mailing list for Scilab [hidden email]
Objet : Re: [Scilab-users] find and locate local maxima

 

Hello David,

 

After reading the Matlab documentation page, it seems pretty simple to implement using Scilab : and $ symbols:

 

function [pks, locs]=findpeaks(data)

    ii = find(d(1:$-2) < d(2:$-1) & d(2:$-1) >= d(3:$));

    pks = data(ii+2);

    locs = ii + 2;

endfunction

 

data = [25 8 15 5 6 10 10 3 1 20 7];

plot(data)

 

[pks,locs] = findpeaks(data);

plot(locs, pks, 'xr');

 

Note: using oct2py and pims might also be an option for simple cases but these wrappers are complex to use and data need to be copied at language boundaries.

 

Regards,

 

Clément

 

From: users <[hidden email]> On Behalf Of CHEZE David 227480
Sent: Tuesday, March 16, 2021 2:53 PM
To: Users mailing list for Scilab <[hidden email]>
Subject: [Scilab-users] find and locate local maxima

 

Hi all,

 

I’m looking for function that could find and locate every local maxima of any discrete time signal (timeseries), similar to Matlab or Octave function findpeaks(), scipy find_peaks(). Is anyone aware if something similar is already available in Scilab ? (I already browsed a little bit and it don’t seem so…)

If not in Scilab macros, any hint to use the Octave or scipy function directly from Scilab?

More globally it seems that Octave Forge could be linked with Python (from oct2py import octave

# Load the Octage-Forge signal package.

octave.eval("pkg load signal")), does someone ever tried to bridge similarly in Scilab ? oct2sci

 

Kind regards,

 

David

 




_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet




_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

 



_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Clément David-3 Clément David-3
Reply | Threaded
Open this post in threaded view
|

Re: find and locate local maxima

Hello David,

 

I merged the change, it is now available on Scilab nightly build and on all CI builds after scilab-6.1-windows-64 #4595 [Jenkins] . Feel free to open bugs or reply on this thread if you have comments on this new feature.

 

Thanks,

 

Clément

 

From: users <[hidden email]> On Behalf Of CHEZE David 227480
Sent: Thursday, March 18, 2021 12:44 PM
To: Users mailing list for Scilab <[hidden email]>
Subject: Re: [Scilab-users] find and locate local maxima

 

Hi all,

 

I’d be glad obviously to download the whole package to test it and report my experience :  I’m not use with the ‘review interface’ is there any way to download the whole package or I just retrieve files one by one ?

 

Thanks,

 

David

 

 

 

De : users <[hidden email]> De la part de Stéphane Mottelet
Envoyé : mercredi 17 mars 2021 10:40
À : [hidden email]
Objet : Re: [Scilab-users] find and locate local maxima

 

Thanks Clément.

Interested users can readily download the files if they want to test the implementation even if it has not been reviewed. Particularly, it has not been discussed if we want to stick to the Matlab's implementation and API for this particular feature. Comments are welcome.

S.

Le 17/03/2021 à 10:19, Clément David a écrit :

Hello all,

 

I take your question as a way to explain / remind how we validate user contributions into the Scilab source code. Any change to the source code should be pushed to the codereview.scilab.org website (this is a gerrit instant, a git server that help reviewing changes). This help testing on multiple machines/OS/compilers and review the content ; any user can comment and give +1/-1 on a change. After there is no disagreement, we merge it into the Scilab source code.

 

The “Cannot merge” error is an alert to the reviewer, this commit need to be rebase (refreshed) against the latest source code ; this is not a blocker for the review but rather for a one-click merge 😊.

 

Regards,

 

Clément

 

From: users [hidden email] On Behalf Of Claus Futtrup
Sent: Tuesday, March 16, 2021 7:40 PM
To: [hidden email]
Subject: Re: [Scilab-users] find and locate local maxima

 

Hi Stéphane

 

It looks very nice and I hope it will be added to Scilab as proposed by your code review. Why does it say in red print "Cannot Merge" ?

 

/Claus

 

On 16-03-2021 17:45, Stéphane Mottelet wrote:

Hi

For real life signals you should rather use something like this (Savitsky-Golay filters)

https://codereview.scilab.org/#/c/21499/

S.

Le 16/03/2021 à 17:09, CHEZE David 227480 a écrit :

Hi Clément,

 

Thank you for your quick reply and solution ! Actually it’s working for simple data but with noisy experimental timeseries, some filtering is required to get perfect regular signal (between the ‘true’ extrema) that could be then managed by the routine. I suppose this is something the Matlab/Octave is handling internally, with some parameters as function’s argument to tune it, maybe it’s not the case .

 

Regards,

 

David

 

 

De : users [hidden email] De la part de Clément David
Envoyé : mardi 16 mars 2021 16:27
À : Users mailing list for Scilab [hidden email]
Objet : Re: [Scilab-users] find and locate local maxima

 

Hello David,

 

After reading the Matlab documentation page, it seems pretty simple to implement using Scilab : and $ symbols:

 

function [pks, locs]=findpeaks(data)

    ii = find(d(1:$-2) < d(2:$-1) & d(2:$-1) >= d(3:$));

    pks = data(ii+2);

    locs = ii + 2;

endfunction

 

data = [25 8 15 5 6 10 10 3 1 20 7];

plot(data)

 

[pks,locs] = findpeaks(data);

plot(locs, pks, 'xr');

 

Note: using oct2py and pims might also be an option for simple cases but these wrappers are complex to use and data need to be copied at language boundaries.

 

Regards,

 

Clément

 

From: users <[hidden email]> On Behalf Of CHEZE David 227480
Sent: Tuesday, March 16, 2021 2:53 PM
To: Users mailing list for Scilab <[hidden email]>
Subject: [Scilab-users] find and locate local maxima

 

Hi all,

 

I’m looking for function that could find and locate every local maxima of any discrete time signal (timeseries), similar to Matlab or Octave function findpeaks(), scipy find_peaks(). Is anyone aware if something similar is already available in Scilab ? (I already browsed a little bit and it don’t seem so…)

If not in Scilab macros, any hint to use the Octave or scipy function directly from Scilab?

More globally it seems that Octave Forge could be linked with Python (from oct2py import octave

# Load the Octage-Forge signal package.

octave.eval("pkg load signal")), does someone ever tried to bridge similarly in Scilab ? oct2sci

 

Kind regards,

 

David

 



_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet



_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users

 

 

_______________________________________________
users mailing list
[hidden email]
https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users
Samuel GOUGEON Samuel GOUGEON
Reply | Threaded
Open this post in threaded view
|

Re: find and locate local maxima

In reply to this post by David Chèze
Le 18/03/2021 à 12:43, CHEZE David 227480 a écrit :
Hi all,

I’d be glad obviously to download the whole package to test it and report my experience :  I’m not use with the ‘review interface’ is there any way to download the whole package or I just retrieve files one by one ?

For another occasion on https://codereview.scilab.org : unfortunately, AFAIK it is not possible to download the whole set of listed files (so-called a "Patch Set" (of files)) and only them.
Either one has to download files one by one. Or to download the whole Scilab source code including the Patch Set files (in their proposed version):
Click on "Download" on the top right ; then use the "Archive" links.



I agree that for people that just want to use the web interface of the forge, being able to download the whole Patch Set and only it would be helpful.

Samuel


_______________________________________________
users mailing list
[hidden email]
http://lists.scilab.org/mailman/listinfo/users