aboutsummaryrefslogtreecommitdiff
path: root/noao/astutil/pdm/pdmampep.x
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /noao/astutil/pdm/pdmampep.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
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