IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Apr 19, 2013, 4:31:05 PM (13 years ago)
Author:
eugene
Message:

merge changes from eam_branches/ipp-20130307 : parallelize dvosecfilt, use dvo_average,measure,secfilt_init functions more broadly; move image calibration to relphot_images; add synthetic photometry referece (w-band); put relphot MARKTIME & INITTIME in macros; in dvo_clients, mextract fields which need image data use a subset image metadata table (instead of loading full Images.dat table); create FIELD and MOSAIC fields for mextract; somewhat better rules for photcode:ave & similar selections in mextract; add hpm_* concept in relastro (high-speed proper motions); fix precision errors in dvopsps; check for dvopsps exit conditions; error-bar clipping to limits of plotting window; parallelize delstar -dup-images; do NOT delete parents (because parent IDs are broken after dvomerge); minor handshake when setting up KAPA connection; avextract and related do not need to launch remote jobs on all clients if region does not include tables from all hosts; add fitplx and xsection functions to mana; enable addstar of diff cmfs (at least PS1_DV3)

Location:
trunk/Ohana
Files:
17 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/Ohana

  • trunk/Ohana/src/opihi

  • trunk/Ohana/src/opihi/cmd.astro

  • trunk/Ohana/src/opihi/cmd.astro/Makefile

    r34342 r35416  
    3030$(SRC)/drizzle.$(ARCH).o           \
    3131$(SRC)/flux.$(ARCH).o              \
     32$(SRC)/fitplx.$(ARCH).o    \
    3233$(SRC)/fixwrap.$(ARCH).o           \
    3334$(SRC)/fixcols.$(ARCH).o           \
  • trunk/Ohana/src/opihi/cmd.astro/init.c

    r34342 r35416  
    1414int drizzle                 PROTO((int, char **));
    1515int flux                    PROTO((int, char **));
     16int fitplx                  PROTO((int, char **));
    1617int fixwrap                 PROTO((int, char **));
    1718int fiximage                PROTO((int, char **));
     
    7172  {1, "drizzle",     drizzle,      "transform image to image"},
    7273  {1, "flux",        flux,         "flux in a convex contour"},
     74  {1, "fitplx",      fitplx,       "fit proper motion and parallax"},
    7375  {1, "fixwrap",     fixwrap,      "fix megacam over-wrapped pixels"},
    7476  {1, "fiximage",    fiximage,     "fix pixels in an image by interpolation"},
  • trunk/Ohana/src/opihi/cmd.data

  • trunk/Ohana/src/opihi/cmd.data/Makefile

    r35237 r35416  
    150150$(SRC)/vsmooth.$(ARCH).o           \
    151151$(SRC)/vstats.$(ARCH).o            \
     152$(SRC)/xsection.$(ARCH).o          \
    152153$(SRC)/wd.$(ARCH).o                \
    153154$(SRC)/write_vectors.$(ARCH).o     \
  • trunk/Ohana/src/opihi/cmd.data/init.c

    r35237 r35416  
    141141int wd               PROTO((int, char **));
    142142int write_vectors    PROTO((int, char **));
     143int xsection         PROTO((int, char **));
    143144int zap              PROTO((int, char **));
    144145int zplot            PROTO((int, char **));
     
    299300  {1, "wd",           wd,               "write an image to a file"},
    300301  {1, "write",        write_vectors,    "write vectors to datafile"},
     302  {1, "xsection",     xsection,         "generate cross-section histogram for an image (or region)"},
    301303  {1, "zap",          zap,              "assign values to pixel regions"},
    302304  {1, "zplot",        zplot,            "plot x y with size scaled by z"},
  • trunk/Ohana/src/opihi/dvo/avextract.c

    r34749 r35416  
    137137  // this does all the work of re-packaging the command, calling it on the remote machines, then loading in the results
    138138  if (PARALLEL && !HOST_ID) {
    139     int status = HostTableParallelOps (argc, argv, RESULT_FILE, TRUE, 0, VERBOSE);
     139      int status = HostTableParallelOps (skylist, argc, argv, RESULT_FILE, TRUE, 0, VERBOSE);
    140140
    141141    dbFreeFields (fields, Nfields);
  • trunk/Ohana/src/opihi/dvo/avmatch.c

    r34749 r35416  
    9595
    9696    // I need to pass the RA & DEC vectors to the remote clients...
    97     int status = HostTableParallelOps (argc, argv, RESULT_FILE, TRUE, RAvec->Nelements, VERBOSE);
     97    int status = HostTableParallelOps (skylist, argc, argv, RESULT_FILE, TRUE, RAvec->Nelements, VERBOSE);
    9898    if (vec) free (vec);
    9999   
  • trunk/Ohana/src/opihi/dvo/dvo_host_utils.c

    r35109 r35416  
    88# define DIE(WHO,MSG) { perror(WHO); myAbort(MSG); }
    99
    10 int HostTableLaunchJobs (HostTable *table, char *basecmd, char *options, int VERBOSE) {
     10int HostTableLaunchJobs (SkyList *sky, HostTable *table, char *basecmd, char *options, int VERBOSE) {
    1111
    1212  char uniquer[12];
     
    3535
    3636  int top_status = TRUE;
    37   int i;
     37  int i, j;
    3838  for (i = 0; i < table->Nhosts; i++) {
     39
     40      if (sky && (sky->Nregions < table->Nhosts)) {
     41      // do any of the regions want this host?
     42      int wantThisHost = FALSE;
     43      for (j = 0; j < sky->Nregions; j++) {
     44        if (HostTableTestHost (sky->regions[j], table->hosts[i].hostID)) {
     45          wantThisHost = TRUE;
     46          break;
     47        }
     48      }
     49      if (!wantThisHost) {
     50        // fprintf (stderr, "skip host %s\n", table->hosts[i].hostname);
     51        continue;
     52      }
     53      // fprintf (stderr, "not skip host %s\n", table->hosts[i].hostname);
     54    }
    3955
    4056    // ensure that the paths are absolute path names
     
    88104// an alternative ending step ignores the result files and instead saves the names into
    89105// the list 'result:n' for the user to access as desired
    90 int HostTableParallelOps (int argc, char **argv, char *ResultFile, int ReadVectors, int Nelements, int VERBOSE) {
     106int HostTableParallelOps (SkyList *sky, int argc, char **argv, char *ResultFile, int ReadVectors, int Nelements, int VERBOSE) {
    91107
    92108  int i;
    93109
    94   // load the list of hosts
    95   SkyTable *sky = GetSkyTable();
    96   if (!sky) {
    97     gprint (GP_ERR, "failed to load sky table for database\n");
    98     return FALSE;
    99   }
     110  // XX // load the list of hosts
     111  // XX SkyTable *sky = GetSkyTable();
     112  // XX if (!sky) {
     113  // XX   gprint (GP_ERR, "failed to load sky table for database\n");
     114  // XX   return FALSE;
     115  // XX }
    100116
    101117  char *tmppath = GetCATDIR ();
     
    145161
    146162  // launch this command remotely
    147   HostTableLaunchJobs (table, basecmd, options, VERBOSE);
     163  HostTableLaunchJobs (sky, table, basecmd, options, VERBOSE);
    148164  free (options);
    149165  free (basecmd);
     
    183199
    184200    if (table->hosts[i].status) continue;
     201    if (!table->hosts[i].pid) continue;
    185202
    186203    if (ReadVectors) {
  • trunk/Ohana/src/opihi/dvo/mextract.c

    r35263 r35416  
    1616    if (field->ID == MEAS_CENTER_OFFSET)  return TRUE; // 0.5*NX, 0.5*NY
    1717    if (field->ID == MEAS_EXPNAME_AS_INT) return TRUE; // expname (or as int)
    18     if (field->ID == MEAS_AIRMASS)        return TRUE; // airmass
     18    if (field->ID == MEAS_MEAN_AIRMASS)   return TRUE; // airmass
    1919    return FALSE;
    2020}
     
    171171
    172172    // call the remote client
    173     int status = HostTableParallelOps (targc, targv, RESULT_FILE, TRUE, 0, VERBOSE);
     173    int status = HostTableParallelOps (skylist, targc, targv, RESULT_FILE, TRUE, 0, VERBOSE);
    174174
    175175    dbFreeFields (fields, Nfields);
  • trunk/Ohana/src/opihi/dvo/mmatch.c

    r35263 r35416  
    106106  RAvec  = NULL;
    107107  DECvec = NULL;
    108   if (PARALLEL && !HOST_ID) {
    109 
    110     // We need to copy the args to a temp array and modify them so that we send the
    111     // correct set to the remote client.  The args list looks like this:
    112     // if (!CoordsFile) : mmatch (RA) (DEC) (RADIUS) field, ...
    113     // if ( CoordsFile) : mmatch (RADIUS) field, ... [because we stripped off the -coords filename elements]
    114 
    115     // allocate the temp array and copy all but (RA) (DEC)
    116     int targc = 0;
    117     char **targv = NULL;
    118     ALLOCATE (targv, char *, argc + 2);
    119     for (i = 0; i < argc; i++) {
    120       if (!CoordsFile && (i == 1)) continue;
    121       if (!CoordsFile && (i == 2)) continue;
    122       targv[targc] = strcreate (argv[i]);
    123       targc ++;
    124     }
    125 
    126     // if not specified, create the coords.fits input file
    127     if (!CoordsFile) {
    128       // get vectors corresponding to coordinates of interest
    129       if ((RAvec  = SelectVector (argv[1], ANYVECTOR, TRUE)) == NULL) goto help;
    130       if ((DECvec = SelectVector (argv[2], ANYVECTOR, TRUE)) == NULL) goto help;
    131      
    132       ALLOCATE (vec, Vector *, 2);
    133       vec[0] = RAvec;
    134       vec[1] = DECvec;
    135 
    136       CoordsFile = abspath("coords.fits", 1024);
    137       int status = WriteVectorTableFITS (CoordsFile, "COORDS", vec, 2, FALSE, NULL);
    138       if (!status) goto escape;
    139     }
    140 
    141     // add the coords file to the args list
    142     targv[targc+0] = strcreate ("-coords");
    143     targv[targc+1] = CoordsFile; // this gets freed with targv
    144     targc += 2;
    145    
    146     // if needed, add the index vector to the args list
    147     if (IDXvec) {
    148       REALLOCATE (targv, char *, targc + 2);
    149       targv[targc+0] = strcreate ("-index");
    150       targv[targc+1] = strcreate (IDXvec[0].name);
    151       targc += 2;
    152     }     
    153 
    154     if (loadImages) {
    155       Image *image;
    156       off_t Nimage;
    157       if ((image = LoadImagesDVO (&Nimage)) == NULL) goto escape;
    158 
    159       char *filename = abspath("image.metadata.fits", DVO_MAX_PATH);
    160       ImageMetadataSave (filename, image, Nimage);
    161 
    162       REALLOCATE (targv, char *, targc + 2);
    163       targv[targc+0] = strcreate ("-image-metadata");
    164       targv[targc+1] = strcreate (filename);
    165       targc += 2;
    166     }
    167 
    168     // call the remote client
    169     int status = HostTableParallelOps (targc, targv, RESULT_FILE, TRUE, 0, VERBOSE);
    170     if (vec) free (vec);
    171    
    172     // free up targv
    173     for (i = 0; i < targc; i++) {
    174       free (targv[i]);
    175     }
    176     free (targv);
    177 
    178     return status;
    179   }
    180108
    181109  // get vectors corresponding to coordinates of interest
     
    193121    remove_argument (1, &argc, argv);
    194122  }
     123
     124  /* load regions which contain all supplied RA,DEC coordinates */
     125  if ((skylist = SelectRegionsByCoordVectors (RAvec, DECvec)) == NULL) goto escape;
     126
     127  if (PARALLEL && !HOST_ID) {
     128
     129    // We need to copy the args to a temp array and modify them so that we send the
     130    // correct set to the remote client.  The args list looks like this:
     131    // if (!CoordsFile) : mmatch (RADIUS) field, ... [we removed RA & DEC above]
     132    // if ( CoordsFile) : mmatch (RADIUS) field, ... [because we stripped off the -coords filename elements]
     133
     134    // allocate the temp array and copy all but (RA) (DEC)
     135    int targc = 0;
     136    char **targv = NULL;
     137    ALLOCATE (targv, char *, argc + 2);
     138    for (i = 0; i < argc; i++) {
     139      targv[targc] = strcreate (argv[i]);
     140      targc ++;
     141    }
     142
     143    // if not specified, create the coords.fits input file
     144    // NOTE: RAvec, DECvec were set above
     145    if (!CoordsFile) {
     146      ALLOCATE (vec, Vector *, 2);
     147      vec[0] = RAvec;
     148      vec[1] = DECvec;
     149
     150      // XXX this is now set for both cases...
     151      CoordsFile = abspath("coords.fits", 1024);
     152      int status = WriteVectorTableFITS (CoordsFile, "COORDS", vec, 2, FALSE, NULL);
     153      if (!status) goto escape;
     154    }
     155
     156    // add the coords file to the args list
     157    targv[targc+0] = strcreate ("-coords");
     158    targv[targc+1] = CoordsFile; // this gets freed with targv
     159    targc += 2;
     160   
     161    // if needed, add the index vector to the args list
     162    if (IDXvec) {
     163      REALLOCATE (targv, char *, targc + 2);
     164      targv[targc+0] = strcreate ("-index");
     165      targv[targc+1] = strcreate (IDXvec[0].name);
     166      targc += 2;
     167    }     
     168
     169    if (loadImages) {
     170      Image *image;
     171      off_t Nimage;
     172      if ((image = LoadImagesDVO (&Nimage)) == NULL) goto escape;
     173
     174      char *filename = abspath("image.metadata.fits", DVO_MAX_PATH);
     175      ImageMetadataSave (filename, image, Nimage);
     176
     177      REALLOCATE (targv, char *, targc + 2);
     178      targv[targc+0] = strcreate ("-image-metadata");
     179      targv[targc+1] = strcreate (filename);
     180      targc += 2;
     181    }
     182
     183    // call the remote client
     184    int status = HostTableParallelOps (skylist, targc, targv, RESULT_FILE, TRUE, 0, VERBOSE);
     185    if (vec) free (vec);
     186   
     187    // free up targv
     188    for (i = 0; i < targc; i++) {
     189      free (targv[i]);
     190    }
     191    free (targv);
     192
     193    return status;
     194  } // END of remote call section
     195
    195196  RADIUS = atof (argv[1]);
    196197  remove_argument (1, &argc, argv);
     
    209210  }
    210211
    211   /* load regions which contain all supplied RA,DEC coordinates */
    212   if ((skylist = SelectRegionsByCoordVectors (RAvec, DECvec)) == NULL) goto escape;
    213212
    214213  /* create output storage vectors */
  • trunk/Ohana/src/opihi/dvo/photometry.c

    r34405 r35416  
    11271127  double value;
    11281128  Image *image;
    1129   Coords *mosaic;
     1129  // Coords *mosaic;
    11301130
    11311131  value = 0;
     
    11931193# endif
    11941194      break;
     1195# if 0
    11951196    case MEAS_XMOSAIC: /* OK */
    11961197      ra  = average[0].R - measure[0].dR / 3600.0;
    11971198      dec = average[0].D - measure[0].dD / 3600.0;
    1198       mosaic = MatchMosaic (measure[0].t, measure[0].photcode);
     1199      mosaic = MatchMosaic (measure[0].t, measure[0].photcode); // XXX not used anymore
    11991200      if (mosaic == NULL) break;
    12001201      RD_to_XY (&x, &y, ra, dec, mosaic);
     
    12041205      ra  = average[0].R - measure[0].dR / 3600.0;
    12051206      dec = average[0].D - measure[0].dD / 3600.0;
    1206       mosaic = MatchMosaic (measure[0].t, measure[0].photcode);
     1207      mosaic = MatchMosaic (measure[0].t, measure[0].photcode); // XXX not used anymore
    12071208      if (mosaic == NULL) break;
    12081209      RD_to_XY (&x, &y, ra, dec, mosaic);
    12091210      value = y;
    12101211      break;
     1212# endif
    12111213  }
    12121214  return (value);
  • trunk/Ohana/src/opihi/dvo/remote.c

    r35109 r35416  
    6161  }
    6262
     63  // load the list of hosts
     64  SkyTable *sky = GetSkyTable();
     65  if (!sky) {
     66    gprint (GP_ERR, "failed to load sky table for database\n");
     67    return FALSE;
     68  }
     69  SkyList *skylist = NULL;
     70  ALLOCATE (skylist, SkyList, 1);
     71  skylist[0].Nregions = sky[0].Nregions;
     72  strcpy (skylist[0].hosts, sky[0].hosts);
     73
    6374  // strip of the 'remote' and send the remaining arguments to the remote machine
    64   int status = HostTableParallelOps (argc - 1, &argv[1], NULL, ReadVectors, 0, VERBOSE);
     75  int status = HostTableParallelOps (skylist, argc - 1, &argv[1], NULL, ReadVectors, 0, VERBOSE);
     76  free (skylist);
    6577  return status;
    6678}
  • trunk/Ohana/src/opihi/dvo/skyregion.c

    r33662 r35416  
    9898  new[0].Nregions = 0;
    9999  new[0].ownElements = FALSE; // this list is only holding a view to the elements
     100  strcpy (new[0].hosts, sky[0].hosts);
    100101
    101102  // output list
     
    107108  list[0].Nregions = 0;
    108109  list[0].ownElements = FALSE; // this list is only holding a view to the elements
     110  strcpy (list[0].hosts, sky[0].hosts);
    109111
    110112  for (i = 0; i < Npts; i++) {
  • trunk/Ohana/src/opihi/include/dvoshell.h

    r35109 r35416  
    9999dbValue      dbExtractImages        PROTO((Image *image, off_t Nimage, off_t N, dbField *field));
    100100
    101 int          HostTableLaunchJobs    PROTO((HostTable *table, char *basecmd, char *options, int VERBOSE));
    102 int          HostTableParallelOps   PROTO((int argc, char **argv, char *ResultFile, int ReadVectors, int Nelements, int VERBOSE));
     101int          HostTableLaunchJobs    PROTO((SkyList *sky, HostTable *table, char *basecmd, char *options, int VERBOSE));
     102int          HostTableParallelOps   PROTO((SkyList *sky, int argc, char **argv, char *ResultFile, int ReadVectors, int Nelements, int VERBOSE));
    103103int          HostTableReloadResults PROTO((char *uniquer, int VERBOSE));
    104104int          HostTableGetResults    PROTO((char *uniquer, int VERBOSE));
Note: See TracChangeset for help on using the changeset viewer.