Changeset 15600
- Timestamp:
- Nov 13, 2007, 9:44:27 AM (18 years ago)
- Location:
- trunk/Ohana/src/relastro
- Files:
-
- 1 added
- 12 edited
-
Makefile (modified) (2 diffs)
-
doc/notes.txt (modified) (1 diff)
-
include/relastro.h (modified) (3 diffs)
-
src/FitChip.c (modified) (1 diff)
-
src/FitPar.c (added)
-
src/FitSimple.c (modified) (1 diff)
-
src/ImageOps.c (modified) (7 diffs)
-
src/MosaicOps.c (modified) (3 diffs)
-
src/UpdateChips.c (modified) (1 diff)
-
src/UpdateMosaic.c (modified) (1 diff)
-
src/UpdateObjects.c (modified) (2 diffs)
-
src/args.c (modified) (1 diff)
-
src/relastro.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Ohana/src/relastro/Makefile
r15590 r15600 25 25 $(SRC)/FitMosaic.$(ARCH).o \ 26 26 $(SRC)/FitPM.$(ARCH).o \ 27 $(SRC)/FitPar.$(ARCH).o \ 27 28 $(SRC)/FitPMandPar.$(ARCH).o \ 28 29 $(SRC)/FitSimple.$(ARCH).o \ … … 50 51 $(SRC)/sort.$(ARCH).o \ 51 52 $(SRC)/relastro.$(ARCH).o \ 52 $(SRC)/reload_catalogs.$(ARCH).o \53 53 $(SRC)/save_catalogs.$(ARCH).o \ 54 54 $(SRC)/setExclusions.$(ARCH).o \ -
trunk/Ohana/src/relastro/doc/notes.txt
r15239 r15600 1 2 2007.11.12 3 4 relastro is working for the SIMPLE (single-chip) and CHIP 5 (mosaic-chip) modes. it is not yet working for the MOSAIC mode. 6 The image table contains one mosaic entry and N chip entries for a 7 mosaic with N chips. The mosaic entry has coord.ctype = DIS, while 8 the corresponding chips have coord.ctype = WRP (and matching 9 time/photcodes). 10 11 (this is fairly weak. we should just define the relationship when we 12 register the chips...) 1 13 2 14 2007.10.06 -
trunk/Ohana/src/relastro/include/relastro.h
r15590 r15600 135 135 136 136 int FIT_MODE; 137 enum {FIT_NONE, FIT_AVERAGE, FIT_PM_ONLY, FIT_P M_AND_PAR};137 enum {FIT_NONE, FIT_AVERAGE, FIT_PM_ONLY, FIT_PAR_ONLY, FIT_PM_AND_PAR}; 138 138 139 139 int FIT_TARGET; … … 256 256 void write_coords PROTO((Header *header, Coords *coords)); 257 257 258 259 258 double **array_init (int Nx, int Ny); 260 259 void array_free (double **array, int Nx); … … 281 280 int ParFactor (double *pR, double *pD, double R, double D, time_t T); 282 281 int FitPM (PMFit *fit, double *X, double *dX, double *Y, double *dY, double *T, int Npts); 282 int FitPar (PMFit *fit, double *X, double *dX, double *Y, double *dY, double *pR, double *pD, int Npts); 283 283 int FitPMandPar (PMFit *fit, double *X, double *dX, double *Y, double *dY, double *T, double *pR, double *pD, int Npts); 284 284 285 285 Mosaic *getMosaicForImage (int N); 286 286 287 StarData *getImageRef (Catalog *catalog, int Ncatalog, int im, int *Nstars, int isMosaic); 288 StarData *getImageRaw (Catalog *catalog, int Ncatalog, int im, int *Nstars, int isMosaic); 287 StarData *getImageRef (Catalog *catalog, int Ncatalog, int im, int *Nstars, CoordMode mode); 288 StarData *getImageRaw (Catalog *catalog, int Ncatalog, int im, int *Nstars, CoordMode mode); 289 290 Mosaic *getmosaics (int *N); 291 void initMosaics (Image *image, int Nimage); 292 StarData *getMosaicRaw (Catalog *catalog, int Ncatalog, int mos, int *Nstars); 293 StarData *getMosaicRef (Catalog *catalog, int Ncatalog, int mos, int *Nstars); 294 Mosaic *getMosaicForImage (int im); 289 295 290 296 double getMeanR (Measure *measure, Average *average, SecFilt *secfilt); -
trunk/Ohana/src/relastro/src/FitChip.c
r15238 r15600 13 13 fit_eval (fit); 14 14 fit_apply_coords (fit, coords); 15 fit_free (fit); 15 16 16 17 // apply new coords to raw (X,Y -> L,M) -
trunk/Ohana/src/relastro/src/FitSimple.c
r15238 r15600 13 13 fit_eval (fit); 14 14 fit_apply_coords (fit, coords); 15 fit_free (fit); 15 16 16 17 // apply new coords to raw (X,Y -> P,Q) -
trunk/Ohana/src/relastro/src/ImageOps.c
r15590 r15600 96 96 97 97 measure = &catalog[cat].measure[meas]; 98 99 /* find the image that supplied this measurement */ 98 100 for (i = 0; i < Nimage; i++) { 99 101 if (image[0].photcode == -1) continue; … … 102 104 if (measure[0].t > stop[i]) continue; 103 105 106 // index for (catalog, measure) -> image 104 107 bin[cat][meas] = i; 105 108 109 // index for image, Nentry -> catalog 106 110 clist[i][Nlist[i]] = cat; 111 112 // index for image, Nentry -> measure 107 113 mlist[i][Nlist[i]] = meas; 108 114 Nlist[i] ++; … … 188 194 mosaic = NULL; 189 195 moscoords = NULL; 190 switch (mode) { 191 case MODE_SIMPLE: 192 break; 193 case MODE_CHIP: 196 if (mode == MODE_MOSAIC) { 194 197 mosaic = getMosaicForImage (im); 195 198 if (mosaic == NULL) { 196 fprintf (stderr, "mosaic not found for image %s\n", image[i ].name);199 fprintf (stderr, "mosaic not found for image %s\n", image[im].name); 197 200 exit (1); 198 201 } 199 202 moscoords = &mosaic[0].coords; 200 break;201 case MODE_MOSAIC:202 // XXX find all images which are chips for this mosaic image203 // 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;207 203 } 208 204 … … 228 224 LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, &image[im].coords); 229 225 break; 230 case MODE_ CHIP:226 case MODE_MOSAIC: 231 227 XY_to_LM (&raw[i].L, &raw[i].M, raw[i].X, raw[i].Y, &image[im].coords); 232 228 XY_to_LM (&raw[i].P, &raw[i].Q, raw[i].L, raw[i].M, moscoords); 233 229 LM_to_RD (&raw[i].R, &raw[i].D, raw[i].P, raw[i].Q, moscoords); 234 230 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; 231 default: 232 fprintf (stderr, "error: invalid mode in getImageRaw"); 233 abort (); 241 234 } 242 235 } … … 248 241 // return StarData values for averages positions in the specified image, converting coordinates from 249 242 // the sky positions: R,D -> P,Q -> L,M -> X,Y 250 StarData *getImageRef (Catalog *catalog, int Ncatalog, int im, int *Nstars, int isMosaic) {243 StarData *getImageRef (Catalog *catalog, int Ncatalog, int im, int *Nstars, CoordMode mode) { 251 244 252 245 int i, m, c, n; … … 260 253 mosaic = NULL; 261 254 moscoords = NULL; 262 if ( isMosaic) {255 if (mode == MODE_MOSAIC) { 263 256 mosaic = getMosaicForImage (im); 257 if (mosaic == NULL) { 258 fprintf (stderr, "mosaic not found for image %s\n", image[im].name); 259 exit (1); 260 } 264 261 moscoords = &mosaic[0].coords; 265 262 } … … 273 270 ref[i].R = catalog[c].average[n].R; 274 271 ref[i].D = catalog[c].average[n].D; 272 273 ref[i].Mag = catalog[c].measure[m].M; 274 ref[i].dMag = catalog[c].measure[m].dM; 275 275 276 ref[i].mask = FALSE; 276 277 277 278 /* note that for a Simple image, L,M = P,Q */ 278 if (isMosaic) { 279 RD_to_LM (&ref[i].P, &ref[i].Q, ref[i].R, ref[i].D, moscoords); 280 LM_to_XY (&ref[i].M, &ref[i].L, ref[i].P, ref[i].Q, moscoords); 281 LM_to_XY (&ref[i].X, &ref[i].Y, ref[i].L, ref[i].M, &image[im].coords); 282 } else { 279 switch (mode) { 280 case MODE_SIMPLE: 283 281 RD_to_LM (&ref[i].P, &ref[i].Q, ref[i].R, ref[i].D, &image[im].coords); 284 282 ref[i].L = ref[i].P; 285 283 ref[i].M = ref[i].Q; 286 284 LM_to_XY (&ref[i].X, &ref[i].Y, ref[i].L, ref[i].M, &image[im].coords); 285 break; 286 case MODE_MOSAIC: 287 RD_to_LM (&ref[i].P, &ref[i].Q, ref[i].R, ref[i].D, moscoords); 288 LM_to_XY (&ref[i].M, &ref[i].L, ref[i].P, ref[i].Q, moscoords); 289 LM_to_XY (&ref[i].X, &ref[i].Y, ref[i].L, ref[i].M, &image[im].coords); 290 break; 287 291 } 288 292 } -
trunk/Ohana/src/relastro/src/MosaicOps.c
r15590 r15600 1 1 # include "relastro.h" 2 2 3 Image *getimages (int *N); 4 3 // array of mosaic definition structures 5 4 static int Nmosaic; 6 5 static Mosaic *mosaic; 7 6 8 static int *Nimlist; 9 static int **imlist; /* mosaic -> image[] */ 10 static int **bin; /* catalog, measure -> mosaic */ 7 // list of all images associated with a mosaic 8 static int *Nmosaic_own_images; // number of images for this mosaic 9 static int *Amosaic_own_images; // size of allocated array 10 static int **mosaic_own_images; // array of arrays: mosaic -> images 11 11 12 static int Nimages; 13 static int *moslist; /* image -> mosaic */ 12 // list of mosaic associated with each image 13 static int Nmosaic_for_images; // number of images (for internal checks) 14 static int *mosaic_for_images; // array of: image -> mosaic 14 15 15 static int **clist; /* mosaic -> catalog[] */ 16 static int **mlist; /* mosiac -> measure[] */ 17 static int *Nlist;18 static int *NLIST; 16 Mosaic *getmosaics (int *N) { 17 *N = Nmosaic; 18 return (mosaic); 19 } 19 20 20 /* find mosaic frames (unique time periods & photcode name matches mosaic) */ 21 /* XXX what is a mosaic? do we need to use the 'DIS/WRP' info to track? */ 21 // find mosaic frames (unique time periods & photcode name matches mosaic) 22 22 void initMosaics (Image *image, int Nimage) { 23 23 … … 26 26 char *pname; 27 27 28 // if (!MOSAICNAME[0]) return;29 30 28 Nmosaic = 0; 31 29 NMOSAIC = 10; 32 30 ALLOCATE (mosaic, Mosaic, NMOSAIC); 33 31 34 ALLOCATE ( imlist, int *, NMOSAIC);35 ALLOCATE ( Nimlist, int, NMOSAIC);36 ALLOCATE ( NIMLIST, int, NMOSAIC);32 ALLOCATE (Nmosaic_own_images, int, NMOSAIC); 33 ALLOCATE (Amosaic_own_images, int, NMOSAIC); 34 ALLOCATE (mosaic_own_images, int *, NMOSAIC); 37 35 38 Nimages = Nimage; 39 ALLOCATE (moslist, int, Nimages); 36 /* find the mosaic images (coords.ctype = DIS); generate list of unique mosaics */ 37 for (i = 0; i < Nimage; i++) { 38 if (strcmp(&image[i].coords.ctype[4], "-DIS")) continue; 40 39 41 /* generate list of unique mosaics */ 40 /* set image time range */ 41 start = image[i].tzero - MAX(0.05*image[i].trate*image[i].NY, 1); 42 stop = image[i].tzero + MAX(1.05*image[i].trate*image[i].NY, 1); 43 44 /* a new mosaic, define ranges */ 45 mosaic[Nmosaic].start = start; 46 mosaic[Nmosaic].stop = stop; 47 mosaic[Nmosaic].Mcal = 0.0; 48 mosaic[Nmosaic].dMcal = 0.0; 49 mosaic[Nmosaic].Xm = 0.0; 50 mosaic[Nmosaic].code = image[i].code; 51 mosaic[Nmosaic].secz = image[i].secz; 52 mosaic[Nmosaic].coords = image[i].coords; 53 54 // init the mosaic_own_images array data 55 Nmosaic_own_images[Nmosaic] = 0; 56 Amosaic_own_images[Nmosaic] = 10; 57 ALLOCATE (mosaic_own_images[Nmosaic], int, Amosaic_own_images[Nmosaic]); 58 59 Nmosaic ++; 60 if (Nmosaic == NMOSAIC) { 61 NMOSAIC += 10; 62 REALLOCATE (mosaic, Mosaic, NMOSAIC); 63 REALLOCATE (mosaic_own_images, int *, NMOSAIC); 64 REALLOCATE (Nmosaic_own_images, int, NMOSAIC); 65 REALLOCATE (Amosaic_own_images, int, NMOSAIC); 66 } 67 } 68 69 // array to store image->mosaic index 70 Nmosaic_for_images = Nimage; 71 ALLOCATE (mosaic_for_images, int, Nmosaic_for_images); 72 73 /* now assign the WRP images to these mosaics */ 42 74 for (i = 0; i < Nimage; i++) { 75 mosaic_for_images[i] = -1; // default value for no mosaic found 43 76 44 moslist[i] = -1; // default value for no mosaic found 45 46 /* select valid mosaic images by photcode 47 pname = GetPhotcodeNamebyCode (image[i].photcode); 48 status = strncmp (pname, MOSAICNAME, strlen (MOSAICNAME)); 49 if (status) continue; */ 77 if (strcmp(&image[i].coords.ctype[4], "-WRP")) continue; 50 78 51 79 /* set image time range */ … … 59 87 if (start > mosaic[j].stop) continue; 60 88 found = TRUE; 89 break; 90 } 91 /* if no matching mosaic exists, skip this image */ 92 if (!found) continue; 61 93 62 /* add image to mosaic image list */ 63 imlist[j][Nimlist[j]] = i; 64 Nimlist[j] ++; 65 if (Nimlist[j] == NIMLIST[j]) { 66 NIMLIST[j] += 10; 67 REALLOCATE (imlist[j], int, NIMLIST[j]); 68 } 94 // mosaic corresponding to this image 95 mosaic_for_images[i] = j; 69 96 70 /* add mosaic to image -> mosaic list */ 71 moslist[i] = j; 97 // add image to mosaic_own_image list 98 mosaic_own_images[j][Nmosaic_own_images[j]] = i; 99 Nmosaic_own_images[j] ++; 100 if (Nmosaic_own_images[j] == Amosaic_own_images[j]) { 101 Amosaic_own_images[j] += 10; 102 REALLOCATE (mosaic_own_images[j], int, Amosaic_own_images[j]); 72 103 } 73 if (found) continue; 74 75 /* a new mosaic, define ranges */ 76 mosaic[Nmosaic].start = start; 77 mosaic[Nmosaic].stop = stop; 78 mosaic[Nmosaic].Mcal = 0.0; 79 mosaic[Nmosaic].dMcal = 0.0; 80 mosaic[Nmosaic].Xm = 0.0; 81 mosaic[Nmosaic].code = image[i].code; 82 mosaic[Nmosaic].secz = image[i].secz; 83 mosaic[Nmosaic].coords = image[i].coords; 104 assert (Nmosaic_own_images[j] < Amosaic_own_images[j]); 105 } 84 106 85 /* add image to mosaic -> image list */86 NIMLIST[Nmosaic] = 10;87 Nimlist[Nmosaic] = 1;88 ALLOCATE (imlist[Nmosaic], int, NIMLIST[Nmosaic]);89 imlist[Nmosaic][0] = i;90 91 /* add mosaic to image -> mosaic list */92 moslist[i] = Nmosaic;93 94 Nmosaic ++;95 if (Nmosaic == NMOSAIC) {96 NMOSAIC += 10;97 REALLOCATE (mosaic, Mosaic, NMOSAIC);98 REALLOCATE (imlist, int *, NMOSAIC);99 REALLOCATE (Nimlist, int, NMOSAIC);100 REALLOCATE (NIMLIST, int, NMOSAIC);101 }102 }103 107 return; 104 108 } 105 109 106 void initMosaicBins (Catalog *catalog, int Ncatalog) { 110 // return StarData values for detections in the specified image, converting coordinates from the 111 // chip positions: X,Y -> L,M -> P,Q -> R,D 112 StarData *getMosaicRaw (Catalog *catalog, int Ncatalog, int mos, int *Nstars) { 107 113 108 int i, j; 114 int i, j, im, Nraw, Nnew; 115 StarData *raw, *new; 109 116 110 /* measure -> mosaic */ 111 if (!MOSAICNAME[0]) return; 112 ALLOCATE (bin, int *, Ncatalog); 113 for (i = 0; i < Ncatalog; i++) { 114 ALLOCATE (bin[i], int, MAX (catalog[i].Nmeasure, 1)); 115 for (j = 0; j < catalog[i].Nmeasure; j++) bin[i][j] = -1; 117 Nraw = 0; 118 ALLOCATE (raw, StarData, 1); 119 120 // loop over the images owned by this mosaic 121 for (i = 0; i < Nmosaic_own_images[mos]; i++) { 122 123 im = mosaic_own_images[mos][i]; 124 125 // retrieve stars for this chip, applying chip and mosaic astrometry 126 // this function does the reverse-lookup for the mosaic corresponding to this image 127 new = getImageRaw (catalog, Ncatalog, im, &Nnew, MODE_MOSAIC); 128 129 // merge new and raw 130 REALLOCATE (raw, StarData, Nraw + Nnew); 131 for (j = 0; j < Nnew; j++) { 132 raw[Nraw+j] = new[j]; 133 } 134 Nraw += Nnew; 135 136 free (new); 116 137 } 117 138 118 /* mosaic -> measure */ 119 ALLOCATE (Nlist, int, Nmosaic); 120 ALLOCATE (NLIST, int, Nmosaic); 121 ALLOCATE (clist, int *, Nmosaic); 122 ALLOCATE (mlist, int *, Nmosaic); 123 124 for (i = 0; i < Nmosaic; i++) { 125 Nlist[i] = 0; 126 NLIST[i] = 100; 127 ALLOCATE (clist[i], int, NLIST[i]); 128 ALLOCATE (mlist[i], int, NLIST[i]); 129 } 139 *Nstars = Nraw; 140 return (raw); 130 141 } 131 142 132 void freeMosaicBins (int Ncatalog) { 143 // return StarData values for averages positions in the specified image, converting coordinates from 144 // the sky positions: R,D -> P,Q -> L,M -> X,Y 145 StarData *getMosaicRef (Catalog *catalog, int Ncatalog, int mos, int *Nstars) { 133 146 134 int i; 147 int i, j, im, Nref, Nnew; 148 StarData *ref, *new; 149 150 Nref = 0; 151 ALLOCATE (ref, StarData, 1); 135 152 136 /* measure -> mosaic */ 137 if (!MOSAICNAME[0]) return; 138 for (i = 0; i < Ncatalog; i++) { 139 free (bin[i]); 153 for (i = 0; i < Nmosaic_own_images[mos]; i++) { 154 155 im = mosaic_own_images[mos][i]; 156 157 // retrieve stars for this chip, applying chip and mosaic astrometry 158 // this function does the reverse-lookup for the mosaic corresponding to this image 159 new = getImageRef (catalog, Ncatalog, im, &Nnew, MODE_MOSAIC); 160 161 // merge new and ref 162 REALLOCATE (ref, StarData, Nref + Nnew); 163 for (j = 0; j < Nnew; j++) { 164 ref[Nref+j] = new[j]; 165 } 166 Nref += Nnew; 167 168 free (new); 140 169 } 141 free (bin);142 170 143 /* mosaic -> measure */ 144 for (i = 0; i < Nmosaic; i++) { 145 free (clist[i]); 146 free (mlist[i]); 147 } 148 free (Nlist); 149 free (NLIST); 150 free (clist); 151 free (mlist); 171 *Nstars = Nref; 172 return (ref); 152 173 } 153 174 154 int findMosaics (Catalog *catalog, int Ncatalog) { 155 156 int i, j; 175 Mosaic *getMosaicForImage (int im) { 157 176 158 if (!MOSAICNAME[0]) return (FALSE); 159 for (i = 0; i < Ncatalog; i++) { 160 for (j = 0; j < catalog[i].Nmeasure; j++) { 161 if (TimeSelect) { 162 if (catalog[i].measure[j].t < TSTART) continue; 163 if (catalog[i].measure[j].t > TSTOP) continue; 164 } 165 matchMosaics (catalog, j, i); 166 } 167 } 168 return (TRUE); 169 } 177 int mos; 170 178 171 /* modify this function to use the measure->imageID field ? */ 172 void matchMosaics (Catalog *catalog, int meas, int cat) { 173 174 int i; 175 176 for (i = 0; i < Nmosaic; i++) { 177 if (catalog[cat].measure[meas].t < mosaic[i].start) continue; 178 if (catalog[cat].measure[meas].t > mosaic[i].stop) continue; 179 180 bin[cat][meas] = i; 181 182 clist[i][Nlist[i]] = cat; 183 mlist[i][Nlist[i]] = meas; 184 Nlist[i] ++; 185 186 if (Nlist[i] == NLIST[i]) { 187 NLIST[i] += 100; 188 REALLOCATE (clist[i], int, NLIST[i]); 189 REALLOCATE (mlist[i], int, NLIST[i]); 190 } 191 return; 192 } 193 return; 194 } 195 196 void plot_mosaic_fields (Catalog *catalog) { 197 198 int i, j, m, c, N, ave, Nimage; 199 double *xlist, *ylist; 200 double Xmin, Xmax, Ymin, Ymax; 201 char string[64]; 202 Image *image; 203 Graphdata graphdata; 204 205 if (!MOSAICNAME[0]) return; 206 207 image = getimages (&Nimage); 208 209 N = 0; 210 for (i = 0; i < Nmosaic; i++) 211 N = MAX (N, Nlist[i]); 212 213 ALLOCATE (xlist, double, N); 214 ALLOCATE (ylist, double, N); 215 216 for (i = 0; i < Nmosaic; i++) { 217 N = 0; 218 Xmin = Ymin = +360.0; 219 Xmax = Ymax = -360.0; 220 for (j = 0; j < Nlist[i]; j++) { 221 222 m = mlist[i][j]; 223 c = clist[i][j]; 224 225 if (catalog[c].measure[m].dbFlags & (ID_MEAS_AREA | ID_MEAS_NOCAL)) continue; 226 227 ave = catalog[c].measure[m].averef; 228 xlist[N] = catalog[c].average[ave].R - catalog[c].measure[m].dR / 3600.0; 229 ylist[N] = catalog[c].average[ave].D - catalog[c].measure[m].dD / 3600.0; 230 N++; 231 } 232 233 sprintf (string, "Mosaic %d", i); 234 plot_defaults (&graphdata); 235 plot_list (&graphdata, xlist, ylist, N, string, NULL); 236 } 237 238 free (ylist); 239 free (xlist); 240 } 241 242 void plot_mosaics () { 243 244 int i, bin; 245 double *xlist, *Mlist, *dlist; 246 Graphdata graphdata; 247 248 if (!MOSAICNAME[0]) return; 249 250 ALLOCATE (xlist, double, Nmosaic); 251 ALLOCATE (dlist, double, Nmosaic); 252 ALLOCATE (Mlist, double, Nmosaic); 253 254 for (i = 0; i < Nmosaic; i++) { 255 Mlist[i] = mosaic[i].Mcal; 256 dlist[i] = mosaic[i].dMcal; 257 xlist[i] = mosaic[i].secz; 258 } 259 260 plot_defaults (&graphdata); 261 graphdata.xmin = 0.95; 262 graphdata.xmax = 2.50; 263 graphdata.ymin = PlotdMmin; 264 graphdata.ymax = PlotdMmax; 265 plot_list (&graphdata, xlist, Mlist, Nmosaic, "airmass vs Mcal", "airmass.png"); 266 plot_defaults (&graphdata); 267 graphdata.size = 1.5; 268 graphdata.ptype = 7; 269 plot_list (&graphdata, Mlist, dlist, Nmosaic, "Mcal vs dMcal", "MdM.png"); 270 271 # define NBIN 200 272 REALLOCATE (xlist, double, NBIN); 273 REALLOCATE (Mlist, double, NBIN); 274 275 /**** dMcal histgram ****/ 276 for (i = 0; i < NBIN; i++) xlist[i] = 0.00005*i; 277 bzero (Mlist, NBIN*sizeof(double)); 278 for (i = 0; i < Nmosaic; i++) { 279 bin = mosaic[i].dMcal / 0.00005; 280 bin = MAX (0, MIN (NBIN - 1, bin)); 281 Mlist[bin] += 1.0; 282 } 283 plot_defaults (&graphdata); 284 graphdata.style = 1; 285 plot_list (&graphdata, xlist, Mlist, NBIN, "dMcal hist", "dMcalhist.png"); 286 287 free (dlist); 288 free (xlist); 289 free (Mlist); 290 } 291 292 Mosaic *getMosaicForImage (int Nim) { 293 294 int i; 295 Mosaic *myMosaic; 179 if (im < 0) abort(); 180 if (im >= Nmosaic_for_images) abort(); 296 181 297 182 // search for the mosaic that 298 i = moslist[Nim];299 if ( i< 0) return NULL;183 mos = mosaic_for_images[im]; 184 if (mos < 0) return NULL; 300 185 301 myMosaic = &mosaic[i]; 302 return myMosaic; 186 return &mosaic[mos]; 303 187 } 304 305 int *SelectRefMosaic (Mosaic **refmosaic, int *Nimage) {306 307 int i, Imax, Nmax;308 309 Imax = 0;310 Nmax = Nimlist[0];311 for (i = 0; i < Nmosaic; i++) {312 if (Nimlist[i] > Nmax) {313 Imax = i;314 Nmax = Nimlist[i];315 }316 }317 318 *refmosaic = &mosaic[Imax];319 *Nimage = Nmax;320 return (imlist[Imax]);321 } -
trunk/Ohana/src/relastro/src/UpdateChips.c
r15590 r15600 16 16 17 17 /* convert measure coordinates to raw entries */ 18 raw = getImageRaw (catalog, Ncatalog, i, &Nstars, MODE_ CHIP);18 raw = getImageRaw (catalog, Ncatalog, i, &Nstars, MODE_MOSAIC); 19 19 20 20 /* convert average coordinates to ref entries */ 21 ref = getImageRef (catalog, Ncatalog, i, &Nstars, MODE_ CHIP);21 ref = getImageRef (catalog, Ncatalog, i, &Nstars, MODE_MOSAIC); 22 22 23 23 FitChip (raw, ref, Nstars, &image[i].coords); -
trunk/Ohana/src/relastro/src/UpdateMosaic.c
r15590 r15600 4 4 5 5 /* we can measure new image parameters for each mosaic independently */ 6 int i, N image, Nstars;7 Image *image;6 int i, Nmosaic, Nstars; 7 Mosaic *mosaic; 8 8 StarData *raw, *ref; 9 9 10 image = getimages (&Nimage);10 mosaic = getmosaics (&Nmosaic); 11 11 12 for (i = 0; i < Nimage; i++) { 13 14 /* skip all except DIS images */ 15 if (strcmp(&image[i].coords.ctype[4], "-DIS")) continue; 16 17 /* XXX I probably need modes for getImageRaw/Ref to distinguish SIMPLE, CHIP, MOSAIC */ 12 for (i = 0; i < Nmosaic; i++) { 18 13 19 14 /* convert measure coordinates to raw entries */ 20 raw = get ImageRaw (catalog, Ncatalog, i, &Nstars, MODE_MOSAIC);15 raw = getMosaicRaw (catalog, Ncatalog, i, &Nstars); 21 16 22 17 /* convert average coordinates to ref entries */ 23 ref = get ImageRef (catalog, Ncatalog, i, &Nstars, MODE_MOSAIC);18 ref = getMosaicRef (catalog, Ncatalog, i, &Nstars); 24 19 25 FitMosaic (raw, ref, Nstars, &image[i].coords); 20 // XXX : I'll need to supply these back to the image[] entry 21 FitMosaic (raw, ref, Nstars, &mosaic[i].coords); 26 22 27 23 free (raw); -
trunk/Ohana/src/relastro/src/UpdateObjects.c
r15509 r15600 153 153 break; 154 154 155 case FIT_PAR_ONLY: 156 for (k = 0; k < N; k++) { 157 ParFactor (&pX[k], &pY[k], R[k], D[k], T[k]); 158 } 159 FitPar (&fit, X, dX, Y, dY, pX, pY, N); 160 161 // project Ro, Do back to RA,DEC 162 XY_to_RD (&fit.Ro, &fit.Do, fit.Ro, fit.Do, &coords); 163 Npar ++; 164 break; 165 155 166 case FIT_PM_AND_PAR: 156 167 for (k = 0; k < N; k++) { … … 161 172 Npar ++; 162 173 break; 174 163 175 default: 164 176 fprintf (stderr, "programming error at %s, %s", __FILE__, __LINE__); -
trunk/Ohana/src/relastro/src/args.c
r14590 r15600 18 18 remove_argument (N, &argc, argv); 19 19 FIT_MODE = FIT_PM_ONLY; 20 } 21 if ((N = get_argument (argc, argv, "-par"))) { 22 remove_argument (N, &argc, argv); 23 FIT_MODE = FIT_PAR_ONLY; 20 24 } 21 25 if ((N = get_argument (argc, argv, "-pmpar"))) { -
trunk/Ohana/src/relastro/src/relastro.c
r15235 r15600 27 27 catalog = load_catalogs (skylist, &Ncatalog, (FIT_TARGET != TARGET_OBJECTS)); 28 28 29 /* match measurements with images, mosaics */ 30 initImageBins (catalog, Ncatalog); 31 // initMosaicBins (catalog, Ncatalog); 32 29 /* match measurements with images */ 30 initImageBins (catalog, Ncatalog); 33 31 findImages (catalog, Ncatalog); 34 // findMosaics (catalog, Ncatalog); /* also sets Grid values */35 32 36 33 if (PLOTSTUFF) { 37 34 // plot_star_coords (catalog, Ncatalog); 38 plot_mosaic_fields (catalog);35 // plot_mosaic_fields (catalog); 39 36 } 40 37 … … 62 59 } 63 60 64 /* put these types of functions inside the update functions65 plot_scatter (catalog, Ncatalog);66 plot_grid (catalog);67 plot_mosaics ();68 plot_images ();69 plot_stars (catalog, Ncatalog);70 plot_chisq (catalog, Ncatalog);71 */72 73 61 if (!UPDATE) exit (0); 74 62
Note:
See TracChangeset
for help on using the changeset viewer.
