IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 37378


Ignore:
Timestamp:
Sep 8, 2014, 2:44:35 PM (12 years ago)
Author:
eugene
Message:

i am making image.coords.mosaic and image.parent pointers to the parent (PHU) coord and image strutures; BuildChipMatch sets these values and we do not need to call FindMosaicForImage

Location:
branches/eam_branches/ipp-20140904/Ohana/src
Files:
52 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/include/addstar.h

    r37357 r37378  
    326326int strextend (char *input, char *format,...);
    327327
     328void initMosaicCoords ();
     329void saveMosaicCoords (Coords *input);
     330
     331
    328332/**
    329333    there is an inconsistency to be resolved: fixed structures (like Image)
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/LoadData.c

    r37357 r37378  
    3333  // we need to perform that analysis here
    3434  GetZeroPointExposure (headers, headerSets, Nimages);
     35
     36  if (!options[0].mosaic) {
     37    // we are requiring a single set of N x WRPs + 1 DIS per file set.
     38    // NOTE: if the -mosaic was supplied, do not reset the mosaic coords here
     39    initMosaicCoords ();
     40  }
    3541
    3642  // now run through the images, interpret the headers and read the stars
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/LoadStars.c

    r28241 r37378  
    8888      exit (1);
    8989    }
     90    /* supplied photcode is incompatible with multi-chip images */
     91    if ((NheaderSets > 1) && options[0].mosaic) {
     92      fprintf (stderr, "ERROR: -mosaic cannot be supplied to multiple images\n");
     93      exit (1);
     94    }
    9095
    9196    // if these are SDSS data, load with SDSS-specific wrapper
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/NewImage.c

    r10939 r37378  
    3333      goto reject;
    3434    }
     35    saveMosaicCoords (mosaic);
    3536  }   
    3637
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/ReadImageHeader.c

    r37036 r37378  
    11# include "addstar.h"
     2
     3// for DIS/WRP sets, we need to save the DIS set and supply it to the WRP entries
     4static Coords *mosaic = NULL;
     5
     6void initMosaicCoords () {
     7  mosaic = NULL;
     8}
     9
     10void saveMosaicCoords (Coords *input) {
     11  mosaic = input;
     12}
    213
    314/* read an image header corresponding to a CMF / CMP data block */
     
    5465  /* only load astrometry, NAXIS1,2, and time if this is a MOSAIC_PHU (ctype is ....-DIS) */
    5566  if (!strcmp (&image[0].coords.ctype[4], "-DIS")) {
    56     RegisterMosaic (&image[0].coords);
     67    saveMosaicCoords (&image[0].coords);
    5768    return (TRUE);
    5869  }
     
    7990  }
    8091  if (!strcmp (&image[0].coords.ctype[4], "-WRP")) {
    81     if (!isRegisteredMosaic()) {
     92    if (!mosaic) {
    8293      fprintf (stderr, "no mosaic for WRP image (use -mosaic)\n");
    8394      return (FALSE);
    8495    }
     96    image[0].coords.mosaic = mosaic;
    8597  } else {
    8698    /* force image to lie in 0-360 range */
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/UpdateDatabase_Image.c

    r27435 r37378  
    2121
    2222  /* find correpsonding regions for image */
    23   RegisterMosaic (mosaic);
    2423  skylist = NULL;
    2524  newlist = NULL;
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/args.c

    r37357 r37378  
    175175      exit (1);
    176176    }
    177     RegisterMosaic (&MOSAIC);
     177    saveMosaicCoords (&MOSAIC);
    178178    remove_argument (N, &argc, argv);
    179179    gfits_free_header (&header);
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/args_client.c

    r33963 r37378  
    8383      exit (1);
    8484    }
    85     RegisterMosaic (&MOSAIC);
     85    saveMosaicCoords (&MOSAIC);
    8686    remove_argument (N, &argc, argv);
    8787    gfits_free_header (&header);
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/fakeimage.c

    r37036 r37378  
    6060  MOSAIC.polyterms[6][1] = pltscale;  // M : X^2 Y^0
    6161
    62   RegisterMosaic (&MOSAIC);
    63 
    6462  /* some basic data about the chisp */
    6563  ScanConfig (config, "NCHIPS", "%d", 0, &Nchips);
     
    103101      image[i+1].coords.polyterms[j][1] = 0;
    104102    }
     103    image[i+1].coords.mosaic = &MOSAIC;
    105104
    106105    image[i+1].sidtime  = 0.0;
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/find_missing.c

    r10937 r37378  
    1414    REALLOCATE (catalog[0].missing, Missing, NMISS);
    1515  }
    16   if (!FindMosaicForImage (overlap, Noverlap, j)) continue;
    1716  if (!in_image (catalog[0].average[Nave].R, catalog[0].average[Nave].D, &overlap[j])) continue;
    1817  add_miss_link (&catalog[0].average[Nave], next_miss, Nmiss);
     
    2726/* add reference for undetected catalog stars */
    2827/* XXX allow this option only for single images? */
    29 if (!strcmp (&image[0].coords.ctype[4], "-WRP")) RegisterMosaic (mosaic);
     28if (!strcmp (&image[0].coords.ctype[4], "-WRP")) image[0].coords = mosaic;
    3029for (j = 0; (j < Nave) && !options.skip_missed; j++) {
    3130  n = N2[j];
  • branches/eam_branches/ipp-20140904/Ohana/src/checkastro/src/ImageOps.c

    r36833 r37378  
    130130  }
    131131
    132   BuildChipMatch (image, Nimage);
    133 
    134132  char output[128];
    135133  snprintf (output, 128, "checkastrom.%+3.0f.%+3.0f.%03.0f.%03.0f.dat", UserPatch.Rmin, UserPatch.Rmax, UserPatch.Dmin, UserPatch.Dmax);
     
    148146    name = GetPhotcodeNamebyCode (image[i].photcode);
    149147
    150     off_t myMosaic = FindMosaicForImage (image, Nimage, i);
    151 
    152148    /* only check exposure center */
    153149    double Rexp = NAN, Dexp = NAN, Rccd = NAN, Dccd = NAN;
    154150
    155     if (myMosaic) {
    156       myMosaic --;
    157       XY_to_RD (&Rccd, &Dccd, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords);
    158       XY_to_RD (&Rexp, &Dexp, 0.0, 0.0, &image[myMosaic].coords);
    159     }
     151    XY_to_RD (&Rccd, &Dccd, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords);
     152    XY_to_RD (&Rexp, &Dexp, 0.0, 0.0, &image[i].parent->coords);
    160153
    161154    char *date = ohana_sec_to_date(image[i].tzero);
  • branches/eam_branches/ipp-20140904/Ohana/src/checkastro/src/load_images.c

    r36833 r37378  
    1717  MARKTIME("  convert image table: %f sec\n", dtime);
    1818
     19  BuildChipMatch (image, Nimage);
     20
    1921  // select the images which overlap the selected sky regions
    2022  subset = select_images (skylist, image, Nimage, &LineNumber, &Nsubset);
  • branches/eam_branches/ipp-20140904/Ohana/src/checkastro/src/select_images.c

    r36833 r37378  
    4343
    4444  if (VERBOSE) fprintf (stderr, "finding images\n");
    45   BuildChipMatch (timage, Ntimage);
    46   MARKTIME("build chip match: %f sec\n", dtime);
    4745
    4846  nimage = 0;
     
    8381    }
    8482   
    85     // this adds 1.3 sec for 3M images
    86     off_t myMosaic = FindMosaicForImage (timage, Ntimage, i);
    87     if (!myMosaic) {
    88       fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", i);
    89       continue;
    90     }
    91     myMosaic --;
    92 
    9383    /* only check exposure center */
    9484    if (!strcmp(&timage[i].coords.ctype[4], "-DIS")) {
    9585      XY_to_RD (&Rexp, &Dexp, 0.0, 0.0, &timage[i].coords);
    9686    } else {
    97       XY_to_RD (&Rexp, &Dexp, 0.0, 0.0, &timage[myMosaic].coords);
     87      XY_to_RD (&Rexp, &Dexp, 0.0, 0.0, &timage[i].parent->coords);
    9888    }
    9989    Rexp = ohana_normalize_angle_to_midpoint (Rexp, RmidSkyRegion);
  • branches/eam_branches/ipp-20140904/Ohana/src/delstar/src/ImageOpsFixLAP.c

    r37040 r37378  
    320320    if ((Nimage_valid[i] + Nimage_invalid[i] == 0) || (found_ratio < 0.995)) {
    321321      double r, d;
    322       if (!FindMosaicForImage (image, Nimage, i)) {
    323         fprintf (stderr, "failed to get astrometry for %s\n", image[i].name);
     322      if (!strcmp(&image[i].coords.ctype[4], "-DIS")) {
     323        XY_to_RD (&r, &d, 0.0, 0.0, &image[i].coords);
    324324      } else {
    325         if (!strcmp(&image[i].coords.ctype[4], "-DIS")) {
    326           XY_to_RD (&r, &d, 0.0, 0.0, &image[i].coords);
    327         } else {
    328           XY_to_RD (&r, &d, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords);
    329         }
     325        XY_to_RD (&r, &d, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords);
    330326      }
    331327      char *date = ohana_sec_to_date (image[i].tzero);
  • branches/eam_branches/ipp-20140904/Ohana/src/delstar/src/delete_imagename.c

    r34749 r37378  
    2424  }
    2525
     26  BuildChipMatch (image, Nimage);
     27
    2628  /* find image in db by name */
    2729  imlist = find_images_name (db, IMAGENAME, &Nimlist);
     
    3335    if (VERBOSE) fprintf (stderr, "deleting %s\n", image[j].name);
    3436   
    35     // XXX EAM : need to handle failure
    36     FindMosaicForImage (image, Nimage, j);
    3737    skylist = SkyListByImage (sky, -1, &image[j]);
    3838
  • branches/eam_branches/ipp-20140904/Ohana/src/delstar/src/delete_times.c

    r29001 r37378  
    3131  }
    3232
     33  BuildChipMatch (image, Nimage);
     34
    3335  /* find images for time range, delete each image */
    3436  imlist = find_images_time (db, START, END, PHOTCODE, &Nimlist);
     
    3941    if (VERBOSE) fprintf (stderr, "finding regions for %s\n", image[j].name);
    4042
    41     // XXX EAM : need to handle failure
    42     FindMosaicForImage (image, Nimage, j);
    4343    skyset = SkyListByImage (sky, -1, &image[j]);
    4444
  • branches/eam_branches/ipp-20140904/Ohana/src/dvomerge/Makefile

    r35416 r37378  
    2323dvoverify_client : $(BIN)/dvoverify_client.$(ARCH)
    2424
    25 all: dvomerge dvomerge_client dvoconvert dvosecfilt dvosecfilt_client dvoverify dvoverify_client
     25all: dvomerge dvomerge_client dvoconvert dvosecfilt dvosecfilt_client dvorepair dvoverify dvoverify_client
    2626
    2727#  $(SRC)/dvomergeContinue.$(ARCH).o
  • branches/eam_branches/ipp-20140904/Ohana/src/dvomerge/src/ImageOps.c

    r29938 r37378  
    1818  }
    1919  if (m == -1) return (NULL);
    20   if (!FindMosaicForImage (image, Nimage, m)) return (NULL);
    2120  return (&image[m]);
    2221}
  • branches/eam_branches/ipp-20140904/Ohana/src/dvomerge/src/dvo_image_merge_dbs.c

    r37360 r37378  
    113113  create_IDmap_lookup (IDmap);
    114114
    115   if (!out[0].swapped) {
    116     gfits_convert_Image ((Image *) out[0].ftable.buffer, sizeof(Image), Nout);
    117     out[0].swapped = TRUE;
    118   }
    119 
    120115  Nout += Nimages;
    121116  IDstart += Nimages;
  • branches/eam_branches/ipp-20140904/Ohana/src/dvomerge/src/dvorepairDeleteImageList.c

    r37046 r37378  
    114114    index = deleteIDs[i];
    115115    seq = imageIdx[index];
    116     if (!FindMosaicForImage (image, Nimage, seq)) {
    117       fprintf (stderr, "cannot find mosaic for %s, skipping\n", image[seq].name);
    118       continue;
    119     }
    120116
    121117    XY_to_RD(&Rthis, &Dthis, 0, 0, &image[seq].coords);
  • branches/eam_branches/ipp-20140904/Ohana/src/dvomerge/src/dvorepairFixImages.c

    r29938 r37378  
    130130int MarkMosaicsToDelete(Image *image, off_t Nimage, int *deleteIndex) {
    131131
     132  myAbort ("this function needs to be redone with a concept to match the old BuildChipMatch");
     133
     134# if (0) 
     135
    132136  off_t i;
    133137 
     
    140144     marked.  Now find all WRP images for which none/some/all images are to be deleted.
    141145  */
     146
     147 
    142148
    143149  // make a copy of the ChipMatch table (generated by BuildChipMatch, see libdvo/src/mosaic_astrom.c)
     
    237243  free (ChipByMosaicID);
    238244
     245# endif
     246
    239247  return TRUE;
    240248}
  • branches/eam_branches/ipp-20140904/Ohana/src/getstar/include/dvoImageOverlaps.h

    r27435 r37378  
    3737int edge_check (double *x1, double *y1, double *x2, double *y2);
    3838double opening_angle (double x1, double y1, double x2, double y2, double x3, double y3);
     39
     40void initMosaicCoords ();
     41void saveMosaicCoords (Coords *input);
  • branches/eam_branches/ipp-20140904/Ohana/src/getstar/src/MatchCoords.c

    r31238 r37378  
    2929    if (!WITH_PHU && !strcmp (&dbImages[i].coords.ctype[4], "-DIS")) continue;
    3030    if ( SOLO_PHU &&  strcmp (&dbImages[i].coords.ctype[4], "-DIS")) continue;
    31 
    32     /* if any of these images are WRP images, need to find matching DIS */
    33     if (!FindMosaicForImage (dbImages, NdbImages, i)) continue;
    3431
    3532    /* define image corners */
  • branches/eam_branches/ipp-20140904/Ohana/src/getstar/src/MatchImages.c

    r36481 r37378  
    2424  /* for mosaic astrometry, the grid should be w.r.t. the tangent-plane, not chip coords */
    2525  if (!strcmp (&image[0].coords.ctype[4], "-WRP")) {
    26     // if the input image is a mosaic, we need to register that mosaic for the calculations below
    27     if (MOSAIC == NULL) {
    28       fprintf (stderr, "no mosaic for WRP image (use -mosaic)\n");
    29       return NULL;
    30     }
    31     RegisterMosaic (MOSAIC);
    32 
    33     tcoords = MOSAIC[0];
     26    myAssert (image[0].coords.mosaic, "should already have tested this");
     27    tcoords = image[0].coords.mosaic[0];
    3428    tcoords.cdelt1 = tcoords.cdelt2 = 1.0 / 3600.0;
    3529    tcoords.pc1_1 = tcoords.pc2_2 = 1.0;
     
    7771    if (!WITH_PHU && !strcmp (&dbImages[i].coords.ctype[4], "-DIS")) continue;
    7872    if ( SOLO_PHU &&  strcmp (&dbImages[i].coords.ctype[4], "-DIS")) continue;
    79 
    80     /* if any of these images are WRP images, need to find matching DIS */
    81     if (!FindMosaicForImage (dbImages, NdbImages, i)) continue;
    8273
    8374    /* define image corners */
  • branches/eam_branches/ipp-20140904/Ohana/src/getstar/src/ReadImageFiles.c

    r36874 r37378  
    4242
    4343  mode = GetFileMode (header);
     44
     45  initMosaicCoords ();
    4446
    4547  /*** load data from a single PHU or a collection of PHU files ***/
  • branches/eam_branches/ipp-20140904/Ohana/src/getstar/src/ReadImageHeader.c

    r21508 r37378  
    11# include "dvoImageOverlaps.h"
     2
     3// for DIS/WRP sets, we need to save the DIS set and supply it to the WRP entries
     4static Coords *mosaic = NULL;
     5
     6void initMosaicCoords () {
     7  mosaic = NULL;
     8}
     9
     10void saveMosaicCoords (Coords *input) {
     11  mosaic = input;
     12}
    213
    314/* read an image header corresponding to a CMF / CMP data block */
     
    4455  /* only load astrometry, NAXIS1,2, and time if this is a MOSAIC_PHU (ctype is ....-DIS) */
    4556  if (!strcmp (&image[0].coords.ctype[4], "-DIS")) {
    46     MOSAIC = &image[0].coords;
     57    saveMosaicCoords (&image[0].coords);
    4758    return (TRUE);
    4859  }
     
    5667  }
    5768  if (!strcmp (&image[0].coords.ctype[4], "-WRP")) {
    58     if (MOSAIC == NULL) {
     69    if (mosaic == NULL) {
    5970      fprintf (stderr, "no mosaic for WRP image (use -mosaic)\n");
    6071      return (FALSE);
    6172    }
    62     RegisterMosaic (MOSAIC);
     73    image[0].coords.mosaic = mosaic;
    6374  } else {
    6475    /* force image to lie in 0-360 range */
  • branches/eam_branches/ipp-20140904/Ohana/src/getstar/src/WriteImages.c

    r27435 r37378  
    55 
    66  int i, N;
    7   int nWRP, newWRP, isWRP;
     7  int isWRP;
    88  FILE *f;
    99
     
    1616  }
    1717
    18   nWRP = -1;
     18  Image *mosaic = NULL;
    1919  isWRP = FALSE;
    2020  for (i = 0; i < Nmatches; i++) {
    21     if (!strcmp (&images[0].coords.ctype[4], "-WRP")) {
    22       if (!FindMosaicForImage (images, Nimages, i)) {
    23         fprintf (stderr, "failed to find matching mosaic\n");
    24         exit (1);
    25       }
     21    N = matches[i];
     22    if (!strcmp (&images[N].coords.ctype[4], "-WRP")) {
    2623      if (isWRP) {
    27         newWRP = GetRegisteredMosaic();
    28         if (newWRP != nWRP) {
     24        if (mosaic != images[N].parent) {
    2925          fprintf (stderr, "only one mosaic allowed in an output file\n");
    3026          exit (1);
    3127        }
    3228      } else {
    33         nWRP = GetRegisteredMosaic();
    34         isWRP = TRUE;
     29        mosaic = images[N].parent;
    3530      }
    3631    }     
     
    3833
    3934  if (isWRP) {
    40     WriteImageFITS (f, &images[nWRP]);
     35    WriteImageFITS (f, mosaic);
    4136  } else {
    4237    // write a blank
  • branches/eam_branches/ipp-20140904/Ohana/src/imregister/imphot/dumpfits.c

    r30617 r37378  
    3434
    3535  ftable.header = &theader;
    36   gfits_table_set_Image (&ftable, subset, Nmatch);
     36  // gfits_table_set_Image (&ftable, subset, Nmatch);
    3737
    3838  gfits_fwrite_header  (f, &header);
  • branches/eam_branches/ipp-20140904/Ohana/src/imregister/imphot/modify.c

    r27435 r37378  
    3030  gfits_vtable_from_ftable (&db[0].ftable, &db[0].vtable, match, Nmatch);
    3131  for (i = 0; i < Nmatch; i++) {
    32     gfits_convert_Image ((Image *) db[0].vtable.buffer[i], sizeof (Image), 1);
     32    fprintf (stderr, "need to work with real output format\n");
     33    exit (2);
     34    // gfits_convert_Image ((Image *) db[0].vtable.buffer[i], sizeof (Image), 1);
    3335  }
    3436  gfits_db_update (db);
  • branches/eam_branches/ipp-20140904/Ohana/src/mosastro/src/testcoords.c

    r3404 r37378  
    5353    exit (1);
    5454  }
    55   RegisterMosaic (&field.project);
     55
     56  chip[0].map.mosaic = &field.project;
    5657  strcpy (chip[0].map.ctype, "DEC--WRP");
    5758  for (i = 0; i < chip[0].Nmatch; i++) {
  • branches/eam_branches/ipp-20140904/Ohana/src/opihi/cmd.astro/coords.c

    r33662 r37378  
    7171    if ((mosbuffer = SelectBuffer (MOSAIC, OLDBUFFER, TRUE)) == NULL) goto escape;
    7272    GetCoords (&moscoords, &mosbuffer[0].header);
    73     RegisterMosaic (&moscoords);
     73    coords.mosaic = &moscoords;
    7474  }
    7575 
  • branches/eam_branches/ipp-20140904/Ohana/src/opihi/cmd.astro/getcoords.c

    r34345 r37378  
    5454  if (!strcmp(&coords.ctype[4], "-WRP")) {
    5555    if (MOSAIC == NULL) {
    56       gprint (GP_ERR, "must supply mosaic for WRP coords\n");
     56      gprint (GP_ERR, "must supply mosaic for WRP coords with -mosaic [buffer]\n");
    5757      return (FALSE);
    5858    }
     
    6565    }
    6666    GetCoords (&moscoords, &mosbuffer[0].header);
    67     RegisterMosaic (&moscoords);
     67    coords.mosaic = &moscoords;
    6868  }
    6969 
  • branches/eam_branches/ipp-20140904/Ohana/src/opihi/dvo/gimages.c

    r36489 r37378  
    102102      }
    103103    }     
    104     if (!FindMosaicForImage (image, Nimage, i)) continue;
    105104
    106105    typehash = wordhash (&image[i].coords.ctype[4]);
  • branches/eam_branches/ipp-20140904/Ohana/src/opihi/dvo/images.c

    r34584 r37378  
    152152  SetVector (&Yvec, OPIHI_FLT, NPTS);
    153153
     154  Image *mosaic = NULL;
     155
    154156  ALLOCATE (plist, int, NPTS);
    155157  n = N = 0;
     
    157159    if (ByName && strncmp (image[i].name, name, strlen(name))) continue;
    158160    if (TimeSelect && ((image[i].tzero < tzero) || (image[i].tzero+image[i].trate*image[i].NY > tzero + trange))) continue;
    159     if (!(Nmosaic = FindMosaicForImage (image, Nimage, i))) continue;
    160     Nmosaic --; // XXX kind of a hack: FindMosaicForImage returns 0 or the mosaic seq number + 1
     161
     162    mosaic = image[i].parent;
     163    Nmosaic = (SOLO_MOSAIC && mosaic) ? mosaic - image : -1;
     164
    161165    if (photcode) {
    162166      if ( photcodeEquiv && (photcode[0].code != GetPhotcodeEquivCodebyCode(image[i].photcode))) continue;
     
    170174    typehash = wordhash (&image[i].coords.ctype[4]);
    171175
    172     if (photcode && SOLO_MOSAIC) {
     176    if (photcode && SOLO_MOSAIC && (Nmosaic >= 0)) {
    173177      // mosaic (DIS) images are not currently given a photcode : plot these via the WRP entries
    174178      /* DIS images represent a field, not a chip */
    175179      if (typehash != ChipImage) continue;
    176180      if (foundMosaic[Nmosaic]) continue;
    177       x[0] = -0.5*image[Nmosaic].NX; y[0] = -0.5*image[Nmosaic].NY;
    178       x[1] = +0.5*image[Nmosaic].NX; y[1] = -0.5*image[Nmosaic].NY;
    179       x[2] = +0.5*image[Nmosaic].NX; y[2] = +0.5*image[Nmosaic].NY;
    180       x[3] = -0.5*image[Nmosaic].NX; y[3] = +0.5*image[Nmosaic].NY;
     181      x[0] = -0.5*mosaic->NX; y[0] = -0.5*mosaic->NY;
     182      x[1] = +0.5*mosaic->NX; y[1] = -0.5*mosaic->NY;
     183      x[2] = +0.5*mosaic->NX; y[2] = +0.5*mosaic->NY;
     184      x[3] = -0.5*mosaic->NX; y[3] = +0.5*mosaic->NY;
    181185      for (j = 0; j < Npts; j++) {
    182         status = XY_to_RD (&r[j], &d[j], x[j], y[j], &image[Nmosaic].coords);
     186        status = XY_to_RD (&r[j], &d[j], x[j], y[j], &mosaic->coords);
    183187        if (!status) break;
    184188        r[j] = ohana_normalize_angle (r[j]);
     
    198202
    199203    /* DIS images represent a field, not a chip */
    200     if ((typehash == DistortImage) && !WITH_MOSAIC) continue;
    201     if ((typehash != DistortImage) &&  SOLO_MOSAIC) continue;
     204    if ((typehash == DistortImage) && !WITH_MOSAIC) continue; // do not plot the mosaic images
     205    if ((typehash != DistortImage) &&  SOLO_MOSAIC) continue; // plot only the mosaic images
     206
    202207    if (typehash == DistortImage) {
    203208      x[0] = -0.5*image[i].NX; y[0] = -0.5*image[i].NY;
  • branches/eam_branches/ipp-20140904/Ohana/src/opihi/dvo/imbox.c

    r34584 r37378  
    4343  SetVector (&Yvec, OPIHI_FLT, NPTS);
    4444
     45  mosaic.ctype[0] = 0; 
     46
    4547  while (gfits_fread_header (f, &header)) {
    4648    if (!GetCoords (&coords, &header)) goto skip;
    4749    if (!SOLO_PHU && !strcmp (&coords.ctype[4], "-DIS")) {
    4850      mosaic = coords;
    49       RegisterMosaic (&mosaic);
    5051      goto skip;
     52    }
     53    if (!strcmp (&coords.ctype[4], "-WRP")) {
     54      if (!mosaic.ctype[0]) {
     55        fprintf (stderr, "PHU mosaic not found\n");
     56        return FALSE;
     57      }
     58      coords.mosaic = &mosaic;
    5159    }
    5260
  • branches/eam_branches/ipp-20140904/Ohana/src/opihi/dvo/imdata.c

    r37049 r37378  
    103103    I = subset[i];
    104104
    105     if (!FindMosaicForImage (image, Nimage, I)) continue;
    106105    skyset = SkyListByImage (sky, -1, &image[I]);
    107106
  • branches/eam_branches/ipp-20140904/Ohana/src/opihi/dvo/imdense.c

    r34584 r37378  
    4242    /* project this image to screen display coords */
    4343    status = FALSE;
    44     if (!FindMosaicForImage (image, Nimage, i)) continue;
    4544    XY_to_RD (&r, &d, x, y, &image[i].coords);
    4645    r = ohana_normalize_angle (r);
  • branches/eam_branches/ipp-20140904/Ohana/src/opihi/dvo/imlist.c

    r34088 r37378  
    9797      }
    9898    }
    99     if (!FindMosaicForImage (image, Nimage, i)) continue;
    10099    t = TimeValue (image[i].tzero, TimeReference, TimeFormat);
    101100    if (!strcmp(&image[i].coords.ctype[4], "-DIS")) {
  • branches/eam_branches/ipp-20140904/Ohana/src/opihi/dvo/imstats.c

    r34584 r37378  
    4444    else
    4545      Yvec.elements.Flt[i] = image[i].dMcal;
    46     if (!FindMosaicForImage (image, Nimage, i)) continue;
    4746    XY_to_RD (&r, &d, 0.5*image[i].NX, 0.5*image[i].NY, &image[i].coords);
    4847    gprint (GP_ERR, "%d %8.4f %8.4f %10d %6d  %5.3f %6.3f %6.3f\n",
  • branches/eam_branches/ipp-20140904/Ohana/src/opihi/dvo/skycoverage.c

    r33963 r37378  
    284284      }
    285285    }
    286 
    287     if (!FindMosaicForImage (image, Nimage, i)) continue;
    288286
    289287    typehash = wordhash (&image[i].coords.ctype[4]);
  • branches/eam_branches/ipp-20140904/Ohana/src/opihi/dvo/subpix.c

    r37049 r37378  
    118118
    119119  for (i = 0; i < Nimage; i++) {
    120     if (!FindMosaicForImage (image, Nimage, i)) continue;
    121120    status = RD_to_XY (&X, &Y, Ra, Dec, &image[i].coords);
    122121    if (!status || (X < 0) || (X > image[i].NX) || (Y < 0) || (Y > image[i].NY)) continue;
     
    134133  for (i = 0; i < Nsub; i++) {
    135134    I = index[i];
    136     if (!FindMosaicForImage (image, Nimage, I)) continue;
    137135    Timage = image[I].tzero;
    138136    for (j = 0; j < Nmeasure; j++) {
  • branches/eam_branches/ipp-20140904/Ohana/src/photdbc/src/copy_images.c

    r36833 r37378  
    5252  }
    5353
     54  BuildChipMatch (image, Nimage);
     55  // MARKTIME("build chip match: %f sec\n", dtime);
     56
    5457  subset = select_images (skylist, image, Nimage, &LineNumber, &Nsubset, FALSE);
    5558
  • branches/eam_branches/ipp-20140904/Ohana/src/photdbc/src/select_images.c

    r36833 r37378  
    9292
    9393  if (VERBOSE) fprintf (stderr, "finding images\n");
    94   BuildChipMatch (timage, Ntimage);
    95   MARKTIME("build chip match: %f sec\n", dtime);
    9694
    9795  nimage = 0;
     
    115113keep_image:
    116114
    117     // this adds 1.3 sec for 3M images
    118     if (!FindMosaicForImage (timage, Ntimage, i)) {
    119       fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", i);
    120       continue;
    121     }
    122 
    123115    /* define image corners - note the DIS images (mosaic phu) are special */
    124116    if (!strcmp(&timage[i].coords.ctype[4], "-DIS")) {
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/UpdateChips.c

    r33652 r37378  
    494494}
    495495
    496 // XXX if (!FindMosaicForImage (image, Nimage, i)) { }
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/assign_images.c

    r36630 r37378  
    8989    if (!strcmp(&image[j].coords.ctype[4], "-DIS")) continue;
    9090
    91     // match the image to its corresponding ASTROMETRIC mosaic (not the same as the Mosaic above)
    92     if (!FindMosaicForImage (image, Nimage, j)) {
    93       if (VERBOSE2) fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", i);
    94       continue;
    95     }
    96    
    9791    // Exclude images with crazy astrometry
    9892    // XXX NOTE : this is gpc1-specific
     
    199193}
    200194
    201 int calculate_host_image_bounds (RegionHostTable *regionHosts) {
    202 
    203   int i, n;
    204   off_t j;
    205 
    206   for (i = 0; i < regionHosts->Nhosts; i++) {
    207 
    208     RegionHostInfo *host = &regionHosts->hosts[i];
    209 
    210     // XXX clear the chip match?
    211 
    212     BuildChipMatch (host->image, host->Nimage);
    213 
    214     double Rmin = 360.0;
    215     double Rmax =   0.0;
    216     double Dmin = +90.0;
    217     double Dmax = -90.0;
    218 
    219     for (j = 0; j < host->Nimage; j++) {
    220 
    221       Image *image = &host->image[j];
    222 
    223       if (!FindMosaicForImage (host->image, host->Nimage, j)) {
    224         fprintf (stderr, "missing astrometry? programming error?\n");
    225         abort ();
    226       }
    227      
    228       // define image corners
    229       for (n = 0; n < 4; n++) {
    230         double Xc, Yc, Rc, Dc;
    231         Xc = Xf[n]*image->NX;
    232         Yc = Yf[n]*image->NY;
    233         XY_to_RD (&Rc, &Dc, Xc, Yc, &image->coords);
    234         Rc = ohana_normalize_angle_to_midpoint (Rc, 180.0);
    235      
    236         Rmin = MIN (Rmin, Rc);
    237         Dmin = MIN (Dmin, Rc);
    238        
    239         Rmax = MAX (Rmax, Rc);
    240         Dmax = MAX (Dmax, Rc);
    241       }
    242 
    243     }
    244 
    245     host->RminCat = Rmin;
    246     host->DminCat = Dmin;
    247     host->RmaxCat = Rmax;
    248     host->DmaxCat = Dmax;
    249 
    250     // regionHosts needs to have the full outer boundary
    251     // (so reload_catalogs covers the correct region)
    252     regionHosts->Rmin = MIN(Rmin, regionHosts->Rmin);
    253     regionHosts->Rmax = MAX(Rmax, regionHosts->Rmax);
    254     regionHosts->Dmin = MIN(Dmin, regionHosts->Dmin);
    255     regionHosts->Dmax = MAX(Dmax, regionHosts->Dmax);
    256   }
    257   return TRUE;
    258 }
    259 
    260 
    261195// XXX add a search tree to speed this up?
    262196int find_host_for_coords (RegionHostTable *regionHosts, double Rc, double Dc) {
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/load_images.c

    r36630 r37378  
    1616  }
    1717  MARKTIME("  convert image table: %f sec\n", dtime);
     18
     19  BuildChipMatch (image, Nimage);
     20  MARKTIME("build chip match: %f sec\n", dtime);
    1821
    1922  // select the images which overlap the selected sky regions
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/select_images.c

    r36630 r37378  
    104104
    105105  if (VERBOSE) fprintf (stderr, "finding images\n");
    106   BuildChipMatch (timage, Ntimage);
    107   MARKTIME("build chip match: %f sec\n", dtime);
    108106
    109107  nimage = 0;
     
    148146    }
    149147   
    150     // this adds 1.3 sec for 3M images
    151     if (!FindMosaicForImage (timage, Ntimage, i)) {
    152       fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", i);
    153       continue;
    154     }
    155 
    156148    /* define image corners - note the DIS images (mosaic phu) are special */
    157149    if (!strcmp(&timage[i].coords.ctype[4], "-DIS")) {
  • branches/eam_branches/ipp-20140904/Ohana/src/relphot/src/MosaicOps.c

    r37037 r37378  
    520520      m = MosaicToImage[i][j];
    521521
    522       if (!FindMosaicForImage (image, Nimage, m)) {
    523         if (VERBOSE2) fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", i);
    524         continue;
    525       }
    526 
    527522      NX = image[m].NX;
    528523      NY = image[m].NY;
    529       XY_to_RD (&R, &D, 0.5*NX, 0.5*NY, &image[m].coords);
     524      if (!XY_to_RD (&R, &D, 0.5*NX, 0.5*NY, &image[m].coords)) continue;
    530525      R = ohana_normalize_angle_to_midpoint (R, 180.0);
    531526
  • branches/eam_branches/ipp-20140904/Ohana/src/relphot/src/assign_images.c

    r37037 r37378  
    8080    if (!strcmp(&image[j].coords.ctype[4], "-DIS")) continue;
    8181
    82     // match the image to its corresponding ASTROMETRIC mosaic (not the same as the Mosaic above)
    83     if (!FindMosaicForImage (image, Nimage, j)) {
    84       if (VERBOSE2) fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", i);
    85       continue;
    86     }
    87    
    8882    // Exclude images with crazy astrometry
    8983    // XXX NOTE : this is gpc1-specific
     
    206200}
    207201
    208 int calculate_host_image_bounds (RegionHostTable *regionHosts, double Rmid) {
    209 
    210   int i, n;
    211   off_t j;
    212 
    213   for (i = 0; i < regionHosts->Nhosts; i++) {
    214 
    215     RegionHostInfo *host = &regionHosts->hosts[i];
    216 
    217     // XXX clear the chip match?
    218 
    219     BuildChipMatch (host->image, host->Nimage);
    220 
    221     double Rmin =  720.0;
    222     double Rmax = -360.0;
    223     double Dmin =  +90.0;
    224     double Dmax = -90.0;
    225 
    226     for (j = 0; j < host->Nimage; j++) {
    227 
    228       Image *image = &host->image[j];
    229 
    230       if (!FindMosaicForImage (host->image, host->Nimage, j)) {
    231         fprintf (stderr, "missing astrometry? programming error?\n");
    232         abort ();
    233       }
    234      
    235       // define image corners
    236       for (n = 0; n < 4; n++) {
    237         double Xc, Yc, Rc, Dc;
    238         Xc = Xf[n]*image->NX;
    239         Yc = Yf[n]*image->NY;
    240         XY_to_RD (&Rc, &Dc, Xc, Yc, &image->coords);
    241         Rc = ohana_normalize_angle_to_midpoint (Rc, Rmid);
    242      
    243         Rmin = MIN (Rmin, Rc);
    244         Dmin = MIN (Dmin, Rc);
    245        
    246         Rmax = MAX (Rmax, Rc);
    247         Dmax = MAX (Dmax, Rc);
    248       }
    249 
    250     }
    251 
    252     // RminCat, RmaxCat may extended beyond 0.0 - 360.0
    253     host->RminCat = Rmin;
    254     host->DminCat = Dmin;
    255     host->RmaxCat = Rmax;
    256     host->DmaxCat = Dmax;
    257 
    258     // regionHosts needs to have the full outer boundary
    259     // (so reload_catalogs covers the correct region)
    260     regionHosts->Rmin = MIN(Rmin, regionHosts->Rmin);
    261     regionHosts->Rmax = MAX(Rmax, regionHosts->Rmax);
    262     regionHosts->Dmin = MIN(Dmin, regionHosts->Dmin);
    263     regionHosts->Dmax = MAX(Dmax, regionHosts->Dmax);
    264   }
    265   return TRUE;
    266 }
    267 
    268 
    269202// Rc is in range 0.0 - 360.0, hosts Rmin,Rmax in range 0.0 - 360.0
    270203int find_host_for_coords (RegionHostTable *regionHosts, double Rc, double Dc) {
  • branches/eam_branches/ipp-20140904/Ohana/src/relphot/src/load_images.c

    r35759 r37378  
    2727  }
    2828  MARKTIME("read image table: %f sec\n", dtime);
     29
     30  BuildChipMatch (image, Nimage);
     31  MARKTIME("build chip match for %d images: %f sec\n", (int) Nimage, dtime);
    2932
    3033  // allocate and init an array to identify the images included in the subset
  • branches/eam_branches/ipp-20140904/Ohana/src/relphot/src/select_images.c

    r36491 r37378  
    9393
    9494  if (VERBOSE) fprintf (stderr, "finding images\n");
    95   BuildChipMatch (timage, Ntimage);
    96   MARKTIME("build chip match for %d images: %f sec\n", (int) Ntimage, dtime);
    9795
    9896  D_NIMAGE = 6000;
     
    123121    }
    124122   
    125     // this adds 1.3 sec for 3M images
    126     if (!FindMosaicForImage (timage, Ntimage, i)) {
    127       if (VERBOSE2) fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", i);
    128       continue;
    129     }
    130 
    131123    /* define image corners - note the DIS images (mosaic phu) are special */
    132124    if (!strcmp(&timage[i].coords.ctype[4], "-DIS")) {
  • branches/eam_branches/ipp-20140904/Ohana/src/uniphot/src/find_image_sgroups.c

    r36481 r37378  
    4242    // if (!strcmp(&image[i].coords.ctype[4], "-DIS")) continue;
    4343
    44     // this adds 1.3 sec for 3M images
    45     if (!FindMosaicForImage (image, Nimage, i)) {
    46       fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", i);
    47       continue;
    48     }
    49 
    5044    /* define image center - note the DIS images (mosaic phu) are special */
    5145    if (!strcmp(&image[i].coords.ctype[4], "-DIS")) {
     
    8377      // if (!strcmp(&image[j].coords.ctype[4], "-DIS")) continue;
    8478
    85       // this adds 1.3 sec for 3M images
    86       if (!FindMosaicForImage (image, Nimage, j)) {
    87           fprintf (stderr, "cannot find mosaic for "OFF_T_FMT"\n", j);
    88           continue;
    89       }
    90 
    9179      /* project image center to local coords, check radius */
    9280      if (!strcmp(&image[j].coords.ctype[4], "-DIS")) {
Note: See TracChangeset for help on using the changeset viewer.