Re: Blackbody

From: John Houck <houck>
Date: Mon, 7 May 2001 18:23:09 -0400
On Mon, May 07, 2001 at 16:47 -0400, Bulent KIZILTAN wrote:
> How does one define a blackbody function for the fit?

Hi Bulent,

I'll probably add a blackbody function to an upcoming release but,
for now, perhaps the appended S-Lang implementation will help.

John

-- 
John C. Houck    MIT Center for Space Research
617-253-3849     One Hampshire St, NE80-6005, Cambridge, MA 02139



static variable Const_hc = 12.3984185734;
static variable min_exp = 1.e-13;
static variable max_exp = 500.0;

define blackbody_fit (lo, hi, par)
{
   variable kt = par[1];
   
   variable n = length(lo);
   variable val = Double_Type [n];
   
   variable elo, ehi;
   elo = Const_hc / hi;
   ehi = Const_hc / lo;
   
   variable xlo, xhi;
   xlo = elo / kt;
   xhi = ehi / kt;
   
   if (xlo[0] > max_exp)
     {
	val[*] = 0.0;
	return val;
     }
   
   variable i, j, k;

   variable alo = Double_Type[n];
   variable ahi = Double_Type[n];
   
   i = where (min_exp < xlo and xlo < max_exp);
   if (length(i))
     {
	alo[i] = elo[i]^2 / (exp (xlo[i]) - 1.0);
	ahi[i] = ehi[i]^2 / (exp (xhi[i]) - 1.0);	
     }

   j = where (xlo <= min_exp);
   if (length(j))
     {
	alo[j] = elo[j] * kt;
	ahi[j] = ehi[j] * kt;	
     }
   
   k = where (max_exp <= xlo);
   if (length(k))
     {
	alo[k] = 0.0;
	ahi[k] = 0.0;
     }
   
   variable norm = 8.0525 / kt^4;
   val = par[0] * 0.5 * (alo + ahi) * norm * (ehi - elo);
   
   return val;
}

add_slang_function ("blackbody", ["norm", "kt"]);
----
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 Mon May 07 2001 - 18:23:12 EDT

This archive was generated by hypermail 2.2.0 : Thu Mar 15 2007 - 08:45:50 EDT