/* FILE: snowman.c * PURPOSE: * AUTHOR: Kenneth J. Mighell (mighell@noao.edu) * LANGUAGE: ANSI C * DATE: 2001SEP10 * COPYRIGHT: (C) 2001 Assoc. of Universities for Research in Astronomy Inc. */ #include #include "inc.h" #define DEBUG (MX_TRUE) IRAFTASK (snowman) { int i; extern int iraf_snowman (void); i = iraf_snowman (); } /* * ############################################################################ */ int iraf_snowman(void) { char mxfunc[] = "iraf_snowman"; int mxstatus=0; int status; inc_ParS ParS; inc_ImageS ImageS; struct mxip_image_s *xd=NULL; struct mxip_image_s *yd=NULL; struct mxip_image_s *zd=NULL; struct mxip_image_s *ed=NULL; struct mxip_image_s *md=NULL; struct mxip_image_s *wd=NULL; struct mxip_image_s *del[MXNPARL]; double mnpeak; double mxpeak; double rond; double pixeld; long nparl; long xdiml; long ydiml; long nptsl; long jl; int j; char ausec[MXNPARL+1]; double trued[MXNPARL]; double guessd[MXNPARL]; double ad[MXNPARL]; double ead[MXNPARL]; double diff_stopd; double lambdad; double old_chisqd; double chisqd; double rchsqd; double erchsqd; int k; long nptsmxl; double diff; long ndfl; int mfiti; double nsr; mxstatus++; status = mxp_init_f0(); if (status) goto mx_error; mxstatus++; status = inc_ParS_Get_i1 (&ParS); if (status) goto mx_error; mxstatus++; status = inc_ImageS_Open_i2 (&ParS, &ImageS); if (status) goto mx_error; mxstatus++; status = mxip_image_s_open_f7( &xd, ImageS.nxi, ImageS.nyi, ImageS.llx0i, ImageS.lly0i, 1, "X values"); if (status) goto mx_error; mxstatus++; status = mxip_image_s_open_f7( &yd, ImageS.nxi, ImageS.nyi, ImageS.llx0i, ImageS.lly0i, 1, "Y values"); if (status) goto mx_error; zd = ImageS.mxIrafImage->data; mxstatus++; status = mxip_image_s_open_f7( &ed, ImageS.nxi, ImageS.nyi, ImageS.llx0i, ImageS.lly0i, 1, "Error values"); if (status) goto mx_error; mxstatus++; status = mxip_image_s_open_f7( &md, ImageS.nxi, ImageS.nyi, ImageS.llx0i, ImageS.lly0i, 1, "Model values"); if (status) goto mx_error; mxstatus++; status = mxip_image_s_open_f7( &wd, ImageS.nxi, ImageS.nyi, ImageS.llx0i, ImageS.lly0i, 1, "Working vector"); if (status) goto mx_error; mxstatus++; for (k=0; kvectord, yd->vectord, xdiml, ydiml); rond = ParS.ron; if (rond<=0) rond = 1e-4; for (jl=0; jlvectord[jl]; if (pixeld>0) { ed->vectord[jl] = sqrt(pixeld+(rond*rond)); } else { ed->vectord[jl] = rond; } } strcpy(ausec,ParS.parflags); for (j=0; j0) ParS.osmag = -2.50*log10(ParS.ose/1.0); nsr = ParS.oese/ParS.ose; if (nsr>0.0) ParS.oesmag = 1.0857*nsr; /* 1.0857 is Pogson's constant */ /* ** ========================================================================= */ mxstatus++; status = inc_ParS_Put_i1 (&ParS); if (status) goto mx_error; inc_ParS_Print_v2 (&ParS, stdout); ok: status = 0; goto bye; mx_error: mx_error1: mxp_tmpmsg_init_f0(); mx_error2: mxp_errmsg_append_f3 (mxfunc, mxstatus, MX.tmpmsg); mxp_tmpmsg_init_f0(); mxp_errmsg_dump_f0(); goto bye; bye: inc_ImageS_Close_i1( &ImageS ); fflush (stdout); return(status); } #undef DEBUG /* end-of-file */