IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 10939


Ignore:
Timestamp:
Jan 5, 2007, 11:23:20 AM (19 years ago)
Author:
eugene
Message:

added updates to client/server version and threaded server

Location:
trunk/Ohana/src/addstar
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/Makefile

    r10937 r10939  
    4141$(SRC)/fakeimage.$(ARCH).o \
    4242$(SRC)/find_matches.$(ARCH).o \
     43$(SRC)/find_matches_closest.$(ARCH).o \
    4344$(SRC)/find_matches_refstars.$(ARCH).o \
    4445$(SRC)/find_subset.$(ARCH).o \
     
    7172
    7273# $(SRC)/gimages.$(ARCH).o \
    73 # $(SRC)/find_matches_closest.$(ARCH).o \
    7474
    7575ADDSTARD = \
     
    107107$(SRC)/getusno.$(ARCH).o \
    108108$(SRC)/getusnob.$(ARCH).o \
     109$(SRC)/ImageOptions.$(ARCH).o \
    109110$(SRC)/gimages.$(ARCH).o \
    110111$(SRC)/greference.$(ARCH).o \
     
    118119ADDSTART = \
    119120$(SRC)/addstart.$(ARCH).o \
     121$(SRC)/ImageOptions.$(ARCH).o \
    120122$(SRC)/DatasetOps.$(ARCH).o \
    121123$(SRC)/SocketOps.$(ARCH).o \
     
    163165ADDSTARC = \
    164166$(SRC)/addstarc.$(ARCH).o \
     167$(SRC)/airmass.$(ARCH).o \
    165168$(SRC)/SocketOps.$(ARCH).o \
    166169$(SRC)/ConfigInit.$(ARCH).o \
     
    168171$(SRC)/grefstars.$(ARCH).o \
    169172$(SRC)/load_subpix.$(ARCH).o \
    170 $(SRC)/rfits.$(ARCH).o \
    171173$(SRC)/parse_time.$(ARCH).o \
    172 $(SRC)/rtext.$(ARCH).o \
     174$(SRC)/ReadStarsFITS.$(ARCH).o \
     175$(SRC)/GetFileMode.$(ARCH).o \
     176$(SRC)/ReadImageHeader.$(ARCH).o \
     177$(SRC)/ReadStarsTEXT.$(ARCH).o \
     178$(SRC)/FilterStars.$(ARCH).o \
    173179$(SRC)/Shutdown.$(ARCH).o \
    174180$(SRC)/SetSignals.$(ARCH).o \
  • trunk/Ohana/src/addstar/include/addstar.h

    r10937 r10939  
    2525  int Nstars;
    2626  Stars *stars;
    27   Image *image;
     27  int Nimages;
     28  Image *images;
    2829  Coords *mosaic;
    2930  SkyRegion *patch;
     
    202203int        WaitServerSocket       PROTO((int InitSocket, SockAddress *Address, int *validIP, int Nvalid));
    203204int        GetClientSocket        PROTO((char *hostname));
    204 int        UpdateDatabase_Image   PROTO((AddstarClientOptions *options, Image *image, Coords *mosaic, Stars *stars, int Nstars));
     205int        UpdateDatabase_Image   PROTO((AddstarClientOptions *options, Image *images, int Nimages, Coords *mosaic, Stars *stars, int Nstars));
    205206int        UpdateDatabase_Reflist PROTO((AddstarClientOptions *options, Stars *stars, int Nstars));
    206207int        UpdateDatabase_Refcat  PROTO((AddstarClientOptions *options, SkyRegion *UserPatch, char *refcat));
  • trunk/Ohana/src/addstar/src/NewImage.c

    r5347 r10939  
    33int NewImage (int BindSocket) {
    44
    5   int N, Nstars;
     5  int N, Nstars, Nimages;
    66  Stars *stars;
    7   Image *image;
     7  Image *images;
    88  Coords *mosaic;
    99  AddstarClientOptions *options;
     
    1919  }
    2020
    21   if (!Recv_Image (BindSocket, &image, &N)) {
     21  if (!Recv_Image (BindSocket, &images, &Nimages)) {
    2222    fprintf (stderr, "error: problem receiving image data\n");
    23     goto reject;
    24   }
    25   if (N != 1) {
    26     fprintf (stderr, "error: invalid number of images (%d)\n", N);
    2723    goto reject;
    2824  }
     
    4339    goto reject;
    4440  }
    45   fprintf (stderr, "accepted %s, %d stars\n", image[0].name, Nstars);
     41  fprintf (stderr, "accepted %d images, %d stars\n", Nimages, Nstars);
    4642
    4743  /* add to db */
    48   UpdateDatabase_Image (options, image, mosaic, stars, Nstars);
     44  UpdateDatabase_Image (options, images, Nimages, mosaic, stars, Nstars);
    4945
    5046  close (BindSocket);
  • trunk/Ohana/src/addstar/src/NewImage_Thread.c

    r6498 r10939  
    33int NewImage_Thread (int BindSocket) {
    44
    5   int N, Nstars;
     5  int N, Nstars, Nimages;
    66  Stars *stars;
    7   Image *image;
     7  Image *images;
    88  Coords *mosaic;
    99  AddstarClientOptions *options;
     
    2020  }
    2121
    22   if (!Recv_Image (BindSocket, &image, &N)) {
     22  if (!Recv_Image (BindSocket, &images, &Nimages)) {
    2323    fprintf (stderr, "error: problem receiving image data\n");
    24     goto reject;
    25   }
    26   if (N != 1) {
    27     fprintf (stderr, "error: invalid number of images (%d)\n", N);
    2824    goto reject;
    2925  }
     
    4440    goto reject;
    4541  }
    46   fprintf (stderr, "accepted %s, %d stars\n", image[0].name, Nstars);
     42  fprintf (stderr, "accepted %d, %d stars\n", Nimages, Nstars);
    4743
    4844  /* create new dataset to store the incoming data */
     
    5147  dataset[0].patch   = NULL;
    5248  dataset[0].refcat  = NULL;
    53   dataset[0].image   = image;
     49  dataset[0].images  = images;
     50  dataset[0].Nimages = Nimages;
    5451  dataset[0].mosaic  = mosaic;
    5552  dataset[0].stars   = stars;
  • trunk/Ohana/src/addstar/src/NewRefcat_Thread.c

    r6674 r10939  
    4343  dataset[0].patch   = patch;
    4444  dataset[0].refcat  = message.buffer;
    45   dataset[0].image   = NULL;
     45  dataset[0].images  = NULL;
    4646  dataset[0].mosaic  = NULL;
    4747  dataset[0].stars   = NULL;
  • trunk/Ohana/src/addstar/src/NewReflist_Thread.c

    r6674 r10939  
    2929  dataset[0].patch   = NULL;
    3030  dataset[0].refcat  = NULL;
    31   dataset[0].image   = NULL;
     31  dataset[0].images  = NULL;
    3232  dataset[0].mosaic  = NULL;
    3333  dataset[0].stars   = stars;
  • trunk/Ohana/src/addstar/src/UpdateDatabase_Image.c

    r8516 r10939  
    11# include "addstar.h"
    22
    3 int UpdateDatabase_Image (AddstarClientOptions *options, Image *image, Coords *mosaic, Stars *stars, int Nstars) {
     3int UpdateDatabase_Image (AddstarClientOptions *options, Image *images, int Nimages, Coords *mosaic, Stars *stars, int Nstars) {
    44
    55  int i, Noverlap, status;
    66  Image *overlap;
    77  Catalog catalog;
    8   SkyList *skylist;
     8  SkyList *skylist, *newlist;
    99
    1010  if (options[0].mode != M_IMAGE) {
     
    1616  if (options[0].update) catalog.catflags = LOAD_AVES | LOAD_MEAS_META | LOAD_MISS | LOAD_SECF;
    1717 
     18  // XXX this is probably not needed anymore
    1819  SetAirmassQuality (options[0].quality_airmass);
    19 
    20   /*** find image overlaps, if needed ***/
    21   Noverlap = 0;
    22   overlap = NULL;
    23   if (!options[0].skip_missed) {
    24     FITS_DB db;
    25 
    26     set_db (&db);
    27     status = dvo_image_lock (&db, ImageCat, 60.0, LCK_SOFT);
    28     if (!status) Shutdown ("ERROR: failure to lock image catalog %s", db.filename);
    29 
    30     /* load images / build overlap : XXX EAM : split into two functions? */
    31     overlap = gimages (&db, image, mosaic, &Noverlap);
    32     dvo_image_unlock (&db);
    33   }
    3420
    3521  /*** update catalog: average, measure, etc ***/
     
    3723  /* find correpsonding regions for image */
    3824  RegisterMosaic (mosaic);
    39   skylist = SkyListByImage (ServerSky, -1, image);
     25  skylist = NULL;
     26  newlist = NULL;
     27  for (i = 0; i < Nimages; i++) {
     28      newlist = SkyListByImage (ServerSky, -1, &images[i]);
     29      SkyListMerge (&skylist, newlist);
     30      SkyListFree (newlist, FALSE);
     31  }
     32
     33  ImageOptions (options, images, Nimages);
    4034
    4135  /* reduce regions to existing subset, if necessary */
     
    7367
    7468    if (options[0].closest) {
    75       find_matches_closest (skylist[0].regions[i], stars, Nstars, &catalog, image, overlap, Noverlap, mosaic, options[0]);
     69      find_matches_closest (skylist[0].regions[i], stars, Nstars, &catalog, options[0]);
    7670    } else {
    77       find_matches (skylist[0].regions[i], stars, Nstars, &catalog, image, overlap, Noverlap, mosaic, options[0]);
     71      find_matches (skylist[0].regions[i], stars, Nstars, &catalog, options[0]);
    7872    }
    7973
     
    8781  }
    8882
    89   if (options[0].calibrate) { FindCalibration (image); }
     83  if (options[0].calibrate) { FindCalibration (&images[0]); }
    9084 
    9185  /*** load image db, save new image ***/
     
    9387    FITS_DB db;
    9488
    95     set_db (&db);
    96 
     89    /*** update the image table ***/
     90    /* setup image table format and lock */
     91    db.mode   = dvo_catalog_catmode (CATMODE);
     92    db.format = dvo_catalog_catformat (CATFORMAT);
    9793    status = dvo_image_lock (&db, ImageCat, 60.0, LCK_XCLD);
    9894    if (!status) Shutdown ("ERROR: failure to lock image catalog %s", db.filename);
    9995
    100     /* load images / build overlap : XXX EAM : split into two functions? */
    101     overlap = gimages (&db, image, mosaic, &Noverlap);
     96    /* load or create the image table */
     97    if (db.dbstate == LCK_EMPTY) {
     98      if (VERBOSE) fprintf (stderr, "can't find %s, creating a new one\n", ImageCat);
     99      dvo_image_create (&db, ZeroPt);
     100    } else {
     101      if (!dvo_image_load (&db, VERBOSE, FORCE_READ)) {
     102        Shutdown ("can't read image catalog %s", db.filename);
     103      }
     104    }
    102105
    103     if (db.dbstate == LCK_EMPTY) dvo_image_create (&db, ZeroPt);
    104  
    105106    /* write out new image */
    106     dvo_image_addrows (&db, image, 1);
     107    dvo_image_addrows (&db, images, Nimages);
    107108    SetProtect (TRUE);
    108109    dvo_image_update (&db, VERBOSE);
     
    111112  }
    112113  free (mosaic);
    113   free (image);
     114  free (images);
    114115  free (stars);
    115116  return (TRUE);
  • trunk/Ohana/src/addstar/src/addstar.c

    r10937 r10939  
    103103        Nsubset = Nstars;
    104104        if (options.closest) {
    105           // Nmatch += find_matches_closest (skylist[0].regions[i], stars, Nstars, &catalog, options);
     105          Nmatch += find_matches_closest (skylist[0].regions[i], stars, Nstars, &catalog, options);
    106106        } else {
    107107          Nmatch += find_matches (skylist[0].regions[i], stars, Nstars, &catalog, options);
  • trunk/Ohana/src/addstar/src/addstarc.c

    r5445 r10939  
    33int main (int argc, char **argv) {
    44
    5   int Nstars;
     5  int Nstars, Nimages;
    66  int BindSocket;
    77  AddstarClientOptions options;
    88  Stars *stars;
    9   Image image;
     9  Image *images;
    1010
    1111  /* load config and options */
     
    2121    case M_IMAGE:
    2222      /* load data */
    23       stars = gstars (argv[1], &Nstars, options.photcode, &image);
     23      stars = gstars (argv[1], &Nstars, &images, &Nimages, options.photcode);
    2424
    2525      /* send data to server */
    2626      SendCommand (BindSocket, 5, "IMAGE");
    2727      Send_AddstarClientOptions (BindSocket, &options, 1, TRUE);
    28       Send_Image (BindSocket, &image, 1, FALSE);
     28      Send_Image (BindSocket, images, Nimages, FALSE);
    2929      if (options.mosaic) {
    3030        Send_Coords (BindSocket, MOSAIC, 1, FALSE);
  • trunk/Ohana/src/addstar/src/addstart.c

    r8361 r10939  
    3232    switch (dataset[0].options[0].mode) {
    3333      case M_IMAGE:
    34         UpdateDatabase_Image (dataset[0].options, dataset[0].image, dataset[0].mosaic, dataset[0].stars, dataset[0].Nstars);
     34        UpdateDatabase_Image (dataset[0].options, dataset[0].images, dataset[0].Nimages, dataset[0].mosaic, dataset[0].stars, dataset[0].Nstars);
    3535        continue;
    3636
  • trunk/Ohana/src/addstar/src/find_matches.c

    r10937 r10939  
    1010  int Nave, NAVE, Nmeas, NMEAS, Nmatch;
    1111  int Nsecfilt, Nsec;
    12   float Mcat, *Mval, MTIME;
     12  float Mcat, *Mval;
    1313  PhotCode *code;
    1414  Coords tcoords;
     
    9898  /** find matched stars **/
    9999  for (i = j = 0; (i < Nstars) && (j < Nave); ) {
    100    
     100        if (!finite(X1[i]) || !finite(Y1[i])) {
     101      i++;
     102      continue;
     103    }
     104    if (!finite(X2[j]) || !finite(Y2[j])) {
     105      j++;
     106      continue;
     107    }
     108
    101109    /* negative dX: j is too large */
    102110    dX = X1[i] - X2[j];
     
    273281    catalog[0].measure[Nmeas].airmass_PS  = stars[N].airmass;
    274282
    275     catalog[0].measure[Nmeas].Mgal_PS     = MIN (stars[N].Mgal + MTIME, NO_MAG);
     283    catalog[0].measure[Nmeas].Mgal_PS     = stars[N].Mgal;
    276284    catalog[0].measure[Nmeas].FWx         = MIN (100*stars[N].fx, NO_MAG);
    277285    catalog[0].measure[Nmeas].FWy         = MIN (100*stars[N].fy, NO_MAG);
  • trunk/Ohana/src/addstar/src/find_matches_closest.c

    r8644 r10939  
    11# include "addstar.h"
    22
    3 int find_matches_closest (SkyRegion *region, Stars *stars, int NstarsIn, Catalog *catalog, Image *image, Image *overlap, int Noverlap, Coords *mosaic, AddstarClientOptions options) {
     3int find_matches_closest (SkyRegion *region, Stars *stars, int NstarsIn, Catalog *catalog, AddstarClientOptions options) {
    44
    55  int i, j, n, N, J, Jmin, status, Nstars;
     
    1414  PhotCode *code;
    1515
    16   /* XXX EAM : options.photcode overridden by image.source.... */
    17   code = GetPhotcodebyCode (image[0].source);
    18 
    19   /* photcode data - must by of type DEP, (PRI, SEC) - probably should restrict to DEP */
     16  /* photcode data - must by of type DEP; options.photcode is equiv PRI/SEC photcode */
     17  /* this function requires incoming stars to have the same photcode.equiv value */
    2018  Nsecfilt = GetPhotcodeNsecfilt ();
    21   Nsec = (code[0].type == PHOT_DEP) ? GetPhotcodeNsec (code[0].equiv) : GetPhotcodeNsec (code[0].code);
    22   /* this function requires incoming stars to have the same photcode */
     19  Nsec     = GetPhotcodeNsec (options.photcode);
    2320
    2421  /** allocate local arrays (stars) **/
     
    4138
    4239  /* project onto rectilinear grid with 1 arcsec pixels. the choice of ZEA projection has the
    43      advantage that every point in R,D has a mapping to a unique X,Y.  However, note that not all
    44      possible X,Y points map back to R,D and the local plate scale changes substantially far from
    45      the projection pole.  a better mapping might be ARC, not yet implemented (see
    46      coordops.update.c).  We keep the original crpix1,2 and crref1,2.  For mosaic astrometry, the
    47      grid should be w.r.t. the tangent-plane, not chip coords */
    48 
    49   if (!strcmp (&image[0].coords.ctype[4], "-WRP")) {
    50     tcoords = mosaic[0];
    51     tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0;
    52     tcoords.pc1_1 = tcoords.pc2_2 = 1.0;
    53     tcoords.pc1_2 = tcoords.pc2_1 = 0.0;
    54     tcoords.Npolyterms = 1;
    55     strcpy (tcoords.ctype, "RA---ZEA");
     40   * advantage that every point in R,D has a mapping to a unique X,Y.  However, note that not all
     41   * possible X,Y points map back to R,D and the local plate scale changes substantially far from
     42   * the projection pole.  a better mapping might be ARC, not yet implemented (see
     43   * coordops.update.c).  We use the center of the region (catalog) for crval1,2.
     44   */
     45  tcoords.crval1 = 0.5*(region[0].Rmin + region[0].Rmax);
     46  if (region[0].Rmax < 90) {
     47    tcoords.crval2 = 0.5*(region[0].Dmin + region[0].Dmax);
    5648  } else {
    57     tcoords = image[0].coords;
    58     tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0;
    59     tcoords.pc1_1 = tcoords.pc2_2 = 1.0;
    60     tcoords.pc1_2 = tcoords.pc2_1 = 0.0;
    61     tcoords.Npolyterms = 1;
    62     strcpy (tcoords.ctype, "RA---ZEA");
    63   }
     49    tcoords.crval2 = 90.0;
     50  }
     51  tcoords.crpix1 = 0;
     52  tcoords.crpix2 = 0;
     53  tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0;
     54  tcoords.pc1_1 = tcoords.pc2_2 = 1.0;
     55  tcoords.pc1_2 = tcoords.pc2_1 = 0.0;
     56  tcoords.Npolyterms = 1;
     57  strcpy (tcoords.ctype, "RA---ZEA");
    6458
    6559  /* build spatial index (RA sort) referencing input array sequence */
     
    8074    free (Y2);
    8175    free (N2);
    82     return;
     76    return (0);
    8377  }
    8478  if (Nstars > 1) sort_lists (X1, Y1, N1, Nstars);
     
    10296
    10397  /* choose a radius for matches */
    104   if (options.radius == 0) {
    105     RADIUS = options.Nsigma * 0.02 * image[0].cerror;  /* 0.02 corrects cerror to arcsec from storage units */
    106   } else {
    107     RADIUS = options.radius; /* provided by config */
    108   }
     98  RADIUS = options.radius; /* provided by config */
    10999  RADIUS2 = RADIUS*RADIUS;
    110 
    111   /* correct instrumental mags for exposure time */
    112   MTIME = (image[0].exptime > 0) ? 2.500*log10(image[0].exptime) : 0.0;
    113100
    114101  /** find matched stars **/
     
    170157    /* add to end of measurement list */
    171158    add_meas_link (&catalog[0].average[n], next_meas, Nmeas, NMEAS);
    172     ohana_memcheck (0);
    173159       
    174     /* calculate accurate per-star airmass, if required */
    175     secz = airmass (image[0].secz_PS, stars[N].R, stars[N].D, image[0].sidtime, image[0].latitude);
    176      
    177160    /** add measurements for this star **/
    178161    /** dR,dD now represent arcsec **/
     
    196179    }
    197180    catalog[0].measure[Nmeas].dD_PS       = 3600.0*(catalog[0].average[n].D - stars[N].D);
    198     catalog[0].measure[Nmeas].M_PS        = MIN (stars[N].M + MTIME, NO_MAG);
    199     catalog[0].measure[Nmeas].dM_PS       = MIN (stars[N].dM, NO_ERR);  /* error in input files stored in thousandths of mag */
    200     catalog[0].measure[Nmeas].Mcal_PS     = image[0].Mcal_PS;
    201     catalog[0].measure[Nmeas].t           = image[0].tzero + 1e-4*stars[N].Y*image[0].trate;  /* trate is in 0.1 msec / row */
     181    catalog[0].measure[Nmeas].M_PS        = stars[N].M;
     182    catalog[0].measure[Nmeas].dM_PS       = stars[N].dM;  /* error in input files stored in thousandths of mag */
     183    catalog[0].measure[Nmeas].Mcal_PS     = stars[N].Mcal;
     184    catalog[0].measure[Nmeas].t           = stars[N].t;
    202185    catalog[0].measure[Nmeas].averef      = n;
    203186    catalog[0].measure[Nmeas].source      = stars[N].code;  /* photcode */
    204187    catalog[0].measure[Nmeas].dophot      = stars[N].dophot; 
    205188    catalog[0].measure[Nmeas].flags       = 0;
    206     catalog[0].measure[Nmeas].dt_PS       = MTIME;
    207     catalog[0].measure[Nmeas].airmass_PS  = secz;
    208 
    209     catalog[0].measure[Nmeas].Mgal_PS     = MIN (stars[N].Mgal + MTIME, NO_MAG);
     189    catalog[0].measure[Nmeas].dt_PS       = stars[N].dt;
     190    catalog[0].measure[Nmeas].airmass_PS  = stars[N].airmass;
     191
     192    catalog[0].measure[Nmeas].Mgal_PS     = stars[N].Mgal;
    210193    catalog[0].measure[Nmeas].FWx         = MIN (100*stars[N].fx, NO_MAG);
    211194    catalog[0].measure[Nmeas].FWy         = MIN (100*stars[N].fy, NO_MAG);
     
    234217    Nmeas ++;
    235218    i++;
    236     ohana_memcheck (0);
    237   }
    238   ohana_memcheck (0);
    239 
    240   /** add reference for undetected catalog stars **/
    241   if (!strcmp (&image[0].coords.ctype[4], "-WRP")) RegisterMosaic (mosaic);
    242   for (j = 0; (j < Nave) && !options.skip_missed; j++) {
    243     n = N2[j];
    244     if (catalog[0].found[n] < 0) {
    245       /* make sure there is space for next entry */
    246       if (Nmiss >= NMISS) {
    247         NMISS = Nmiss + 1000;
    248         REALLOCATE (next_miss, int, NMISS);
    249         REALLOCATE (catalog[0].missing, Missing, NMISS);
    250       }
    251 
    252       /* should the catalog star be on this image? project into image coords */
    253       if (!in_image (catalog[0].average[n].R, catalog[0].average[n].D, image)) continue;
    254       add_miss_link (&catalog[0].average[n], next_miss, Nmiss);
    255 
    256       /* calculate time of exposure for this coordinate in the image */
    257       RD_to_XY (&X, &Y, catalog[0].average[n].R, catalog[0].average[n].D, &image[0].coords);     
    258       catalog[0].missing[Nmiss].t  = image[0].tzero + 1e-4*Y*image[0].trate;  /* trate is in 0.1 msec / row */
    259       catalog[0].average[n].Nn ++;
    260       Nmiss ++;
    261     }
    262219  }
    263220
     
    279236    N = N1[i];
    280237    if (stars[N].found >= 0) continue;
    281     if (!IN_CATALOG (stars[N].R, stars[N].D)) continue;
    282 
    283     secz = airmass (image[0].secz_PS, stars[N].R, stars[N].D, image[0].sidtime, image[0].latitude);
     238    if (!IN_REGION (stars[N].R, stars[N].D)) continue;
    284239
    285240    catalog[0].average[Nave].R         = stars[N].R;
     
    313268    catalog[0].measure[Nmeas].dR_PS       = 0.0;
    314269    catalog[0].measure[Nmeas].dD_PS       = 0.0;
    315     catalog[0].measure[Nmeas].M_PS        = MIN (stars[N].M + MTIME, NO_MAG);
    316     catalog[0].measure[Nmeas].dM_PS       = MIN (stars[N].dM, NO_ERR);
    317     catalog[0].measure[Nmeas].Mcal_PS     = image[0].Mcal_PS;
    318     catalog[0].measure[Nmeas].t           = image[0].tzero + 1e-4*stars[N].Y*image[0].trate; /* trate is in 0.1 msec / row */
     270    catalog[0].measure[Nmeas].M_PS        = stars[N].M;
     271    catalog[0].measure[Nmeas].dM_PS       = stars[N].dM;
     272    catalog[0].measure[Nmeas].Mcal_PS     = stars[N].Mcal;
     273    catalog[0].measure[Nmeas].t           = stars[N].t;
    319274    catalog[0].measure[Nmeas].averef      = Nave;
    320275    catalog[0].measure[Nmeas].source      = stars[N].code;  /* photcode */
    321276    catalog[0].measure[Nmeas].dophot      = stars[N].dophot; 
    322277    catalog[0].measure[Nmeas].flags       = 0;
    323     catalog[0].measure[Nmeas].dt_PS       = MTIME;
    324     catalog[0].measure[Nmeas].airmass_PS  = secz;
    325 
    326     catalog[0].measure[Nmeas].Mgal_PS     = MIN (stars[N].Mgal + MTIME, NO_MAG);
     278    catalog[0].measure[Nmeas].dt_PS       = stars[N].dt;
     279    catalog[0].measure[Nmeas].airmass_PS  = stars[N].airmass;
     280
     281    catalog[0].measure[Nmeas].Mgal_PS     = stars[N].Mgal;
    327282    catalog[0].measure[Nmeas].FWx         = MIN (100*stars[N].fx, NO_MAG);
    328283    catalog[0].measure[Nmeas].FWy         = MIN (100*stars[N].fy, NO_MAG);
     
    332287    Mval = (Nsec == -1) ? &catalog[0].average[Nave].M : &catalog[0].secfilt[Nave*Nsecfilt+Nsec].M_PS;
    333288    if (*Mval == NO_MAG) *Mval = Mcat;
    334 
    335     /** now add references from all previous non-detection observations of this spot on the sky */
    336     for (j = 0; (j < Noverlap) && !options.skip_missed; j++) {
    337       /* make sure there is space for next entry */
    338       if (Nmiss >= NMISS) {
    339         NMISS = Nmiss + 1000;
    340         REALLOCATE (next_miss, int, NMISS);
    341         REALLOCATE (catalog[0].missing, Missing, NMISS);
    342       }
    343       if (!FindMosaicForImage (overlap, Noverlap, j)) continue;
    344       if (!in_image (catalog[0].average[Nave].R, catalog[0].average[Nave].D, &overlap[j])) continue;
    345       add_miss_link (&catalog[0].average[Nave], next_miss, Nmiss);
    346 
    347       /* get time of exposure of this portion of the image */
    348       RD_to_XY (&X, &Y, catalog[0].average[Nave].R, catalog[0].average[Nave].D, &overlap[j].coords);     
    349       catalog[0].missing[Nmiss].t  = overlap[j].tzero + 1e-4*Y*overlap[j].trate;  /* rough guess at time */
    350       catalog[0].average[Nave].Nn ++;
    351       Nmiss ++;
    352     }
    353289
    354290    /* next[Nmeas] should always be -1 in this context (it is always the only
     
    362298  REALLOCATE (catalog[0].average, Average, Nave);
    363299  REALLOCATE (catalog[0].measure, Measure, Nmeas);
    364   REALLOCATE (catalog[0].missing, Missing, Nmiss);
    365300 
    366301  if (options.nosort) {
     
    370305    catalog[0].measure = sort_measure (catalog[0].average, Nave, catalog[0].measure, Nmeas, next_meas);
    371306  }
    372   catalog[0].missing = sort_missing (catalog[0].average, Nave, catalog[0].missing, Nmiss, next_miss);
    373   /* missing is REQUIRED to be sorted */
    374307
    375308  /* note stars which have been found in this catalog */
     
    385318  catalog[0].Naverage = Nave;
    386319  catalog[0].Nmeasure = Nmeas;
    387   catalog[0].Nmissing = Nmiss;
    388   if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas, Nmiss: %d %d %d %d, (%d matches)\n", NstarsIn, Nave, Nmeas, Nmiss, Nmatch);
     320  if (VERBOSE) fprintf (stderr, "Nstars, Nave, Nmeas: %d %d %d, (%d matches)\n", Nstars, Nave, Nmeas, Nmatch);
    389321
    390322  free (catalog[0].found);
Note: See TracChangeset for help on using the changeset viewer.