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

Home » Public Forums » archive » MPFITFUN error -- only reading the first data value
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: MPFITFUN error -- only reading the first data value [message #90749 is a reply to message #90748] Thu, 09 April 2015 02:32 Go to previous messageGo to previous message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
Den torsdag 9 april 2015 kl. 10:28:30 UTC+2 skrev graham kerr:
> On Wednesday, April 8, 2015 at 11:55:44 PM UTC+1, Craig Markwardt wrote:
>> On Thursday, April 2, 2015 at 6:02:07 AM UTC-4, graham kerr wrote:
>>> So after much staring at code I think I have found my (somewhat daft) mistake!
>>>
>>> I think that in mpfitfun (and mpfit & mpfitexpr), the function that you specify ('myfunction') must have the independent variable set as 'x' and the dependent variable set as 'p'.
>>>
>>> So, in my case, in planck_fit_sot, I changed the function call from
>>>
>>> planck_fit_sot, wave, temp
>>>
>>> to
>>>
>>> planck_fit_sot, x, p
>>>
>>> ... and then within the code I changed all the 'wave' to 'x' and 'temp' to 'p[0]'.
>>>
>>> This seems to have solved my problem.
>>
>> Huh? Nope.
>>
>> For MPFITFUN, it doesn't matter what you name the parameters, it's just that the first parameter needs to be the independent variable, and the second parameter needs to be the array function parameters. This is documented at the top of MPFITFUN.PRO
>>
>> For MPFITEXPR, yes indeed, the independent variable in the expression needs to be X and the parameter array needs to be P. This is also documented.
>>
>> Craig
>
> Oh, that seemed to fix my problem, somehow. Do you know what the issue might have been then?

Maybe this: "I changed all the [...] 'temp' to 'p[0]'". I think the problem is you did not have 'temp[0]' in the first place.

If temp is a 1-element array, the line

bb_fn = const1 / ( wave_cm^5.0 * ( exp( const2]/temp)-1. ) )

might not give you the array with the dimension of wave_cm that you'd expect, but rather a 1-element array like temp. (Even with the bracket corrected.)

I mean:

IDL> a=[1,2,3]
IDL> help,a
A INT = Array[3]
IDL> help,a*2
<Expression> INT = Array[3]
IDL> help,a*[2]
<Expression> INT = Array[1]
IDL> help,a^[2]
<Expression> INT = Array[1]
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Keep getting a transparent background on a composite image
Next Topic: Function call string

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

Current Time: Wed Oct 08 13:56:02 PDT 2025

Total time taken to generate the page: 0.00223 seconds