comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: fitting mixed gaussians
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: fitting mixed gaussians [message #44131 is a reply to message #44130] Wed, 18 May 2005 13:35 Go to previous messageGo to previous message
jcami is currently offline  jcami
Messages: 4
Registered: May 2005
Junior Member
> Yes I looked at these - the trouble is that I want to perform this on

> literally thousands of images (each image has one object in it).
Manual
> seeding is not practical. I think what I am after is described
here...
>
> http://tinyurl.com/9horr
>
> I have started to translate the MatLab code to IDL - but it is
clearly
> over my head.

I would start by writing a function that creates multiple Gaussians.
Something like

FUNCTION multi_gauss, X, P

; P contains a set of 3 parameters per Gaussian, plus an offset and a
slope
; for the linear part of the model.

n_gauss = (n_elements(P)-2)/3
profile = dblarr(n_elements(X))
for loop=0,n_gauss-1 do begin
this_P = P[loop*3:loop*3+2]
this_u = (X-this_P[1])/this_P[2]
profile = profile + this_P[0] * exp(-5d-1 * this_u^2)
endfor
profile = profile + P[n_g * 3]
profile = profile + P[n_g * 3 + 1] * X

return, profile

END

You can feed this sort of function to mpfitfun; in your peak fitting
routine
you can then start with a single Gaussian, subtract the fit from the
data and look for a second Gaussian (again using something like
mpfitpeak); if you find a second Gaussian, you use the parameters for
both Gaussians as initial estimates to the multi_gauss routine and
mpfitfun should do the rest.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: IDLCanvas 0.1.0 released !!!
Next Topic: Re: Executing with classes dependies

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Mon Dec 01 03:44:44 PST 2025

Total time taken to generate the page: 2.24719 seconds