IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 7, 2013, 9:51:07 AM (13 years ago)
Author:
eugene
Message:

merge changes from eam_branches/ipp-20130306: addstar now can block against duplicate image IDs; mextract, mmatch now use a subset of image metadata instead of the whole table

Location:
trunk/Ohana
Files:
6 edited
3 copied

Legend:

Unmodified
Added
Removed
  • trunk/Ohana

  • trunk/Ohana/src/libdvo/Makefile

    r34260 r35263  
    9898$(SRC)/LoadImages.$(ARCH).o             \
    9999$(SRC)/ImageSelection.$(ARCH).o         \
     100$(SRC)/ImageMetadataSelection.$(ARCH).o \
     101$(SRC)/ImageMetadata.$(ARCH).o \
    100102$(SRC)/ImageOps.$(ARCH).o               \
    101103$(SRC)/match_image.$(ARCH).o            \
  • trunk/Ohana/src/libdvo/include/dvodb.h

    r35237 r35263  
    298298} dbValue;
    299299
     300typedef struct {
     301  double crval1;
     302  double crval2;
     303  unsigned int imageID;
     304  unsigned int externID;
     305  unsigned int expname;
     306  float Mcal;
     307  float secz;
     308  float Xcenter;
     309  float Ycenter;
     310} ImageMetadata;
     311
    300312Image        *LoadImagesDVO         PROTO((off_t *Nimage));
    301313void          FreeImagesDVO         PROTO((Image *images));
     
    346358int dbExtractMeasuresInitAve (void);
    347359int dbExtractMeasuresInitMeas (void);
    348 int dbExtractMeasuresInit (void);
     360int dbExtractMeasuresInit (int isRemoteClient);
    349361
    350362int dbExtractAveragesInitTransform (CoordTransformSystem target);
     
    363375#include "get_graphdata.h"
    364376
     377ImageMetadata *ImageMetadataLoad(char *filename, off_t *nimage);
     378int ImageMetadataSave(char *filename, Image *image, off_t Nimage);
     379
     380int SetImageMetadataSelection (char *filename);
     381void FreeImageMetadataSelection ();
     382ImageMetadata *MatchImageMetadataDVO (unsigned int imageID);
     383Coords *MatchMosaicMetadata (unsigned int imageID);
     384off_t match_image_by_ID (ImageMetadata *image, off_t Nimage, unsigned int ID);
     385void sort_image_metadata (ImageMetadata *image, off_t Nimage);
     386
    365387# endif
  • trunk/Ohana/src/libdvo/src/ImageSelection.c

    r35260 r35263  
    6868}
    6969
     70Image *MatchImageDVO_old (unsigned int time, short int source, unsigned int imageID) {
     71
     72  int m = -1;
     73
     74  if ((imageID != 0) && (imageID < Nimage)) {
     75    // imageID is in range for the array of images. If the table is still in order and
     76    // no images have been deleted the index of the image we are looking for will be imageID - 1
     77    // If this is the case, we have it. Otherwise we'll have to go search for it below
     78    int guess = (int) imageID - 1;
     79    if (image[guess].imageID == imageID) {
     80        m = guess;
     81    }
     82  }
     83  if (m == -1) {
     84    m = match_image_subset (image, subset, Nsubset, time, source);
     85  }
     86  if (m == -1) return (NULL);
     87  if (!FindMosaicForImage (image, Nimage, m)) return (NULL);
     88  return (&image[m]);
     89}
     90
    7091Coords *MatchMosaic (unsigned int time, short int source) {
    7192
  • trunk/Ohana/src/libdvo/src/dbExtractMeasures.c

    r35237 r35263  
    1414static CoordTransform *celestial_to_ecliptic = NULL;
    1515
     16static int REMOTE_CLIENT = FALSE;
     17
    1618static int haveGalacticAve = FALSE;
    1719static double GLON_AVE = 0.0;
     
    3032static double ELAT_MEAS = 0.0;
    3133
    32 int dbExtractMeasuresInit () {
     34int dbExtractMeasuresInit (int isRemoteClient) {
     35  REMOTE_CLIENT = isRemoteClient;
    3336  GetTimeFormat (&TimeReference, &TimeFormat);
    3437  return (TRUE);
     
    335338      break;
    336339    case MEAS_MEAN_AIRMASS: /* OK */
    337       {
     340      if (REMOTE_CLIENT) {
     341        ImageMetadata *image = MatchImageMetadataDVO (measure[0].imageID);
     342        if (image == NULL) break;
     343        value.Flt = image[0].secz;
     344      } else {
    338345        Image *image = MatchImageDVO (measure[0].t, measure[0].photcode, measure[0].imageID);
    339346        if (image == NULL) break;
    340347        value.Flt = image[0].secz;
    341         break;
    342       }
     348      }
     349      break;
    343350    case MEAS_AZ: /* OK */
    344351      value.Flt = measure[0].az;
     
    461468      ra  = average[0].R - measure[0].dR / 3600.0;
    462469      dec = average[0].D - measure[0].dD / 3600.0;
    463       mosaic = MatchMosaic (measure[0].t, measure[0].photcode);
     470      mosaic = MatchMosaicMetadata (measure[0].imageID);
    464471      if (mosaic == NULL) break;
    465472      RD_to_XY (&x, &y, ra, dec, mosaic);
     
    515522      break;
    516523    case MEAS_EXTERN_ID: /* OK */
    517       {
    518         Image *image;
    519         image = MatchImageDVO (measure[0].t, measure[0].photcode, measure[0].imageID);
     524      if (REMOTE_CLIENT) {
     525        ImageMetadata *image = MatchImageMetadataDVO (measure[0].imageID);
    520526        if (image == NULL) break;
    521527        value.Int = image->externID;
     528      } else {
     529        Image *image = MatchImageDVO (measure[0].t, measure[0].photcode, measure[0].imageID);
     530        if (image == NULL) break;
     531        value.Int = image[0].externID;
    522532      }
    523533      break;
    524534
    525535    case MEAS_EXPNAME_AS_INT:
    526       {
    527         Image *image;
    528         image = MatchImageDVO (measure[0].t, measure[0].photcode, measure[0].imageID);
     536      if (REMOTE_CLIENT) {
     537        ImageMetadata *image = MatchImageMetadataDVO (measure[0].imageID);
     538        if (image == NULL) break;
     539        value.Int = image->expname;
     540      } else {
     541        Image *image = MatchImageDVO (measure[0].t, measure[0].photcode, measure[0].imageID);
    529542        if (image == NULL) break;
    530543        // XXX very crude: if this matches oNNNNgNNNNo, then convert to an int
     
    544557    case MEAS_FLAT: /* OK */
    545558      // flat = measure.Mcal - image.Mcal
    546       {
    547         Image *image;
    548         image = MatchImageDVO (measure[0].t, measure[0].photcode, measure[0].imageID);
     559      if (REMOTE_CLIENT) {
     560        ImageMetadata *image = MatchImageMetadataDVO (measure[0].imageID);
    549561        if (image == NULL) break;
    550562        value.Flt = measure[0].Mcal - image[0].Mcal;
    551       }
    552       break;
    553 
     563      } else {
     564        Image *image = MatchImageDVO (measure[0].t, measure[0].photcode, measure[0].imageID);
     565        if (image == NULL) break;
     566        value.Flt = measure[0].Mcal - image[0].Mcal;
     567      }
     568      break;
     569
     570      // we have measure[0].Xccd,Yccd and image[0].NX,NY.  Find the distance to the center
    554571    case MEAS_CENTER_OFFSET: /* OK */
    555       {
    556         Image *image;
    557         image = MatchImageDVO (measure[0].t, measure[0].photcode, measure[0].imageID);
    558         if (image == NULL) break;
    559        
    560         // we have measure[0].Xccd,Yccd and image[0].NX,NY.  Find the distance to the center
    561 
     572      if (REMOTE_CLIENT) {
     573        ImageMetadata *image = MatchImageMetadataDVO (measure[0].imageID);
     574        if (image == NULL) break;
     575        float Xcenter = image[0].Xcenter;
     576        float Ycenter = image[0].Ycenter;
     577        float distance = hypot (measure[0].Xccd - Xcenter, measure[0].Yccd - Ycenter);
     578        value.Flt = distance;
     579      } else {
     580        Image *image = MatchImageDVO (measure[0].t, measure[0].photcode, measure[0].imageID);
     581        if (image == NULL) break;
    562582        // XXX we may hypotetically have images with -NX to +NX here (eg, projection center), but
    563583        // we do not get a detection from that type of image
  • trunk/Ohana/src/libdvo/src/dvosorts.c

    r27817 r35263  
    2323
    2424  OHANA_SORT (N, COMPARE, SWAPFUNC);
     25
     26# undef SWAPFUNC
     27# undef COMPARE
     28
     29}
     30
     31/* sort ImageMetadata array by image[i].imageID */
     32void sort_image_metadata (ImageMetadata *image, off_t Nimage) {
     33
     34# define SWAPFUNC(A,B){ ImageMetadata tmp; tmp = image[A]; image[A] = image[B]; image[B] = tmp; }
     35# define COMPARE(A,B)(image[A].imageID < image[B].imageID)
     36
     37  OHANA_SORT (Nimage, COMPARE, SWAPFUNC);
    2538
    2639# undef SWAPFUNC
Note: See TracChangeset for help on using the changeset viewer.