Changeset 39294
- Timestamp:
- Dec 24, 2015, 6:01:22 AM (11 years ago)
- Location:
- trunk/Ohana/src/opihi
- Files:
-
- 3 edited
-
cmd.astro/cdensify.c (modified) (10 diffs)
-
dvo/gcat.c (modified) (4 diffs)
-
dvo/gstar.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.astro/cdensify.c
r39233 r39294 11 11 Buffer *bf; 12 12 Vector *vr, *vd; 13 opihi_flt *r, *d,x, y;13 opihi_flt x, y; 14 14 int kapa; 15 15 Graphdata graphmode; … … 24 24 double Rmin = graphmode.coords.crval1 - 182.0; 25 25 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 } 26 33 27 34 float scale = 0.0; … … 45 52 gprint (GP_ERR, "USAGE: cdensify buffer R D\n"); 46 53 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"); 47 58 return (FALSE); 48 59 } … … 53 64 54 65 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 } 55 73 56 74 REQUIRE_VECTOR_FLT (vr, FALSE); … … 99 117 InitCoords (&coords, "DEC--TAN"); 100 118 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 103 126 val = (float *)bf[0].matrix.buffer; 127 104 128 for (i = 0; i < vr[0].Nelements; i++, r++, d++) { 105 129 double rn = ohana_normalize_angle (*r); … … 108 132 coords.crval1 = rn; 109 133 coords.crval2 = *d; 134 135 float F = 1.0; 136 if (vv) { 137 F = isFloatScale ? Fs[i] : Is[i]; 138 } 110 139 111 140 switch (PSFTYPE) { … … 118 147 if (Xb < 0) continue; 119 148 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 } 121 154 break; 122 155 case IS_SQUARE: … … 134 167 if (Xb < 0) continue; 135 168 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 } 137 174 } 138 175 } … … 154 191 if (Xb < 0) continue; 155 192 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 } 157 198 } 158 199 } … … 173 214 if (Xb < 0) continue; 174 215 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 } 176 221 } 177 222 } -
trunk/Ohana/src/opihi/dvo/gcat.c
r34088 r39294 9 9 SkyList *skylist; 10 10 11 int ShowFile = FALSE; 12 if ((N = get_argument (argc, argv, "-file"))) { 13 remove_argument (N, &argc, argv); 14 ShowFile = TRUE; 15 } 11 16 int ShowHost = FALSE; 12 17 if ((N = get_argument (argc, argv, "-host"))) { … … 41 46 skylist = SkyListByRadius (sky, -1, Ra, Dec, Radius); 42 47 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 43 58 // prepare to handle interrupt signals 44 59 signal (SIGINT, handle_interrupt); … … 46 61 47 62 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) { 50 81 gprint (GP_ERR, " *"); 51 82 } else { … … 53 84 } 54 85 if (ShowHost) { 55 gprint (GP_ERR, " %3d", skylist[0].regions[i][0].hostID);86 gprint (GP_ERR, " %3d", region->hostID); 56 87 } else { 57 88 gprint (GP_ERR, " "); 58 89 } 59 90 if (ShowBackup) { 60 gprint (GP_ERR, " %3d", skylist[0].regions[i][0].backupID);91 gprint (GP_ERR, " %3d", region->backupID); 61 92 } else { 62 93 gprint (GP_ERR, " "); 63 94 } 64 95 if (ShowFlags) { 65 gprint (GP_ERR, " 0x%04x", skylist[0].regions[i][0].hostFlags);96 gprint (GP_ERR, " 0x%04x", region->hostFlags); 66 97 } else { 67 98 gprint (GP_ERR, " "); 68 99 } 69 100 gprint (GP_ERR, "\n"); 70 set_str_variable ("CATNAME", skylist[0].filename[i]);101 set_str_variable ("CATNAME", hostfile); 71 102 } 72 103 -
trunk/Ohana/src/opihi/dvo/gstar.c
r38471 r39294 210 210 remove_argument (N, &argc, argv); 211 211 PARALLEL = TRUE; 212 // can this now be deprecated? 212 213 } 213 214 … … 236 237 237 238 HostTable *table = NULL; 238 if (PARALLEL) {239 char *CATDIR = GetCATDIR();239 char *CATDIR = GetCATDIR(); 240 if (HostTableExists (CATDIR, sky->hosts)) { 240 241 table = HostTableLoad (CATDIR, sky->hosts); 241 242 if (!table) {
Note:
See TracChangeset
for help on using the changeset viewer.
