aboutsummaryrefslogtreecommitdiff
path: root/noao/onedspec/identify/idcenter.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/onedspec/identify/idcenter.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'noao/onedspec/identify/idcenter.x')
-rw-r--r--noao/onedspec/identify/idcenter.x37
1 files changed, 37 insertions, 0 deletions
diff --git a/noao/onedspec/identify/idcenter.x b/noao/onedspec/identify/idcenter.x
new file mode 100644
index 00000000..6b6dba06
--- /dev/null
+++ b/noao/onedspec/identify/idcenter.x
@@ -0,0 +1,37 @@
+include <smw.h>
+include "identify.h"
+
+# ID_CENTER -- Locate the center of a feature.
+
+double procedure id_center (id, x, width, type)
+
+pointer id # ID pointer
+double x # Initial guess
+real width # Feature width
+int type # Feature type
+
+int np1
+real value
+double dvalue
+
+real center1d()
+double smw_c1trand()
+
+begin
+ if (IS_INDEFD(x))
+ return (x)
+
+ dvalue = smw_c1trand (ID_PL(id), x)
+ if (IS_INDEFD(dvalue))
+ return (dvalue)
+
+ np1 = NP1(ID_SH(id)) - 1
+ value = dvalue - np1
+ value = center1d (value, IMDATA(id,1), ID_NPTS(id),
+ width, type, ID_CRADIUS(id), ID_THRESHOLD(id))
+
+ if (IS_INDEF(value))
+ return (INDEFD)
+ else
+ return (smw_c1trand (ID_LP(id), double(value+np1)))
+end