From 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 Mon Sep 17 00:00:00 2001 From: Joe Hunkeler Date: Tue, 11 Aug 2015 16:51:37 -0400 Subject: Repatch (from linux) of OSX IRAF --- math/curfit/cvsaver.x | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 math/curfit/cvsaver.x (limited to 'math/curfit/cvsaver.x') diff --git a/math/curfit/cvsaver.x b/math/curfit/cvsaver.x new file mode 100644 index 00000000..513083a5 --- /dev/null +++ b/math/curfit/cvsaver.x @@ -0,0 +1,44 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include + +include "curfitdef.h" + +# CVSAVE -- Procedure to save the parameters of the fit for later +# use by cveval and cvvector. Only curve_type, order, xmin, xmax +# and the coefficients are saved. The parameters are saved in fit +# in the order curve_type, order, xmin, xmax, followed by the +# coefficients. + +procedure cvsave (cv, fit) + +pointer cv # curve descriptor +real fit[ARB] # PIXEL array containing curve parameters + +begin + # set common curve parameters + CV_SAVETYPE(fit) = CV_TYPE(cv) + CV_SAVEXMIN(fit) = CV_XMIN(cv) + CV_SAVEXMAX(fit) = CV_XMAX(cv) + if (CV_TYPE(cv) == USERFNC) + CV_SAVEFNC(fit) = CV_USERFNCR(cv) # no type conversion + + # set curve-type dependent parmeters + switch (CV_TYPE(cv)) { + case LEGENDRE, CHEBYSHEV, USERFNC: + CV_SAVEORDER(fit) = CV_ORDER(cv) + case SPLINE1, SPLINE3: + CV_SAVEORDER(fit) = CV_NPIECES(cv) + 1 + default: + call error (0, "CVSAVE: Unknown curve type.") + } + + + # set coefficients + if (CV_TYPE(cv) == USERFNC) + call amovr (COEFF(CV_COEFF(cv)), fit[CV_SAVECOEFF+1], + CV_NCOEFF(cv)) + else + call amovr (COEFF(CV_COEFF(cv)), fit[CV_SAVECOEFF], + CV_NCOEFF(cv)) +end -- cgit