#include "focas1.h" /* ARTCAT -- Enter objects to make an artificial catalog */ artcat (catalog) char *catalog; { FILE *fin; int i, j, x1, x2, y1, y2, ny; float x, y, m, L, intmag(); char object[80], class[5]; struct objrec ob; struct areas a; fin = getstdin; cfd = catopen (catalog, 2); afd = fndar (sp.arfl, 1); cmmnt ("artcat"); wtcathdr (cfd, 0); ob.subent = 0; ob.eflgs = EVAL; ob.sbr = 0.; ob.nsbr = 0; ob.ssbr = 0.; ob.area = 0; ob.tarea = 0; ob.ispht = 0.; ob.xavg = ob.yavg = 0.; ob.ra = ob.dec = 0.; ob.sLi = 0.; ob.icx = ob.icy = ob.ixx = ob.iyy = ob.ixy = 0.; ob.ir1 = ob.ir3 = ob.ir4 = 0.; ob.cx = ob.cy = ob.xx = ob.yy = ob.xy = ob.r1 = 0.; ob.fitxc = ob.fityc = 0.; ob.frac = ob.scale = ob.prob = 0.; for (i=0;;) { gets (object); if (feof (fin)) break; j = sscanf (object, "%hf %hf %hf %s %hf %hf %hf", &x, &y, &m, class, &ob.scale, &ob.frac, &ob.prob); if (j < 3) continue; if (j == 3) strcpy (class, "s"); else strcpy (class, "g"); L = pow (10., -0.4 * m); ob.entnum = i++; strncpy (ob.class, class, 5); ob.xc = x - 1; ob.yc = y - 1; ob.Li = ob.Lc = ob.Lfca = ob.Ltotal = L; ob.mag = intmag (L); x1 = x - 4.5 > 0 ? x - 4.5 : 0; x2 = x + 3.5 < sp.kpts - 1 ? x + 3.5 : sp.kpts - 1; y1 = y - 4.5 > 0 ? y - 4.5 : 0; y2 = y + 3.5 < sp.kscan - 1 ? y + 3.5 : sp.kscan - 1; ny = y2 - y1 + 1; a.rct[0] = x1; a.rct[1] = y1; a.rct[2] = x2; a.rct[3] = y2; a.xmin = x1; a.xmax = x2; a.d.ychst = y2; a.d.nlines = ny; for (j=0; j