IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 40415 for trunk


Ignore:
Timestamp:
May 2, 2018, 12:30:58 PM (8 years ago)
Author:
eugene
Message:

add -imstats-only option (just calculate stats, do not fit); re-work stack analysis to merge the fit and stats-only version

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

Legend:

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

    r40405 r40415  
    5252$(SRC)/UpdateChips.$(ARCH).o         \
    5353$(SRC)/UpdateStacks.$(ARCH).o         \
    54 $(SRC)/UpdateStacksWithFit.$(ARCH).o \
    5554$(SRC)/UpdateMosaic.$(ARCH).o        \
    5655$(SRC)/UpdateObjects.$(ARCH).o       \
     
    110109$(SRC)/relastroVisual.$(ARCH).o
    111110
    112 #$(SRC)/write_coords.$(ARCH).o        \
     111#$(SRC)/write_coords.$(ARCH).o       
     112#$(SRC)/UpdateStacksWithFit.$(ARCH).o
    113113
    114114$(RELASTRO): $(INC)/relastro.h
  • trunk/Ohana/src/relastro/include/relastro.h

    r40414 r40415  
    368368
    369369int    FIT_STACKS;
     370int    IMSTATS_ONLY;
    370371int    REPAIR_STACKS;
    371372int    USE_IMAGE_COORDS_FOR_REPAIR;
  • trunk/Ohana/src/relastro/src/UpdateChips.c

    r39926 r40415  
    116116    // note that Nraw & Nref must be equal: if not, we made a programming error in one of these two functions.
    117117    assert (Nraw == Nref);
     118
     119    if (IMSTATS_ONLY) {
     120      int Nstat;
     121      float dLsig, dMsig, dRsig;
     122      GetScatterRawRef(&dLsig, &dMsig, &dRsig, &Nstat, raw, ref, Nraw, IMFIT_SYS_SIGMA_LIM);
     123
     124      // XXX: I need to convert dLsig, dMsig from degrees to pixels
     125      dLsig *= 3600.0;
     126      dMsig *= 3600.0;
     127
     128      image[i].dXpixSys = dLsig;
     129      image[i].dYpixSys = dMsig;
     130      image[i].nFitAstrom = Nstat;
     131      continue;
     132    }
    118133
    119134    // save these in case of failure
  • trunk/Ohana/src/relastro/src/UpdateStacks.c

    r39926 r40415  
    1111  off_t Nskip = 0;
    1212  off_t Nmeas = 0;
     13  off_t NnewFit = 0;
     14  off_t NoldFit = 0;
    1315
    1416  // measure the scatter for each stack
     
    4345    assert (Nraw == Nref);
    4446
    45     int Nstat;
    46     float dLsig, dMsig, dRsig;
    47     GetScatterRawRef(&dLsig, &dMsig, &dRsig, &Nstat, raw, ref, Nraw, IMFIT_SYS_SIGMA_LIM);
     47    // the natural default for stacks is to NOT re-fit
     48    if (FIT_STACKS == FALSE) {
     49      int Nstat;
     50      float dLsig, dMsig, dRsig;
     51      GetScatterRawRef(&dLsig, &dMsig, &dRsig, &Nstat, raw, ref, Nraw, IMFIT_SYS_SIGMA_LIM);
    4852
    49     // XXX: I need to convert dLsig, dMsig from degrees to pixels
    50     dLsig *= 3600.0;
    51     dMsig *= 3600.0;
     53      // XXX: I need to convert dLsig, dMsig from degrees to pixels
     54      dLsig *= 3600.0;
     55      dMsig *= 3600.0;
    5256
    53     image[i].dXpixSys = dLsig;
    54     image[i].dYpixSys = dMsig;
    55     image[i].nFitAstrom = Nstat;
     57      image[i].dXpixSys = dLsig;
     58      image[i].dYpixSys = dMsig;
     59      image[i].nFitAstrom = Nstat;
     60      continue;
     61    }
     62
     63    // save these in case of failure
     64    Coords oldCoords;
     65    SaveCoords (&oldCoords, &image[i].coords);
     66
     67    float dXpixSys = image[i].dXpixSys;
     68    float dYpixSys = image[i].dYpixSys;
     69    int   nFitAstr = image[i].nFitAstrom;
     70
     71    // FitChip does iterative, clipped fitting
     72    if (!FitChip (raw, ref, Nraw, &image[i])) {
     73      if (VERBOSE) fprintf (stderr, "reject fit for image %s ("OFF_T_FMT") : Nstars: "OFF_T_FMT", Nused %d of %d\n", image[i].name, i, Nraw, image[i].nFitAstrom, image[i].nstar);
     74
     75      // restore status quo ante (replace truMap with tmpMap)
     76      RestoreCoords (&image[i].coords, &oldCoords, &image[i]);
     77      image[i].dXpixSys = dXpixSys;
     78      image[i].dYpixSys = dYpixSys;
     79      image[i].nFitAstrom = nFitAstr;
     80
     81      NoldFit ++;
     82      free (raw);
     83      free (ref);
     84      continue;
     85    }
     86
     87    AstromOffsetMapFree (oldCoords.offsetMap);
     88
     89    // Apply the modified coords back to the measure.R,D.  Note that raw.R,D, ref.L,M, etc
     90    // are all automatically updated in this block because they are re-generated from
     91    // image.coords on each pass.
     92    setImageRaw (catalog, Ncatalog, i, raw, Nraw, MODE_MOSAIC);
     93
     94    NnewFit ++;
     95    free (raw);
     96    free (ref);
    5697  }
    5798
  • trunk/Ohana/src/relastro/src/args.c

    r40414 r40415  
    9191    remove_argument (N, &argc, argv);
    9292    CATCH_UP = TRUE;
     93  }
     94
     95  // only update the fit statistics (systematic floor)
     96  IMSTATS_ONLY = FALSE;
     97  if ((N = get_argument (argc, argv, "-imstats-only"))) {
     98    remove_argument (N, &argc, argv);
     99    IMSTATS_ONLY = FALSE;
    93100  }
    94101
     
    896903    remove_argument (N, &argc, argv);
    897904    CHECK_MEASURE_TO_IMAGE = TRUE;
     905  }
     906
     907  // only update the fit statistics (systematic floor)
     908  IMSTATS_ONLY = FALSE;
     909  if ((N = get_argument (argc, argv, "-imstats-only"))) {
     910    remove_argument (N, &argc, argv);
     911    IMSTATS_ONLY = FALSE;
    898912  }
    899913
  • trunk/Ohana/src/relastro/src/launch_region_hosts.c

    r40414 r40415  
    155155
    156156    if (FIT_STACKS)          strextend (&command, "-fit-stacks");
     157    if (IMSTATS_ONLY)        strextend (&command, "-imstats-only");
    157158
    158159    strextend (&command, "-nloop %d", NLOOP);
  • trunk/Ohana/src/relastro/src/relastro_images.c

    r40414 r40415  
    8787      }
    8888
    89       if (FIT_STACKS) {
    90         // model astrometry for stacks
    91         UpdateStacksWithFit (catalog, Ncatalog);
    92       } else {
    93         // measure scatter for stacks
    94         UpdateStacks (catalog, Ncatalog);
    95       }
     89      // measure scatter for stacks
     90      UpdateStacks (catalog, Ncatalog);
    9691      MARKTIME("UpdateStacks: %f sec\n", dtime);
    9792
     
    108103    case SET_STACKS:
    109104      // we just want to fit the selected stacks to the mean positions
    110       if (FIT_STACKS) {
    111         // model astrometry for stacks
    112         UpdateStacksWithFit (catalog, Ncatalog);
    113       } else {
    114         // measure scatter for stacks
    115         UpdateStacks (catalog, Ncatalog);
    116       }
     105      UpdateStacks (catalog, Ncatalog);
    117106      MARKTIME("update stacks : %f sec\n", dtime);
    118107      break;
  • trunk/Ohana/src/relastro/src/relastro_parallel_images.c

    r40414 r40415  
    150150      }
    151151
    152       if (FIT_STACKS) {
    153         // model astrometry for stacks
    154         UpdateStacksWithFit (catalog, Ncatalog);
    155       } else {
    156         // measure scatter for stacks
    157         UpdateStacks (catalog, Ncatalog);
    158       }
     152      // measure astrometry or scatter [default] for stacks
     153      UpdateStacks (catalog, Ncatalog);
    159154      LOGRTIME("UpdateStacks on %s, host %d: %f sec\n", myHostName, REGION_HOST_ID, dtime);
    160155
     
    167162      share_mean_pos (catalog, Ncatalog, regionHosts, 0);
    168163      slurp_mean_pos (catalog, Ncatalog, regionHosts, 0);
    169       if (FIT_STACKS) {
    170         // model astrometry for stacks
    171         UpdateStacksWithFit (catalog, Ncatalog);
    172       } else {
    173         // measure scatter for stacks
    174         UpdateStacks (catalog, Ncatalog);
    175       }
     164      UpdateStacks (catalog, Ncatalog);
    176165      share_image_pos (regionHosts, 0);
    177166      slurp_image_pos (catalog, Ncatalog, regionHosts, 0);
Note: See TracChangeset for help on using the changeset viewer.