diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /noao/digiphot/apphot/center/apictr.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'noao/digiphot/apphot/center/apictr.x')
-rw-r--r-- | noao/digiphot/apphot/center/apictr.x | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/noao/digiphot/apphot/center/apictr.x b/noao/digiphot/apphot/center/apictr.x new file mode 100644 index 00000000..3a3bd31e --- /dev/null +++ b/noao/digiphot/apphot/center/apictr.x @@ -0,0 +1,48 @@ +# AP_ICTR -- Given a subraster of pixels and an initial center compute +# the centroid of the pixels. + +procedure ap_ictr (im, wx, wy, radius, emission, xcenter, ycenter) + +pointer im # pointer to the iraf image +real wx # initial x coordinate +real wy # initial y coordinate +int radius # half width of centering box +int emission # emission feature +real xcenter # fitted x coordinate +real ycenter # fitted y coordinate + +int nx, ny, ier +pointer cbuf +real xc, yc, datamin, datamax, junk +int ap_mctr1d() +pointer ap_ctrpix() + +begin + # Get the pixels. + cbuf = ap_ctrpix (im, wx, wy, radius, xc, yc, nx, ny) + if (cbuf == NULL) { + xcenter = wx + ycenter = wy + return + } + + # Fit the center of the subraster. + call alimr (Memr[cbuf], nx * ny, datamin, datamax) + if (emission == YES) + call asubkr (Memr[cbuf], datamin, Memr[cbuf], nx * ny) + else { + call anegr (Memr[cbuf], Memr[cbuf], nx * ny) + call aaddkr (Memr[cbuf], datamax, Memr[cbuf], nx * ny) + } + ier = ap_mctr1d (Memr[cbuf], nx, ny, 1.0, xcenter, ycenter, junk, junk) + + # Compute the center in image coordinates. + if (IS_INDEFR(xcenter)) + xcenter = wx + else + xcenter = xcenter + wx - xc + if (IS_INDEFR(ycenter)) + ycenter = wy + else + ycenter = ycenter + wy - yc +end |