MPFIT .TIED [message #92278] |
Tue, 10 November 2015 07:08  |
wouter.schellekens
Messages: 2 Registered: November 2015
|
Junior Member |
|
|
Dear All,
I'm using MPFITFUN to find Gaussian shapes among some datasets. Mostly I'm interested in 2D Gaussian shapes (i.e. having a sigma-x and sigma-y). Additionally, I would like to tie both Gaussian sigma parameters to eachother in the sense that sigma-x cannot be bigger than e.g. 5*sigma-y, and vice versa as well (e.g. sigma-y cannot be bigger than 5*sigma-x).
As I understand I can tie one parameter to another by specifing the parinfo[X].tied. The examples show how I can set one parameter equal to another. However, I have not been successfull in specifing a tied relation that covers a certain range (.2*Sx < Sy <= Sx < 5*Sy). Is this even possible?
Thanks in advance!
Cheers,
Wouter
|
|
|
Re: MPFIT .TIED [message #92280 is a reply to message #92278] |
Tue, 10 November 2015 07:49   |
Dick Jackson
Messages: 347 Registered: August 1998
|
Senior Member |
|
|
On Tuesday, 10 November 2015 07:08:15 UTC-8, wouter.sc...@gmail.com wrote:
> Dear All,
>
> I'm using MPFITFUN to find Gaussian shapes among some datasets. Mostly I'm interested in 2D Gaussian shapes (i.e. having a sigma-x and sigma-y). Additionally, I would like to tie both Gaussian sigma parameters to eachother in the sense that sigma-x cannot be bigger than e.g. 5*sigma-y, and vice versa as well (e.g. sigma-y cannot be bigger than 5*sigma-x).
>
> As I understand I can tie one parameter to another by specifing the parinfo[X].tied. The examples show how I can set one parameter equal to another. However, I have not been successfull in specifing a tied relation that covers a certain range (.2*Sx < Sy <= Sx < 5*Sy). Is this even possible?
>
> Thanks in advance!
> Cheers,
>
> Wouter
Hi Wouter,
I think what will work is to have one of the two (say, Sx) be a regular parameter, and have a "ratio" parameter (say, SyOverSx) that might start at 1.0 and be limited (using parinfo.limits and parinfo.limited) to [0.2, 5.0]. Then in your function, compute Sy as (Sx * SyOverSx) and use that. Sy and Sx will always stay within the relative range you're looking for.
I know this was brief, but does it give you enough to go on?
Cheers,
-Dick
Dick Jackson Software Consulting Inc.
Victoria, BC, Canada --- http://www.d-jackson.com
|
|
|
Re: MPFIT .TIED [message #92296 is a reply to message #92280] |
Thu, 12 November 2015 11:08   |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
On Tuesday, November 10, 2015 at 10:49:18 AM UTC-5, Dick Jackson wrote:
> On Tuesday, 10 November 2015 07:08:15 UTC-8, wouter.sc...@gmail.com wrote:
>> Dear All,
>>
>> I'm using MPFITFUN to find Gaussian shapes among some datasets. Mostly I'm interested in 2D Gaussian shapes (i.e. having a sigma-x and sigma-y). Additionally, I would like to tie both Gaussian sigma parameters to eachother in the sense that sigma-x cannot be bigger than e.g. 5*sigma-y, and vice versa as well (e.g. sigma-y cannot be bigger than 5*sigma-x).
>>
>> As I understand I can tie one parameter to another by specifing the parinfo[X].tied. The examples show how I can set one parameter equal to another. However, I have not been successfull in specifing a tied relation that covers a certain range (.2*Sx < Sy <= Sx < 5*Sy). Is this even possible?
>>
>> Thanks in advance!
>> Cheers,
>>
>> Wouter
>
> Hi Wouter,
>
> I think what will work is to have one of the two (say, Sx) be a regular parameter, and have a "ratio" parameter (say, SyOverSx) that might start at 1.0 and be limited (using parinfo.limits and parinfo.limited) to [0.2, 5.0]. Then in your function, compute Sy as (Sx * SyOverSx) and use that. Sy and Sx will always stay within the relative range you're looking for.
>
> I know this was brief, but does it give you enough to go on?
Yes, this is the right approach!
|
|
|
Re: MPFIT .TIED [message #92308 is a reply to message #92280] |
Sat, 14 November 2015 11:20  |
wouter.schellekens
Messages: 2 Registered: November 2015
|
Junior Member |
|
|
On Tuesday, November 10, 2015 at 4:49:18 PM UTC+1, Dick Jackson wrote:
> On Tuesday, 10 November 2015 07:08:15 UTC-8, wouter.sc...@gmail.com wrote:
>> Dear All,
>>
>> I'm using MPFITFUN to find Gaussian shapes among some datasets. Mostly I'm interested in 2D Gaussian shapes (i.e. having a sigma-x and sigma-y). Additionally, I would like to tie both Gaussian sigma parameters to eachother in the sense that sigma-x cannot be bigger than e.g. 5*sigma-y, and vice versa as well (e.g. sigma-y cannot be bigger than 5*sigma-x).
>>
>> As I understand I can tie one parameter to another by specifing the parinfo[X].tied. The examples show how I can set one parameter equal to another. However, I have not been successfull in specifing a tied relation that covers a certain range (.2*Sx < Sy <= Sx < 5*Sy). Is this even possible?
>>
>> Thanks in advance!
>> Cheers,
>>
>> Wouter
>
> Hi Wouter,
>
> I think what will work is to have one of the two (say, Sx) be a regular parameter, and have a "ratio" parameter (say, SyOverSx) that might start at 1.0 and be limited (using parinfo.limits and parinfo.limited) to [0.2, 5.0]. Then in your function, compute Sy as (Sx * SyOverSx) and use that. Sy and Sx will always stay within the relative range you're looking for.
>
> I know this was brief, but does it give you enough to go on?
>
> Cheers,
> -Dick
>
> Dick Jackson Software Consulting Inc.
> Victoria, BC, Canada --- http://www.d-jackson.com
Yes indeed, that worked like a charm!
Thanks!
Wouter
|
|
|