- Timestamp:
- Mar 10, 2020, 10:52:25 AM (6 years ago)
- Location:
- trunk/Ohana/src/opihi
- Files:
-
- 5 edited
-
cmd.astro/csystem.c (modified) (3 diffs)
-
cmd.astro/mkgauss.c (modified) (3 diffs)
-
cmd.data/read_vectors.c (modified) (8 diffs)
-
dvo/skyregion.c (modified) (1 diff)
-
lib.data/starfuncs.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.astro/csystem.c
r39926 r41305 12 12 Vector *uxvec = NULL; 13 13 Vector *uyvec = NULL; 14 15 int Quiet = FALSE; 16 if ((N = get_argument (argc, argv, "-q"))) { 17 Quiet = TRUE; 18 remove_argument (N, &argc, argv); 19 } 20 if ((N = get_argument (argc, argv, "-quiet"))) { 21 Quiet = TRUE; 22 remove_argument (N, &argc, argv); 23 } 14 24 15 25 // transform proper motions at the same time … … 84 94 85 95 if (uXname) { 86 gprint (GP_LOG, "%10.6f %10.6f @ %10.6f %10.6f\n", x, y, ux, uy); 96 if (!Quiet) { 97 gprint (GP_LOG, "%10.6f %10.6f @ %10.6f %10.6f\n", x, y, ux, uy); 98 switch (output) { 99 case COORD_CELESTIAL: 100 set_variable ("uR", ux); 101 set_variable ("uD", uy); 102 break; 103 case COORD_ECLIPTIC: 104 set_variable ("uL", ux); 105 set_variable ("uB", uy); 106 break; 107 case COORD_GALACTIC: 108 case COORD_GALACTIC_REID_2004: 109 set_variable ("uLon", ux); 110 set_variable ("uLat", uy); 111 break; 112 default: 113 break; 114 } 115 } 87 116 } else { 88 gprint (GP_LOG, "%10.6f %10.6f\n", x, y); 117 if (!Quiet) { 118 gprint (GP_LOG, "%10.6f %10.6f\n", x, y); 119 } 120 } 121 switch (output) { 122 case COORD_CELESTIAL: 123 set_variable ("RA", x); 124 set_variable ("DEC", y); 125 break; 126 case COORD_ECLIPTIC: 127 set_variable ("Lambda", x); 128 set_variable ("Beta", y); 129 break; 130 case COORD_GALACTIC: 131 case COORD_GALACTIC_REID_2004: 132 set_variable ("gLon", x); 133 set_variable ("gLat", y); 134 break; 135 default: 136 break; 89 137 } 90 138 free (transform); … … 154 202 gprint (GP_ERR, " e.g. : csystem C G R D -pm uR uD -> R D will contain glon, glat; uR, uD will contain uL, uB\n"); 155 203 gprint (GP_ERR, " e.g. : csystem C G R D -pmback uL uB -> R D will contain glon, glat; uL, uB will contain uR, uD\n"); 204 gprint (GP_ERR, " : if input values are vectors, their values are replaced with the transformed values\n"); 205 gprint (GP_ERR, " : if input values are scalars, the transformed coordinates are printed (disable with -q)\n"); 206 gprint (GP_ERR, " : and the following output variables will be set (names depend on output system)\n"); 207 gprint (GP_ERR, " : output positions (RA, DEC), (Lambda, Beta), (gLon, gLat)\n"); 208 gprint (GP_ERR, " : output motions (uR, uD), (uL, uB), (uLon, uLat)\n"); 156 209 return FALSE; 157 210 } -
trunk/Ohana/src/opihi/cmd.astro/mkgauss.c
r26891 r41305 10 10 double x, y, r, f, Xo, Yo; 11 11 Buffer *buf; 12 13 int Normalize = FALSE; 14 if ((N = get_argument (argc, argv, "-norm"))) { 15 Normalize = TRUE; 16 remove_argument (N, &argc, argv); 17 } 12 18 13 19 // this should be Nx/2, Ny/2 if not set … … 60 66 /* f = exp (-r), r = (x^2 / 2Sx) + (y^2 / 2Sy) + Sxy*x*y */ 61 67 68 double Io = Normalize ? 1.0 / (2.0 * M_PI * Sig_x * Sig_y) : 1.0; 69 62 70 in = (float *) buf[0].matrix.buffer; 63 71 for (j = 0; j < Ny; j++) { … … 67 75 y = j - Yo; 68 76 r = 0.5*x*x/Sx + 0.5*y*y/Sy + x*y*Sxy; 69 f = exp (-r);77 f = Io * exp (-r); 70 78 *in += f; 71 79 } -
trunk/Ohana/src/opihi/cmd.data/read_vectors.c
r41269 r41305 35 35 36 36 // vector types 37 enum {COLTYPE_NONE, COLTYPE_FLT, COLTYPE_INT, COLTYPE_TIME, COLTYPE_ CHAR, COLTYPE_STR};37 enum {COLTYPE_NONE, COLTYPE_FLT, COLTYPE_INT, COLTYPE_TIME, COLTYPE_DATE, COLTYPE_CHAR, COLTYPE_STR, COLTYPE_HMS}; 38 38 39 39 static int Nvec = 0; … … 91 91 gprint (GP_ERR, " -skip N : skip N lines before reading\n"); 92 92 gprint (GP_ERR, " column names may include a type: name:type\n"); 93 gprint (GP_ERR, " type is int, float, char, str, time \n");93 gprint (GP_ERR, " type is int, float, char, str, time, date, hms\n"); 94 94 gprint (GP_ERR, " for char, values are placed into a list $name:0 - $name:n\n"); 95 95 gprint (GP_ERR, " for str, values are placed into a string-typed vector\n"); 96 gprint (GP_ERR, " for hms, values are sexigesimal values HH:MM:SS (good for degrees as well)\n"); 97 gprint (GP_ERR, " for date, values are human-readable date strings YYYY/MM/DD\n"); 96 98 gprint (GP_ERR, " for time, values are human-readable date/time strings YYYY/MM/DD,hh:mm:ss\n"); 97 gprint (GP_ERR, " the resulting vector is a float based on the TIMEFORMAT, TIMEREF values\n");99 gprint (GP_ERR, " date & time values are stored as a float using the TIMEFORMAT, TIMEREF values for the conversion\n"); 98 100 99 101 gprint (GP_ERR, " -fits options:\n"); … … 154 156 if (!strcasecmp(ptr, "char")) { coltype[i] = COLTYPE_CHAR; } 155 157 if (!strcasecmp(ptr, "str")) { coltype[i] = COLTYPE_STR; } 158 if (!strcasecmp(ptr, "date")) { coltype[i] = COLTYPE_DATE; } 156 159 if (!strcasecmp(ptr, "time")) { coltype[i] = COLTYPE_TIME; } 160 if (!strcasecmp(ptr, "hms")) { coltype[i] = COLTYPE_HMS; } 157 161 if (!coltype[i]) goto bad_colname; 158 162 } … … 212 216 break; 213 217 case COLTYPE_FLT: 218 case COLTYPE_HMS: 214 219 case COLTYPE_TIME: 215 // note that COLTYPE_TIME is a type of float 220 case COLTYPE_DATE: 216 221 ResetVector (vec[i], OPIHI_FLT, NELEM); 217 222 break; … … 292 297 time_t tvalue; 293 298 int readStatus = FALSE; 299 int dataStatus = FALSE; 294 300 // need to make the if cases for coltype[i] 295 301 switch (coltype[i]) { … … 341 347 vec[i][0].elements.Flt[Nelem] = readStatus ? dvalue : NAN; 342 348 break; 349 case COLTYPE_DATE: { 350 char *string = NULL; 351 if (IsCSV) { 352 char *ptr = ptrparse_csv (col[i], c0); 353 string = strcreate (ptr); // create separate string (NULL-safe) 354 ptr = (string == NULL) ? NULL : strchr (string, ','); 355 if (ptr != NULL) *ptr = 0; // place an EOL here so parsing does not go past the comma 356 } else { 357 char *ptr = ptrparse (col[i], c0); // NULL-safe 358 string = getword (ptr); // NULL-safe 359 } 360 tvalue = ohana_date_to_sec (string); // NULL-safe (returns 0) 361 dvalue = TimeValue (tvalue, TimeReference, TimeFormat); 362 vec[i][0].elements.Flt[Nelem] = string ? dvalue : NAN; 363 FREE (string); 364 break; 365 } 366 case COLTYPE_HMS: { 367 char *ptr = IsCSV ? ptrparse_csv (col[i], c0) : ptrparse (col[i], c0); 368 char *string = strcreate (ptr); // make a copy so we can munge it in ohana_dms_to_ddd 369 dataStatus = ohana_dms_to_ddd (&dvalue, string); 370 vec[i][0].elements.Flt[Nelem] = ((string != NULL) && dataStatus) ? dvalue : NAN; 371 FREE (string); 372 break; 373 } 343 374 } 344 375 if (!readStatus && VERBOSE) { … … 366 397 break; 367 398 case COLTYPE_FLT: 399 case COLTYPE_HMS: 368 400 case COLTYPE_TIME: 401 case COLTYPE_DATE: 369 402 ResetVector (vec[i], OPIHI_FLT, NELEM); 370 403 break; … … 390 423 break; 391 424 case COLTYPE_FLT: 425 case COLTYPE_HMS: 392 426 case COLTYPE_TIME: 427 case COLTYPE_DATE: 393 428 ResetVector (vec[i], OPIHI_FLT, Nelem); 394 429 break; -
trunk/Ohana/src/opihi/dvo/skyregion.c
r41282 r41305 49 49 gprint (GP_ERR, "current skyregion: %f - %f : %f - %f\n", Rmin, Rmax, Dmin, Dmax); 50 50 gprint (GP_ERR, "USAGE: skyregion (min RA) (max RA) (min DEC) (max DEC)\n"); 51 gprint (GP_ERR, " skyregion -box (RA) (DEC) (radius) [sets Rmin,Rmax & Dmin,Dmax]\n"); 51 52 return FALSE; 52 53 } -
trunk/Ohana/src/opihi/lib.data/starfuncs.c
r41162 r41305 76 76 FWHMy = 2.355*sqrt (fabs(y2 / I - y*y)); 77 77 78 fprintf (stderr, "Mxx, Myy: %f, %f\n", x2/I - x*x, y2/I - y*y);78 // fprintf (stderr, "Mxx, Myy: %f, %f\n", x2/I - x*x, y2/I - y*y); 79 79 Sxy = xy / I - x*y; 80 80 mag = -2.5*log10(I);
Note:
See TracChangeset
for help on using the changeset viewer.
