Changeset 39926 for trunk/Ohana/src/opihi
- Timestamp:
- Jan 6, 2017, 11:30:10 AM (10 years ago)
- Location:
- trunk
- Files:
-
- 16 edited
- 2 copied
-
. (modified) (1 prop)
-
Ohana (modified) (1 prop)
-
Ohana/src/opihi/cmd.astro/csystem.c (modified) (1 diff)
-
Ohana/src/opihi/cmd.astro/fitplx_irls.c (modified) (2 diffs)
-
Ohana/src/opihi/cmd.astro/spex1dgas.c (modified) (1 diff)
-
Ohana/src/opihi/cmd.astro/spex2dgas.c (modified) (1 diff)
-
Ohana/src/opihi/cmd.astro/spexseq.c (modified) (1 diff)
-
Ohana/src/opihi/cmd.data/Makefile (modified) (1 diff)
-
Ohana/src/opihi/cmd.data/init.c (modified) (2 diffs)
-
Ohana/src/opihi/cmd.data/match2d.c (modified) (10 diffs)
-
Ohana/src/opihi/cmd.data/rndseed.c (copied) (copied from branches/czw_branch/20160809/Ohana/src/opihi/cmd.data/rndseed.c )
-
Ohana/src/opihi/cmd.data/stats-new.c (modified) (1 diff)
-
Ohana/src/opihi/cmd.data/test/fit1d_irls.sh (copied) (copied from branches/czw_branch/20160809/Ohana/src/opihi/cmd.data/test/fit1d_irls.sh )
-
Ohana/src/opihi/dvo/imbox.c (modified) (3 diffs)
-
Ohana/src/opihi/dvo/imdense.c (modified) (2 diffs)
-
Ohana/src/opihi/dvo/skycat.c (modified) (1 diff)
-
Ohana/src/opihi/lib.data/style_args.c (modified) (3 diffs)
-
Ohana/src/opihi/lib.shell/startup.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk
-
Property svn:mergeinfo
set to
/branches/czw_branch/20160809 merged eligible
-
Property svn:mergeinfo
set to
-
trunk/Ohana
-
trunk/Ohana/src/opihi/cmd.astro/csystem.c
r39591 r39926 125 125 opihi_flt *yptr = yvec[0].elements.Flt; 126 126 127 opihi_flt *uxptr = uxvec ? xvec[0].elements.Flt : NULL;128 opihi_flt *uyptr = uyvec ? yvec[0].elements.Flt : NULL;127 opihi_flt *uxptr = uxvec ? uxvec[0].elements.Flt : NULL; 128 opihi_flt *uyptr = uyvec ? uyvec[0].elements.Flt : NULL; 129 129 130 130 for (i = 0; i < xvec[0].Nelements; i++, xptr++, yptr++) { -
trunk/Ohana/src/opihi/cmd.astro/fitplx_irls.c
r39610 r39926 158 158 // now that the mask has been updated, we need to recalculate mean epoch and positions 159 159 // XXX make this conditional on actually masking unmasked points above 160 PlxSetMeanEpoch (R, D, T, &Rmean, &Dmean, &Tmean, mask, Ntotal);161 PlxSetEpochPosition (&fitdata, R, D, dR, dD, T, mask, Ntotal, &coords, Tmean);160 // PlxSetMeanEpoch (R, D, T, &Rmean, &Dmean, &Tmean, mask, Ntotal); 161 // PlxSetEpochPosition (&fitdata, R, D, dR, dD, T, mask, Ntotal, &coords, Tmean); 162 162 163 163 PlxFitData sample; … … 218 218 // fprintf (stderr, "%f +/- %f | %f %f\n", fit.p, fit.dp, fit.uR, fit.uD); 219 219 220 /* 221 FILE *f = fopen ("test.pf.dat", "w"); 220 Vector *dRresPMP, *dDresPMP, *dRresPLX, *dDresPLX; 221 222 // save fit residuals (with only pm removed, and pm and plx removed) 223 if ((dRresPMP = SelectVector ("dRresPMP", ANYVECTOR, TRUE)) == NULL) ESCAPE ("cannot generate vector %s\n", "dRresPMP"); 224 if ((dDresPMP = SelectVector ("dDresPMP", ANYVECTOR, TRUE)) == NULL) ESCAPE ("cannot generate vector %s\n", "dDresPMP"); 225 if ((dRresPLX = SelectVector ("dRresPLX", ANYVECTOR, TRUE)) == NULL) ESCAPE ("cannot generate vector %s\n", "dRresPLX"); 226 if ((dDresPLX = SelectVector ("dDresPLX", ANYVECTOR, TRUE)) == NULL) ESCAPE ("cannot generate vector %s\n", "dDresPLX"); 227 228 ResetVector (dRresPMP, OPIHI_FLT, Ntotal); 229 ResetVector (dDresPMP, OPIHI_FLT, Ntotal); 230 ResetVector (dRresPLX, OPIHI_FLT, Ntotal); 231 ResetVector (dDresPLX, OPIHI_FLT, Ntotal); 232 222 233 for (i = 0; i < Ntotal; i++) { 223 double Xf = fit.Ro + fit.uR*fitdata.t[i] + fit.p*fitdata.pX[i]; 224 double Yf = fit.Do + fit.uD*fitdata.t[i] + fit.p*fitdata.pY[i]; 225 fprintf (f, "%f : %f %f : %f %f : %f : %f %f : %f %f\n", T[i], R[i], D[i], Xf, Yf, fitdata.t[i], fitdata.X[i], fitdata.Y[i], fitdata.pX[i], fitdata.pY[i]); 226 } 227 fclose (f); 228 */ 234 235 double x0, y0; 236 RD_to_XY (&x0, &y0, R[i], D[i], &coords); 237 238 double pX0, pY0; 239 ParFactor (&pX0, &pY0, R[i], D[i], T[i]); 240 241 double t0 = (T[i] - Tmean)/365.25; 242 243 double Xpmp = fit.Ro + fit.uR*t0 + fit.p*pX0; 244 double Ypmp = fit.Do + fit.uD*t0 + fit.p*pY0; 245 double Xplx = fit.Ro + fit.uR*t0; 246 double Yplx = fit.Do + fit.uD*t0; 247 248 dRresPMP->elements.Flt[i] = x0 - Xpmp; 249 dDresPMP->elements.Flt[i] = y0 - Ypmp; 250 dRresPLX->elements.Flt[i] = x0 - Xplx; 251 dDresPLX->elements.Flt[i] = y0 - Yplx; 252 } 229 253 230 254 // fprintf (stderr, "Roff, Doff: %f, %f; dRo, dDo: %f, %f\n", fit.Ro, fit.Do, fit.dRo, fit.dDo); -
trunk/Ohana/src/opihi/cmd.astro/spex1dgas.c
r33662 r39926 108 108 IDList = NULL; 109 109 XoList = NULL; 110 {111 // init random numbers112 long A, B;113 A = time(NULL);114 for (B = 0; A == time(NULL); B++);115 srand48(B);116 }117 110 111 // srand48() is called by startup.c 112 118 113 if (argc != 11) goto usage; 119 114 -
trunk/Ohana/src/opihi/cmd.astro/spex2dgas.c
r33662 r39926 120 120 float XoMax, YoMax; 121 121 122 { 123 // init random numbers 124 long A, B; 125 A = time(NULL); 126 for (B = 0; A == time(NULL); B++); 127 srand48(B); 128 } 129 122 // srand48() is called by startup.c 123 130 124 if (argc != 9) goto usage; 131 125 -
trunk/Ohana/src/opihi/cmd.astro/spexseq.c
r39457 r39926 90 90 int Nobject = 0; 91 91 92 {93 // init random numbers94 long A, B;95 A = time(NULL);96 for (B = 0; A == time(NULL); B++);97 srand48(B);98 }99 100 92 if (argc != 6) goto usage; 93 94 // srand48() is called by startup.c 101 95 102 96 // XXX enforce matching lengths on the three vectors -
trunk/Ohana/src/opihi/cmd.data/Makefile
r39638 r39926 124 124 $(SRC)/resize.$(ARCH).o \ 125 125 $(SRC)/relocate.$(ARCH).o \ 126 $(SRC)/rndseed.$(ARCH).o \ 126 127 $(SRC)/roll.$(ARCH).o \ 127 128 $(SRC)/rotate.$(ARCH).o \ -
trunk/Ohana/src/opihi/cmd.data/init.c
r39638 r39926 113 113 int reindex PROTO((int, char **)); 114 114 int relocate PROTO((int, char **)); 115 int rndseed PROTO((int, char **)); 115 116 int roll PROTO((int, char **)); 116 117 int rotate PROTO((int, char **)); … … 293 294 {1, "relocate", relocate, "set graphics/image window position"}, 294 295 {1, "roll", roll, "roll image to new start point"}, 296 {1, "rndseed", rndseed, "set the pseudo-random seed"}, 295 297 {1, "rotate", rotate, "rotate image"}, 296 298 {1, "save", save, "save an SAOimage style image overlay"}, -
trunk/Ohana/src/opihi/cmd.data/match2d.c
r36084 r39926 1 1 # include "data.h" 2 2 3 int find_matches2d (Vector *X1, Vector *Y1, Vector *X2, Vector *Y2, double Radius, Vector *index1, Vector *index2 );3 int find_matches2d (Vector *X1, Vector *Y1, Vector *X2, Vector *Y2, double Radius, Vector *index1, Vector *index2, Vector *radiusMatch); 4 4 int find_matches2d_closest (Vector *X1, Vector *Y1, Vector *X2, Vector *Y2, double Radius, Vector *index); 5 6 int find_matches2d_sphere (Vector *X1, Vector *Y1, Vector *X2, Vector *Y2, double Radius, Vector *index1, Vector *index2, Vector *radiusMatch); 7 int find_matches2d_sphere_closest (Vector *X1, Vector *Y1, Vector *X2, Vector *Y2, double Radius, Vector *index); 5 8 6 9 // match2d (X1) (Y1) (X2) (Y2) (Radius) [-index1 (index1)] [-index2 (index2)] [-nomatch1 nomatch1] [-nomatch2 nomatch2] … … 23 26 } 24 27 28 int SPHERE_DISTANCE = FALSE; 29 if ((N = get_argument (argc, argv, "-sphere"))) { 30 remove_argument (N, &argc, argv); 31 SPHERE_DISTANCE = TRUE; 32 } 33 if ((N = get_argument (argc, argv, "-sky"))) { 34 remove_argument (N, &argc, argv); 35 SPHERE_DISTANCE = TRUE; 36 } 37 25 38 if ((N = get_argument (argc, argv, "-index1"))) { 26 39 remove_argument (N, &argc, argv); … … 37 50 } else { 38 51 if ((index2 = SelectVector ("index2", ANYVECTOR, TRUE)) == NULL) return (FALSE); 52 } 53 54 55 Vector *radiusMatch = NULL; 56 if ((N = get_argument (argc, argv, "-radius"))) { 57 if (CLOSEST) { 58 gprint (GP_ERR, "error: -radius and -closest are currently incompatible\n"); 59 return (FALSE); 60 } 61 remove_argument (N, &argc, argv); 62 if ((radiusMatch = SelectVector (argv[N], ANYVECTOR, TRUE)) == NULL) return (FALSE); 63 remove_argument (N, &argc, argv); 39 64 } 40 65 … … 84 109 } 85 110 86 if (CLOSEST) { 111 if (SPHERE_DISTANCE) { 112 if (CLOSEST) { 113 find_matches2d_sphere_closest (X1vec, Y1vec, X2vec, Y2vec, Radius, index1); 114 find_matches2d_sphere_closest (X2vec, Y2vec, X1vec, Y1vec, Radius, index2); 115 } else { 116 find_matches2d_sphere (X1vec, Y1vec, X2vec, Y2vec, Radius, index1, index2, radiusMatch); 117 } 118 } else { 119 if (CLOSEST) { 87 120 find_matches2d_closest (X1vec, Y1vec, X2vec, Y2vec, Radius, index1); 88 121 find_matches2d_closest (X2vec, Y2vec, X1vec, Y1vec, Radius, index2); 89 } else {90 find_matches2d (X1vec, Y1vec, X2vec, Y2vec, Radius, index1, index2 );91 }92 122 } else { 123 find_matches2d (X1vec, Y1vec, X2vec, Y2vec, Radius, index1, index2, radiusMatch); 124 } 125 } 93 126 return (TRUE); 94 127 … … 108 141 gprint (GP_ERR, "use 'reindex' to generate new vectors based on these index vectors\n"); 109 142 143 gprint (GP_ERR, "if -sphere or -sky is supplied, (x1,y1) and (x2,y2) are treaded as (ra,dec) or (long,lat) pairs in degrees\n"); 144 145 gprint (GP_ERR, "if -radius (vector) is supplied, the vector will be filled with the distance between the matched pairs\n"); 146 gprint (GP_ERR, " not valid with -closest\n"); 110 147 return FALSE; 111 148 } 112 149 113 150 // we are not defining a relative offset DX,DY for now 114 int find_matches2d (Vector *X1, Vector *Y1, Vector *X2, Vector *Y2, double Radius, Vector *index1, Vector *index2 ) {151 int find_matches2d (Vector *X1, Vector *Y1, Vector *X2, Vector *Y2, double Radius, Vector *index1, Vector *index2, Vector *radiusMatch) { 115 152 116 153 off_t i, j, first_j, I, J, *N1, *N2, Nmatch, NMATCH, DMATCH; … … 122 159 ResetVector (index1, OPIHI_INT, NMATCH); 123 160 ResetVector (index2, OPIHI_INT, NMATCH); 161 if (radiusMatch) ResetVector (radiusMatch, OPIHI_FLT, NMATCH); 124 162 125 163 ALLOCATE (N1, off_t, X1->Nelements); … … 154 192 index1->elements.Int[Nmatch] = I; 155 193 index2->elements.Int[Nmatch] = J; 194 if (radiusMatch) radiusMatch->elements.Flt[Nmatch] = dR; 156 195 157 196 // XXX track matches 1 and 2 with internal vector, save new nomatch index vectors … … 163 202 REALLOCATE (index1->elements.Int, opihi_int, NMATCH); 164 203 REALLOCATE (index2->elements.Int, opihi_int, NMATCH); 204 if (radiusMatch) { REALLOCATE (radiusMatch->elements.Flt, opihi_flt, NMATCH); } 165 205 } 166 206 } … … 171 211 index1->Nelements = Nmatch; 172 212 index2->Nelements = Nmatch; 213 if (radiusMatch) radiusMatch->Nelements = Nmatch; 173 214 174 215 free (N1); … … 246 287 return (TRUE); 247 288 } 289 290 double gcdist (double r1, double d1, double r2, double d2) { 291 double num,den; 292 r1 *= RAD_DEG; 293 d1 *= RAD_DEG; 294 r2 *= RAD_DEG; 295 d2 *= RAD_DEG; 296 297 num = sqrt(pow((cos(d2) * sin(r2 - r1)),2) + 298 pow((cos(d1) * sin(d2) - 299 sin(d1) * cos(d2) * cos(r2 - r1)),2)); 300 den = (sin(d1) * sin(d2) + cos(d1) * cos(d2) * cos(r2 - r1)); 301 return(atan2(num,den) * (180 / M_PI)); 302 } 303 304 typedef struct { 305 double sD; 306 double cD; 307 double sR; 308 double cR; 309 } Match2D_PreCalc; 310 311 double gcdist_PreCalc_v0 (Match2D_PreCalc *p1, Match2D_PreCalc *p2) { 312 double num,den; 313 314 num = sqrt(pow((p2->cD * (p2->sR*p1->cR - p1->sR*p2->cR)),2) + 315 pow((p1->cD * p2->sD - 316 p1->sD * p2->cD * (p2->cR*p1->cR + p2->sR*p1->sR)),2)); 317 den = (p1->sD * p2->sD + p1->cD * p2->cD * (p2->cR*p1->cR + p2->sR*p1->sR)); 318 return(atan2(num,den) * (180 / M_PI)); 319 } 320 321 // we are not defining a relative offset DX,DY for now 322 double gcdist_PreCalc (Match2D_PreCalc *p1, Match2D_PreCalc *p2) { 323 double num,den; 324 325 // double Qd = p1->sD * p1->cD * p2->sD * p2->cD; 326 // double Qr = p1->sR * p1->cR * p2->sR * p2->cR; 327 328 // double Xa 329 // = SQ(p2->cD * p1->cR * p2->sR) 330 // + SQ(p2->cD * p1->sR * p2->cR) - 331 // - 2 * SQ(p2->cD) * Qr; 332 333 double cdR = (p2->cR*p1->cR + p2->sR*p1->sR); 334 335 double Xa = SQ(p2->cD * p2->sR * p1->cR - p2->cD * p1->sR * p2->cR); 336 double Xb = SQ(p1->cD * p2->sD - p1->sD * p2->cD * cdR); 337 338 num = sqrt(Xa + Xb); 339 den = (p1->sD * p2->sD + p1->cD * p2->cD * cdR); 340 return(atan2(num,den) * (180 / M_PI)); 341 } 342 343 // we are not defining a relative offset DX,DY for now 344 int find_matches2d_sphere (Vector *X1, Vector *Y1, Vector *X2, Vector *Y2, double Radius, Vector *index1, Vector *index2, Vector *radiusMatch) { 345 346 off_t i, j, first_j, I, J, *N1, *N2, Nmatch, NMATCH, DMATCH; 347 double dY, dR; 348 349 NMATCH = MAX(MAX(0.05*X1->Nelements, 0.05*X2->Nelements), 1000); 350 DMATCH = NMATCH; 351 352 ResetVector (index1, OPIHI_INT, NMATCH); 353 ResetVector (index2, OPIHI_INT, NMATCH); 354 if (radiusMatch) ResetVector (radiusMatch, OPIHI_FLT, NMATCH); 355 356 ALLOCATE (N1, off_t, X1->Nelements); 357 ALLOCATE (N2, off_t, X2->Nelements); 358 359 ALLOCATE_PTR (A1, Match2D_PreCalc, X1->Nelements); 360 ALLOCATE_PTR (A2, Match2D_PreCalc, X2->Nelements); 361 362 for (i = 0; i < X1->Nelements; i++) { 363 A1[i].sR = sin(RAD_DEG*X1->elements.Flt[i]); 364 A1[i].cR = cos(RAD_DEG*X1->elements.Flt[i]); 365 A1[i].sD = sin(RAD_DEG*Y1->elements.Flt[i]); 366 A1[i].cD = cos(RAD_DEG*Y1->elements.Flt[i]); 367 N1[i] = i; 368 } 369 for (i = 0; i < X2->Nelements; i++) { 370 A2[i].sR = sin(RAD_DEG*X2->elements.Flt[i]); 371 A2[i].cR = cos(RAD_DEG*X2->elements.Flt[i]); 372 A2[i].sD = sin(RAD_DEG*Y2->elements.Flt[i]); 373 A2[i].cD = cos(RAD_DEG*Y2->elements.Flt[i]); 374 N2[i] = i; 375 } 376 377 // sort from one pole to the other 378 sort_coords_indexonly (Y1->elements.Flt, X1->elements.Flt, N1, X1->Nelements); 379 sort_coords_indexonly (Y2->elements.Flt, X2->elements.Flt, N2, X2->Nelements); 380 381 Nmatch = 0; 382 for (i = j = 0; (i < X1->Nelements) && (j < X2->Nelements);) { 383 I = N1[i]; 384 J = N2[j]; 385 386 // we can use dY as minimal requirement: if dY > Radius, we are too far apart 387 dY = Y1->elements.Flt[I] - Y2->elements.Flt[J]; 388 389 if (dY <= -1.02*Radius) { i++; continue; } 390 if (dY >= +1.02*Radius) { j++; continue; } 391 392 // look for all matches of list2() to list1(i) 393 first_j = j; 394 for (j = first_j; (dY > -1.02*Radius) && (j < X2->Nelements); j++) { 395 J = N2[j]; 396 397 dR = gcdist_PreCalc (&A1[I], &A2[J]); 398 // dR = gcdist (X1->elements.Flt[I], Y1->elements.Flt[I], X2->elements.Flt[J], Y2->elements.Flt[J]); 399 400 if (dR < Radius) { 401 index1->elements.Int[Nmatch] = I; 402 index2->elements.Int[Nmatch] = J; 403 if (radiusMatch) radiusMatch->elements.Flt[Nmatch] = dR; 404 405 // XXX track matches 1 and 2 with internal vector, save new nomatch index vectors 406 // after this loop 407 408 Nmatch ++; 409 if (Nmatch >= NMATCH) { 410 NMATCH += DMATCH; 411 REALLOCATE (index1->elements.Int, opihi_int, NMATCH); 412 REALLOCATE (index2->elements.Int, opihi_int, NMATCH); 413 if (radiusMatch) { REALLOCATE (radiusMatch->elements.Flt, opihi_flt, NMATCH); } 414 } 415 } 416 } 417 j = first_j; 418 i++; 419 } 420 index1->Nelements = Nmatch; 421 index2->Nelements = Nmatch; 422 if (radiusMatch) radiusMatch->Nelements = Nmatch; 423 424 free (A1); 425 free (A2); 426 427 free (N1); 428 free (N2); 429 430 return (TRUE); 431 } 432 433 // we are not defining a relative offset DX,DY for now 434 int find_matches2d_sphere_closest (Vector *X1, Vector *Y1, Vector *X2, Vector *Y2, double Radius, Vector *index) { 435 436 off_t i, j, Jmin, Ji, I, J, *N1, *N2; 437 double dY, dR, Rmin; 438 439 ResetVector (index, OPIHI_INT, X1->Nelements); 440 for (i = 0; i < index->Nelements; i++) { index->elements.Int[i] = -1; } 441 442 ALLOCATE (N1, off_t, X1->Nelements); 443 ALLOCATE (N2, off_t, X2->Nelements); 444 445 ALLOCATE_PTR (A1, Match2D_PreCalc, X1->Nelements); 446 ALLOCATE_PTR (A2, Match2D_PreCalc, X2->Nelements); 447 448 for (i = 0; i < X1->Nelements; i++) { 449 A1[i].sR = sin(RAD_DEG*X1->elements.Flt[i]); 450 A1[i].cR = cos(RAD_DEG*X1->elements.Flt[i]); 451 A1[i].sD = sin(RAD_DEG*Y1->elements.Flt[i]); 452 A1[i].cD = cos(RAD_DEG*Y1->elements.Flt[i]); 453 N1[i] = i; 454 } 455 for (i = 0; i < X2->Nelements; i++) { 456 A2[i].sR = sin(RAD_DEG*X2->elements.Flt[i]); 457 A2[i].cR = cos(RAD_DEG*X2->elements.Flt[i]); 458 A2[i].sD = sin(RAD_DEG*Y2->elements.Flt[i]); 459 A2[i].cD = cos(RAD_DEG*Y2->elements.Flt[i]); 460 N2[i] = i; 461 } 462 463 // sort from one pole to the other 464 sort_coords_indexonly (Y1->elements.Flt, X1->elements.Flt, N1, X1->Nelements); 465 sort_coords_indexonly (Y2->elements.Flt, X2->elements.Flt, N2, X2->Nelements); 466 467 for (i = j = 0; (i < X1->Nelements) && (j < X2->Nelements);) { 468 I = N1[i]; 469 J = N2[j]; 470 471 // we can use dY as minimal requirement: if dY > Radius, we are too far apart 472 dY = Y1->elements.Flt[I] - Y2->elements.Flt[J]; 473 474 if (dY <= -1.02*Radius) { 475 // no match in list 2 to this entry 476 index->elements.Int[I] = -1; // (probably not needed --- index is init'ed above)o 477 i++; 478 continue; 479 } 480 if (dY >= +1.02*Radius) { j++; continue; } 481 482 // look for all matches of list2() to list1(i) 483 Jmin = -1; 484 Rmin = Radius; 485 for (Ji = j; (dY > -1.02*Radius) && (Ji < X2->Nelements); Ji++) { 486 J = N2[Ji]; 487 488 dR = gcdist_PreCalc (&A1[I], &A2[J]); 489 // dR = gcdist (X1->elements.Flt[I], Y1->elements.Flt[I], X2->elements.Flt[J], Y2->elements.Flt[J]); 490 491 if (dR < Rmin) { 492 Rmin = dR; 493 Jmin = J; 494 } 495 } 496 497 498 // no match in list 2 to this entry 499 if (Jmin == -1) { 500 index->elements.Int[I] = -1; 501 i++; 502 continue; 503 } 504 index->elements.Int[I] = Jmin; 505 i++; 506 } 507 508 free (A1); 509 free (A2); 510 511 free (N1); 512 free (N2); 513 514 return (TRUE); 515 } 516 517 -
trunk/Ohana/src/opihi/cmd.data/stats-new.c
r15274 r39926 129 129 ALLOCATE (values, float, Nsample); 130 130 131 A = time(NULL); 132 for (B = 0; A == time(NULL); B++); 133 srand48(B); 131 // srand48() is called by startup.c 134 132 135 133 *buffer = (float *) matrix[0].buffer; -
trunk/Ohana/src/opihi/dvo/imbox.c
r37807 r39926 15 15 16 16 if (!style_args (&graphmode, &argc, argv, &kapa)) return FALSE; 17 18 char *xaxis = NULL; 19 if ((N = get_argument (argc, argv, "-xaxis"))) { 20 remove_argument (N, &argc, argv); 21 xaxis = strcreate (argv[N]); 22 remove_argument (N, &argc, argv); 23 } 24 char *yaxis = NULL; 25 if ((N = get_argument (argc, argv, "-yaxis"))) { 26 remove_argument (N, &argc, argv); 27 yaxis = strcreate (argv[N]); 28 remove_argument (N, &argc, argv); 29 } 17 30 18 31 SOLO_PHU = FALSE; … … 61 74 // XXX currently, image uses an unsigned short for NX,XY. this is rather restrictive 62 75 // and needs to be at least checked. 63 haveNx = gfits_scan (&header, "IMNAXIS1", "%d", 1, &Nx); 64 haveNy = gfits_scan (&header, "IMNAXIS2", "%d", 1, &Ny); 76 haveNx = FALSE; 77 if (xaxis) { 78 haveNx = gfits_scan (&header, xaxis, "%d", 1, &Nx); 79 } 80 if (!haveNx) { 81 haveNx = gfits_scan (&header, "IMNAXIS1", "%d", 1, &Nx); 82 } 83 if (!haveNx) { 84 haveNx = gfits_scan (&header, "ZNAXIS1", "%d", 1, &Nx); 85 } 86 if (!haveNx) { 87 haveNx = gfits_scan (&header, "NAXIS1", "%d", 1, &Nx); 88 } 65 89 66 if (!haveNx && !haveNy) { 67 haveNx = gfits_scan (&header, "ZNAXIS1", "%d", 1, &Nx); 90 haveNy = FALSE; 91 if (yaxis) { 92 haveNy = gfits_scan (&header, yaxis, "%d", 1, &Ny); 93 } 94 if (!haveNy) { 95 haveNy = gfits_scan (&header, "IMNAXIS2", "%d", 1, &Ny); 96 } 97 if (!haveNy) { 68 98 haveNy = gfits_scan (&header, "ZNAXIS2", "%d", 1, &Ny); 69 99 } 70 71 if (!haveNx && !haveNy) { 72 haveNx = gfits_scan (&header, "NAXIS1", "%d", 1, &Nx); 100 if (!haveNy) { 73 101 haveNy = gfits_scan (&header, "NAXIS2", "%d", 1, &Ny); 74 102 } … … 137 165 free (Xvec.elements.Flt); 138 166 free (Yvec.elements.Flt); 167 if (xaxis) free (xaxis); 168 if (yaxis) free (yaxis); 139 169 return (TRUE); 140 170 -
trunk/Ohana/src/opihi/dvo/imdense.c
r37807 r39926 4 4 int imdense (int argc, char **argv) { 5 5 6 long A, B;7 6 off_t i, Nimage; 8 7 int kapa, N, status, NPTS; … … 27 26 Rmax = graphmode.coords.crval1 + 182.0; 28 27 29 A = time(NULL); 30 for (B = 0; A == time(NULL); B++); 31 srand48(B); 28 // srand48() is called by startup.c 32 29 33 30 N = 0; -
trunk/Ohana/src/opihi/dvo/skycat.c
r39457 r39926 78 78 if (table) { 79 79 int hostID = (regions[i][0].hostFlags & DATA_USE_BCK) ? regions[i][0].backupID : regions[i][0].hostID; 80 int index = table->index[hostID]; 81 snprintf (hostfile, 1024, "%s/%s.cpt", table->hosts[index].pathname, regions[i][0].name); 80 if (hostID) { 81 int index = table->index[hostID]; 82 snprintf (hostfile, 1024, "%s/%s.cpt", table->hosts[index].pathname, regions[i][0].name); 83 } else { 84 strcpy (hostfile, skylist[0].filename[i]); 85 } 82 86 } else { 83 87 strcpy (hostfile, skylist[0].filename[i]); -
trunk/Ohana/src/opihi/lib.data/style_args.c
r13479 r39926 29 29 if ((N = get_argument (*argc, argv, "-lt"))) { 30 30 remove_argument (N, argc, argv); 31 graphmode[0].ltype = atof(argv[N]);31 graphmode[0].ltype = KapaLineTypeFromString(argv[N]); 32 32 remove_argument (N, argc, argv); 33 33 } … … 39 39 if ((N = get_argument (*argc, argv, "-pt"))) { 40 40 remove_argument (N, argc, argv); 41 graphmode[0].ptype = atof(argv[N]);41 graphmode[0].ptype = KapaPointStyleFromString(argv[N]); 42 42 remove_argument (N, argc, argv); 43 43 } … … 63 63 if ((N = get_argument (*argc, argv, "-x"))) { 64 64 remove_argument (N, argc, argv); 65 graphmode[0].style = atof(argv[N]);65 graphmode[0].style = KapaPlotStyleFromString(argv[N]); 66 66 remove_argument (N, argc, argv); 67 67 } -
trunk/Ohana/src/opihi/lib.shell/startup.c
r33963 r39926 51 51 gfits_set_unsign_mode (FALSE); 52 52 53 set_variable ("M_PI", M_PI); 54 set_variable ("M_E", M_E); 55 set_variable ("M_c", 299792459.0); // meter / second 56 set_variable ("M_c_cgs", 29979245900.0); // cm / second 57 58 set_variable ("M_h", 6.62607004e-34); // meter^2 kg / second (J s) 59 set_variable ("M_h_cgs", 6.62607004e-27); // erg s 60 61 set_variable ("M_kB", 1.38064853e-23); // J / K 62 set_variable ("M_kB_cgs", 1.38064853e-16); // erg / K 63 53 64 /* check history file permission */ 54 65 {
Note:
See TracChangeset
for help on using the changeset viewer.
