aboutsummaryrefslogtreecommitdiff
path: root/noao/digiphot/daophot/addstar/dpaddrd.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/digiphot/daophot/addstar/dpaddrd.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'noao/digiphot/daophot/addstar/dpaddrd.x')
-rw-r--r--noao/digiphot/daophot/addstar/dpaddrd.x89
1 files changed, 89 insertions, 0 deletions
diff --git a/noao/digiphot/daophot/addstar/dpaddrd.x b/noao/digiphot/daophot/addstar/dpaddrd.x
new file mode 100644
index 00000000..108448ee
--- /dev/null
+++ b/noao/digiphot/daophot/addstar/dpaddrd.x
@@ -0,0 +1,89 @@
+include "../lib/apseldef.h"
+
+# DP_TADINIT -- Initializie the column descriptors for the input ST photometry
+# table.
+
+procedure dp_tadinit (tp, column)
+
+pointer tp # table descriptor
+int column[ARB] # column pointer array
+
+begin
+ # Find the column pointers
+ call tbcfnd (tp, ID, column[1], 1)
+ if (column[1] == NULL)
+ call tbcfnd (tp, "ID", column[1], 1)
+ if (column[1] == NULL)
+ call printf ("Error reading ID.\n")
+
+ call tbcfnd (tp, XCENTER, column[2], 1)
+ if (column[2] == NULL)
+ call tbcfnd (tp, "XCENTER", column[2], 1)
+ if (column[2] == NULL)
+ call printf ("Error reading XCENTER.\n")
+
+ call tbcfnd (tp, YCENTER, column[3], 1)
+ if (column[3] == NULL)
+ call tbcfnd (tp, "YCENTER", column[3], 1)
+ if (column[3] == NULL)
+ call printf ("Error reading YCENTER.\n")
+
+ call tbcfnd (tp, MAG, column[4], 1)
+ if (column[4] == NULL)
+ call tbcfnd (tp, APMAG, column[4], 1)
+ if (column[4] == NULL)
+ call printf ("Error reading MAG.\n")
+end
+
+
+# DP_TADREAD -- Read a record from the input ST photometry table.
+
+procedure dp_tadread (tp, column, id, x, y, mag, row)
+
+pointer tp # table descriptor
+int column[ARB] # column pointer array
+int id # output id
+real x # output x value
+real y # output y value
+real mag # output magnitude
+int row # integer row
+
+bool nullflag
+
+begin
+ call tbrgti (tp, column[1], id, nullflag, 1, row)
+ if (nullflag)
+ id = 0
+ call tbrgtr (tp, column[2], x, nullflag, 1, row)
+ call tbrgtr (tp, column[3], y, nullflag, 1, row)
+ call tbrgtr (tp, column[4], mag, nullflag, 1, row)
+end
+
+
+# DP_GCOORDS -- Read the coordinates and magnitudes from a simple text file.
+
+int procedure dp_gcoords (cl, x, y, mag, id)
+
+int cl # file descriptor
+real x # x coordinate centers
+real y # y coordinate centers
+real mag # magnitudes
+int id # id of the star
+
+int fscan(), nscan()
+
+begin
+ while (fscan (cl) != EOF) {
+ call gargr (x)
+ call gargr (y)
+ call gargr (mag)
+ if (nscan () < 3)
+ next
+ call gargi (id)
+ if (nscan() < 4)
+ id = 0
+ return (1)
+ }
+
+ return (EOF)
+end