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/photcal/fitparams/ftref.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'noao/digiphot/photcal/fitparams/ftref.x')
-rw-r--r-- | noao/digiphot/photcal/fitparams/ftref.x | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/noao/digiphot/photcal/fitparams/ftref.x b/noao/digiphot/photcal/fitparams/ftref.x new file mode 100644 index 00000000..0fab41c4 --- /dev/null +++ b/noao/digiphot/photcal/fitparams/ftref.x @@ -0,0 +1,50 @@ +include <error.h> +include "../lib/parser.h" + + +# FT_RFEVAL - Evaluate reference equation (left hand side) for all observations +# and store them into a one column table, called the reference table (rtable). + +procedure ft_rfeval (code, otable, rtable) + +pointer code # equation code +pointer otable # 2d observation table +pointer rtable # 1d reference table (output) + +int n +real rval +real dummy[1] + +#bool clgetb() +int mct_nrows() +real pr_eval() +pointer mct_getrow() + +begin + # Debug ? + #if (clgetb ("debug.fitcode")) { + #call eprintf ("ft_rfeval (code=%d) (otable=%d)\n") + #call pargi (code) + #call pargi (otable) + #} + + # Allocate space for reference table. + # call mct_alloc (rtable, mct_nrows (otable), 1, TY_REAL) + + # Loop over all data in the table. + do n = 1, mct_nrows (otable) { + + # Evaluate the equation. + iferr (rval = pr_eval (code, Memr[mct_getrow (otable, n)], dummy)) { + call eprintf ("ft_ref (%d)\n") + call pargi (n) + call erract (EA_ERROR) + } + + # Put data into reference table. + call mct_putr (rtable, n, 1, rval) + } + + # Debug ? + #call dg_dref ("from ft_rfeval", rtable) +end |