IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39325 for trunk


Ignore:
Timestamp:
Jan 27, 2016, 11:19:00 AM (10 years ago)
Author:
eugene
Message:

remove deprecated code

Location:
trunk/Ohana/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/libdvo/src/mosaic_astrom.c

    r37807 r39325  
    77void SortDISindex (e_time *S, off_t *I, off_t N);
    88
    9 # if (0)
     9// Generate the links images[i].coords.mosaic & images[i].parent which point at the parent
     10// coords structure and the parent image structure, respectively.  These links are built
     11// based on the date/time of the exposure (image->tzero) and will not necessarily work if
     12// & when we use 2 cameras (e.g., gpc1 & gpc2).
    1013
    11 /* chip-match table: j = ChipMatch[i], images[j] is DIS for images[i] WRP */
     14// for 22M images, this function takes about 5 seconds.
    1215
    13 static off_t  iDIS = -1;      // DIS entry in ChipMatch[]
    14 static off_t  Ndis = 0;
    15 static off_t  *DISentry = NULL;
    16 static e_time *DIStzero = NULL;
    17 static off_t  *ChipMatch = NULL;
    18 
    19 /* what is the currently registered mosaic image? */
    20 off_t GetRegisteredMosaic () {
    21   return (iDIS);
    22 }
    23 
    24 /* what is the currently registered mosaic image? */
    25 off_t *GetChipMatch () {
    26   return (ChipMatch);
    27 }
    28 
    29 /* given an image array and a current entry of type WRP, find matching DIS & Register it */
    30 int FindMosaicForImage (Image *images, off_t Nimages, off_t entry) {
    31 
    32   int status;
    33 
    34   if (ChipMatch == NULL) {
    35     status = FindMosaicForImage_TableSearch (images, Nimages, entry);
    36     return (status);
    37   }
    38   status = FindMosaicForImage_MatchSearch (images, Nimages, entry);
    39   return (status);
    40 }
    41 
    42 /* given an image array and a current entry of type WRP, find matching DIS & Register it */
    43 int FindMosaicForImage_TableSearch (Image *images, off_t Nimages, off_t entry) {
    44 
    45   e_time tzero;
    46   off_t i;
    47 
    48   /* search backwards for image with same time and type DIS */
    49 
    50   if (strcmp(&images[entry].coords.ctype[4], "-WRP")) {
    51     /* not a wrp image, do nothing */
    52     return (entry + 1); /* error or not */
    53   }
    54 
    55   tzero = images[entry].tzero;
    56  
    57   for (i = entry - 1; i >= 0; i--) {
    58     if (images[i].tzero != tzero) continue;
    59     if (strcmp(&images[i].coords.ctype[4], "-DIS")) continue;
    60 
    61     /* found a valid match */
    62     RegisterMosaic (&images[i].coords);
    63     iDIS = i;
    64     return (i + 1);
    65   }
    66 
    67   for (i = entry + 1; i < Nimages; i++) {
    68     if (images[i].tzero != tzero) continue;
    69     if (strcmp(&images[i].coords.ctype[4], "-DIS")) continue;
    70 
    71     /* found a valid match */
    72     RegisterMosaic (&images[i].coords);
    73     iDIS = i;
    74     return (i + 1);
    75   }
    76   return (FALSE);
    77 }
    78 
    79 /* given an image array and a current entry of type WRP, find matching DIS & Register it */
    80 int FindMosaicForImage_MatchSearch (Image *images, off_t Nimages, off_t entry) {
    81 
    82   off_t N;
    83 
    84   if (strcmp(&images[entry].coords.ctype[4], "-WRP")) {
    85     /* not a wrp image, do nothing */
    86     return (entry + 1); /* error or not? */
    87   }
    88 
    89   if (ChipMatch == NULL) return (FALSE);
    90 
    91   N = ChipMatch[entry];
    92   if (N < 0) return (FALSE);
    93   if (N >= Nimages) return (FALSE);
    94 
    95   RegisterMosaic (&images[N].coords);
    96   iDIS = N;
    97   return (N + 1);
    98 }
    99 
    100 // this is a very old version of BuildChipMatch which does not use bisection
    101 int BuildChipMatch_nosort (Image *images, off_t Nimages) {
    102 
    103   off_t i, j, NDIS;
    104 
    105   if (DISentry != NULL) free (DISentry);
    106   if (DIStzero != NULL) free (DIStzero);
    107   if (ChipMatch != NULL) free (ChipMatch);
    108 
    109   /* find all DIS images, save tzero (& instrument) */
    110   Ndis = 0;
    111   NDIS = 100;
    112   ALLOCATE (DISentry, off_t, NDIS);
    113   ALLOCATE (DIStzero, e_time, NDIS);
    114 
    115   for (i = 0; i < Nimages; i++) {
    116     if (strcmp(&images[i].coords.ctype[4], "-DIS")) continue;
    117     DISentry[Ndis] = i;
    118     DIStzero[Ndis] = images[i].tzero;
    119     Ndis ++;
    120     if (Ndis >= NDIS) {
    121       NDIS += 100;
    122       REALLOCATE (DISentry, off_t, NDIS);
    123       REALLOCATE (DIStzero, e_time, NDIS);
    124     }
    125   }
    126 
    127   /* find all matched WRP images */
    128   ALLOCATE (ChipMatch, off_t, Nimages);
    129   for (i = 0; i < Nimages; i++) {
    130     ChipMatch[i] = -1;
    131     if (strcmp(&images[i].coords.ctype[4], "-WRP")) continue;
    132     for (j = 0; j < Ndis; j++) {
    133       if (DIStzero[j] < images[i].tzero) continue;
    134       if (DIStzero[j] > images[i].tzero + (int) images[i].exptime) continue;
    135       ChipMatch[i] = DISentry[j];
    136       goto got_match;
    137     }
    138 
    139     fprintf (stderr, "WARNING: can't find matching mosaic \n");
    140     ChipMatch[i] = -2;
    141 
    142   got_match:
    143     continue;
    144   }
    145   return (TRUE);
    146 }
    147 
    148 // this is an old version of BuildChipMatch which stores the results here in a local static variable
    149 int BuildChipMatch_static (Image *images, off_t Nimages) {
    150 
    151   off_t i, j, NDIS;
    152 
    153   if (DISentry != NULL) free (DISentry);
    154   if (DIStzero != NULL) free (DIStzero);
    155   if (ChipMatch != NULL) free (ChipMatch);
    156 
    157   // allocate containers for DIS indexing
    158   Ndis = 0;
    159   NDIS = 100;
    160   ALLOCATE (DISentry, off_t, NDIS);
    161   ALLOCATE (DIStzero, e_time, NDIS);
    162 
    163   // find all DIS images, save tzero (& instrument)
    164   for (i = 0; i < Nimages; i++) {
    165     if (strcmp(&images[i].coords.ctype[4], "-DIS")) continue;
    166     DISentry[Ndis] = i;
    167     DIStzero[Ndis] = images[i].tzero;
    168     Ndis ++;
    169     if (Ndis >= NDIS) {
    170       NDIS += 100;
    171       REALLOCATE (DISentry, off_t, NDIS);
    172       REALLOCATE (DIStzero, e_time, NDIS);
    173     }
    174   }
    175 
    176   // sort the index, start, and stop by the start times:
    177   SortDISindex (DIStzero, DISentry, Ndis);
    178 
    179   // ChipMatch has a few possible values:
    180   // -3 : image is a mosaic (DIS)
    181   // -2 : image is an unassigned WRP image
    182   // -1 : image is not a WRP or DIS images
    183   // >= 0 : value is the mosaic seq number for this WRP image
    184 
    185   /* find all matched WRP images */
    186   ALLOCATE (ChipMatch, off_t, Nimages);
    187   for (i = 0; i < Nimages; i++) {
    188     ChipMatch[i] = -1;
    189     if (!strcmp(&images[i].coords.ctype[4], "-DIS")) {
    190       ChipMatch[i] = -3;
    191       continue;
    192     }
    193     if (strcmp(&images[i].coords.ctype[4], "-WRP")) continue;
    194 
    195     j = getDISentry (images[i].tzero, images[i].tzero + (int) images[i].exptime, DIStzero, DISentry, Ndis);
    196     if (j == -1) {
    197       fprintf (stderr, "WARNING: can't find matching mosaic \n");
    198       ChipMatch[i] = -2;
    199       continue;
    200     }
    201     if (j >= Nimages) abort();
    202 
    203     ChipMatch[i] = j;
    204   }
    205   return (TRUE);
    206 }
    207 # endif
    208 
    209 // XXX Note that this links (images[i].coords.mosaic, images[i].parent) will break
    210 // if we reallocate the Image array in the middle of program
     16// Note that the links (images[i].coords.mosaic, images[i].parent) will break if we
     17// reallocate the Image array in the middle of program
    21118int BuildChipMatch (Image *images, off_t Nimages) {
    21219
  • trunk/Ohana/src/relphot/src/setMrelCatalog.c

    r39290 r39325  
    299299    dvo_secfilt_init (&secfilt[Nsec], SECFILT_RESET_CHIP); // this does not reset astrometry or STACK bits
    300300
    301     // XXX hardwired
    302     if ((Nsec < 4) || (Nsec == 8)) {
     301    // XXX hardwired grizy = (01234) JHK = (567) w = (8)
     302    if ((Nsec < 5) || (Nsec == 8)) {
    303303      secfilt[Nsec].Ncode = results->NexpPS1[Nsec];
    304304    } else {
Note: See TracChangeset for help on using the changeset viewer.