IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39051 for trunk


Ignore:
Timestamp:
Nov 6, 2015, 8:39:16 AM (11 years ago)
Author:
eugene
Message:

add -diff-inv options and detID modifications

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

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/include/addstar.h

    r39041 r39051  
    141141int     OLD_RESORT;
    142142int     READ_XRAD_DATA;
     143int     DIFF_WITH_INV;
    143144
    144145int    PARALLEL;
  • trunk/Ohana/src/addstar/src/LoadStars.c

    r38553 r39051  
    114114  }
    115115
     116  // only keep the even numbered images
     117  if (DIFF_WITH_INV) {
     118    if (*Nimages % 2) {
     119      fprintf (stderr, "-diff-inv only makes sense if an even number of images are supplied, non-inv first\n");
     120      exit (3);
     121    }
     122
     123    // detections from the odd images get bumped by the number of stars:
     124    for (i = 0; i < catalog->Nmeasure; i++) {
     125      int imageID = catalog->measure[i].imageID;
     126      if (imageID % 2) {
     127        catalog->measure[i].detID += images[0][imageID-1].nstar;
     128        catalog->measure[i].extID += images[0][imageID-1].nstar; // the PSPS ID uses the detID in definition
     129      }
     130      catalog->measure[i].imageID = imageID / 2;
     131    }
     132    for (i = 0; i < catalog->Nlensing; i++) {
     133      int imageID = catalog->lensing[i].imageID;
     134      if (imageID % 2) {
     135        catalog->lensing[i].detID += images[0][imageID-1].nstar;
     136      }
     137      catalog->lensing[i].imageID = imageID / 2;
     138    }
     139
     140    int NoutImages = *Nimages / 2;
     141    Image *outImages = NULL;
     142    ALLOCATE (outImages, Image, NoutImages);
     143    for (i = 0; i < NoutImages; i++) {
     144      outImages[i] = images[0][2*i];
     145      outImages[i].imageID = i;
     146    }
     147    free (*images);
     148
     149    *Nimages = NoutImages;
     150    *images = outImages;
     151  }
     152
    116153  if (*Nimages == 0) {
    117154    if (Nfile == 1)
  • trunk/Ohana/src/addstar/src/UpdateImageIDs.c

    r38553 r39051  
    5454  }
    5555
     56  // why is this not just a loop over catalog->Nmeasure and catalog->Nlensing??
    5657  off_t j, m;
    5758  for (i = 0; i < catalog->Naverage; i++) {
  • trunk/Ohana/src/addstar/src/args.c

    r38441 r39051  
    8787    remove_argument (N, &argc, argv);
    8888    READ_XRAD_DATA = TRUE;
     89  }
     90  DIFF_WITH_INV = FALSE;
     91  if ((N = get_argument (argc, argv, "-diff-inv"))) {
     92    remove_argument (N, &argc, argv);
     93    DIFF_WITH_INV = TRUE;
    8994  }
    9095
Note: See TracChangeset for help on using the changeset viewer.