Changeset 39591
- Timestamp:
- May 28, 2016, 5:07:36 PM (10 years ago)
- Location:
- trunk/Ohana/src/opihi/cmd.astro
- Files:
-
- 1 added
- 4 edited
-
Makefile (modified) (1 diff)
-
csystem.c (modified) (3 diffs)
-
fitplx_irls.c (modified) (1 diff)
-
init.c (modified) (2 diffs)
-
parallax_factor.c (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/opihi/cmd.astro/Makefile
r39245 r39591 60 60 $(SRC)/objload.$(ARCH).o \ 61 61 $(SRC)/outline.$(ARCH).o \ 62 $(SRC)/parallax_factor.$(ARCH).o \ 62 63 $(SRC)/polar.$(ARCH).o \ 63 64 $(SRC)/precess.$(ARCH).o \ -
trunk/Ohana/src/opihi/cmd.astro/csystem.c
r37807 r39591 4 4 5 5 /* USAGE: csystem [C/G/E/H] [C/G/E/H] [epoch] */ 6 int i; 7 double X, Y, x, y; 8 opihi_flt *xptr, *yptr; 9 Vector *xvec, *yvec; 6 int i, N; 7 double X, Y, x, y, uX, uY, ux, uy; 10 8 CoordTransformSystem input, output; 11 CoordTransform *transform; 9 10 Vector *xvec = NULL; 11 Vector *yvec = NULL; 12 Vector *uxvec = NULL; 13 Vector *uyvec = NULL; 14 15 // transform proper motions at the same time 16 char *uXname = NULL; 17 char *uYname = NULL; 18 int pmBackwards = FALSE; 19 if ((N = get_argument (argc, argv, "-pm"))) { 20 remove_argument (N, &argc, argv); 21 uXname = strcreate (argv[N]); 22 remove_argument (N, &argc, argv); 23 uYname = strcreate (argv[N]); 24 remove_argument (N, &argc, argv); 25 } 26 if ((N = get_argument (argc, argv, "-pmback"))) { 27 if (uXname) { 28 gprint (GP_ERR, "cannot mix -pm and -pmback\n"); 29 return FALSE; 30 } 31 remove_argument (N, &argc, argv); 32 uXname = strcreate (argv[N]); 33 remove_argument (N, &argc, argv); 34 uYname = strcreate (argv[N]); 35 remove_argument (N, &argc, argv); 36 pmBackwards = TRUE; 37 } 12 38 13 39 if (argc != 5) goto syntax; … … 35 61 } 36 62 37 transform = InitTransform (input, output);63 CoordTransform *transform = InitTransform (input, output); 38 64 if (transform == NULL) { 39 65 gprint (GP_ERR, "transform %c to %c is not yet defined\n", argv[1][0], argv[2][0]); … … 42 68 43 69 if (SelectScalar (argv[3], &X)) { 44 if (!SelectScalar (argv[4], &Y)) return (FALSE);70 if (!SelectScalar (argv[4], &Y)) goto escape; 45 71 72 // apply transform at the current coordinate to transform motions: 73 if (uXname) { 74 if (!SelectScalar (uXname, &uX)) goto escape; 75 if (!SelectScalar (uYname, &uY)) goto escape; 76 77 if (pmBackwards) { 78 TransformProperMotionBackwards (&ux, &uy, uX, uY, X, Y, transform); 79 } else { 80 TransformProperMotionForewards (&ux, &uy, uX, uY, X, Y, transform); 81 } 82 } 46 83 ApplyTransform (&x, &y, X, Y, transform); 47 84 48 gprint (GP_LOG, "%10.6f %10.6f\n", x, y); 85 if (uXname) { 86 gprint (GP_LOG, "%10.6f %10.6f @ %10.6f %10.6f\n", x, y, ux, uy); 87 } else { 88 gprint (GP_LOG, "%10.6f %10.6f\n", x, y); 89 } 90 free (transform); 49 91 return (TRUE); 50 92 } 51 93 52 94 /* find vectors */ 53 if ((xvec = SelectVector (argv[3], OLDVECTOR, TRUE)) == NULL) return (FALSE);54 if ((yvec = SelectVector (argv[4], OLDVECTOR, TRUE)) == NULL) return (FALSE);95 if ((xvec = SelectVector (argv[3], OLDVECTOR, TRUE)) == NULL) goto escape; 96 if ((yvec = SelectVector (argv[4], OLDVECTOR, TRUE)) == NULL) goto escape; 55 97 56 98 if (xvec[0].Nelements != yvec[0].Nelements) { 57 99 gprint (GP_ERR, "vectors %s and %s not the same length\n", argv[3], argv[4]); 58 return (FALSE);100 goto escape; 59 101 } 60 102 103 // apply transform at the current coordinate to transform motions: 104 if (uXname) { 105 if ((uxvec = SelectVector (uXname, OLDVECTOR, TRUE)) == NULL) goto escape; 106 if ((uyvec = SelectVector (uYname, OLDVECTOR, TRUE)) == NULL) goto escape; 107 108 if (xvec[0].Nelements != uxvec[0].Nelements) { 109 gprint (GP_ERR, "vectors %s and %s not the same length\n", argv[3], uXname); 110 goto escape; 111 } 112 if (xvec[0].Nelements != uyvec[0].Nelements) { 113 gprint (GP_ERR, "vectors %s and %s not the same length\n", argv[3], uYname); 114 goto escape; 115 } 116 117 CastVector (uxvec, OPIHI_FLT); 118 CastVector (uyvec, OPIHI_FLT); 119 } 120 61 121 CastVector (xvec, OPIHI_FLT); 62 122 CastVector (yvec, OPIHI_FLT); 63 123 64 xptr = xvec[0].elements.Flt; 65 yptr = yvec[0].elements.Flt; 124 opihi_flt *xptr = xvec[0].elements.Flt; 125 opihi_flt *yptr = yvec[0].elements.Flt; 126 127 opihi_flt *uxptr = uxvec ? xvec[0].elements.Flt : NULL; 128 opihi_flt *uyptr = uyvec ? yvec[0].elements.Flt : NULL; 66 129 67 130 for (i = 0; i < xvec[0].Nelements; i++, xptr++, yptr++) { 131 if (uXname) { 132 if (pmBackwards) { 133 TransformProperMotionBackwards (uxptr, uyptr, *uxptr, *uyptr, *xptr, *yptr, transform); 134 } else { 135 TransformProperMotionForewards (uxptr, uyptr, *uxptr, *uyptr, *xptr, *yptr, transform); 136 } 137 uxptr ++; 138 uyptr ++; 139 } 68 140 ApplyTransform (xptr, yptr, *xptr, *yptr, transform); 69 141 } 70 142 143 FREE (transform); 71 144 return (TRUE); 72 145 146 escape: 147 FREE (transform); 148 return FALSE; 149 73 150 syntax: 74 gprint (GP_ERR, "USAGE: csystems [C/G/E/H] [C/G/E/H] X Y\n"); 75 return (FALSE); 151 gprint (GP_ERR, "USAGE : csystems [C/G/E/H] [C/G/E/H] X Y [-pm uX uY] [-pmback ux uy]\n"); 152 gprint (GP_ERR, " -pm : transform motions in source system to target system\n"); 153 gprint (GP_ERR, " -pmback: transform motions in target system to source system\n"); 154 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 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"); 156 return FALSE; 76 157 } -
trunk/Ohana/src/opihi/cmd.astro/fitplx_irls.c
r39585 r39591 123 123 } 124 124 // FitPMandPar_IRLS sets the values of Wx,Wy based on the fit distance 125 126 if (VERBOSE && Nresample) { 127 fprintf (stderr, "-- solution before resample --\n"); 128 fprintf (stderr, "Ro, Do: %f, %f +/- %f, %f (%f, %f)\n", Rmean, Dmean, fit.dRo, fit.dDo, fit.Ro, fit.Do); 129 fprintf (stderr, "uR, uD: %f, %f; duR, duD: %f, %f\n", fit.uR, fit.uD, fit.duR, fit.duD); 130 fprintf (stderr, "par: %f +/- %f\n", fit.p, fit.dp); 131 fprintf (stderr, "chisq: %f Nfit %d\n", fit.chisq, fit.Nfit); 132 } 125 133 126 134 // update the mask based on the input mask and the outlier limits. -
trunk/Ohana/src/opihi/cmd.astro/init.c
r39245 r39591 48 48 int objload PROTO((int, char **)); 49 49 int outline PROTO((int, char **)); 50 int parallax_factor PROTO((int, char **)); 50 51 int polar PROTO((int, char **)); 51 52 int precess PROTO((int, char **)); … … 117 118 {1, "objload", objload, "plot obj data on Ximage "}, 118 119 {1, "outline", outline, "fit outline region"}, 120 {1, "parallax_factor", parallax_factor, "generate parallax_factors"}, 119 121 {1, "polar", polar, "convert polar image to cartesian"}, 120 122 {1, "precess", precess, "precess coordinates"},
Note:
See TracChangeset
for help on using the changeset viewer.
