aboutsummaryrefslogtreecommitdiff
path: root/noao/astutil/pdm/pdmfindmin.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/pdmfindmin.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'noao/astutil/pdm/pdmfindmin.x')
-rw-r--r--noao/astutil/pdm/pdmfindmin.x57
1 files changed, 57 insertions, 0 deletions
diff --git a/noao/astutil/pdm/pdmfindmin.x b/noao/astutil/pdm/pdmfindmin.x
new file mode 100644
index 00000000..4053bf43
--- /dev/null
+++ b/noao/astutil/pdm/pdmfindmin.x
@@ -0,0 +1,57 @@
+include <mach.h>
+include <ctype.h>
+include <error.h>
+include "pdm.h"
+
+# PDM_FINDMIN -- Find the minimum value of the abscissa.
+
+int procedure pdm_findmin (pdmp, ptype, startint, endint, is, ie)
+
+pointer pdmp # pointer to PDM data structure
+int ptype # plot type
+double startint, endint # start and end ordinates
+int is, ie # start and end indexs
+
+double miny, dy, dx
+int i, isave, npt
+pointer xpt, ypt
+
+begin
+ # Dereference npt.
+ npt = PDM_NPT(pdmp)
+
+ # Dereference the appropriate abcissa and ordinate.
+ switch (ptype) {
+ case DATAPLOT:
+ xpt = PDM_XP(pdmp)
+ ypt = PDM_DYP(pdmp)
+ case THETAPPLOT:
+ xpt = PDM_XTHP(pdmp)
+ ypt = PDM_YTHP(pdmp)
+ case THETAFPLOT:
+ ypt = PDM_YTHP(pdmp)
+ xpt = PDM_XTHP(pdmp)
+ case PHASEPLOT:
+ ypt = PDM_YPHP(pdmp)
+ xpt = PDM_XPHP(pdmp)
+ }
+
+ # Search the abscissas between startint and endint
+ # for the minimum value.
+
+ isave = 1
+ miny = MAX_DOUBLE
+ do i = is, ie {
+ dx = Memd[xpt+i-1]
+ dy = Memd[ypt+i-1]
+ if (dx > startint && dx < endint) {
+ if (dy < miny) {
+ miny = dy
+ isave = i
+ }
+ }
+ }
+
+ # Return the corresponding index value.
+ return (isave)
+end