/* FILE: qdphot.c * PURPOSE: Quick & Dirty CCD Stellar Photometry (QDPHOT) * AUTHOR: Kenneth J. Mighell (mighell@noao.edu) * LANGUAGE: ANSI C * DATE: 2001JUL03 * COPYRIGHT: (C) 2001 Assoc. of Universities for Research in Astronomy Inc. */ #include "mx.h" #include "qdphot.h" #include /* * ############################################################################ */ IRAFTASK (qdphot) { int status; extern int iraf_qdphot5 (void); status = iraf_qdphot5 (); } /* * ############################################################################ */ int iraf_qdphot5(void) { char mxfunc[] = "iraf_qdphot5"; int status; qdphot5_ParS Par; qdphot5_ImageS Image1; qdphot5_ImageS Image2; int nstr; int delta; int jdx; int jdxb; int jdxe; int jdy; int jdyb; int jdye; int jdy_squared; int dx; int dy; double radius; FILE *ofp1; FILE *ofp2; double odx2; double ody2; int nstrmx; clock_t chrono; double elapsed; time_t now; time_t start; time_t stop; struct tm *start_tm; struct tm *stop_tm; char pwd[30]; int coodim; int mxobj; int npx1; int npx2; int mxpx; time(&now); start_tm = localtime(&now); strftime (Par.ostart, sizeof Par.ostart, "%Y %B %d %H:%M:%S %Z %A", start_tm); status = mxp_init_f0(); if (status) {status=1; goto mx_error1;} status = qdphot5_ParS_Get_f1 (&Par); if (status) {status=2; goto mx_error1;} status = qdphot5_ImageS_Open_f3 (&Par, 1, &Image1); if (status) {status = 3; goto mx_error1;} status = qdphot5_ImageS_Open_f3 (&Par, 2, &Image2); if (status) {status = 4; goto mx_error1;} /* * Show banner if not printing photometry to STDOUT */ if ((!Image1.ofp_is_STDOUT)&&(!Image2.ofp_is_STDOUT)) { printf ("\007"); qdphot5_Banner_vf2 (stdout, ""); fflush (stdout); } chrono = clock(); /* * If no coordinate file, then find stars */ if (Par.coodim == 0) { npx1 = Image1.mxIrafImage->data->npxi; npx2 = Image2.mxIrafImage->data->npxi; mxpx = npx1; if ( npx2 > mxpx ) mxpx = npx2; mxobj = mxpx/4 + 1; /* estimate of max number of stars */ status = qdphot5_ParS_CooS_Peaker_f3( &Par, &Image1, mxobj ); if (status) {status = 45; goto mx_error1;} } if (Par.dosearch) { status = qdphot5_Search_f3 (&Par, &Image1, &Image2); if (status) {status = 48; goto mx_error1;} } do_phot: /* * Quick&Dirty photometry on sources in ParS->CooS */ qdphot5_QDPhot_vf3 (&Par, &Image1, &Image2); Par.ocpusec = (double)(clock() - chrono) / (double)CLOCKS_PER_SEC ; status = qdphot5_ParS_Put_f1 (&Par); if (status) {status=5; goto mx_error1;} time(&now); stop_tm = localtime(&now); strftime (Par.ostop, sizeof Par.ostop, "%Y %B %d %H:%M:%S %Z %A", start_tm); /* Print the command parameters */ qdphot5_ParS_Print_vf2 (&Par, Image1.ofp); if (Image1.ofp != Image2.ofp) qdphot5_ParS_Print_vf2 (&Par, Image2.ofp); ok: status = 0; goto bye; mx_error1: mxp_tmpmsg_init_f0(); mx_error2: mxp_errmsg_append_f3 (mxfunc, status, MX.tmpmsg); mxp_errmsg_dump_f0(); goto bye; bye: fflush (stdout); qdphot5_ImageS_Close_f1( &Image1 ); qdphot5_ImageS_Close_f1( &Image2 ); fflush (stdout); return(status); } /* end-of-file */