[Gambas-user] curve fitting library ?

Randall Morgan rmorgan62 at ...626...
Mon Jan 23 10:03:06 CET 2012


Wally,

SG and RDP both would do a decent job for you since you need to preserve
your peaks. I don't have code for this but you can find psuedo code for it
on Wikipedia. The sudo code should be easy to convert into Gambas. It would
be nice if one Gambas had tools like GSL, Armadillo, PyLab, and Numpy. I
think it will get there but not anytime soon. Still RDP does not need any
external libraries. You can use the built in math functions. You don't need
a coefficients like  you do with SG. SG will give better over-all
smoothing. But under Gambas would require a lot more work.

As for porting GSL to Gambas that is not a trivial task. Not impossible but
it's not something you'll do in a few hours... I've ported much of the TIdy
Library to Gambas for use with data extraction and web crawling. But it
took me weeks to do only a portion of the library.

Hope this helps



On Mon, Jan 23, 2012 at 12:38 AM, Wally <wally at ...2037...> wrote:

>
> The signal data i want to process comes from a HPLC detctor, which
> generates analog voltage outputs. e.g. every second one meqasurement.
> The data is typical chromatography data as generated by several
> spectroscopic methods.
> The time base can be set to different values but mostly i use 1 Hz.
> A 16bit ADc convert this analog data to digital float values
> So i get a list of "Y"values with constant time-delta.
> The data is noisy - so i uesed in 1st step Sawatzky-Golay smoothing.
>
> These data contains usually few peaks which i need to find. I need
> maximumvalue, time value of maximum, half-height-width and area of
> every single peak. Sometimes peaks are very close so area is overlapping.
>
> The fityk-package is doing all this jobs very simple but i can not use in
> gambas. Another candidate, which is suitable to use with ganbas is
> Gnu Scientific Library. There are a lot of numerical functions available,
> but accessing this functions, was so far, too  difficult for me to code
> with
> gambas. I always mess up all the pointer stuff needed to declare and access
> this functionality. So i ask here to find a simple plain C library  or
> Gambas-, even VB-code to do this jobs.
>
> wally
>
> On Monday, January 23, 2012 00:06:49 Randall Morgan wrote:
> > Most of the stuff I did in signal processing was on the 68000 and Z80's.
> So
> > I let most of that go a very long time ago. Besides, unless you know what
> > you are looking for in a smoothing algorithm, any code would be useless.
> > For example, the simplest algorithm for smoothing is the moving average
> > method. It's very simple to write in any programming language. Simple
> > decide on the number of data points you are going to track and then
> average
> > the value of that many points. That average becomes you first point.
> Slide
> > the window up one value (or more, as long as there is plenty of overlap),
> > allowing the low value(s) to fall out of the window, then calculate the
> > average again. and plot your next point. Continue until you're out of
> input
> > data.
> >
> > This issue with the moving average method is that you will flatten your
> > data and loose your peaks. Since you have not said what your data is
> being
> > used for or how you are getting it, it is impossible to guess what method
> > of smoothing would be appropriate. So you need to ask yourself, are my
> > peaks important? Is my data timed? What am I doing with it once I smooth
> it
> > out? If you are displaying it, what information in your data is important
> > to convey to the viewer? Etc... Without details no one can really help
> you.
> > Give me specifics and perhaps I can be of more help.
> >
> > On Sun, Jan 22, 2012 at 11:44 PM, Wally <wally at ...2037...> wrote:
> > > I assume you do not have a code  example, right  ?
> > >
> > > On Sunday, January 22, 2012 17:02:17 Randall Morgan wrote:
> > > > Just a thought,
> > > >
> > > > You could write a callable wrapper around numpy then call that from
> > >
> > > Gambas.
> > >
> > > > Would give you all the power of the python numerical library from
> > > > within Gambas.
> > > >
> > > > On Sun, Jan 22, 2012 at 2:18 AM, Randall Morgan
> > > > <rmorgan62 at ...626...>
> > >
> > > wrote:
> > > > > Not with Gambas and it's been a long while. But if you
> > > > > understand the
> > > > > algorithms used and the type of curve fitting you desire for
> > > > > your
> > > > > problem
> > > > > domain then implementing it in Gambas is not a problem.
> > > > >
> > > > > You may want to google curve fitting algorithms. You need to
> > > > > know if
> > >
> > > you
> > >
> > > > > want a linear, polynomial, rational, cubic, or nonlinear
> > > > > fitting. Then find a C/C++/Python implementation and flow chart
> > > > > the algorithm. Then you  can easily convert it to Gambas or any
> > > > > programming language.> > >
> > > > > On Sun, Jan 22, 2012 at 12:54 AM, Wally <wally at ...2037...> wrote:
> > > > >> Does anyone have experience with curve fitting and/or
> > > > >> peakfinding
> > > > >> using gambas ?    (e.g. example code)
> > > > >>
> > > > >> Is there a plain C library (Linux) known, suitable to this
> > > > >> problem
> > > > >> and gambas ?
> > > > >>
> > > > >> Something like "fityk" (which is written in C++) but written
> > > > >> in plain C
> > > > >> to use with "EXTERN"
> > > > >>
> > > > >> I might wrap the fityk C++ or try Gnu Scientific Library, but
> > > > >> i'm
> > > > >> still
> > > > >> searching for alternatives.
> > > > >>
> > > > >> wally
> > > > >>
> > > > >>
> > > > >>
> > > > >> --------------------------------------------------------------
> > > > >> -------- -------- Try before you buy = See our experts in
> > > > >> action!
> > > > >> The most comprehensive online learning library for Microsoft
> > > > >> developers
> > > > >> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5,
> > > > >> CSS3,
> > > > >> MVC3,
> > > > >> Metro Style Apps, more. Free future releases when you
> > > > >> subscribe now!
> > > > >> http://p.sf.net/sfu/learndevnow-dev2
> > > > >> _______________________________________________
> > > > >> Gambas-user mailing list
> > > > >> Gambas-user at lists.sourceforge.net
> > > > >> https://lists.sourceforge.net/lists/listinfo/gambas-user
> > > > >
> > > > > --
> > > > > If you ask me if it can be done. The answer is YES, it can
> > > > > always be
> > > > > done. The correct questions however are... What will it cost,
> > > > > and how
> > > > > long will it take?
> > >
> > >
> ------------------------------------------------------------------------
> > > ------ Try before you buy = See our experts in action!
> > > The most comprehensive online learning library for Microsoft developers
> > > is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3,
> MVC3,
> > > Metro Style Apps, more. Free future releases when you subscribe now!
> > > http://p.sf.net/sfu/learndevnow-dev2
> > > _______________________________________________
> > > Gambas-user mailing list
> > > Gambas-user at lists.sourceforge.net
> > > https://lists.sourceforge.net/lists/listinfo/gambas-user
>
>
> ------------------------------------------------------------------------------
> Try before you buy = See our experts in action!
> The most comprehensive online learning library for Microsoft developers
> is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
> Metro Style Apps, more. Free future releases when you subscribe now!
> http://p.sf.net/sfu/learndevnow-dev2
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
>



-- 
If you ask me if it can be done. The answer is YES, it can always be done.
The correct questions however are... What will it cost, and how long will
it take?



More information about the User mailing list