Changeset 12206
- Timestamp:
- Mar 2, 2007, 4:35:02 PM (19 years ago)
- Location:
- branches/dvo-mods-2007-02/Ohana/src
- Files:
-
- 5 edited
-
libautocode/def/average.d (modified) (1 diff)
-
libautocode/def/measure.d (modified) (1 diff)
-
libdvo/include/dvo.h (modified) (3 diffs)
-
libdvo/src/coordops.c (modified) (14 diffs)
-
relastro/include/relastro.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/dvo-mods-2007-02/Ohana/src/libautocode/def/average.d
r12012 r12206 46 46 # the DVO object IDs are generated internally and are not equivalent to the PSPS object IDs 47 47 # probably need to add position chisq 48 49 # XXX include the number of measurements used to determine the positional information? -
branches/dvo-mods-2007-02/Ohana/src/libautocode/def/measure.d
r12008 r12206 47 47 FIELD imageID_lo, IMAGE_ID_LO, unsigned int, reference to image 48 48 49 # we may need 2 extra bytes for padding purposes... 50 FIELD dummy, dummy, char[6], padding 49 # note that with airmass = 1.0 / cos(90 - alt), we have full alt/az representation 50 FIELD az, AZ, float, telescope azimuth 51 52 # we need extra bytes for padding purposes... 53 FIELD dummy, dummy, char[2], padding -
branches/dvo-mods-2007-02/Ohana/src/libdvo/include/dvo.h
r12071 r12206 39 39 PROJ_GLS, // pseudocyl 40 40 PROJ_PAR, // pseudocyl 41 } OhanaProjection s;41 } OhanaProjection; 42 42 43 43 typedef enum { … … 46 46 PROJ_MODE_ZENITHAL, 47 47 PROJ_MODE_PSEUDOCYL, 48 } OhanaProjectionMode s;48 } OhanaProjectionMode; 49 49 50 50 /* RegImage.flag values */ … … 226 226 OhanaProjection GetProjection (char *ctype); 227 227 int SetProjection (char *ctype, OhanaProjection proj); 228 OhanaProjectionMode s GetProjectionMode (OhanaProjectionsproj);228 OhanaProjectionMode GetProjectionMode (OhanaProjection proj); 229 229 230 230 char *libdvo_version (); -
branches/dvo-mods-2007-02/Ohana/src/libdvo/src/coordops.c
r12069 r12206 7 7 } 8 8 9 int XY_to_RD (double *ra, double *dec, double x, double y, Coords *coords) { 10 11 int Zenith1, Zenith2, Zenithal, Polynomial, Cartesian, PseudoCyl; 12 char *type; 13 double L, M, X, Y, T, Z, Z2; 14 double R, sphi, cphi, stht, ctht; 9 int XY_to_LM (double *L, double *M, double x, double y, Coords *coords) { 10 11 double X, Y; 12 13 /** convert pixel coordinates to cartesian system **/ 14 X = coords[0].cdelt1*(x - coords[0].crpix1); 15 Y = coords[0].cdelt2*(y - coords[0].crpix2); 16 17 *L = (X*coords[0].pc1_1 + Y*coords[0].pc1_2); 18 *M = (X*coords[0].pc2_1 + Y*coords[0].pc2_2); 19 20 /** extra polynomial terms **/ 21 if (coords[0].Npolyterms > 1) { 22 *L += X*X*coords[0].polyterms[0][0] + X*Y*coords[0].polyterms[1][0] + Y*Y*coords[0].polyterms[2][0]; 23 *M += X*X*coords[0].polyterms[0][1] + X*Y*coords[0].polyterms[1][1] + Y*Y*coords[0].polyterms[2][1]; 24 } 25 if (coords[0].Npolyterms > 2) { 26 *L += X*X*X*coords[0].polyterms[3][0] + X*X*Y*coords[0].polyterms[4][0] + X*Y*Y*coords[0].polyterms[5][0] + Y*Y*Y*coords[0].polyterms[6][0]; 27 *M += X*X*X*coords[0].polyterms[3][1] + X*X*Y*coords[0].polyterms[4][1] + X*Y*Y*coords[0].polyterms[5][1] + Y*Y*Y*coords[0].polyterms[6][1]; 28 } 29 30 return (TRUE); 31 } 32 33 int LM_to_RD (double *ra, double *dec, double L, double M, Coords *coords) { 34 35 OhanaProjection proj; 36 OhanaProjectionMode mode; 37 double R, T, Z, Z2, sphi, cphi, stht, ctht; 15 38 double alpha, delta, salp, calp, sdel, sdp, cdp; 16 17 *ra = 0; 18 *dec = 0; 19 stht = ctht = 1; 20 39 21 40 proj = GetProjection (coords[0].ctype); 22 41 mode = GetProjectionMode (proj); … … 24 43 if (proj == PROJ_MODE_NONE) return (FALSE); 25 44 26 /** convert pixel coordinates to cartesian system **/ 27 X = coords[0].cdelt1*(x - coords[0].crpix1); 28 Y = coords[0].cdelt2*(y - coords[0].crpix2); 29 30 L = (X*coords[0].pc1_1 + Y*coords[0].pc1_2); 31 M = (X*coords[0].pc2_1 + Y*coords[0].pc2_2); 32 33 /** extra polynomial terms **/ 34 if (coords[0].Npolyterms > 1) { 35 L += X*X*coords[0].polyterms[0][0] + X*Y*coords[0].polyterms[1][0] + Y*Y*coords[0].polyterms[2][0]; 36 M += X*X*coords[0].polyterms[0][1] + X*Y*coords[0].polyterms[1][1] + Y*Y*coords[0].polyterms[2][1]; 37 } 38 if (coords[0].Npolyterms > 2) { 39 L += X*X*X*coords[0].polyterms[3][0] + X*X*Y*coords[0].polyterms[4][0] + X*Y*Y*coords[0].polyterms[5][0] + Y*Y*Y*coords[0].polyterms[6][0]; 40 M += X*X*X*coords[0].polyterms[3][1] + X*X*Y*coords[0].polyterms[4][1] + X*Y*Y*coords[0].polyterms[5][1] + Y*Y*Y*coords[0].polyterms[6][1]; 41 } 45 stht = ctht = 1; 42 46 43 47 /** Locally Cartesian Projections **/ … … 77 81 break; 78 82 case PROJ_STG: 79 stht = (4 - RAD_DEG*R) / (4 + RAD_DE C*R);83 stht = (4 - RAD_DEG*R) / (4 + RAD_DEG*R); 80 84 ctht = sqrt (1 - stht*stht); 81 85 break; … … 94 98 ctht = sqrt (1 - stht*stht); 95 99 break; 100 default: 101 return (FALSE); 96 102 } 97 103 sdp = sin(RAD_DEG*coords[0].crval2); … … 115 121 116 122 /**** Other Conventional Projections ****/ 117 if (mode == PROJ_MODE_PSEUDOC LY) {123 if (mode == PROJ_MODE_PSEUDOCYL) { 118 124 switch (proj) { 119 125 case PROJ_AIT: … … 135 141 delta = 3 * DEG_RAD * asin (M/180.0); 136 142 break; 143 default: 144 return (FALSE); 137 145 } 138 146 *ra = alpha + coords[0].crval1; … … 148 156 } 149 157 150 int RD_to_XY (double *x, double *y, double ra, double dec, Coords *coords) { 151 152 char *type; 153 int i, status, Polynomial, Zenith1, Zenith2, Zenithal, Cartesian, PseudoCyl; 158 int RD_to_LM (double *L, double *M, double ra, double dec, Coords *coords) { 159 154 160 double phi, theta; 155 double determ; 156 double X, Y, L, M, Lo, Mo, dL, dM; 161 double Lo, Mo; 157 162 double sphi, cphi, stht; 158 163 double salp, calp, sdel, cdel, sdp, cdp; 159 164 double P, A, Rc; 160 161 status = TRUE; 162 *x = 0; 163 *y = 0; 164 type = &coords[0].ctype[4]; 165 L = M = 0; 165 OhanaProjection proj; 166 OhanaProjectionMode mode; 167 168 *L = *M = 0; 166 169 167 170 proj = GetProjection (coords[0].ctype); … … 175 178 if (mosaic == NULL) return (FALSE); 176 179 RD_to_XY (&Lo, &Mo, ra, dec, mosaic); 177 L = (Lo - coords[0].crval1); 178 M = (Mo - coords[0].crval2); 179 } else { 180 L = (ra - coords[0].crval1); 181 M = (dec - coords[0].crval2); 182 } 180 *L = (Lo - coords[0].crval1); 181 *M = (Mo - coords[0].crval2); 182 return (TRUE); 183 } 184 *L = (ra - coords[0].crval1); 185 *M = (dec - coords[0].crval2); 186 return (TRUE); 183 187 } 184 188 … … 195 199 sphi = cdel*salp; /* = cos(theta)*sin(phi) */ 196 200 cphi = cdel*sdp*calp - sdel*cdp; /* = cos(theta)*cos(phi) */ 197 if (stht < 0) status = FALSE;201 if (stht < 0) return (FALSE); 198 202 199 203 switch (proj) { 200 204 case PROJ_TAN: 201 205 case PROJ_DIS: 202 L = DEG_RAD * sphi / stht;203 M = -DEG_RAD * cphi / stht;204 break;206 *L = DEG_RAD * sphi / stht; 207 *M = -DEG_RAD * cphi / stht; 208 return (TRUE); 205 209 case PROJ_SIN: 206 L = DEG_RAD * sphi;207 M = -DEG_RAD * cphi;208 break;210 *L = DEG_RAD * sphi; 211 *M = -DEG_RAD * cphi; 212 return (TRUE); 209 213 case PROJ_ZEA: 210 214 case PROJ_ZPL: 211 215 Rc = DEG_RAD * M_SQRT2 / sqrt (1 + stht); 212 L = Rc * sphi; 213 M = -Rc * cphi; 214 status = TRUE; 215 break; 216 } 216 *L = Rc * sphi; 217 *M = -Rc * cphi; 218 return (TRUE); 219 default: 220 return (FALSE); 221 } 222 return (FALSE); 217 223 } 218 224 … … 224 230 theta = RAD_DEG*(dec - coords[0].crval2); 225 231 P = 1.0 + cos (theta) * cos (0.5*phi); 226 if (P != 0.0) {227 A = DEG_RAD * sqrt (2.0 / P);228 L = 2.0 * A * cos (theta) * sin (0.5*phi);229 M = A * sin (theta);230 } else {231 L = 0.0;232 M = 0.0;233 }234 break;232 if (P == 0.0) { 233 *L = 0.0; 234 *M = 0.0; 235 return (TRUE); 236 } 237 A = DEG_RAD * sqrt (2.0 / P); 238 *L = 2.0 * A * cos (theta) * sin (0.5*phi); 239 *M = A * sin (theta); 240 return (TRUE); 235 241 case PROJ_GLS: 236 242 phi = ra - coords[0].crval1; 237 243 theta = dec - coords[0].crval2; 238 L = phi * cos(RAD_DEG * theta);239 M = theta;240 break;244 *L = phi * cos(RAD_DEG * theta); 245 *M = theta; 246 return (TRUE); 241 247 case PROJ_PAR: 242 248 phi = ra - coords[0].crval1; 243 249 theta = dec - coords[0].crval2; 244 L = phi * (2.0*cos(2*RAD_DEG*theta/3.0) - 1); 245 M = 180.0 * sin (RAD_DEG*theta/3.0); 246 break; 247 } 248 } 250 *L = phi * (2.0*cos(2*RAD_DEG*theta/3.0) - 1); 251 *M = 180.0 * sin (RAD_DEG*theta/3.0); 252 return (TRUE); 253 default: 254 return (FALSE); 255 } 256 return (FALSE); 257 } 258 return (FALSE); 259 } 260 261 int LM_to_XY (double *x, double *y, double L, double M, Coords *coords) { 262 263 int i; 264 double determ; 265 double X, Y, Lo, Mo, dL, dM; 266 267 *x = 0; 268 *y = 0; 249 269 250 270 /* convert L,M to X,Y */ … … 278 298 *y = Y / coords[0].cdelt2 + coords[0].crpix2; 279 299 300 return (TRUE); 301 } 302 303 int XY_to_RD (double *ra, double *dec, double x, double y, Coords *coords) { 304 305 double L, M; 306 int status; 307 308 status = XY_to_LM (&L, &M, x, y, coords); 309 if (!status) return FALSE; 310 311 status = LM_to_RD (ra, dec, L, M, coords); 312 return (status); 313 } 314 315 int RD_to_XY (double *x, double *y, double ra, double dec, Coords *coords) { 316 317 double L, M; 318 int status; 319 320 status = RD_to_LM (&L, &M, ra, dec, coords); 321 if (!status) return FALSE; 322 323 status = LM_to_XY (x, y, L, M, coords); 280 324 return (status); 281 325 } … … 601 645 WRP is equiv to PLY, with implied mosaic */ 602 646 603 intGetProjection (char *ctype) {647 OhanaProjection GetProjection (char *ctype) { 604 648 if (!strcmp(&ctype[4], "-ZEA")) return PROJ_ZEA; 605 649 if (!strcmp(&ctype[4], "-ZPL")) return PROJ_ZPL; … … 620 664 } 621 665 622 int SetProjection (char *ctype, intproj) {666 int SetProjection (char *ctype, OhanaProjection proj) { 623 667 switch (proj) { 624 case PROJ_ZEA: strcpy(&ctype[4], "-ZEA") return TRUE; 625 case PROJ_ZPL: strcpy(&ctype[4], "-ZPL") return TRUE; 626 case PROJ_ARC: strcpy(&ctype[4], "-ARC") return TRUE; 627 case PROJ_STG: strcpy(&ctype[4], "-STG") return TRUE; 628 case PROJ_SIN: strcpy(&ctype[4], "-SIN") return TRUE; 629 case PROJ_TAN: strcpy(&ctype[4], "-TAN") return TRUE; 630 case PROJ_DIS: strcpy(&ctype[4], "-DIS") return TRUE; 631 case PROJ_LIN: strcpy(&ctype[4], "-LIN") return TRUE; 632 case PROJ_PLY: strcpy(&ctype[4], "-PLY") return TRUE; 633 case PROJ_WRP: strcpy(&ctype[4], "-WRP") return TRUE; 634 case PROJ_AIT: strcpy(&ctype[4], "-AIT") return TRUE; 635 case PROJ_GLS: strcpy(&ctype[4], "-GLS") return TRUE; 636 case PROJ_PAR: strcpy(&ctype[4], "-PAR") return TRUE; 668 case PROJ_ZEA: strcpy(&ctype[4], "-ZEA"); return TRUE; 669 case PROJ_ZPL: strcpy(&ctype[4], "-ZPL"); return TRUE; 670 case PROJ_ARC: strcpy(&ctype[4], "-ARC"); return TRUE; 671 case PROJ_STG: strcpy(&ctype[4], "-STG"); return TRUE; 672 case PROJ_SIN: strcpy(&ctype[4], "-SIN"); return TRUE; 673 case PROJ_TAN: strcpy(&ctype[4], "-TAN"); return TRUE; 674 case PROJ_DIS: strcpy(&ctype[4], "-DIS"); return TRUE; 675 case PROJ_LIN: strcpy(&ctype[4], "-LIN"); return TRUE; 676 case PROJ_PLY: strcpy(&ctype[4], "-PLY"); return TRUE; 677 case PROJ_WRP: strcpy(&ctype[4], "-WRP"); return TRUE; 678 case PROJ_AIT: strcpy(&ctype[4], "-AIT"); return TRUE; 679 case PROJ_GLS: strcpy(&ctype[4], "-GLS"); return TRUE; 680 case PROJ_PAR: strcpy(&ctype[4], "-PAR"); return TRUE; 681 case PROJ_NONE: return FALSE; 637 682 } 638 683 return FALSE; 639 684 } 640 685 641 int GetProjectionMode (intproj) {686 OhanaProjectionMode GetProjectionMode (OhanaProjection proj) { 642 687 switch (proj) { 643 688 case PROJ_ZEA: … … 656 701 case PROJ_GLS: 657 702 case PROJ_PAR: 658 return PROJ_MODE_PSEUDOCLY; 703 return PROJ_MODE_PSEUDOCYL; 704 default: PROJ_MODE_NONE; 659 705 } 660 706 return PROJ_MODE_NONE; -
branches/dvo-mods-2007-02/Ohana/src/relastro/include/relastro.h
r12050 r12206 3 3 # include <kapa.h> 4 4 # include <signal.h> 5 6 // structure to hold coordinate fitting terms 7 typedef struct { 8 int Npts; 9 int Nterms; 10 int Npower; 11 int Norder; 12 double **xsum; 13 double **ysum; 14 15 double **vector; 16 double **matrix; 17 } CoordFit; 5 18 6 19 typedef struct { … … 12 25 13 26 double p, dp; 27 28 double chisq; 29 int Nfit; 14 30 } PMfit; 15 31
Note:
See TracChangeset
for help on using the changeset viewer.
