IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39569 for trunk


Ignore:
Timestamp:
May 9, 2016, 9:12:10 AM (10 years ago)
Author:
eugene
Message:

adding code to match measure and lensing fields

Location:
trunk/Ohana/src/opihi
Files:
1 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/dvo/Makefile

    r37807 r39569  
    2525$(SRC)/dvo_host_utils.$(ARCH).o         \
    2626$(SRC)/region_list.$(ARCH).o            \
     27$(SRC)/mySequence.$(ARCH).o             \
    2728$(SRC)/photcode_ops.$(ARCH).o           \
    2829$(SRC)/find_matches.$(ARCH).o           
  • trunk/Ohana/src/opihi/dvo/gstar.c

    r39457 r39569  
    9292  off_t j, k, m, N, Nlo, Nhi;
    9393  int Nsecfilt, NPTS, QUIET, INST, SHOW_MASKS;
    94   int found, GetMeasures;
     94  int found, GetMeasure, GetLensing;
    9595  int SaveVectors;
    9696  Vector *vec1, *vec2, *vec3, *vec4, *vec5, *vec6;
     
    196196  }
    197197
    198   GetMeasures = FALSE;
     198  GetMeasure = FALSE;
    199199  if ((N = get_argument (argc, argv, "-m"))) {
    200     GetMeasures = TRUE;
     200    GetMeasure = TRUE;
    201201    remove_argument (N, &argc, argv);
    202202  }
    203203  if ((N = get_argument (argc, argv, "-meas"))) {
    204     GetMeasures = TRUE;
     204    GetMeasure = TRUE;
     205    remove_argument (N, &argc, argv);
     206  }
     207  if (SaveVectors) GetMeasure = TRUE;
     208
     209  GetLensing = FALSE;
     210  if ((N = get_argument (argc, argv, "-lens"))) {
     211    GetLensing = TRUE;
    205212    remove_argument (N, &argc, argv);
    206213  }
     
    258265  /* lock, load, unlock catalog */
    259266  catalog.catflags = DVO_LOAD_AVERAGE | DVO_LOAD_SECFILT;
    260   catalog.catflags |= GetMeasures ? DVO_LOAD_MEASURE : DVO_SKIP_MEASURE;
     267  catalog.catflags |= GetMeasure ? DVO_LOAD_MEASURE : DVO_SKIP_MEASURE;
     268  catalog.catflags |= GetLensing ? DVO_LOAD_LENSING : DVO_SKIP_LENSING;
    261269  catalog.Nsecfilt = 0;
    262270
     
    676684      gprint (GP_LOG, "\n");
    677685     
    678       if (GetMeasures || SaveVectors) {
     686      if (GetMeasure) {
    679687
    680688        if (catalog.average[k].Nmeasure == 0) continue;
     
    717725          float dDoff = dvoOffsetD(&catalog.measure[Nv], &catalog.average[k]);
    718726
    719           if (GetMeasures && !QUIET) {
     727          if (GetMeasure && !QUIET) {
    720728            date = ohana_sec_to_date (catalog.measure[Nv].t);
    721729            gprint (GP_LOG, "%6.3f ",  Mcat);
     
    744752            gprint (GP_LOG, "%5.2f ",  FromShortPixels(catalog.measure[Nv].FWx));
    745753            gprint (GP_LOG, "%5.2f ",  FromShortPixels(catalog.measure[Nv].FWy));
     754            gprint (GP_LOG, "%5.2f ",  FromShortPixels(catalog.measure[Nv].Mxx));
     755            gprint (GP_LOG, "%5.2f ",  FromShortPixels(catalog.measure[Nv].Mxy));
     756            gprint (GP_LOG, "%5.2f ",  FromShortPixels(catalog.measure[Nv].Myy));
    746757
    747758            if (FULL_OUTPUT) {
     
    777788              gprint (GP_LOG, "%10.3e ", catalog.measure[Nv].dFluxAp);
    778789            }
    779             gprint (GP_LOG, "\n");
    780 
     790
     791            if (GetLensing && catalog.average[k].Nlensing) {
     792              int mLens = catalog.average[k].lensingOffset;
     793              int foundLens = FALSE;
     794              for (int Nlens = 0; !foundLens && (Nlens < catalog.average[k].Nlensing); Nlens ++) {
     795                Lensing *lensing = &catalog.lensing[mLens + Nlens];
     796                if (lensing->imageID != catalog.measure[Nv].imageID) continue;
     797
     798                gprint (GP_LOG, "%10.3e ",  lensing->X11_sm_obj);
     799                gprint (GP_LOG, "%10.3e ",  lensing->X12_sm_obj);
     800                gprint (GP_LOG, "%10.3e ",  lensing->X22_sm_obj);
     801                gprint (GP_LOG, "%10.3e ",  lensing-> E1_sm_obj);
     802                gprint (GP_LOG, "%10.3e ",  lensing-> E2_sm_obj);
     803                gprint (GP_LOG, "%10.3e ",  lensing->X11_sh_obj);
     804                gprint (GP_LOG, "%10.3e ",  lensing->X12_sh_obj);
     805                gprint (GP_LOG, "%10.3e ",  lensing->X22_sh_obj);
     806                gprint (GP_LOG, "%10.3e ",  lensing-> E1_sh_obj);
     807                gprint (GP_LOG, "%10.3e ",  lensing-> E2_sh_obj);
     808                gprint (GP_LOG, "%10.3e ",  lensing->X11_sm_psf);
     809                gprint (GP_LOG, "%10.3e ",  lensing->X12_sm_psf);
     810                gprint (GP_LOG, "%10.3e ",  lensing->X22_sm_psf);
     811                gprint (GP_LOG, "%10.3e ",  lensing-> E1_sm_psf);
     812                gprint (GP_LOG, "%10.3e ",  lensing-> E2_sm_psf);
     813                gprint (GP_LOG, "%10.3e ",  lensing->X11_sh_psf);
     814                gprint (GP_LOG, "%10.3e ",  lensing->X12_sh_psf);
     815                gprint (GP_LOG, "%10.3e ",  lensing->X22_sh_psf);
     816                gprint (GP_LOG, "%10.3e ",  lensing-> E1_sh_psf);
     817                gprint (GP_LOG, "%10.3e ",  lensing-> E2_sh_psf);
     818                gprint (GP_LOG, " %10.3e ", lensing-> E1_psf);
     819                gprint (GP_LOG,  "%10.3e ", lensing-> E2_psf);
     820                foundLens = TRUE;
     821              }       
     822            }
     823
     824            gprint (GP_LOG, "\n");
    781825            free (date);
    782826          }
  • trunk/Ohana/src/opihi/dvo/mextract.c

    r39457 r39569  
    216216  int needStarpar = dbFieldNeedStarpar (fields, Nfields, FALSE);
    217217
     218  // the lensing table does not have a good index to/from the measure table.  if we need lensing
     219  // parameters, we need to generate a lookup table to avoid excess iterations
     220  mySequenceType *lensingSeq = NULL;
     221  if (needLensing) {
     222    lensingSeq = mySequenceAlloc();
     223  }
     224
    218225  // grab data from all selected sky regions
    219226  struct sigaction *old_sigaction = SetInterrupt();
     
    249256
    250257    for (j = 0; (j < catalog.Naverage) && !interrupt; j++) {
    251       m = catalog.average[j].measureOffset;
     258      Average *average = &catalog.average[j];
     259
     260      m = average->measureOffset;
    252261      if (m > catalog.Nmeasure) {
    253262        gprint (GP_ERR, "ERROR: inconsistent average->measure offset.  Unsorted database?\n");
     
    257266      dbExtractMeasuresInitAve (); // reset counters for saved fields (costs very little)
    258267
    259       for (k = 0; (k < catalog.average[j].Nmeasure); k++, m++) {
     268      off_t Lj;
     269      off_t Loff = average->lensingOffset;
     270
     271      if (needLensing) {
     272        mySequenceSetSize (lensingSeq, average->Nlensing);
     273       
     274        // generate an index for these lensing entries (based on Lj and imageID)
     275        for (Lj = 0; Lj < average->Nlensing; Lj++) {
     276          mySequenceSetValue (lensingSeq, catalog.lensing[Loff + Lj].imageID, Lj);
     277        }
     278       
     279        mySequenceSort (lensingSeq);
     280      }
     281
     282      for (k = 0; (k < average->Nmeasure); k++, m++) {
    260283        if (catalog.measure[m].averef != j) {
    261284          gprint (GP_ERR, "ERROR: inconsistent measure->average link.  Unsorted database?\n");
     
    266289        dbExtractMeasuresInitMeas (); // reset counters for saved fields  (costs very little
    267290
    268         Average *average = &catalog.average[j];
    269 
    270291        int Nstarpar = average->starparOffset;
    271         StarPar *starpar = needStarpar ? &catalog.starpar[Nstarpar] : NULL;
    272 
    273         int Nlensing = average->lensingOffset;
    274         Lensing *lensing = needLensing ? &catalog.lensing[Nlensing] : NULL;
     292        StarPar *starpar = needStarpar && average->Nstarpar ? &catalog.starpar[Nstarpar] : NULL;
     293
     294        Lensing *lensing = NULL;
     295
     296        // a gpc1 analysis specific choice: only look for lensing if photcode is a warp one
     297        if (needLensing && average->Nlensing && (catalog.measure[m].photcode >= 12000) && (catalog.measure[m].photcode <= 12500)) {
     298          Lj = mySequenceGetEntry (lensingSeq, catalog.measure[m].imageID);
     299          if (Lj >= 0) lensing = &catalog.lensing[Loff + Lj];
     300        }
    275301
    276302        int Nsec = j*Nsecfilt;
  • trunk/Ohana/src/opihi/include/dvoshell.h

    r39457 r39569  
    2626  e_time t;
    2727} CMPstars;
     28
     29// a structure to define a sequence lookup
     30typedef struct {
     31  int minID;
     32  int maxID;
     33  int *value;
     34  int *sequence;
     35  int Nsequence;
     36  int NSEQUENCE;
     37} mySequenceType;
    2838
    2939/** some globals used particularly by DVO_CLIENT **/
     
    93103int          HostTableGetResults    PROTO((char *uniquer, int VERBOSE));
    94104
     105mySequenceType *mySequenceAlloc ();
     106int mySequenceFree (mySequenceType *mySequence);
     107int mySequenceSetSize (mySequenceType *mySequence, int Nmax);
     108int mySequenceSetValue (mySequenceType *mySequence, int value, int entry);
     109int mySequenceSort (mySequenceType *mySequence);
     110int mySequenceGetEntry (mySequenceType *mySequence, int value);
     111
    95112# endif // DVOSHELL_H
Note: See TracChangeset for help on using the changeset viewer.