IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jan 12, 2015, 12:29:24 PM (12 years ago)
Author:
eugene
Message:

merge changes from trunk

Location:
branches/eam_branches/ipp-pv3-20140717-merge/Ohana
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-pv3-20140717-merge/Ohana

  • branches/eam_branches/ipp-pv3-20140717-merge/Ohana/src/relphot/src/assign_images.c

    r37037 r37822  
    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
     
    123117
    124118    if (MOSAIC_ZEROPT) {
    125       // use the coords of the associated mosaic to select
     119      // use the coords of the associated mosaic to select (only for chips; stacks use their own center)
    126120      Mosaic *mosaic = getMosaicForImage (j);
    127       Rc = mosaic->coords.crval1;
    128       Dc = mosaic->coords.crval2;
    129       // NOTE : have defined mosaic Rc,Dc to choose the side of 0,360 on which most of the
    130       // chips are located.  but, for host assignment, we rationalize to 0.0 - 360.0
    131       Rc = ohana_normalize_angle_to_midpoint (Rc, 180.0);
     121      if (mosaic) {
     122        Rc = mosaic->coords.crval1;
     123        Dc = mosaic->coords.crval2;
     124        // NOTE : have defined mosaic Rc,Dc to choose the side of 0,360 on which most of the
     125        // chips are located.  but, for host assignment, we rationalize to 0.0 - 360.0
     126        Rc = ohana_normalize_angle_to_midpoint (Rc, 180.0);
     127      }
    132128    }
    133129
     
    206202}
    207203
    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 
    269204// Rc is in range 0.0 - 360.0, hosts Rmin,Rmax in range 0.0 - 360.0
    270205int find_host_for_coords (RegionHostTable *regionHosts, double Rc, double Dc) {
Note: See TracChangeset for help on using the changeset viewer.