Re: ISIS bug?

From: <"'houck_at_email.domain.hidden>
Date: Thu, 21 Jun 2001 16:51:34 -0400
On Thu, Jun 21, 2001 at 15:30 -0400, Gagne, Marc wrote:
> I'm running ISIS 0.9.13 and using the gauss function to fit HEG and MEG
> emission lines.  The gauss parameters are yielding very narrow emission
> lines, at least twice as narrow as I would expect.  Is FWHM = 2.3548*sigma?
> The gauss function described in the isis manual looks like the standard
> gaussian (e.g., Bevington) with exponent = -0.5*(x-x0)**2/sigma**2.
> However, the gauss_b C function in the ISIS src appears to use erf.  On my
> Alpha, erf's exponent is -t**2.  Could this be the problem?


Hi Marc,

ISIS has its own erf() function (in libsrc/src/util.c) which should
normally replace the built-in erf.  It is possible that the Alpha
handles the linking differently and is using its built-in erf()
anyway -- I'll try to find a local Alpha machine on which to test
this.

If this is the problem, changing erf -> isis_erf throughout the
isis source code should fix it (erf only appears in 3 or 4 lines
of code). I'm appending a patch for 0.9.13 which will make this
change.

If that's not it, I don't know what the problem might be. For what
it's worth, ISIS line-fitting has been used quite extensively on
Solaris and Linux with no problems.  

Let me know if this works -- if so, I'll make this change for
the next release.  If not, I'll have to keep looking.

Thanks,

John

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


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
To apply the patch (assuming you have GNU patch or the 
equivalent):
   1) save it in a file e.g. ~/patch-0.9.13
   2) cd to the top-level ISIS source-code directory
   3) Apply the patch and recompile:
      patch -p1 < ~/patch-0.9.13
      make clean all install
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

diff -ur isis-0.9.13/libsrc/src/model.c isis-0.9.13_patch/libsrc/src/model.c
--- isis-0.9.13/libsrc/src/model.c	Sat Feb 10 14:31:49 2001
+++ isis-0.9.13_patch/libsrc/src/model.c	Thu Jun 21 16:26:25 2001
_at_email.domain.hidden    dxh = (double) (wlhi - wl0) / sigma;
    dxl = (double) (wllo - wl0) / sigma;
    
-   *f = (float) (erf (dxh) - erf (dxl));
+   *f = (float) (isis_erf (dxh) - isis_erf (dxl));
    
    return 0;
 }
diff -ur isis-0.9.13/libsrc/src/util.c isis-0.9.13_patch/libsrc/src/util.c
--- isis-0.9.13/libsrc/src/util.c	Sat Feb 10 14:31:49 2001
+++ isis-0.9.13_patch/libsrc/src/util.c	Thu Jun 21 16:26:31 2001
_at_email.domain.hidden 
 /*{{{ error function */
 
-double erf (double x)
+double isis_erf (double x)
 {
   /*
    *  erf(x) = (1/sqrt(2 pi)) * Integral( -Inf, x, exp(-0.5*t^2) )
diff -ur isis-0.9.13/libsrc/src/util.h isis-0.9.13_patch/libsrc/src/util.h
--- isis-0.9.13/libsrc/src/util.h	Sat Feb 10 14:31:50 2001
+++ isis-0.9.13_patch/libsrc/src/util.h	Thu Jun 21 16:26:36 2001
_at_email.domain.hidden extern int find_bin (double x, double *lo, double *hi, int n);
 
 extern int cvt_double_array_to_float (float * dest, double * src, int n);
-extern double erf (double x);
+extern double isis_erf (double x);
 
 extern int unit_id (char *name);
 extern int unit_name (char *name, int unit);
diff -ur isis-0.9.13/src/fit-functions.c isis-0.9.13_patch/src/fit-functions.c
--- isis-0.9.13/src/fit-functions.c	Wed Feb 21 23:15:20 2001
+++ isis-0.9.13_patch/src/fit-functions.c	Thu Jun 21 16:26:01 2001
_at_email.domain.hidden 	dxh = (g->bin_hi[n] - x0) / sigma;
 	dxl = (g->bin_lo[n] - x0) / sigma;
 
-	val[i] = area * (erf (dxh) - erf (dxl));
+	val[i] = area * (isis_erf (dxh) - isis_erf (dxl));
      }
 
    return 0;

----
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 Thu Jun 21 2001 - 16:51:42 EDT

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