Re: mpfit2dpeak and fitting an ellipse [message #60605] |
Sun, 01 June 2008 07:26 |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
Kevin.Pallati@gmail.com writes:
> Hello,
>
> I have a quick question regarding fitting routines. I will describe
> the problem first.
> I have an image with X,Y coordinates and I try to find an overdensity
> of points
> by smoothing out the image. I used mpfit2dpeak to fit the N number of
> points
> and I was able to find the center xcen and ycen that way. But the
> mpfit2dpeak
> assumes either a Gaussian,Lorentzian or Moffat function. The shape
> that I am
> looking for in the image is an ellipse so I was looking if there is an
> available
> program that fits a 2 dimensional ellipse but I could not find one.
> Does anyone have any suggestions on how to handle this?
I'm also a little confused. If you have N discrete points, then I'm
not sure it's appropriate to fit a 2D function, but rather to compute
the simple centroid. But you also say that you compute the mean
density (intensity), and in that case MPFIT2DPEAK might be more
appropriate.
I also don't know exactly what you mean be a "2 dimensional ellipse."
Perhaps you mean a flat-topped ellipsoidal disk? It really wouldn't
be that difficult for you to modify the code to add such a function.
It might look something like this,
; Lorentzian Function
function mpfit2dpeak_disk, x, y, p, tilt=tilt, symmetric=sym, _extra=extra
u = mpfit2dpeak_u(x, y, p, tilt=keyword_set(tilt), symmetric=keyword_set(sym))
return, p[0] + p[1]*(u LT 1)
end
The "u LT 1" part selects only the pixels that are within the bounds
of the ellipse.
Happy fitting,
Craig
|
|
|
Re: mpfit2dpeak and fitting an ellipse [message #60608 is a reply to message #60605] |
Sat, 31 May 2008 09:29  |
Vince Hradil
Messages: 574 Registered: December 1999
|
Senior Member |
|
|
On May 30, 2:09 pm, Kevin.Pall...@gmail.com wrote:
> Hello,
>
> I have a quick question regarding fitting routines. I will describe
> the problem first.
> I have an image with X,Y coordinates and I try to find an overdensity
> of points
> by smoothing out the image. I used mpfit2dpeak to fit the N number of
> points
> and I was able to find the center xcen and ycen that way. But the
> mpfit2dpeak
> assumes either a Gaussian,Lorentzian or Moffat function. The shape
> that I am
> looking for in the image is an ellipse so I was looking if there is an
> available
> program that fits a 2 dimensional ellipse but I could not find one.
> Does anyone have any suggestions on how to handle this?
>
> Thank you,
> Kevin Pallati
mpfit2dpeak will fit a gaussian (or the other functions) in 2d with
separate widths and a tilt - so it is an ellipsoid. Are the
intensities gaussian (or the other functions)? I'm guessing,
"probably". So don't the other parameters get what you want?
|
|
|