From eaa96130f5cfa6bcff25021f75448c426a39ebcc Mon Sep 17 00:00:00 2001 From: tlatorre Date: Tue, 2 Oct 2018 16:57:59 -0500 Subject: update get_quantum_efficiency() to use interp1d() This speeds up the "boot up" time from ~30 seconds to ~12 seconds. --- src/quantum_efficiency.c | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/quantum_efficiency.c b/src/quantum_efficiency.c index f8ae972..a3996b7 100644 --- a/src/quantum_efficiency.c +++ b/src/quantum_efficiency.c @@ -2,17 +2,13 @@ #include #include #include -#include -#include +#include "misc.h" static int initialized = 0; static double *x, *y; static size_t size; -gsl_interp_accel *acc; -gsl_spline *spline; - static int init() { int i; @@ -99,10 +95,6 @@ static int init() fclose(f); - acc = gsl_interp_accel_alloc(); - spline = gsl_spline_alloc(gsl_interp_linear, size); - gsl_spline_init(spline, x, y, size); - initialized = 1; return 0; @@ -121,5 +113,5 @@ double get_quantum_efficiency(double wavelength) } } - return gsl_spline_eval(spline, wavelength, acc); + return interp1d(wavelength, x, y, size); } -- cgit