%% Created by Lia Corrales
%% lia@space.mit.edu

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
define simple_dust_fit( lo, hi, par, fun )
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{

	% Feb 6, 2013 : Created by lia@astro.columbia.edu
	% Contribution to total extinction from a simple dust scattering model
	% Multiplicative : exp( - tau * (E/Eref)^-2 )

	variable tau  = par[0];
	variable Eref = par[1];

	variable Angs  = 0.5 * (lo + hi);
	variable E_kev = Const_hc / Angs;            % keV
	return exp(-tau * (E_kev/Eref)^-2 ) * fun;

}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
define simple_dust_defaults(i)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
{
	switch(i)
	{ case 0:
		return ( 1.0, 0, 0, 100 );
	}
	{ case 1:
		return ( 1.0, 1, 0.01, 10.0 );
	}	
}

add_slang_function("simple_dust", ["tau", "Eref [keV]"]);
set_function_category("simple_dust", ISIS_FUN_OPERATOR);
set_param_default_hook("simple_dust", "simple_dust_defaults");

