Changeset 15590
- Timestamp:
- Nov 11, 2007, 4:12:43 PM (18 years ago)
- Location:
- trunk/Ohana/src/relastro
- Files:
-
- 9 edited
-
Makefile (modified) (1 diff)
-
include/relastro.h (modified) (2 diffs)
-
src/ImageOps.c (modified) (5 diffs)
-
src/MosaicOps.c (modified) (4 diffs)
-
src/UpdateChips.c (modified) (1 diff)
-
src/UpdateMosaic.c (modified) (1 diff)
-
src/UpdateSimple.c (modified) (1 diff)
-
src/fitpoly.c (modified) (3 diffs)
-
src/mkpolyterm.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/relastro/Makefile
r15509 r15590 55 55 $(SRC)/write_coords.$(ARCH).o 56 56 57 $(RELASTRO): $(INC)/relastro.h 58 $(BIN)/relastro.$(ARCH): $(RELASTRO) 57 $(RELASTRO): $(INC)/relastro.h $(KAPA_INCS) 58 $(BIN)/relastro.$(ARCH): $(RELASTRO) $(KAPA_LIBS) -
trunk/Ohana/src/relastro/include/relastro.h
r12731 r15590 3 3 # include <kapa.h> 4 4 # include <signal.h> 5 6 typedef enum { 7 MODE_SIMPLE, 8 MODE_CHIP, 9 MODE_MOSAIC, 10 } CoordMode; 5 11 6 12 typedef struct { … … 277 283 int FitPMandPar (PMFit *fit, double *X, double *dX, double *Y, double *dY, double *T, double *pR, double *pD, int Npts); 278 284 279 Image*getMosaicForImage (int N);285 Mosaic *getMosaicForImage (int N); 280 286 281 287 StarData *getImageRef (Catalog *catalog, int Ncatalog, int im, int *Nstars, int isMosaic); -
trunk/Ohana/src/relastro/src/ImageOps.c
r15579 r15590 176 176 // return StarData values for detections in the specified image, converting coordinates from the 177 177 // chip positions: X,Y -> L,M -> P,Q -> R,D 178 StarData *getImageRaw (Catalog *catalog, int Ncatalog, int im, int *Nstars, int isMosaic) {178 StarData *getImageRaw (Catalog *catalog, int Ncatalog, int im, int *Nstars, CoordMode mode) { 179 179 180 180 int i, m, c; 181 182 Image*mosaic;181 182 Mosaic *mosaic; 183 183 Coords *moscoords; 184 184 StarData *raw; … … 188 188 mosaic = NULL; 189 189 moscoords = NULL; 190 if (isMosaic) { 191 mosaic = getMosaicForImage (im); 192 if (mosaic == NULL) { 193 fprintf (stderr, "mosaic not found for image %s\n", image[i].name); 194 exit (1); 195 } 196 moscoords = &mosaic[0].coords; 190 switch (mode) { 191 case MODE_SIMPLE: 192 break; 193 case MODE_CHIP: 194 mosaic = getMosaicForImage (im); 195 if (mosaic == NULL) { 196 fprintf (stderr, "mosaic not found for image %s\n", image[i].name); 197 exit (1); 198 } 199 moscoords = &mosaic[0].coords; 200 break; 201 case MODE_MOSAIC: 202 // XXX find all images which are chips for this mosaic image 203 // XXX count the stars in the superset of lists? 204 fprintf (stderr, "problem with the mosaic mode (need to grab the correct set of stars)"); 205 abort (); 206 break; 197 207 } 198 208 … … 208 218 raw[i].dMag = catalog[c].measure[m].dM; 209 219 210 /* note that for a Simple image, L,M = P,Q */ 211 XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[im].coords); 212 if (isMosaic) { 213 XY_to_LM (&raw[i].P, &raw[i].Q, raw[i].L, raw[i].M, moscoords); 214 LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, moscoords); 215 } else { 216 raw[i].P = raw[i].L; 217 raw[i].Q = raw[i].M; 218 LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, &image[im].coords); 220 raw[i].mask = FALSE; 221 222 switch (mode) { 223 case MODE_SIMPLE: 224 /* note that for a Simple image, L,M = P,Q */ 225 XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[im].coords); 226 raw[i].P = raw[i].L; 227 raw[i].Q = raw[i].M; 228 LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, &image[im].coords); 229 break; 230 case MODE_CHIP: 231 XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[im].coords); 232 XY_to_LM (&raw[i].P, &raw[i].Q, raw[i].L, raw[i].M, moscoords); 233 LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, moscoords); 234 break; 235 case MODE_MOSAIC: 236 XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[im].coords); 237 raw[i].P = raw[i].L; 238 raw[i].Q = raw[i].M; 239 LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, &image[im].coords); 240 break; 219 241 } 220 } 221 242 } 243 222 244 *Nstars = Nlist[im]; 223 245 return (raw); … … 230 252 int i, m, c, n; 231 253 232 Image*mosaic;254 Mosaic *mosaic; 233 255 Coords *moscoords; 234 256 StarData *ref; … … 251 273 ref[i].R = catalog[c].average[n].R; 252 274 ref[i].D = catalog[c].average[n].D; 275 ref[i].mask = FALSE; 253 276 254 277 /* note that for a Simple image, L,M = P,Q */ 255 RD_to_LM (&ref[i].P, &ref[i].Q, ref[i].R, ref[i].D, &image[im].coords);256 278 if (isMosaic) { 279 RD_to_LM (&ref[i].P, &ref[i].Q, ref[i].R, ref[i].D, moscoords); 257 280 LM_to_XY (&ref[i].M, &ref[i].L, ref[i].P, ref[i].Q, moscoords); 258 LM_to_XY (&ref[i].X, &ref[i].Y, ref[i].L, ref[i].M, moscoords);281 LM_to_XY (&ref[i].X, &ref[i].Y, ref[i].L, ref[i].M, &image[im].coords); 259 282 } else { 283 RD_to_LM (&ref[i].P, &ref[i].Q, ref[i].R, ref[i].D, &image[im].coords); 260 284 ref[i].L = ref[i].P; 261 285 ref[i].M = ref[i].Q; -
trunk/Ohana/src/relastro/src/MosaicOps.c
r15579 r15590 11 11 12 12 static int Nimages; 13 static int **moslist; /* image -> mosaic */13 static int *moslist; /* image -> mosaic */ 14 14 15 15 static int **clist; /* mosaic -> catalog[] */ … … 81 81 mosaic[Nmosaic].code = image[i].code; 82 82 mosaic[Nmosaic].secz = image[i].secz; 83 mosaic[Nmosaic].coords = image[i].coords; 83 84 84 85 /* add image to mosaic -> image list */ … … 289 290 } 290 291 291 Image*getMosaicForImage (int Nim) {292 Mosaic *getMosaicForImage (int Nim) { 292 293 293 294 int i; 294 Image *mosaic;295 Mosaic *myMosaic; 295 296 296 297 // search for the mosaic that … … 298 299 if (i < 0) return NULL; 299 300 300 m osaic = &mosaic[i];301 return m osaic;301 myMosaic = &mosaic[i]; 302 return myMosaic; 302 303 } 303 304 -
trunk/Ohana/src/relastro/src/UpdateChips.c
r15237 r15590 16 16 17 17 /* convert measure coordinates to raw entries */ 18 raw = getImageRaw (catalog, Ncatalog, i, &Nstars, TRUE);18 raw = getImageRaw (catalog, Ncatalog, i, &Nstars, MODE_CHIP); 19 19 20 20 /* convert average coordinates to ref entries */ 21 ref = getImageRef (catalog, Ncatalog, i, &Nstars, TRUE);21 ref = getImageRef (catalog, Ncatalog, i, &Nstars, MODE_CHIP); 22 22 23 23 FitChip (raw, ref, Nstars, &image[i].coords); -
trunk/Ohana/src/relastro/src/UpdateMosaic.c
r15237 r15590 18 18 19 19 /* convert measure coordinates to raw entries */ 20 raw = getImageRaw (catalog, Ncatalog, i, &Nstars, TRUE);20 raw = getImageRaw (catalog, Ncatalog, i, &Nstars, MODE_MOSAIC); 21 21 22 22 /* convert average coordinates to ref entries */ 23 ref = getImageRef (catalog, Ncatalog, i, &Nstars, TRUE);23 ref = getImageRef (catalog, Ncatalog, i, &Nstars, MODE_MOSAIC); 24 24 25 25 FitMosaic (raw, ref, Nstars, &image[i].coords); -
trunk/Ohana/src/relastro/src/UpdateSimple.c
r15237 r15590 17 17 18 18 /* convert measure coordinates to raw entries */ 19 raw = getImageRaw (catalog, Ncatalog, i, &Nstars, FALSE);19 raw = getImageRaw (catalog, Ncatalog, i, &Nstars, MODE_SIMPLE); 20 20 21 21 /* convert average coordinates to ref entries */ 22 ref = getImageRef (catalog, Ncatalog, i, &Nstars, FALSE);22 ref = getImageRef (catalog, Ncatalog, i, &Nstars, MODE_SIMPLE); 23 23 24 24 FitSimple (raw, ref, Nstars, &image[i].coords); -
trunk/Ohana/src/relastro/src/fitpoly.c
r12332 r15590 130 130 } 131 131 132 dgaussj (matrix, fit[0].Nelems, vector, 2);133 134 132 for (i = 0; i < fit[0].Nelems; i++) { 135 133 ix = i % fit[0].Nterms; … … 139 137 } 140 138 139 dgaussj (matrix, fit[0].Nelems, vector, 2); 140 141 for (i = 0; i < fit[0].Nelems; i++) { 142 ix = i % fit[0].Nterms; 143 iy = i / fit[0].Nterms; 144 fprintf (stderr, "x2 : x^%dy^%d: %10.4g y2 : x^%dy^%d: %10.4g \n", 145 ix, iy, vector[i][0], ix, iy, vector[i][1]); 146 } 147 141 148 /* remap the vector terms into xfit,yfit */ 142 149 for (i = 0; i < fit[0].Nelems; i++) { … … 256 263 257 264 // set the polyterm elements 258 coords[0].polyterms[0][0] = modfit[0].xfit[2][0]; 259 coords[0].polyterms[1][0] = modfit[0].xfit[1][1]; 260 coords[0].polyterms[2][0] = modfit[0].xfit[0][2]; 261 262 coords[0].polyterms[0][1] = modfit[0].yfit[2][0]; 263 coords[0].polyterms[1][1] = modfit[0].yfit[1][1]; 264 coords[0].polyterms[2][1] = modfit[0].yfit[0][2]; 265 if (coords->Npolyterms > 1) { 266 coords[0].polyterms[0][0] = modfit[0].xfit[2][0]; 267 coords[0].polyterms[1][0] = modfit[0].xfit[1][1]; 268 coords[0].polyterms[2][0] = modfit[0].xfit[0][2]; 269 270 coords[0].polyterms[0][1] = modfit[0].yfit[2][0]; 271 coords[0].polyterms[1][1] = modfit[0].yfit[1][1]; 272 coords[0].polyterms[2][1] = modfit[0].yfit[0][2]; 273 } 265 274 266 275 // I need to validate Norder 267 coords[0].polyterms[3][0] = modfit[0].xfit[3][0]; 268 coords[0].polyterms[4][0] = modfit[0].xfit[2][1]; 269 coords[0].polyterms[5][0] = modfit[0].xfit[1][2]; 270 coords[0].polyterms[6][0] = modfit[0].xfit[0][3]; 271 272 coords[0].polyterms[3][1] = modfit[0].yfit[3][0]; 273 coords[0].polyterms[4][1] = modfit[0].yfit[2][1]; 274 coords[0].polyterms[5][1] = modfit[0].yfit[1][2]; 275 coords[0].polyterms[6][1] = modfit[0].yfit[0][3]; 276 if (coords->Npolyterms > 2) { 277 coords[0].polyterms[3][0] = modfit[0].xfit[3][0]; 278 coords[0].polyterms[4][0] = modfit[0].xfit[2][1]; 279 coords[0].polyterms[5][0] = modfit[0].xfit[1][2]; 280 coords[0].polyterms[6][0] = modfit[0].xfit[0][3]; 281 282 coords[0].polyterms[3][1] = modfit[0].yfit[3][0]; 283 coords[0].polyterms[4][1] = modfit[0].yfit[2][1]; 284 coords[0].polyterms[5][1] = modfit[0].yfit[1][2]; 285 coords[0].polyterms[6][1] = modfit[0].yfit[0][3]; 286 } 276 287 277 288 /* we do not modify crval1,2: these are kept at the default values */ -
trunk/Ohana/src/relastro/src/mkpolyterm.c
r12332 r15590 100 100 yPx = poly2d_copy (input->yfit, Nx, Ny); 101 101 102 for (i = 0; i < =input->Nterms; i++) {102 for (i = 0; i < input->Nterms; i++) { 103 103 xPy = poly2d_copy (xPx, Nx, Ny); 104 104 yPy = poly2d_copy (yPx, Nx, Ny); 105 for (j = 0; j < =input->Nterms; j++) {105 for (j = 0; j < input->Nterms; j++) { 106 106 output->xfit[i][j] = poly2d_eval (xPy, Nx, Ny, Xo, Yo) / factorial(i) / factorial(j); 107 107 output->yfit[i][j] = poly2d_eval (yPy, Nx, Ny, Xo, Yo) / factorial(i) / factorial(j);
Note:
See TracChangeset
for help on using the changeset viewer.
