[SciPy-User] Fitting tools

Erik Tollerud erik.tollerud at gmail.com
Wed Apr 14 14:13:30 EDT 2010


I'm not sure exactly what you mean... the best-fit values for the
parameters should appear in the bottom panel of the fitgui dialog, is
that what you're hoping to see?  Or do you mean extract them from the
GUI back into an interactive ipython session?  If the latter, just do

mod = fit_data(xdata,ydata,...)
mod.pardict

and mod will be the output model, with mod.pardict a dictionary of the
parameters and their values.  Or if you want the gui non-modal, do

fg = FitGui(...)
fg.edit_traits()
mod = fg.getModelObject()

On Tue, Apr 13, 2010 at 11:47 PM, Gökhan Sever <gokhansever at gmail.com> wrote:
> Erik,
>
> Thanks for the fix. It works now. Finally I was able to launch the graphical
> interface as well. Is it possible to get parameter estimates using the GUI?
>
> On Tue, Apr 13, 2010 at 1:13 AM, Erik Tollerud <erik.tollerud at gmail.com>
> wrote:
>>
>> Ok, I just committed a patch that I think should fix the particular
>> problem you were encountering - let me know if it does not, or if you
>> encounter some other problem trying to run the fitgui.
>>
>> Also, if you there are some models/distributions you want to use that
>> are not already included in the builtin models (rather likely, as most
>> of them are astronomy-related aside from the basics like gaussian,
>> linear, polynomial, and so on) it's straightforward to add new ones in
>> your own code and register them so that the gui will display them as
>> options.  If it's a fairly standard distribution, feel free to submit
>> it to me and I can add it to the astropysics builtins, as well.
>>
>>
>> On Mon, Apr 12, 2010 at 12:54 PM, Gökhan Sever <gokhansever at gmail.com>
>> wrote:
>> >
>> >
>> > On Mon, Apr 12, 2010 at 12:34 PM, <josef.pktd at gmail.com> wrote:
>> >>
>> >> On Mon, Apr 12, 2010 at 1:14 PM, Gökhan Sever <gokhansever at gmail.com>
>> >> wrote:
>> >> > Hello,
>> >> >
>> >> > Are there any compact curve/distribution fitting tools around similar
>> >> > to
>> >> > the
>> >> > commercial TableCurve 2D [1] and EasyFit [2] products?
>> >> >
>> >> > [1] http://www.sigmaplot.com/products/tablecurve2d/tablecurve2d.php
>> >>
>> >> I think astrogui, or astropysics might have something like this,
>> >> Travis showcased it briefly in the stats webinar. There is also an
>> >> online curve fitting (zunzun ?) with (I think) BSD licensed source
>> >> code that might be useful.
>> >>
>> >> > [2] http://www.mathwave.com/easyfit-distribution-fitting.html
>> >>
>> >> I looked at easyfit a year or more ago, and wrote a script that tried
>> >> to do similar fitting for all distributions in scipy.stats. It worked
>> >> ok for distributions with unlimited support, but there are still the
>> >> problems with estimating distributions with a finite bound in the
>> >> support.
>> >> I used kstest as distance measure, but never rewrote Anderson-Darling
>> >> to function as generic distance measure as (if I remember correctly)
>> >> easyfit does.
>> >>
>> >> Josef
>> >
>> > Thanks for the input Josef.
>> >
>> > I have known astrogui from Travis' webinar as well. However I have never
>> > been able to run it. Maybe Erik could make some comments to fix the
>> > problem:
>> >
>> > # Using bzr branch lp:astropysics
>> >
>> > python
>> > Python 2.6.2 (r262:71600, Jan 25 2010, 18:46:45)
>> > [GCC 4.4.2 20091222 (Red Hat 4.4.2-20)] on linux2
>> > Type "help", "copyright", "credits" or "license" for more information.
>> >>>> from astropysics import gui
>> >
>> > /home/gsever/Desktop/python-repo/ETS_3.3.1/Enable_3.2.1/enthought/kiva/fonttools/font_manager.py:1064:
>> > UserWarning: Could not match sans-serif, normal, normal.  Returning
>> > /usr/share/fonts/khmeros/KhmerOS.ttf
>> >   warnings.warn('Could not match %s, %s, %s.  Returning %s' % (name,
>> > style,
>> > variant, self.defaultFont))
>> >
>> > /usr/lib/python2.6/site-packages/Astropysics-0.1.dev-py2.6.egg/astropysics/io.py:34:
>> > UserWarning: pyfits not found - all FITS-related IO will not work
>> >   warn('pyfits not found - all FITS-related IO will not work')
>> >
>> > /usr/lib/python2.6/site-packages/Astropysics-0.1.dev-py2.6.egg/astropysics/io.py:314:
>> > UserWarning: vo.table not found - VOTable processing limited to
>> > VOTableReader class
>> >   warn('vo.table not found - VOTable processing limited to VOTableReader
>> > class')
>> >
>> > /usr/lib/python2.6/site-packages/Astropysics-0.1.dev-py2.6.egg/astropysics/phot.py:2742:
>> > UserWarning: SExtractor not found on system - phot.SExtractor class will
>> > not
>> > function
>> >   warn('SExtractor not found on system - phot.SExtractor class will not
>> > function')
>> > Traceback (most recent call last):
>> >   File "<stdin>", line 1, in <module>
>> >   File
>> >
>> > "/usr/lib/python2.6/site-packages/Astropysics-0.1.dev-py2.6.egg/astropysics/gui/__init__.py",
>> > line 28, in <module>
>> >     from spectarget import spec_target
>> >   File
>> >
>> > "/usr/lib/python2.6/site-packages/Astropysics-0.1.dev-py2.6.egg/astropysics/gui/spectarget.py",
>> > line 18, in <module>
>> >     from ..phot import CMDAnalyzer
>> >   File
>> >
>> > "/usr/lib/python2.6/site-packages/Astropysics-0.1.dev-py2.6.egg/astropysics/phot.py",
>> > line 3463, in <module>
>> >     Spectrum._rgbsensitivity = __generateRGBSensTuple()
>> >   File
>> >
>> > "/usr/lib/python2.6/site-packages/Astropysics-0.1.dev-py2.6.egg/astropysics/phot.py",
>> > line 3455, in __generateRGBSensTuple
>> >     from .models import BlackbodyModel
>> >   File
>> >
>> > "/usr/lib/python2.6/site-packages/Astropysics-0.1.dev-py2.6.egg/astropysics/models/__init__.py",
>> > line 73, in <module>
>> >     from core import *
>> >   File
>> >
>> > "/usr/lib/python2.6/site-packages/Astropysics-0.1.dev-py2.6.egg/astropysics/models/core.py",
>> > line 2247, in <module>
>> >     class
>> > FunctionModel2DScalar(FunctionModel,InputCoordinateTransformer):
>> >   File
>> >
>> > "/usr/lib/python2.6/site-packages/Astropysics-0.1.dev-py2.6.egg/astropysics/models/core.py",
>> > line 2253, in FunctionModel2DScalar
>> >     from ..coords import cartesian_to_polar,polar_to_cartesian
>> >   File
>> >
>> > "/usr/lib/python2.6/site-packages/Astropysics-0.1.dev-py2.6.egg/astropysics/coords.py",
>> > line 2447, in <module>
>> >     solsysobjs['sun'] = Sun()
>> >   File
>> >
>> > "/usr/lib/python2.6/site-packages/Astropysics-0.1.dev-py2.6.egg/astropysics/coords.py",
>> > line 2267, in __init__
>> >
>> > EphemerisObject.__init__(self,name='Sol',jd0=KeplerianOrbit.jd2000-0.5)
>> >   File
>> >
>> > "/usr/lib/python2.6/site-packages/Astropysics-0.1.dev-py2.6.egg/astropysics/coords.py",
>> > line 1791, in __init__
>> >     self.jd0 = EphemerisObject.jd2000 if jd0 is None else jd0
>> >   File
>> >
>> > "/usr/lib/python2.6/site-packages/Astropysics-0.1.dev-py2.6.egg/astropysics/coords.py",
>> > line 1799, in _setJd0
>> >     from .obstools import calendar_to_jd
>> >   File
>> >
>> > "/usr/lib/python2.6/site-packages/Astropysics-0.1.dev-py2.6.egg/astropysics/obstools.py",
>> > line 1580, in <module>
>> >     sites['uciobs'] =
>> > Site(33.63614044191056,-117.83079922199249,80,'PST','UC Irvine
>> > Observatory')
>> >   File
>> >
>> > "/usr/lib/python2.6/site-packages/Astropysics-0.1.dev-py2.6.egg/astropysics/obstools.py",
>> > line 498, in __init__
>> >     raise ValueError('unrecognized time zone string '+tz)
>> > ValueError: unrecognized time zone string PST
>> >
>> >
>> > --
>> > Gökhan
>> >
>
>
>
> --
> Gökhan
>



More information about the SciPy-User mailing list