IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 15590


Ignore:
Timestamp:
Nov 11, 2007, 4:12:43 PM (18 years ago)
Author:
eugene
Message:

progress on running relastro:images

Location:
trunk/Ohana/src/relastro
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/relastro/Makefile

    r15509 r15590  
    5555$(SRC)/write_coords.$(ARCH).o
    5656
    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  
    33# include <kapa.h>
    44# include <signal.h>
     5
     6typedef enum {
     7  MODE_SIMPLE,
     8  MODE_CHIP,
     9  MODE_MOSAIC,
     10} CoordMode;
    511
    612typedef struct {
     
    277283int FitPMandPar (PMFit *fit, double *X, double *dX, double *Y, double *dY, double *T, double *pR, double *pD, int Npts);
    278284
    279 Image *getMosaicForImage (int N);
     285Mosaic *getMosaicForImage (int N);
    280286
    281287StarData *getImageRef (Catalog *catalog, int Ncatalog, int im, int *Nstars, int isMosaic);
  • trunk/Ohana/src/relastro/src/ImageOps.c

    r15579 r15590  
    176176// return StarData values for detections in the specified image, converting coordinates from the
    177177// chip positions: X,Y -> L,M -> P,Q -> R,D
    178 StarData *getImageRaw (Catalog *catalog, int Ncatalog, int im, int *Nstars, int isMosaic) {
     178StarData *getImageRaw (Catalog *catalog, int Ncatalog, int im, int *Nstars, CoordMode mode) {
    179179
    180180  int i, m, c;
    181 
    182   Image *mosaic;
     181 
     182  Mosaic *mosaic;
    183183  Coords *moscoords;
    184184  StarData *raw;
     
    188188  mosaic = NULL;
    189189  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;
    197207  }
    198208
     
    208218    raw[i].dMag = catalog[c].measure[m].dM;
    209219
    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;
    219241    }
    220   }
    221  
     242  } 
     243
    222244  *Nstars = Nlist[im];
    223245  return (raw);
     
    230252  int i, m, c, n;
    231253
    232   Image *mosaic;
     254  Mosaic *mosaic;
    233255  Coords *moscoords;
    234256  StarData *ref;
     
    251273    ref[i].R = catalog[c].average[n].R;
    252274    ref[i].D = catalog[c].average[n].D;
     275    ref[i].mask = FALSE;
    253276
    254277    /* 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);
    256278    if (isMosaic) {
     279      RD_to_LM (&ref[i].P, &ref[i].Q, ref[i].R, ref[i].D, moscoords);
    257280      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);
    259282    } else {
     283      RD_to_LM (&ref[i].P, &ref[i].Q, ref[i].R, ref[i].D, &image[im].coords);
    260284      ref[i].L = ref[i].P;
    261285      ref[i].M = ref[i].Q;
  • trunk/Ohana/src/relastro/src/MosaicOps.c

    r15579 r15590  
    1111
    1212static int    Nimages;
    13 static int   **moslist; /* image -> mosaic */
     13static int    *moslist; /* image -> mosaic */
    1414
    1515static int   **clist;  /* mosaic -> catalog[] */
     
    8181    mosaic[Nmosaic].code  = image[i].code;
    8282    mosaic[Nmosaic].secz  = image[i].secz;
     83    mosaic[Nmosaic].coords = image[i].coords;
    8384
    8485    /* add image to mosaic -> image list */
     
    289290}
    290291
    291 Image *getMosaicForImage (int Nim) {
     292Mosaic *getMosaicForImage (int Nim) {
    292293
    293294  int i;
    294   Image *mosaic;
     295  Mosaic *myMosaic;
    295296
    296297  // search for the mosaic that
     
    298299  if (i < 0) return NULL;
    299300
    300   mosaic = &mosaic[i];
    301   return mosaic;
     301  myMosaic = &mosaic[i];
     302  return myMosaic;
    302303}
    303304
  • trunk/Ohana/src/relastro/src/UpdateChips.c

    r15237 r15590  
    1616
    1717    /* convert measure coordinates to raw entries */
    18     raw = getImageRaw (catalog, Ncatalog, i, &Nstars, TRUE);
     18    raw = getImageRaw (catalog, Ncatalog, i, &Nstars, MODE_CHIP);
    1919
    2020    /* convert average coordinates to ref entries */
    21     ref = getImageRef (catalog, Ncatalog, i, &Nstars, TRUE);
     21    ref = getImageRef (catalog, Ncatalog, i, &Nstars, MODE_CHIP);
    2222
    2323    FitChip (raw, ref, Nstars, &image[i].coords);
  • trunk/Ohana/src/relastro/src/UpdateMosaic.c

    r15237 r15590  
    1818
    1919    /* convert measure coordinates to raw entries */
    20     raw = getImageRaw (catalog, Ncatalog, i, &Nstars, TRUE);
     20    raw = getImageRaw (catalog, Ncatalog, i, &Nstars, MODE_MOSAIC);
    2121
    2222    /* convert average coordinates to ref entries */
    23     ref = getImageRef (catalog, Ncatalog, i, &Nstars, TRUE);
     23    ref = getImageRef (catalog, Ncatalog, i, &Nstars, MODE_MOSAIC);
    2424
    2525    FitMosaic (raw, ref, Nstars, &image[i].coords);
  • trunk/Ohana/src/relastro/src/UpdateSimple.c

    r15237 r15590  
    1717
    1818    /* convert measure coordinates to raw entries */
    19     raw = getImageRaw (catalog, Ncatalog, i, &Nstars, FALSE);
     19    raw = getImageRaw (catalog, Ncatalog, i, &Nstars, MODE_SIMPLE);
    2020
    2121    /* convert average coordinates to ref entries */
    22     ref = getImageRef (catalog, Ncatalog, i, &Nstars, FALSE);
     22    ref = getImageRef (catalog, Ncatalog, i, &Nstars, MODE_SIMPLE);
    2323
    2424    FitSimple (raw, ref, Nstars, &image[i].coords);
  • trunk/Ohana/src/relastro/src/fitpoly.c

    r12332 r15590  
    130130  }
    131131
    132   dgaussj (matrix, fit[0].Nelems, vector, 2);
    133 
    134132  for (i = 0; i < fit[0].Nelems; i++) {
    135133    ix = i % fit[0].Nterms;
     
    139137  }     
    140138
     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
    141148  /* remap the vector terms into xfit,yfit */
    142149  for (i = 0; i < fit[0].Nelems; i++) {
     
    256263
    257264  // 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  }
    265274
    266275  // 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  }
    276287
    277288  /* we do not modify crval1,2: these are kept at the default values */
  • trunk/Ohana/src/relastro/src/mkpolyterm.c

    r12332 r15590  
    100100  yPx = poly2d_copy (input->yfit, Nx, Ny);
    101101
    102   for (i = 0; i <= input->Nterms; i++) {
     102  for (i = 0; i < input->Nterms; i++) {
    103103    xPy = poly2d_copy (xPx, Nx, Ny);
    104104    yPy = poly2d_copy (yPx, Nx, Ny);
    105     for (j = 0; j <= input->Nterms; j++) {
     105    for (j = 0; j < input->Nterms; j++) {
    106106      output->xfit[i][j] = poly2d_eval (xPy, Nx, Ny, Xo, Yo) / factorial(i) / factorial(j);
    107107      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.