IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35759 for trunk/Ohana


Ignore:
Timestamp:
Jul 3, 2013, 2:14:41 PM (13 years ago)
Author:
eugene
Message:

fix primary cell assignment for parallel dvo; use projID /skycellID to set primary cell (not file name); cleanup some plots; count gpc1 exposure detetions explicitly; raise ID_SECF_STACK_PRIMARY where needed

Location:
trunk/Ohana/src/relphot
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/relphot/include/relphot.h

    r35416 r35759  
    1717# define GRID_V2
    1818# define NO_IMAGE -100
     19
     20# define ID_SECF_STACK_PRIMARY 0x00004000
    1921
    2022// choose off_t or int depending on full-scale relphot analysis resources
     
    114116  unsigned int photom_map_id;
    115117  unsigned int flags;
     118  int projID;
     119  int skycellID;
    116120  unsigned int tzero;
    117121  unsigned char trate;
     
    149153char        *IMAGES;
    150154char        *BCATALOG;
     155char        *BOUNDARY_TREE;
    151156ModeType     MODE;
    152157
     
    328333void          plot_star_coords    PROTO((Catalog *catalog, int Ncatalog));
    329334void          plot_stars          PROTO((Catalog *catalog, int Ncatalog));
     335
     336void          plot_list_add       PROTO((Graphdata *graphdata, double *xlist, double *ylist, int N));
     337int           get_graph           PROTO((int N));
     338int           open_graph          PROTO((int N));
     339
    330340void          reload_catalogs     PROTO((SkyList *skylist, FlatCorrectionTable *flatcorr, int hostID, char *hostpath));
    331341int           reload_catalogs_parallel PROTO((SkyList *sky));
     
    390400
    391401int MatchImageName (off_t meas, int cat, char *name);
     402int MatchImageSkycellID (off_t meas, int cat, int myProjectionID, int mySkycellID);
    392403
    393404int load_tree (char *treefile);
    394405int BoundaryTreePrimaryCell (char *primaryCellName, double ra, double dec);
     406int BoundaryTreePrimaryCellIDs (int *projID, int *skycellID, double ra, double dec);
    395407
    396408int print_measure_set_alt (Average *average, SecFilt *secfilt, Measure *measure);
  • trunk/Ohana/src/relphot/src/BoundaryTreeOps.c

    r34844 r35759  
    4949}
    5050
     51int BoundaryTreePrimaryCellIDs (int *projID, int *skycellID, double ra, double dec) {
     52
     53  int zone, band;
     54
     55  *projID = -1;
     56  *skycellID = -1;
     57
     58  if (!tree) return FALSE;
     59
     60  if (!BoundaryTreeCellCoords (tree, &zone, &band, ra, dec)) {
     61    fprintf (stderr, "mismatch!\n");
     62    return FALSE;
     63  }
     64 
     65  // I have ra, dec, and the primary projection cell.  In order to choose the primary skycell,
     66  // I just need to project to ra,dec to X,Y based on the center of the cell and then get the subdivision right.
     67   
     68  double x = 0.0;
     69  double y = 0.0;
     70  BoundaryTreeProjection (&x, &y, ra, dec, tree, zone, band);
     71 
     72  int xi = x / tree->dX[zone][band];
     73  int yi = y / tree->dY[zone][band];
     74  int N = xi + tree->NX_SUB * yi;
     75 
     76  *projID = tree->projID[zone][band];
     77  *skycellID = N;
     78
     79  return TRUE;
     80}
     81
    5182int load_tree (char *treefile) {
    5283
  • trunk/Ohana/src/relphot/src/ImageOps.c

    r35104 r35759  
    4545static IDX_T       **ImageToMeasure = NULL; // measure for given measure on image : ImageMeasure[ImageIndex][i] = cat (i : 0 < NonImage[ImageIndex])
    4646
     47// Projection Cell / SkyCell ID : for stack primary detection, we need to know the projection cell and skycell ID for each
     48// stack image.  for now, we generate these ID arrays based on the image names when we load in the image table (initImages).
     49// When we pass data to the remote clients via the ImageSubset, the projID/skycellID values are carried directly in the table.
     50int *projectID = NULL;
     51int *skycellID = NULL;
     52
    4753// MeasureToImage was 'bin'
    4854// ImageToCatalog was 'clist'
     
    7480  ALLOCATE (imageIdx, off_t, Nimage);
    7581
     82  // for stack images, assign projection cell ID and skycell ID based on filenames
     83  ALLOCATE (projectID,   int, Nimage);
     84  ALLOCATE (skycellID,   int, Nimage);
     85
    7686  for (i = 0; i < Nimage; i++) {
    7787    imageIdx[i] = i;
    7888    imageIDs[i] = image[i].imageID;
    79   }
     89    projectID[i] = -1;
     90    skycellID[i] = -1;
     91    if (!strncmp (image[i].name, "RINGS.V3.skycell", strlen("RINGS.V3.skycell"))) {
     92      projectID[i] = atoi(&image[i].name[17]);
     93      skycellID[i] = atoi(&image[i].name[22]);
     94    }
     95  }
     96
     97  // sort the image index by the IDs
    8098  llsortpair (imageIDs, imageIdx, Nimage);
    8199}
     
    88106  // create full a Image array and save the needed values
    89107  ALLOCATE (image, Image, N);
     108  ALLOCATE (projectID, int, N);
     109  ALLOCATE (skycellID, int, N);
     110
    90111  for (i = 0; i < N; i++) {
    91112    image[i].imageID       = input[i].imageID      ;
     
    97118    image[i].trate         = input[i].trate        ;
    98119    image[i].ubercalDist   = input[i].ubercalDist  ;
     120    projectID[i]           = input[i].projID       ;
     121    skycellID[i]           = input[i].skycellID    ;
    99122  }
    100123  LineNumber = line_number;
     
    130153    subset[i].trate         = image[i].trate        ;
    131154    subset[i].ubercalDist   = image[i].ubercalDist  ;
     155    subset[i].projID        = projectID[i];
     156    subset[i].skycellID     = skycellID[i];
    132157  }
    133158  return subset;
     
    433458  if (!strncmp(image[i].name, name, strlen(name))) return TRUE;
    434459  return FALSE;
     460}
     461
     462// returns image.Mcal - ff(x,y)
     463int MatchImageSkycellID (off_t meas, int cat, int myProjectionID, int mySkycellID) {
     464
     465  off_t i;
     466
     467  if (!MeasureToImage) return FALSE;
     468
     469  i = MeasureToImage[cat][meas];
     470  if (i == -1) return FALSE;
     471
     472  if (projectID[i] == -1) return FALSE;
     473  if (skycellID[i] == -1) return FALSE;
     474
     475  if (projectID[i] != myProjectionID) return FALSE;
     476  if (skycellID[i] != mySkycellID) return FALSE;
     477 
     478  return TRUE;
    435479}
    436480
     
    595639    image[i].Xm    = 100.0*log10(stats.chisq);
    596640
    597     plot_setMcal (list, N, &stats, CLOUD_TOLERANCE);
     641    if (PLOTSTUFF) {
     642      fprintf (stderr, "Mcal for : %s\n", image[i].name);
     643      plot_setMcal (list, N, &stats, CLOUD_TOLERANCE);
     644    }
    598645
    599646    // bright end scatter
     
    683730}
    684731
     732static int setMcal_init_done = FALSE;
    685733void plot_setMcal (double *list, int Npts, StatType *stats, float clouds) {
    686734
     
    691739  if (!PLOTSTUFF) return;
    692740
     741  if (Npts == 0) {
     742    // fprintf (stderr, "cannot set image Mcal values yet (nan Mave)\n");
     743    return;
     744  }
     745
     746  plot_defaults (&graphdata);
     747  graphdata.xmin = -0.01;
     748  graphdata.xmax = +1.01;
     749  graphdata.ymin = -0.21;
     750  graphdata.ymax = +0.21;
     751
     752  if (!setMcal_init_done) {
     753    int kapa = get_graph(0);
     754    if (kapa < 1) {
     755      kapa = open_graph(0);
     756      if (!kapa) return;
     757    }
     758
     759    KapaClearSections (kapa);
     760    KapaClearPlots (kapa);
     761    KapaSetLimits (kapa, &graphdata);
     762    KapaSetFont (kapa, "helvetica", 14);
     763    KapaBox (kapa, &graphdata);
     764    setMcal_init_done = TRUE;
     765  }
     766
    693767  ALLOCATE (xlist, double, Npts);
    694 
    695   /**** Mcal vs seq ****/
    696   float minMcal    = +100.0;
    697   float maxMcal    = -100.0;
    698768  for (i = 0; i < Npts; i++) {
    699     xlist[i] = i;
    700     minMcal = MIN (list[i], minMcal);
    701     maxMcal = MAX (list[i], maxMcal);
    702   }
    703 
    704   float McalRange  = MAX(1.2*(maxMcal - minMcal), 0.21);
    705   float McalCenter = 0.5*(maxMcal + minMcal);
    706 
    707   plot_defaults (&graphdata);
    708   graphdata.xmin = -1;
    709   graphdata.xmax = Npts + 1;
    710   graphdata.ymin = McalCenter - 0.5*McalRange;
    711   graphdata.ymax = McalCenter + 0.5*McalRange;
    712   plot_list (&graphdata, xlist, list, Npts, "sequence vs Mcal", "%s.seq.png", OUTROOT);
     769    xlist[i] = i / (float) Npts;
     770  }
     771
     772  plot_list_add (&graphdata, xlist, list, Npts);
    713773
    714774  free (xlist);
  • trunk/Ohana/src/relphot/src/ImageSubset.c

    r35104 r35759  
    5858  char type[16];
    5959
    60   GET_COLUMN (Mcal,    "MCAL",       float);
    61   GET_COLUMN (dMcal,   "MCAL_ERR",   float);
    62   GET_COLUMN (imageID, "IMAGE_ID",   int);
    63   GET_COLUMN (map,     "PHOTOM_MAP", int);
    64   GET_COLUMN (flags,   "FLAGS",      int);
    65   GET_COLUMN (tzero,   "TZERO",      int);
    66   GET_COLUMN (trate,   "TRATE",      short);
    67   GET_COLUMN (ucdist,  "UBERCAL_DIST", short);
     60  GET_COLUMN (Mcal,      "MCAL",         float);
     61  GET_COLUMN (dMcal,     "MCAL_ERR",     float);
     62  GET_COLUMN (imageID,   "IMAGE_ID",     int);
     63  GET_COLUMN (map,       "PHOTOM_MAP",   int);
     64  GET_COLUMN (flags,     "FLAGS",        int);
     65  GET_COLUMN (projID,    "PROJ_ID",      int);
     66  GET_COLUMN (skycellID, "SKYCELL_ID",   int);
     67  GET_COLUMN (tzero,     "TZERO",        int);
     68  GET_COLUMN (trate,     "TRATE",        short);
     69  GET_COLUMN (ucdist,    "UBERCAL_DIST", short);
    6870
    6971  // XXX free the fits table data here
     
    7678    image[i].photom_map_id = map[i];
    7779    image[i].flags         = flags[i];
     80    image[i].projID        = projID[i];
     81    image[i].skycellID     = skycellID[i];
    7882    image[i].tzero         = tzero[i];
    7983    image[i].trate         = trate[i];
     
    8791  free (map);
    8892  free (flags);
     93  free (projID);
     94  free (skycellID);
    8995  free (tzero);
    9096  free (trate);
     
    124130  gfits_define_bintable_column (&theader, "J", "FLAGS", "flags", NULL, 1.0, 1.0*0x8000);
    125131
     132  gfits_define_bintable_column (&theader, "J", "PROJ_ID", "ID", NULL, 1.0, 0.0);
     133  gfits_define_bintable_column (&theader, "J", "SKYCELL_ID", "ID", NULL, 1.0, 0.0);
     134
    126135  gfits_define_bintable_column (&theader, "J", "TZERO", "exposure start", NULL, 1.0, 1.0*0x8000);
    127136  gfits_define_bintable_column (&theader, "I", "TRATE", "tti rate", NULL, 1.0, 0.0);
     
    134143  float *Mcal, *dMcal;
    135144  unsigned int *imageID, *map, *flags, *tzero;
     145  int *projID, *skycellID;
    136146  unsigned short *trate;
    137147  short *ucdist;
    138148
    139149  // create intermediate storage arrays
    140   ALLOCATE (Mcal,    float,          Nimage);
    141   ALLOCATE (dMcal,   float,          Nimage);
    142   ALLOCATE (imageID, unsigned int,   Nimage);
    143   ALLOCATE (map,     unsigned int,   Nimage);
    144   ALLOCATE (flags,   unsigned int,   Nimage);
    145   ALLOCATE (tzero,   unsigned int,   Nimage);
    146   ALLOCATE (trate,   unsigned short, Nimage);
    147   ALLOCATE (ucdist,  short,          Nimage);
     150  ALLOCATE (Mcal,      float,        Nimage);
     151  ALLOCATE (dMcal,     float,        Nimage);
     152  ALLOCATE (imageID,   unsigned int,   Nimage);
     153  ALLOCATE (map,       unsigned int,   Nimage);
     154  ALLOCATE (flags,     unsigned int,   Nimage);
     155  ALLOCATE (projID,    int,            Nimage);
     156  ALLOCATE (skycellID, int,            Nimage);
     157  ALLOCATE (tzero,     unsigned int,   Nimage);
     158  ALLOCATE (trate,     unsigned short, Nimage);
     159  ALLOCATE (ucdist,    short,          Nimage);
    148160
    149161  // assign the storage arrays
    150162  for (i = 0; i < Nimage; i++) {
    151     Mcal[i]    = image[i].Mcal;
    152     dMcal[i]   = image[i].dMcal;
    153     imageID[i] = image[i].imageID;
    154     map[i]     = image[i].photom_map_id;
    155     flags[i]   = image[i].flags;
    156     tzero[i]   = image[i].tzero;
    157     trate[i]   = image[i].trate;
    158     ucdist[i]  = image[i].ubercalDist;
     163    Mcal[i]      = image[i].Mcal;
     164    dMcal[i]     = image[i].dMcal;
     165    imageID[i]   = image[i].imageID;
     166    map[i]       = image[i].photom_map_id;
     167    flags[i]     = image[i].flags;
     168    tzero[i]     = image[i].tzero;
     169    trate[i]     = image[i].trate;
     170    ucdist[i]    = image[i].ubercalDist;
     171    projID[i]    = image[i].projID;
     172    skycellID[i] = image[i].skycellID;
    159173  }
    160174
    161175  // add the columns to the output array
    162   gfits_set_bintable_column (&theader, &ftable, "MCAL",         Mcal,    Nimage);
    163   gfits_set_bintable_column (&theader, &ftable, "MCAL_ERR",     dMcal,   Nimage);
    164   gfits_set_bintable_column (&theader, &ftable, "IMAGE_ID",     imageID, Nimage);
    165   gfits_set_bintable_column (&theader, &ftable, "PHOTOM_MAP",   map,     Nimage);
    166   gfits_set_bintable_column (&theader, &ftable, "FLAGS",        flags,   Nimage);
    167   gfits_set_bintable_column (&theader, &ftable, "TZERO",        tzero,   Nimage);
    168   gfits_set_bintable_column (&theader, &ftable, "TRATE",        trate,   Nimage);
    169   gfits_set_bintable_column (&theader, &ftable, "UBERCAL_DIST", ucdist,  Nimage);
     176  gfits_set_bintable_column (&theader, &ftable, "MCAL",         Mcal,      Nimage);
     177  gfits_set_bintable_column (&theader, &ftable, "MCAL_ERR",     dMcal,     Nimage);
     178  gfits_set_bintable_column (&theader, &ftable, "IMAGE_ID",     imageID,   Nimage);
     179  gfits_set_bintable_column (&theader, &ftable, "PHOTOM_MAP",   map,       Nimage);
     180  gfits_set_bintable_column (&theader, &ftable, "FLAGS",        flags,     Nimage);
     181  gfits_set_bintable_column (&theader, &ftable, "PROJ_ID",      projID,    Nimage);
     182  gfits_set_bintable_column (&theader, &ftable, "SKYCELL_ID",   skycellID, Nimage);
     183  gfits_set_bintable_column (&theader, &ftable, "TZERO",        tzero,     Nimage);
     184  gfits_set_bintable_column (&theader, &ftable, "TRATE",        trate,     Nimage);
     185  gfits_set_bintable_column (&theader, &ftable, "UBERCAL_DIST", ucdist,    Nimage);
    170186
    171187  free (Mcal);
     
    174190  free (map);
    175191  free (flags);
     192  free (projID);
     193  free (skycellID);
    176194  free (tzero);
    177195  free (trate);
  • trunk/Ohana/src/relphot/src/MosaicOps.c

    r35416 r35759  
    711711  if (FREEZE_MOSAICS) return (FALSE);
    712712
    713   if (NTHREADS) {
     713  // plots cannot be done in a threaded context (the plot commands collide)
     714  // so do not run setMmos in threaded mode if PLOTSTUFF is set
     715  if (NTHREADS && !PLOTSTUFF) {
    714716    int status = setMmos_threaded (catalog, PoorImages, flatcorr);
    715717    return status;
     
    734736  SetMmosInfoInit (&info, Nmax, TRUE, PoorImages);
    735737
     738  // int savePlotDelay = PLOTDELAY;
     739  // if (PLOTSTUFF) PLOTDELAY = 0.0;
     740
    736741  for (i = 0; i < Nmosaic; i++) {
    737742    setMmos_mosaic (&mosaic[i], i, image, catalog, &info, flatcorr);
    738743  }
    739744  SetMmosInfoFree (&info);
     745
     746  if (PLOTSTUFF) {
     747    fprintf (stdout, "press return\n");
     748    if (fscanf (stdin, "%*c") != 1) fprintf (stderr, "\n");
     749  }
    740750
    741751  npass_output ++;
     
    757767
    758768  StatType stats;
    759   liststats_setmode (&stats, STATMODE);
     769  // liststats_setmode (&stats, STATMODE);
     770  liststats_setmode (&stats, "INNER_WTMEAN");
    760771
    761772  double *list   = info->list;
     
    937948  }
    938949
    939   plot_setMcal (list, N, &stats, CLOUD_TOLERANCE);
     950  if (PLOTSTUFF) {
     951    fprintf (stderr, "Mmos: %6.3f %6.3f +/- %6.3f %5d %5d | %s\n", stats.mean, stats.median, stats.sigma, stats.Nmeas, N, image[MosaicToImage[Nmos][0]].name);
     952    plot_setMcal (list, N, &stats, CLOUD_TOLERANCE);
     953  }
    940954
    941955  // bright end scatter
     
    961975    // fprintf (stderr, "%d %d %d\n", (int) i, (int) im, image[im].ubercalDist);
    962976  }
     977 
    963978  return TRUE;
    964979}
  • trunk/Ohana/src/relphot/src/StarOps.c

    r35104 r35759  
    168168  for (i = 0; i < Ncatalog; i++) {
    169169    switch (SET_MREL_VERSION) {
    170       case 0:
    171         setMrel_catalog (catalog, i, pass, flatcorr, &results, Nsecfilt);
    172         break;
     170      // case 0:
     171      // setMrel_catalog (catalog, i, pass, flatcorr, &results, Nsecfilt);
     172      // break;
    173173      case 1:
    174174        setMrel_catalog_alt (catalog, i, pass, flatcorr, &results, Nsecfilt);
    175175        break;
    176176      default:
    177         fprintf (stderr, "invalid setMrel version %d (use 0 or 1)\n", SET_MREL_VERSION);
     177        fprintf (stderr, "invalid setMrel version %d (use 1)\n", SET_MREL_VERSION);
    178178        exit (2);
    179179    }
  • trunk/Ohana/src/relphot/src/args.c

    r35416 r35759  
    177177  }
    178178
    179   SET_MREL_VERSION = 1;
    180   if ((N = get_argument (argc, argv, "-set-mrel-version"))) {
    181     remove_argument (N, &argc, argv);
    182     SET_MREL_VERSION = atof(argv[N]);
    183     remove_argument (N, &argc, argv);
    184   }
    185 
    186179  UPDATE = FALSE;
    187180  if ((N = get_argument (argc, argv, "-update"))) {
     
    218211  }
    219212
     213  BOUNDARY_TREE = NULL;
    220214  if ((N = get_argument (argc, argv, "-boundary-tree"))) {
    221215    remove_argument (N, &argc, argv);
    222     load_tree (argv[N]);
     216    BOUNDARY_TREE = strcreate(argv[N]);
     217    load_tree (BOUNDARY_TREE);
    223218    remove_argument (N, &argc, argv);
    224219  }
     
    419414  }
    420415
     416  BOUNDARY_TREE = NULL;
     417  if ((N = get_argument (argc, argv, "-boundary-tree"))) {
     418    remove_argument (N, &argc, argv);
     419    BOUNDARY_TREE = strcreate(argv[N]);
     420    load_tree (BOUNDARY_TREE);
     421    remove_argument (N, &argc, argv);
     422  }
     423
    421424  /* specify portion of the sky */
    422425  UserPatch.Rmin = 0;
     
    433436    remove_argument (N, &argc, argv);
    434437    UserPatch.Dmax = atof (argv[N]);
     438    remove_argument (N, &argc, argv);
     439  }
     440
     441  SET_MREL_VERSION = 1;
     442  if ((N = get_argument (argc, argv, "-set-mrel-version"))) {
     443    remove_argument (N, &argc, argv);
     444    SET_MREL_VERSION = atof(argv[N]);
    435445    remove_argument (N, &argc, argv);
    436446  }
  • trunk/Ohana/src/relphot/src/load_images.c

    r35416 r35759  
    9595# endif
    9696
     97  if (Nimage == 0) {
     98    fprintf (stderr, "no images selected for analysis : problem with region or photcode?\n");
     99    exit (4);
     100  }
     101
    97102  // match chips to mosaics (if applicable)
    98103  initMosaics (subset, Nsubset, image, inSubset, Nimage);
  • trunk/Ohana/src/relphot/src/plot_scatter.c

    r33651 r35759  
    4848
    4949                Mrel = catalog[i].secfilt[Nsecfilt*j+Nsec].M;
     50                if (isnan(Mrel)) continue;
     51
    5052                xlist[N] = Mrel;
    5153                ylist[N] = PhotSysTiny (&catalog[i].measureT[m], &catalog[i].averageT[j], &catalog[i].secfilt[j*Nsecfilt]) - Mcal - Mmos - Mgrid - Mrel;
     
    5456            }
    5557        }
     58    }
     59
     60    if (N == 0) {
     61      fprintf (stderr, "no valid average values yet\n");
     62      continue;
    5663    }
    5764
  • trunk/Ohana/src/relphot/src/plotstuff.c

    r33651 r35759  
    1919}
    2020
     21int get_graph (int N) {
     22  return Xgraph[N];
     23}
     24
    2125int open_graph (int N) {
    2226
    2327  char name[100];
    2428
    25   sprintf (name, "gastro [%d]", N);
     29  sprintf (name, "gastro:%d", N);
    2630
    2731  // if -plot is supplied, the plots are shown on the screen;
     
    156160}
    157161
     162// plot the vector pair to a file with name defined by the varargs format
     163void plot_list_add (Graphdata *graphdata, double *xlist, double *ylist, int Npts) {
     164
     165  KapaPrepPlot (Xgraph[0], Npts, graphdata);
     166  PlotVector (Npts, xlist, 0, 0, "x");
     167  PlotVector (Npts, ylist, 1, 0, "y");
     168}
     169
    158170void plot_defaults (Graphdata *graphdata) {
    159171
  • trunk/Ohana/src/relphot/src/reload_catalogs.c

    r35104 r35759  
    156156  // load the list of hosts
    157157  HostTable *table = HostTableLoad (CATDIR, sky->hosts);
     158
     159  if (BOUNDARY_TREE) {
     160    char *tmppath = abspath(BOUNDARY_TREE, DVO_MAX_PATH);
     161    free (BOUNDARY_TREE);
     162    BOUNDARY_TREE = tmppath;
     163   
     164  }
    158165
    159166  int i;
     
    187194    if (!KEEP_UBERCAL)    { snprintf (tmpline, 1024, "%s -reset-ubercal",       command);                                         strcpy (command, tmpline); }
    188195    if (UPDATE_CATFORMAT) { snprintf (tmpline, 1024, "%s -update-catformat %s", command, UPDATE_CATFORMAT);                       strcpy (command, tmpline); }
     196    if (BOUNDARY_TREE)    { snprintf (tmpline, 1024, "%s -boundary-tree %s",    command, BOUNDARY_TREE);                          strcpy (command, tmpline); }
    189197    if (SET_MREL_VERSION != 1) { snprintf (tmpline, 1024, "%s -set-mrel-version %d", command, SET_MREL_VERSION);                  strcpy (command, tmpline); }
    190198    if (AreaSelect)       { snprintf (tmpline, 1024, "%s -area %f %f %f %f",    command, AreaXmin, AreaXmax, AreaYmin, AreaYmax); strcpy (command, tmpline); }
  • trunk/Ohana/src/relphot/src/select_images.c

    r35416 r35759  
    407407  tcoords.pc1_1  = tcoords.pc2_2 = 1.0;
    408408  tcoords.pc1_2  = tcoords.pc2_1 = 0.0;
     409
     410  tcoords.Npolyterms = 0;
     411  memset (tcoords.polyterms, 0, 14*sizeof(float));
    409412  strcpy (tcoords.ctype, "RA---TAN");
    410413
  • trunk/Ohana/src/relphot/src/setMrelCatalog.c

    r35104 r35759  
    110110    if (!isSetMrelFinal && (secfilt[Nsec].flags & STAR_BAD)) continue;
    111111
     112    int NexpPS1 = 0;
    112113    int Ncode = 0;
    113114    int Next = 0;
     
    132133      if (code->equiv != thisCode) { continue; }
    133134      Ncode ++;
     135
     136      // are we a PS1 exposure photcode?
     137      if ((measure[k].photcode >= 10000) && (measure[k].photcode <= 10500)) {
     138        NexpPS1 ++;
     139      }
    134140
    135141      if (measureT[k].dbFlags & MEAS_BAD) SKIP_THIS_MEAS(Nbad);
     
    272278    int Nminmeas = isSetMrelFinal ? 1 : STAR_TOOFEW + 1;
    273279
     280    // XXX : ugh : another hard-wired photcode entry...
     281    if (isSetMrelFinal && (pass == 0)) {
     282      if ((thisCode < 6) || (thisCode == 9)) {
     283        secfilt[Nsec].Ncode = NexpPS1;
     284      } else {
     285        secfilt[Nsec].Ncode = Ncode; // 2MASS data if it exists
     286      }
     287    }
     288
    274289    // when performing the grid analysis, STAR_TOOFEW should be set to 1;
    275290    if (N < Nminmeas) { /* too few measurements */
     
    309324
    310325      secfilt[Nsec].Mstdev = 1000.0*stats->sigma; // Mstdev is in millimags (not enough space for more precision)
    311       secfilt[Nsec].Ncode = Ncode;
     326      // secfilt[Nsec].Ncode = Ncode;
    312327      secfilt[Nsec].Nused = stats->Nmeas;
    313328
     
    391406
    392407  // set the name of the primary skycell (this is used in a strcmp to match the skycells in stack detections)
    393   BoundaryTreePrimaryCell(primaryCell, average[0].R, average[0].D);
     408  // XXX drop BoundaryTreePrimaryCell(primaryCell, average[0].R, average[0].D);
     409  int projectID = -1;
     410  int skycellID = -1;
     411  BoundaryTreePrimaryCellIDs(&projectID, &skycellID, average[0].R, average[0].D);
    394412
    395413  int NstackGood = 0;
     
    459477      // which stack image should we use for the mean value?
    460478      // if we request the primary (USE_TREE_FOR_PRIMARY), then find the min distances for data from the primary cell
    461       if (MatchImageName (meas, cat, primaryCell)) {
     479      if (MatchImageSkycellID (meas, cat, projectID, skycellID)) {
    462480        float stackPrimaryOffset = getCenterOffset (meas, cat, &measure[k], &stackImageID);
    463481        if (stackPrimaryOffset < stackPrimaryOffsetMin) {
     
    550568    if (stackPrimaryMeasureMin >= 0) {
    551569      measure[k].dbFlags |= ID_MEAS_STACK_PRIMARY;
     570      secfilt[Nsec].flags |= ID_SECF_STACK_PRIMARY;
    552571    }
    553572
  • trunk/Ohana/src/relphot/src/setMrelFinal.c

    r34749 r35759  
    1616    // flags used by the photometry analysis (excluding UBERCAL)
    1717    unsigned int PHOTOM_FLAGS =
    18       ID_MEAS_NOCAL |       // detection ignored for this analysis (photcode, time range)
    19       ID_MEAS_POOR_PHOTOM | // detection is photometry outlier
    20       ID_MEAS_SKIP_PHOTOM | // detection was ignored for photometry measurement
    21       ID_MEAS_AREA;       // detetion was outside acceptable area of device
    22    
     18      ID_MEAS_NOCAL |          // detection ignored for this analysis (photcode, time range)
     19      ID_MEAS_POOR_PHOTOM |    // detection is photometry outlier
     20      ID_MEAS_SKIP_PHOTOM |    // detection was ignored for photometry measurement
     21      ID_MEAS_AREA |           // detetion was outside acceptable area of device
     22      ID_MEAS_SYNTH_MAG |      // magnitude is synthetic
     23      ID_MEAS_STACK_PRIMARY |  // this stack measurement is in the primary skycell
     24      ID_MEAS_STACK_PHOT_SRC;  // this measurement supplied the stack photometry
     25
     26    // ID_MEAS_PHOTOM_UBERCAL -- externally-supplied zero point from ubercal analysis
     27    // this is set by 'setphot', do not reset here
     28
    2329    // flags used by the photometry analysis (excluding UBERCAL)
    2430    // unsigned int secfiltFlags =
Note: See TracChangeset for help on using the changeset viewer.