aboutsummaryrefslogtreecommitdiff
path: root/noao/astutil/pdm/pdmampep.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/astutil/pdm/pdmampep.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'noao/astutil/pdm/pdmampep.x')
-rw-r--r--noao/astutil/pdm/pdmampep.x38
1 files changed, 38 insertions, 0 deletions
diff --git a/noao/astutil/pdm/pdmampep.x b/noao/astutil/pdm/pdmampep.x
new file mode 100644
index 00000000..08c2c4e1
--- /dev/null
+++ b/noao/astutil/pdm/pdmampep.x
@@ -0,0 +1,38 @@
+include <mach.h>
+include <ctype.h>
+include <error.h>
+include "pdm.h"
+
+# PDM_AMPEP -- Calculate the amplitude and epoch for this data.
+
+procedure pdm_ampep (pdmp, period)
+
+pointer pdmp # PDM structure pointer
+double period # period for which to calculate
+
+int i, isave
+double npt, ymin, ymax
+errchk pdm_phase
+
+begin
+ npt = PDM_NPT(pdmp)
+
+ # Find the maximum and minimum values in the data.
+ # The difference is the amplitude.
+
+ ymax = -MAX_DOUBLE
+ ymin = MAX_DOUBLE
+ do i = 1, npt {
+ if (PDM_INUSE(pdmp,i) == 0)
+ next
+ if (PDM_DY(pdmp,i) < ymin)
+ ymin = PDM_DY(pdmp,i)
+ if (PDM_DY(pdmp,i) > ymax) {
+ ymax = PDM_DY(pdmp,i)
+ isave = i
+ }
+ }
+
+ PDM_AMPL(pdmp) = ymax - ymin
+ PDM_EPOCH(pdmp) = PDM_X(pdmp, isave)
+end