integer model parameters

From: David P. Huenemoerder <dph_at_email.domain.hidden>
Date: Sun, 4 Mar 2012 15:20:49 -0500
If I have a user-defined fit fun with a parameter which is a
non-negative integer exponent, what's a good way to constrain it to be
an integer?  (it's the exponent of some possibly negative value).

In my fit function, I currently have something like...

 define windprofile3_fit( lo, hi, par )
 {
 ...
     variable n  = nint( par[ 4 ] ) ; % exponent >= 0, integer
 ...
 }

So internally, I think this is fine - the model function is evaluated
as desired.

But the function will get called with arbitrary values by the
optimizer, so what I see in the output after a fit is something like

> list_par
...
  5  windprofile3(1).n        0     0         4.684222           0           5  
...


In the _param_defaults() function, does it make sense to also set the
"step" to 1?

    {
	case 4:            % n
	r.value =  0 ; 
	r.freeze = 1 ;
	r.min    = 0 ;
	r.max    = 10;
	r.hard_min = 0 ;
	r.hard_max = DOUBLE_MAX ;
	r.step = 1 ;
	r.relstep = 1./max([1,r.value]) ;
    }


What I have seems to work (no NaN's in my model line profiles); I just
have to understand that some of the output parameter values are really
nint(value) ... unless there's a nicer way to do this.


-- Dave

David Huenemoerder  617-253-4283 (o); -253-8084 (f); http://space.mit.edu/home/dph
MIT Kavli Institute for Astrophysics and Space Research
70 Vassar St., NE80-6065,
Cambridge, MA  02139
[Admin. Asst.: Elaine Tirrell, 617-253-7480, egt_at_email.domain.hidden----
You received this message because you are
subscribed to the isis-users list.
To unsubscribe, send a message to
isis-users-request_at_email.domain.hiddenwith the first line of the message as:
unsubscribe
Received on Sun Mar 04 2012 - 15:21:04 EST

This archive was generated by hypermail 2.3.0 : Fri May 02 2014 - 08:35:47 EDT