[Gambas-user] curve fitting library ?

Randall Morgan rmorgan62 at ...626...
Tue Jan 24 06:02:38 CET 2012


Wally,

I've been looking at the GSL and Gambas C/C++ components. I'm thinking we
can create a gsl component in C.
I'm playing around with that idea now. If I can get some simple examples
working then I know I can get more advanced
things working.

Writing a C based component should make life a little easier.



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

> Rqandall,
>
> let us listen Marcin first. Maybe he has some interesting informations.
> In fityk i found that the favourie mehtod is "chi squares method".
>
> Gsl offers this also :
> — Function: double gsl_cdf_chisq_P (double x, double nu)
> — Function: double gsl_cdf_chisq_Q (double x, double nu)
> — Function: double gsl_cdf_chisq_Pinv (double P, double nu)
> — Function: double gsl_cdf_chisq_Qinv (double Q, double nu)
>
>
>
>
>
>
>
> On Monday, January 23, 2012 10:41:55 Randall Morgan wrote:
> > Looks to me that as long as any derivative work is lincesed GPL and we
> > follow it's terms we should be good to go with the fityk library.
> >
> > On Mon, Jan 23, 2012 at 10:18 AM, Randall Morgan <rmorgan62 at ...626...
> >wrote:
> > > Wally,
> > >
> > > I just found this:  http://fityk.nieto.pl/intro.html#about
> > >
> > > If you scroll down you'll find that the fityk library is licensed under
> > > the GPL 2 or later. This should allow us to create derivative works.
> > >
> > > Take a look at the license and I will too.
> > >
> > > Randall
> > >
> > > On Mon, Jan 23, 2012 at 10:11 AM, Randall Morgan
> <rmorgan62 at ...626...>wrote:
> > >> OK thank you.
> > >>
> > >> On Mon, Jan 23, 2012 at 10:09 AM, Wally <wally at ...2037...> wrote:
> > >>> Marcin Wojdyr , author of fityk told me he will post his opinion
> > >>> directlty here to the mailinglist today or tomorrow.
> > >>>
> > >>> On Monday, January 23, 2012 09:59:16 Randall Morgan wrote:
> > >>> > Thanks, Wally.
> > >>> >
> > >>> > I'll go over both but get back to me once you have an answer
> > >>> > from the
> > >>> > author of fityk. I would still love to see a plot and GSL module
> > >>> > for
> > >>> > Gambas. But fityk looks like a lot less work right now. GSL has
> > >>> > grown
> > >>>
> > >>> quite
> > >>>
> > >>> > a bit since I last used it.
> > >>> >
> > >>> > On Mon, Jan 23, 2012 at 4:29 AM, Wally <wally at ...2037...> wrote:
> > >>> > > The spline example is member of Gambas3 examples
> > >>> > > "Examples-> Drawing->GSLSpline"
> > >>> > > or see attachment
> > >>> > >
> > >>> > > I'll try to contact the author of fityk to get his opinion
> > >>> > > about what we want to do. Fityk seems more clear and easier
> > >>> > > to implement. On the other hand GSL covers a much wider
> > >>> > > range of functionality.>>> > >
> > >>> > > On Monday, January 23, 2012 03:42:32 Randall Morgan wrote:
> > >>> > > > I don't think this app is licensed OSS. So I am not sure
> > >>> > > > if you can>>> > >
> > >>> > > legally
> > >>> > >
> > >>> > > > write a module with it. The GSL or similar library is
> > >>> > > > the way to
> > >>>
> > >>> go.
> > >>>
> > >>> > > > I have my plate full at the moment but I will try to
> > >>> > > > give you as
> > >>> > > > much guidance as I can. Be forewarned I too am still
> > >>> > > > learning. Give me a day or two to go over the GSL and
> > >>> > > > then we'll see what we can get done.
> > >>> > > >
> > >>> > > > send me your demo of the spline as well.
> > >>> > > >
> > >>> > > > On Mon, Jan 23, 2012 at 3:29 AM, Wally <wally at ...2037...>
> wrote:
> > >>> > > > > Randall, Benoit
> > >>> > > > >
> > >>> > > > > this example, using the spline stuff from the GSL is
> > >>> > > > > one of the
> > >>> > > > > most
> > >>> > > > > simple functions in GSL. All the intersting rest is
> > >>> > > > > much more
> > >>> > > > > confusing.
> > >>> > > > >
> > >>> > > > > Have a look how easy fityk doing a peakfind on very
> > >>> > > > > noisy data:
> > >>> > > > > (not sure the mailinglist allow me to attach
> > >>> > > > > screenshots )
> > >>> > > > > honmepage: fityk.nieto.pl
> > >>> > > > >
> > >>> > > > > On the other hand this fityk is not really free
> > >>> > > > > opensource i
> > >>> > > > > think.
> > >>> > > > >
> > >>> > > > > But here is a code example of guessing gaussian peak
> > >>> > > > > from a
> > >>> > > > > clean exp function:
> > >>> > > > >
> > >>> > > > > #include <iostream>
> > >>> > > > > #include <cmath>
> > >>> > > > >
> > >>> > > > > #include <fityk.h>
> > >>> > > > >
> > >>> > > > > using namespace std;
> > >>> > > > > using namespace fityk;
> > >>> > > > >
> > >>> > > > > int main()
> > >>> > > > > {
> > >>> > > > >
> > >>> > > > >    Fityk *f = new Fityk;
> > >>> > > > >    cout << f->get_info("version", true) << endl;
> > >>> > > > >    cout << "ln(2) = " <<
> > >>> > > > >    f->calculate_expr("ln(2)") << endl;
> > >>> > > > >    const double mu = 12.345;
> > >>> > > > >    for (int i = 0; i != 500; ++i) {
> > >>> > > > >
> > >>> > > > >        double x = i / 100. + 10;
> > >>> > > > >        double y = ceil(100 *
> > >>> > > > >        exp(-(x-mu)*(x-mu)/2));
> > >>> > > > >        f->add_point(x, y, sqrt(y));
> > >>> > > > >
> > >>> > > > >    }
> > >>> > > > >    f->execute("Y = randnormal(y, s)");
> > >>> > > > >    f->execute("guess %gauss = Gaussian");
> > >>> > > > >    f->execute("fit");
> > >>> > > > >    cout << "peak center: " <<
> > >>> > > > >    f->calculate_expr("%gauss.Center") <<
> > >>> > > > >    endl;
> > >>> > > > >    delete f;
> > >>> > > > >    return 0;
> > >>> > > > >
> > >>> > > > > }
> > >>> > > > >
> > >>> > > > > output:
> > >>> > > > >
> > >>> > > > > Fityk 0.9.8
> > >>> > > > > ln(2) = 0.693147
> > >>> > > > > peak center: 12.3485
> > >>> > > > >
> > >>> > > > > So ithink an implematation of GSL (or similar, maybe
> > >>> > > > > gnuplot))
> > >>> > > > > would be great - but i'm not able to do it without
> > >>> > > > > help.
> > >>> > > > >
> > >>> > > > > On Monday, January 23, 2012 03:06:29 Randall Morgan wrote:
> > >>> > > > > > You must be familiar with C at some level? I'd
> > >>> > > > > > be surprised
> > >>> > > > > > if the
> > >>> > > > > > GSL
> > >>> > > > > > doesn't already have a C wrapper somewhere. I
> > >>> > > > > > haven't used
> > >>> > > > > > it in
> > >>> > > > > > many
> > >>> > > > >
> > >>> > > > > years
> > >>> > > > >
> > >>> > > > > > so I can't recall, and I am sure it has changed.
> > >>> > > > > > It sounds
> > >>> > > > > > like
> > >>> > > > > > you've
> > >>> > > > > > already got a start. So you just need to invest
> > >>> > > > > > more time
> > >>> > > > > > into
> > >>> > > > > > porting
> > >>> > > > >
> > >>> > > > > GSL
> > >>> > > > >
> > >>> > > > > > to Gambas.
> > >>> > > > > >
> > >>> > > > > > On Mon, Jan 23, 2012 at 2:59 AM, Wally
> > >>> > > > > > <wally at ...2037...>
> > >>>
> > >>> wrote:
> > >>> > > > > > > On Monday, January 23, 2012 11:47:47 Benoît Minisini
> wrote:
> > >>> > > > > > > > Le 22/01/2012 09:54, Wally a écrit :
> > >>> > > > > > > > > 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
> > >>> > > > > > > >
> > >>> > > > > > > > There is a GSLSpline example provided
> > >>> > > > > > > > with Gambas.
> > >>> > > > > > > > Does it
> > >>> > > > > > > > help?
> > >>> > > > > > >
> > >>> > > > > > > I did this example :)
> > >>>
> > >>> --------------------------------------------------------------------
> > >>> ---->>>
> > >>> > > > > > > ------ 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
> > >>>
> > >>> --------------------------------------------------------------------
> > >>> ---->>>
> > >>> > > ------ 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?
> > >
> > > --
> > > 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
>



-- 
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