From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- noao/astutil/pdm/pdmampep.x | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 noao/astutil/pdm/pdmampep.x (limited to 'noao/astutil/pdm/pdmampep.x') 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 +include +include +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 -- cgit