/* FILE: QDPhot.c * PURPOSE: Do Quick&Dirty photometry on two images. * 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" #define DEBUG (MX_FALSE) void qdphot5_QDPhot_vf3 ( qdphot5_ParS *ParS, qdphot5_ImageS *ImageS1, qdphot5_ImageS *ImageS2 ){ char mxfunc[] = "qdphot5_QDPhot_vf3"; int status; int mxnstr; int nstr; int id; qdphot5_PhotS PhotS1; qdphot5_PhotS PhotS2; FILE *out1fd; FILE *out2fd; double x1cood; double y1cood; int rejects; int ok; int k; int check_moving; int moving; int moving1; int moving2; int ignore; mxnstr = ParS->mxstars; rejects = ParS->rejects; check_moving = ParS->moving; out1fd = ImageS1->ofp; out2fd = ImageS2->ofp; nstr = 0; if (ParS->coostars<1) goto bye; for ( k=0; k<(ParS->coostars); ++k ) { if ((mxnstr>0)&&(nstr>=mxnstr)) goto shut_down; nstr++; id = nstr; /* coordinate file true X and Y */ x1cood = ParS->CooS[k].xd; y1cood = ParS->CooS[k].yd; if (DEBUG) printf ( "%8.2f%8.2f%7d\n", x1cood, y1cood, id ); /* 1st image */ qdphot5_PhotS_Calc_f5 (ImageS1, &PhotS1, x1cood, y1cood, id); /* 2nd image */ if (PhotS1.ok || rejects) qdphot5_PhotS_Calc_f5 (ImageS2, &PhotS2, x1cood, y1cood, id); /* Print results if ok */ ok = (PhotS1.ok && PhotS2.ok) || rejects; /* OK if both stars are good */ if ( check_moving ) { /* are we analyzing moving objects? */ PhotS1.moving = MX_FALSE; PhotS2.moving = MX_FALSE; if (PhotS1.ok) PhotS1.moving = MX_TRUE; if (!PhotS2.ok) { if (PhotS2.sgnl==0) PhotS2.moving = MX_TRUE; } ok = PhotS1.moving && PhotS2.moving; /* OK if 1st star has moved */ } if ( ok ) { qdphot5_PhotS_Print_vf3 (&PhotS1, out1fd, 1); qdphot5_PhotS_Print_vf3 (&PhotS2, out2fd, 1); } else { nstr--; } } shut_down: /* Print description of columns */ if (nstr>0) { qdphot5_PhotS_Print_vf3 (&PhotS1, out1fd, 0); if (out1fd != out2fd) qdphot5_PhotS_Print_vf3 (&PhotS2, out2fd, 0); } bye: ParS->ostars = nstr; return; } #undef DEBUG /* end-of-file */