aboutsummaryrefslogtreecommitdiff
path: root/noao/twodspec/apextract/apcvset.x
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /noao/twodspec/apextract/apcvset.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'noao/twodspec/apextract/apcvset.x')
-rw-r--r--noao/twodspec/apextract/apcvset.x47
1 files changed, 47 insertions, 0 deletions
diff --git a/noao/twodspec/apextract/apcvset.x b/noao/twodspec/apextract/apcvset.x
new file mode 100644
index 00000000..656187d5
--- /dev/null
+++ b/noao/twodspec/apextract/apcvset.x
@@ -0,0 +1,47 @@
+include <math/curfit.h>
+include "apertures.h"
+
+# AP_CVSET -- Set the trace curve.
+# If the input template aperture is NULL then the output trace curve
+# is set to a constant zero otherwise a copy from the input template
+# aperture is made.
+
+procedure ap_cvset (apin, apout)
+
+pointer apin # Input template aperture
+pointer apout # Output aperture
+
+int apaxis, dispaxis, ncoeffs
+real a, b, c[1]
+pointer sp, coeffs
+
+int cvstati()
+
+begin
+ if (AP_CV(apout) != NULL)
+ call cvfree (AP_CV(apout))
+
+ if (apin == NULL) {
+ # Determine the aperture and alternate axes.
+ apaxis = AP_AXIS(apout)
+ dispaxis = mod (apaxis, 2) + 1
+
+ # Determine the limits over which the curve is defined.
+ a = AP_CEN(apout, dispaxis) + AP_LOW(apout, dispaxis)
+ b = AP_CEN(apout, dispaxis) + AP_HIGH(apout, dispaxis)
+ if (a == b)
+ b = b + 1
+
+ # Set the curve to a legendre polynomial of order 1 and value 0.
+ c[1] = 0.
+ call cvset (AP_CV(apout), LEGENDRE, a, b, c, 1)
+ } else {
+ # Use a SAVE and RESTORE to copy the CURFIT data.
+ call smark (sp)
+ ncoeffs = cvstati (AP_CV(apin), CVNSAVE)
+ call salloc (coeffs, ncoeffs, TY_REAL)
+ call cvsave (AP_CV(apin), Memr[coeffs])
+ call cvrestore (AP_CV(apout), Memr[coeffs])
+ call sfree (sp)
+ }
+end