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

Home » Public Forums » archive » MPFIT2DPEAK with constraints
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: MPFIT2DPEAK [message #44575 is a reply to message #36644] Thu, 23 June 2005 00:50 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
Greetings,

"angela" <Angeliki.Pollatou@gmail.com> writes:
> Hello,
>
> I was wondering if someone can help me out with a problem I have in
> MPFIT2DPEAK.
> Fist I am describing the problem: I have an image with stars and I am
> trying to fit the distribution to a gaussian and determine the
> coordinates of which there is a peak density of stars.
> I have an array of 400x400 pixels (centered where I believe the center
> shoud be) and I have calculated the number density of the stars in a
> specific radius for all the coordinate combinations starting from the
> (0,0) coordinates.
> I am using the MPFIT2DPEAK to fit a gaussian and to get a better handle
> on the center I am trying to find.
> I have two questions:
>
> 1. When I am using MPFIT2DPEAK without a 'guess' about the center (I
> use it with the tilt keyword), I get:
> 3.02628 3.92726 40.2412 13.1586 37.6854
> 24.7872 2.99398
> I have read from the tutorial that if you do not give an initial guess
> the program will try to guess what is the center. How do I know what
> the program thinks as a center? In other words, this result tells me
> that the center is at
> (x,y)=(37.6854,24.7872) or it understands that the center that I used
> is (200,200), so the result is that the center is at
> (200+37.6854,200+24.7872)?

*You* assign X and Y according to the arrays you pass when you call
MPFIT2DPEAK. The routine returns the centroid using the same
coordinate system. So if the command was called like this,
MPFIT2DPEAK(START,A,X,Y)
then (37.6854,24.7872) should refer to a position in the (X,Y)
coordinate system.

> 2.I tried to run the MPFIT2DPEAK using the estimates keyword :
> result=mpfit2dpeak(start,B,start(200,*),start(*,200),/TILT)
> where (200,200) is approximately where I think the center is and
> 'start' is my 400x400 array that has all the densities stored (they are
> all integers). ...

First of all, you didn't actually use the ESTIMATES keyword in your
example, so it's hard to comment. Second of all, you are not passing
proper X and Y values. These should be the *coordinate labels*, not
rows and columns of the array itself. Look at how CONTOUR is
called... same thing here.

> ... I get this message:
> % Attempt to subscript XX with WHMAX is out of range.
> % Execution halted at: MPFIT2DPEAK 390
> /raid1/home/angeliki/IDL/mpfit2dpeak.pro
> % $MAIN$

Yes, fix the problems above and you should be okay. The other thing
is that you passed START(200,*) as a column vector, when it should be
a row vector, and vice versa for START(*,200).

Good luck,
Craig

--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: Different scales in the same plot
Next Topic: interpolate over bad pixels

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

Current Time: Fri Oct 10 12:09:24 PDT 2025

Total time taken to generate the page: 0.08315 seconds