IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39294


Ignore:
Timestamp:
Dec 24, 2015, 6:01:22 AM (11 years ago)
Author:
eugene
Message:

test for parallel dvo; add option to print full filename (automatically parallel or local); add option to scale cdensify image by a vectors

Location:
trunk/Ohana/src/opihi
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/cmd.astro/cdensify.c

    r39233 r39294  
    1111  Buffer *bf;
    1212  Vector *vr, *vd;
    13   opihi_flt *r, *d, x, y;
     13  opihi_flt x, y;
    1414  int kapa;
    1515  Graphdata graphmode;
     
    2424  double Rmin = graphmode.coords.crval1 - 182.0;
    2525  double Rmax = graphmode.coords.crval1 + 182.0;
     26
     27  Vector *vv = NULL;
     28  if ((N = get_argument (argc, argv, "-value"))) {
     29    remove_argument (N, &argc, argv);
     30    if ((vv = SelectVector (argv[N], ANYVECTOR, TRUE)) == NULL) return (FALSE);   
     31    remove_argument (N, &argc, argv);
     32  }
    2633
    2734  float scale = 0.0;
     
    4552    gprint (GP_ERR, "USAGE: cdensify buffer R D\n");
    4653    gprint (GP_ERR, " option: -psf [dot] (circle) (square) (gauss)\n");
     54    gprint (GP_ERR, " other options:\n");
     55    gprint (GP_ERR, "   -raw : do not renormalize PSF\n");
     56    gprint (GP_ERR, "   -scale : spatial scale factor for PSF (radius, half-width, or sigma)\n");
     57    gprint (GP_ERR, "   -value (vector) : multiply sum by the given vector\n");
    4758    return (FALSE);
    4859  }
     
    5364
    5465  if (vr[0].Nelements != vd[0].Nelements) return (FALSE);
     66
     67  if (vv) {
     68    if (vv[0].Nelements != vr[0].Nelements) {
     69      gprint (GP_ERR, "mis-match in vector lengths\n");
     70      return FALSE;
     71    }
     72  }
    5573
    5674  REQUIRE_VECTOR_FLT (vr, FALSE);
     
    99117  InitCoords (&coords, "DEC--TAN");
    100118
    101   r = vr[0].elements.Flt;
    102   d = vd[0].elements.Flt;
     119  opihi_flt *r = vr[0].elements.Flt;
     120  opihi_flt *d = vd[0].elements.Flt;
     121
     122  opihi_flt *Fs = vv ? vv[0].elements.Flt : NULL;
     123  opihi_int *Is = vv ? vv[0].elements.Int : NULL;
     124  int isFloatScale = (vv && vv[0].type == OPIHI_FLT);
     125
    103126  val = (float *)bf[0].matrix.buffer;
     127
    104128  for (i = 0; i < vr[0].Nelements; i++, r++, d++) {
    105129    double rn = ohana_normalize_angle (*r);
     
    108132    coords.crval1 = rn;
    109133    coords.crval2 = *d;
     134
     135    float F = 1.0;
     136    if (vv) {
     137      F = isFloatScale ? Fs[i] : Is[i];
     138    }
    110139
    111140    switch (PSFTYPE) {
     
    118147        if (Xb < 0) continue;
    119148        if (Yb < 0) continue;
    120         val[Xb + Yb*Nx] ++;
     149        if (vv) {
     150          val[Xb + Yb*Nx] += F;
     151        } else {
     152          val[Xb + Yb*Nx] ++;
     153        }
    121154        break;
    122155      case IS_SQUARE:
     
    134167            if (Xb < 0) continue;
    135168            if (Yb < 0) continue;
    136             val[Xb + Yb*Nx] += Normalize ? fSquare : 1.0;
     169            if (vv) {
     170              val[Xb + Yb*Nx] += Normalize ? fSquare*F : F;
     171            } else {
     172              val[Xb + Yb*Nx] += Normalize ? fSquare : 1.0;
     173            }
    137174          }
    138175        }
     
    154191            if (Xb < 0) continue;
    155192            if (Yb < 0) continue;
    156             val[Xb + Yb*Nx] += Normalize ? fCircle : 1.0;
     193            if (vv) {
     194              val[Xb + Yb*Nx] += Normalize ? fCircle*F : F;
     195            } else {
     196              val[Xb + Yb*Nx] += Normalize ? fCircle : 1.0;
     197            }
    157198          }
    158199        }
     
    173214            if (Xb < 0) continue;
    174215            if (Yb < 0) continue;
    175             val[Xb + Yb*Nx] += fGauss*exp(-fSigma*r2);
     216            if (vv) {
     217              val[Xb + Yb*Nx] += F*fGauss*exp(-fSigma*r2);
     218            } else {
     219              val[Xb + Yb*Nx] += fGauss*exp(-fSigma*r2);
     220            }
    176221          }
    177222        }
  • trunk/Ohana/src/opihi/dvo/gcat.c

    r34088 r39294  
    99  SkyList *skylist;
    1010
     11  int ShowFile = FALSE;
     12  if ((N = get_argument (argc, argv, "-file"))) {
     13    remove_argument (N, &argc, argv);
     14    ShowFile = TRUE;
     15  }
    1116  int ShowHost = FALSE;
    1217  if ((N = get_argument (argc, argv, "-host"))) {
     
    4146  skylist = SkyListByRadius (sky, -1, Ra, Dec, Radius);
    4247
     48  HostTable *table = NULL; 
     49  char *CATDIR = GetCATDIR();
     50  if (HostTableExists (CATDIR, sky->hosts)) {
     51    table = HostTableLoad (CATDIR, sky->hosts);
     52    if (!table) {
     53      gprint (GP_ERR, "ERROR: failure reading Host Table %s for parallel database %s\n", sky->hosts, CATDIR);
     54      return FALSE;
     55    }   
     56  }
     57
    4358  // prepare to handle interrupt signals
    4459  signal (SIGINT, handle_interrupt);
     
    4661
    4762  for (i = 0; (i < skylist[0].Nregions) && !interrupt; i++) {
    48     gprint (GP_ERR, "%3d %s", i, skylist[0].regions[i][0].name);
    49     if (stat (skylist[0].filename[i], &filestat) != -1) {
     63    SkyRegion *region = skylist[0].regions[i];
     64
     65    char hostfile[1024];
     66    if (table) {
     67      int hostID = (region->hostFlags & DATA_USE_BCK) ? region->backupID : region->hostID;
     68      int index = table->index[hostID];
     69      snprintf (hostfile, 1024, "%s/%s.cpt", table->hosts[index].pathname, region->name);
     70    } else {
     71      strcpy (hostfile, skylist[0].filename[i]);
     72    }
     73
     74    if (ShowFile) {
     75      gprint (GP_ERR, "%3d %s", i, hostfile);
     76    } else {
     77      gprint (GP_ERR, "%3d %s", i, region->name);
     78    }
     79
     80    if (stat (hostfile, &filestat) != -1) {
    5081      gprint (GP_ERR, " *");
    5182    } else {
     
    5384    }
    5485    if (ShowHost) {
    55       gprint (GP_ERR, "  %3d", skylist[0].regions[i][0].hostID);
     86      gprint (GP_ERR, "  %3d", region->hostID);
    5687    } else {
    5788      gprint (GP_ERR, "     ");
    5889    }
    5990    if (ShowBackup) {
    60       gprint (GP_ERR, "  %3d", skylist[0].regions[i][0].backupID);
     91      gprint (GP_ERR, "  %3d", region->backupID);
    6192    } else {
    6293      gprint (GP_ERR, "     ");
    6394    }
    6495    if (ShowFlags) {
    65       gprint (GP_ERR, "  0x%04x", skylist[0].regions[i][0].hostFlags);
     96      gprint (GP_ERR, "  0x%04x", region->hostFlags);
    6697    } else {
    6798      gprint (GP_ERR, "        ");
    6899    }
    69100    gprint (GP_ERR, "\n");
    70     set_str_variable ("CATNAME", skylist[0].filename[i]);
     101    set_str_variable ("CATNAME", hostfile);
    71102  }
    72103
  • trunk/Ohana/src/opihi/dvo/gstar.c

    r38471 r39294  
    210210    remove_argument (N, &argc, argv);
    211211    PARALLEL = TRUE;
     212    // can this now be deprecated?
    212213  }
    213214
     
    236237
    237238  HostTable *table = NULL; 
    238   if (PARALLEL) {
    239     char *CATDIR = GetCATDIR();
     239  char *CATDIR = GetCATDIR();
     240  if (HostTableExists (CATDIR, sky->hosts)) {
    240241    table = HostTableLoad (CATDIR, sky->hosts);
    241242    if (!table) {
Note: See TracChangeset for help on using the changeset viewer.