Non-linear Regression to a Histogram

Hey guys -

I'm working on a Histogram of pixel values from an astronomical image that looks like a Gaussian curve and then polynomial decay. I'm trying to figure out a way to fit a Gaussian regression to the histogram, but can't find any documentation on this. thanks!

-adrian

You might get a good answer here (although I don't have it), but be aware that your question relates to math, not plotting, so it is not really a matplotlib question. You need nonlinear least-squares. Look in scipy, and try the amazing Google.

Eric

Adrian Price-Whelan wrote:

···

Hey guys -

I'm working on a Histogram of pixel values from an astronomical image that looks like a Gaussian curve and then polynomial decay. I'm trying to figure out a way to fit a Gaussian regression to the histogram, but can't find any documentation on this. thanks!

-adrian

Hi Adrian, if you need low level access there is a python wrapper of the MINUIT and MINUIT2 fitting libraries : GitHub - jpivarski/pyminuit: Automatically exported from code.google.com/p/pyminuit and GitHub - jpivarski/pyminuit2: Automatically exported from code.google.com/p/pyminuit2
It is targeted primarily toward High Energy Physics people, most of whom are familiar with the MINUIT library, but it would solve your problem as well. The doc is still lacking in the project, as I do not have much time, so feel free to ask me questions about it or even to send me some files so that I can try out to script the fit on my side (I work in the field of astro-particle physics and astrophysics, so I might even be interested in the context of your problem!) .

best,
Johann

Adrian Price-Whelan wrote:

···

Hey guys -

I'm working on a Histogram of pixel values from an astronomical image that looks like a Gaussian curve and then polynomial decay. I'm trying to figure out a way to fit a Gaussian regression to the histogram, but can't find any documentation on this. thanks!

-adrian

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

I have been working on a similar problem related to finance. What I have done is call the "R" statistical software from Python and then use matplotlib for graphing within Python

I use Python2.4, the "R" statistical package, and a Python package called rpy which interfaces to "R" from Python

LINKs:
    http://rpy.sourceforge.net/
    http://www.r-project.org/

My tendency is to submit the data to "R" which does the statistical calculations, return the results to Python, and then use Matplotlib to plot. Keep in mind that "R" also has good plotting capabilities and you might just go with that solution.

···

###########################################

Eric Firing wrote:

You might get a good answer here (although I don't have it), but be aware that your question relates to math, not plotting, so it is not really a matplotlib question. You need nonlinear least-squares. Look in scipy, and try the amazing Google.

Eric

Adrian Price-Whelan wrote:

Hey guys -

I'm working on a Histogram of pixel values from an astronomical image that looks like a Gaussian curve and then polynomial decay. I'm trying to figure out a way to fit a Gaussian regression to the histogram, but can't find any documentation on this. thanks!

-adrian
   
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference Don't miss this year's exciting event. There's still time to save $100. Use priority code J8TL2D2. http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

I have an example of fitting distributions to bus arrival times using
'R' that may be helpful. I wanted to calculate the latest time I could
arrive at the bus stop and have a better than 95% chance of catching
the bus. I tend to use R and Scipy whereever each is strongest.

http://www.oplnk.net/~ajackson/software/
http://www.oplnk.net/~ajackson/software/BusStats.R

···

On Sun, 11 May 2008 18:49:58 -0500 glenn andrews <ga@...2011...> wrote:

I have been working on a similar problem related to finance. What I
have done is call the "R" statistical software from Python and then use
matplotlib for graphing within Python

I use Python2.4, the "R" statistical package, and a Python package
called rpy which interfaces to "R" from Python

LINKs:
    http://rpy.sourceforge.net/
    http://www.r-project.org/

My tendency is to submit the data to "R" which does the statistical
calculations, return the results to Python, and then use Matplotlib to
plot. Keep in mind that "R" also has good plotting capabilities and you
might just go with that solution.

        ###########################################

Eric Firing wrote:

>You might get a good answer here (although I don't have it), but be
>aware that your question relates to math, not plotting, so it is not
>really a matplotlib question. You need nonlinear least-squares. Look
>in scipy, and try the amazing Google.
>
>Eric
>
>Adrian Price-Whelan wrote:
>
>
>>Hey guys -
>>
>>I'm working on a Histogram of pixel values from an astronomical image
>>that looks like a Gaussian curve and then polynomial decay. I'm
>>trying to figure out a way to fit a Gaussian regression to the
>>histogram, but can't find any documentation on this. thanks!
>>
>>-adrian
>>
>>
>
>-------------------------------------------------------------------------
>This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
>Don't miss this year's exciting event. There's still time to save $100.
>Use priority code J8TL2D2.
>http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
>_______________________________________________
>Matplotlib-users mailing list
>Matplotlib-users@lists.sourceforge.net
>matplotlib-users List Signup and Options
>
>
>

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
matplotlib-users List Signup and Options

--
-----------------------------------------------------------------------

Alan K. Jackson | To see a World in a Grain of Sand |
alan@...895... | And a Heaven in a Wild Flower, |
www.ajackson.org | Hold Infinity in the palm of your hand |
Houston, Texas | And Eternity in an hour. - Blake |

-----------------------------------------------------------------------