IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 37662


Ignore:
Timestamp:
Nov 22, 2014, 1:09:35 PM (12 years ago)
Author:
eugene
Message:

region hosts need to save and load the per-chip residual table; fix a typo

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

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/FrameCorrectionIO.c

    r37658 r37662  
    8989    gfits_free_matrix (&matrix);
    9090  } else {
    91     fprintf (stderr, "ERROR: FrameCorrectionSet %s has defined SHMAP_DD but not SHMAP_DR\n", filename);
    92     exit (2);
     91    if (strcmp (SHMAP_DD, "NONE")) {
     92      fprintf (stderr, "ERROR: FrameCorrectionSet %s has defined SHMAP_DD but not SHMAP_DR\n", filename);
     93      exit (2);
     94    }
    9395  }
    9496
     
    127129    gfits_free_matrix (&matrix);
    128130  } else {
    129     fprintf (stderr, "ERROR: FrameCorrectionSet %s has defined LOCAL_DD but not LOCAL_DR\n", filename);
    130     exit (2);
     131    if (strcmp (LOCAL_DD, "NONE")) {
     132      fprintf (stderr, "ERROR: FrameCorrectionSet %s has defined LOCAL_DD but not LOCAL_DR\n", filename);
     133      exit (2);
     134    }
    131135  }
    132136  fclose (f);
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/ImagePosIO.c

    r36630 r37662  
    7070  GET_COLUMN (polyterms,        "POLYTERMS",         float); // verify that we got 14 columns?
    7171  GET_COLUMN (ctype,            "CTYPE",             char);  // verify that we got 15 columns?
    72   GET_COLUMN (Npolyterms,       "NPOLYTERMS",        char);
     72  GET_COLUMN (Npolyterms,       "NPOLYTERMS",        byte);
    7373  GET_COLUMN (dXpixSys,         "XPIX_SYS_ERR",      float);
    7474  GET_COLUMN (dYpixSys,         "YPIX_SYS_ERR",      float);
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/assign_images.c

    r37378 r37662  
    144144
    145145    // this is a bit memory expensive : I am making a complete copy of the image table here
    146     off_t Nsubset = regionHosts->hosts[i].Nimage;
    147     regionHosts->hosts[i].image[Nsubset] = image[j];
    148     regionHosts->hosts[i].imseq[Nsubset] = j;
    149 
    150     regionHosts->hosts[i].Nimage ++;
    151     if (regionHosts->hosts[i].Nimage == regionHosts->hosts[i].NIMAGE) {
    152       regionHosts->hosts[i].NIMAGE += D_NIMAGE;
    153       REALLOCATE (regionHosts->hosts[i].image, Image, regionHosts->hosts[i].NIMAGE);
    154       REALLOCATE (regionHosts->hosts[i].imseq, off_t, regionHosts->hosts[i].NIMAGE);
     146    off_t Nsubset = host->Nimage;
     147    host->image[Nsubset] = image[j];
     148    host->imseq[Nsubset] = j;
     149
     150    host->Nimage ++;
     151    if (host->Nimage == host->NIMAGE) {
     152      host->NIMAGE += D_NIMAGE;
     153      REALLOCATE (host->image, Image, host->NIMAGE);
     154      REALLOCATE (host->imseq, off_t, host->NIMAGE);
     155    }
     156
     157    // save the astrometry maps, where they exist
     158    if (image[j].coords.offsetMap) {
     159      if (!host->astromTable) {
     160        host->astromTable = AstromOffsetTableInit();
     161      }
     162      AstromOffsetTableAddMapFromImage(host->astromTable, image[j]);
    155163    }
    156164  }
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/launch_region_hosts.c

    r37658 r37662  
    88  // clear the I/O files
    99  for (i = 0; i < regionHosts->Nhosts; i++) {
    10     char *syncfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "meanmags.sync");
     10    char *syncfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "meanpos.sync");
    1111    if (truncate (syncfile, 0)) fprintf (stderr, "trouble clearing syncfile %s\n", syncfile);
    1212    free (syncfile);
    1313
    14     char *fitsfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "meanmags.fits");
     14    char *fitsfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "meanpos.fits");
    1515    if (truncate (fitsfile, 0)) fprintf (stderr, "trouble clearing fitsfile %s\n", fitsfile);
    1616    free (fitsfile);
    1717
    18     char *imsyncfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "imagemags.sync");
     18    char *icrfsync = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "icrfobj.sync");
     19    if (truncate (icrfsync, 0)) fprintf (stderr, "trouble clearing icrfsync %s\n", icrfsync);
     20    free (icrfsync);
     21
     22    char *icrffits = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "icrfobj.fits");
     23    if (truncate (icrffits, 0)) fprintf (stderr, "trouble clearing icrffits %s\n", icrffits);
     24    free (icrffits);
     25
     26    char *imsyncfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "imagepos.sync");
    1927    if (truncate (imsyncfile, 0)) fprintf (stderr, "trouble clearing imsyncfile %s\n", imsyncfile);
    2028    free (imsyncfile);
    2129
    22     char *imfitsfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "imagemags.fits");
     30    char *imfitsfile = make_filename (CATDIR, regionHosts->hosts[i].hostname, regionHosts->hosts[i].hostID, "imagepos.fits");
    2331    if (truncate (imfitsfile, 0)) fprintf (stderr, "trouble clearing imfitsfile %s\n", imfitsfile);
    2432    free (imfitsfile);
     
    2735    if (truncate (loopsyncfile, 0)) fprintf (stderr, "trouble clearing loopsyncfile %s\n", loopsyncfile);
    2836    free (loopsyncfile);
     37
     38    char imagename[1024];
     39    snprintf (imagename, 1024, "%s/Image.%d.fits", CATDIR, regionHosts->hosts[i].hostID);
     40    if (unlink (imagename)) fprintf (stderr, "trouble clearing image %s\n", imagename);
    2941  }
     42
     43  char *framesync = make_filename (CATDIR, "master", 0, "frame.corr.sync");
     44  if (truncate (framesync, 0)) fprintf (stderr, "trouble clearing framesync %s\n", framesync);
     45  free (framesync);
     46 
     47  char *framefits = make_filename (CATDIR, "master", 0, "frame.corr.fits");
     48  if (truncate (framefits, 0)) fprintf (stderr, "trouble clearing framefits %s\n", framefits);
     49  free (framefits);
    3050
    3151  for (i = 0; i < regionHosts->Nhosts; i++) {
     
    4060    // write the image subset for this host
    4161    ImageTableSave (filename, host->image, host->Nimage);
     62
     63    if (host->astromTable) {
     64      char mapname[1024];
     65      snprintf (mapname, 1024, "%s/AstroMap.%d.fits", CATDIR, host->hostID);
     66
     67      // write the image subset for this host
     68      AstromOffsetMapTableSave (host->astromTable, mapname);
     69    }
    4270
    4371    char command[1024];
     
    100128    strextend (command, "-D ADDSTAR_RADIUS %f", ADDSTAR_RADIUS);
    101129
     130    strextend (command, "-D USE_GALAXY_MODEL %d", USE_GALAXY_MODEL);
     131
    102132    strextend (command, "-D USE_ICRF_CORRECT %d", USE_ICRF_CORRECT);
    103133    strextend (command, "-D USE_ICRF_LOCAL %d",   USE_ICRF_LOCAL);
     
    138168  }
    139169
     170  if (USE_ICRF_CORRECT) return TRUE;
     171
     172  int status = HarvestRegionHosts (regionHosts);
     173  return status;
     174}
     175
     176int HarvestRegionHosts (RegionHostTable *regionHosts) {
     177
     178  int i;
     179
    140180  if (PARALLEL_REGIONS_MANUAL) {
    141181    fprintf (stderr, "run the relastro_client commands above.  when these are done, hit return\n");
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/load_images.c

    r37446 r37662  
    8686}
    8787
     88void put_astrom_table (AstromOffsetTable *myTable) {
     89  table = myTable;
     90}
     91
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/relastro_parallel_images.c

    r37658 r37662  
    3030  }
    3131
     32  // assign image->parent and image->coords.mosaic
     33  BuildChipMatch (image, Nimage);
     34
     35  char mapfile[DVO_MAX_PATH];
     36  snprintf (mapfile, DVO_MAX_PATH, "%s/AstroMap.%d.fits", CATDIR, REGION_HOST_ID);
     37  AstromOffsetTable *table = AstromOffsetMapLoad (mapfile, VERBOSE);
     38
     39  // assign images.coords.offsetMap -> table->map[i]
     40  if (table) {
     41    AstromOffsetTableMatchChips (image, Nimage, table);
     42  } else {
     43    table = AstromOffsetTableInit ();
     44  }
     45  put_astrom_table (table);
     46
    3247  // once we have read this table, we should remove it for repeat runs
    3348  // unlink (IMAGE_TABLE); // XXX a bit risky, add some protection?
     
    5065  free (syncfile);
    5166 
     67  // find ICRF QSOs for reference downstream (only if USE_ICRF_CORRECT)
     68  select_catalog_ICRF (catalog, Ncatalog);
     69
    5270  if (photcodesReset) {
    5371    photcodesKeep  = photcodesReset;
  • branches/eam_branches/ipp-20140904/Ohana/src/relastro/src/share_images_pos.c

    r36630 r37662  
    3333  free (image_pos);
    3434  free (iposfile);
     35
     36  // save the per-chip residual table
     37  AstromOffsetTable *table = get_astrom_table ();
     38  if (table) {
     39    char mapname[1024];
     40    snprintf (mapname, 1024, "%s/AstroMapUpdate.%d.fits", CATDIR, REGION_HOST_ID);
     41   
     42    // write the image subset for this host
     43    AstromOffsetMapTableSave (table, mapname);
     44  }
    3545
    3646  char *syncfile = make_filename (CATDIR, hostname, REGION_HOST_ID, "imagepos.sync");
     
    8393  free (image_pos);
    8494
     95  // load the astrometry offset maps, if they exist, and apply
     96  for (i = 0; i < regionHosts->Nhosts; i++) {
     97    char mapname[1024];
     98    snprintf (mapname, 1024, "%s/AstroMapUpdate.%d.fits", CATDIR, regionHosts->hosts[i].hostID);
     99   
     100    AstromOffsetTable *table = AstromOffsetMapLoad (mapname, VERBOSE);
     101 
     102    // apply table entries here to existing images
     103    for (j = 0; j < table->Nmap; j++) {
     104      off_t seq = getImageByID (table->map[j][0].imageID);
     105      images[seq].coords.offsetMap = table->map[j];
     106      // is this sufficient?
     107    }
     108  }
    85109  fprintf (stderr, "DONE grabbing image mags from other hosts\n");
    86110
Note: See TracChangeset for help on using the changeset viewer.