IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38523


Ignore:
Timestamp:
Jun 23, 2015, 8:51:11 PM (11 years ago)
Author:
eugene
Message:

shifting to a Catalog to carry the image stars

Location:
branches/eam_branches/ipp-20150616/Ohana/src/addstar/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20150616/Ohana/src/addstar/src/LoadData.c

    r38522 r38523  
    55
    66// examine the header sets and set the Image entries for the the valid images
    7 int LoadData (FILE *f, AddstarFile *file, Image **images, off_t *nvalid, Stars **stars, unsigned int *Nstars, Header **headers, off_t *extsize, HeaderSet *headerSets, int Nimages, AddstarClientOptions *options) {
     7Catalog *LoadData (FILE *f, AddstarFile *file, Image **images, off_t *nvalid, unsigned int *Ncatalog, Header **headers, off_t *extsize, HeaderSet *headerSets, int Nimages, AddstarClientOptions *options) {
    88
    99  off_t Nskip, Nvalid, NVALID;
    1010  int i, j, Nhead, Ndata;
    1111  uint32_t parentID = UINT32_MAX;
    12   Stars *inStars;
     12
     13  int ncatalog = 0;
     14  int NCATALOG = Nimages;
     15  Catalog *catalog = NULL;
     16  ALLOCATE (catalog, Catalog, NCATALOG);
    1317
    1418  if (images[0] == NULL) {
     
    7680    fseeko (f, Nskip, SEEK_SET);
    7781         
    78     inStars = ReadStarsFITS (f, headers[Nhead], headers[Ndata], &images[0][Nvalid].nstar);
    79     if (!inStars) {
     82    status = ReadStarsFITS (f, headers[Nhead], headers[Ndata], &images[0][Nvalid].nstar, &catalog[ncatalog]);
     83    if (!status) {
    8084      // XXX need to free the data here or in ReadStarsFITS on error
    8185      continue;
     
    9195      fseeko (f, Nskip, SEEK_SET);
    9296     
    93       if (!ReadXradFITS (f, headers[Nxrad], inStars, images[0][Nvalid].nstar)) {
     97      if (!ReadXradFITS (f, headers[Nxrad], &catalog[ncatalog], images[0][Nvalid].nstar)) {
    9498        fprintf (stderr, "problem reading the radial flux data for %s\n", headerSets[i].extdata);
    9599      }
    96100    }
    97101
    98     inStars = FilterStars (inStars, &images[0][Nvalid], Nvalid, options);
    99     *stars = MergeStars (*stars, Nstars, inStars, images[0][Nvalid].nstar);
    100     FREE (inStars);
     102    FilterStars (&catalog[ncatalog], &images[0][Nvalid], Nvalid, options);
     103
     104    // XXX merge catalogs here : I should only have one output catalog!
     105
     106    // XXX need to merge here?
     107    // *stars = MergeStars (*stars, Nstars, inStars, images[0][Nvalid].nstar);
     108    // FREE (inStars);
    101109
    102110    Nvalid++;
     
    115123}
    116124
     125// thoughts:
     126// 1) I read the data from a single image file into a catalog structure (instead of Stars)
     127// 2) merge these into a single catalog here or in LoadData above?
  • branches/eam_branches/ipp-20150616/Ohana/src/addstar/src/LoadStars.c

    r38522 r38523  
    11# include "addstar.h"
    22
    3 Stars *LoadStars (char *filename, unsigned int *Nstars, Image **images, off_t *Nimages, AddstarClientOptions *options) {
     3Catalog *LoadStars (char *filename, unsigned int *Ncatalog, Image **images, off_t *Nimages, AddstarClientOptions *options) {
    44
    55  off_t *extsize;
    66  int i, Nfile, mode;
    7   Stars *stars;
    87
    98  AddstarFile *file = LoadFilenames (&Nfile, filename, options);
    109
    1110  *Nimages = 0;
    12   *Nstars = 0;
     11  *Ncatalog = 0;
    1312  *images = NULL;
    14   stars = NULL;
     13  Catalog *catalog = NULL;
    1514
    1615  for (i = 0; i < Nfile; i++) {
     
    2322    // load PMM data if specified (these are not stored as FITS-tables)
    2423    if (PMM_CCD_TABLE != NULL) {
    25       LoadDataPMM (f, file[i].imagename, images, Nimages, &stars, Nstars);
     24      *Ncatalog = 1;
     25      // XXX catalog = LoadDataPMM (f, file[i].imagename, images, Nimages);
    2626      continue;
    2727    }
     
    5858    // if these are SDSS data, load with SDSS-specific wrapper
    5959    if (headerSets[0].exttype && !strcmp (headerSets[0].exttype, "SDSS_OBJ")) {
    60       LoadDataSDSS (f, file[i].imagename, images, Nimages, &stars, Nstars, headers, extsize, headerSets, NheaderSets);
     60      *Ncatalog = 1;
     61      // XXX catalog = LoadDataSDSS (f, file[i].imagename, images, Nimages, headers, extsize, headerSets, NheaderSets);
    6162      goto next_file;
    6263    }
     
    6465    // if these are SDSS data, load with SDSS-specific wrapper
    6566    if (headerSets[0].exttype && !strcmp (headerSets[0].exttype, "UKIRT_OBJ")) {
    66       LoadDataUKIRT (f, file[i].imagename, images, Nimages, &stars, Nstars, headers, extsize, headerSets, NheaderSets);
     67      *Ncatalog = 1;
     68      // XXX catalog = LoadDataUKIRT (f, file[i].imagename, images, Nimages, headers, extsize, headerSets, NheaderSets);
    6769      goto next_file;
    6870    }
    6971
    70     LoadData (f, &file[i], images, Nimages, &stars, Nstars, headers, extsize, headerSets, NheaderSets, options);
     72    catalog = LoadData (f, &file[i], images, Nimages, Ncatalog, headers, extsize, headerSets, NheaderSets, options);
    7173
    7274  next_file:
     
    9193
    9294  AddstarFileFree (file, Nfile);
    93   return stars;
     95  return catalog;
    9496}
    9597
Note: See TracChangeset for help on using the changeset viewer.