IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39711


Ignore:
Timestamp:
Sep 22, 2016, 11:13:19 AM (10 years ago)
Author:
eugene
Message:

added dvo loadgaia ingest version

Location:
branches/czw_branch/20160809/Ohana/src/addstar
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20160809/Ohana/src/addstar/include/gaia.h

    r39710 r39711  
    1515AddstarClientOptions args_loadgaia_client (int *argc, char **argv, AddstarClientOptions options);
    1616
    17 int loadgaia_table (SkyList *skylistInput, HostTable *hosts, char *filename, AddstarClientOptions *options);
     17int loadgaia_table (int Nstart, int Nend, SkyList *skylistInput, HostTable *hosts, char **filename, AddstarClientOptions *options);
    1818
    1919Gaia_Stars *loadgaia_make_subset (Gaia_Stars *stars, int Nstars, int start, SkyRegion *region, int *nsubset);
     
    3838Gaia_Stars *loadgaia_load_stars (char *filename, int *nstars);
    3939
    40 Gaia_Stars *loadgaia_readstars (char *filename, int *nstars);
     40Gaia_Stars *loadgaia_readstars (char *filename, Gaia_Stars *stars, int *nstars, AddstarClientOptions *options);
    4141
    4242int loadgaia_sortStars (Gaia_Stars *stars, int Nstars);
  • branches/czw_branch/20160809/Ohana/src/addstar/src/args_loadgaia.c

    r39710 r39711  
    8282    remove_argument (N, argc, argv);
    8383  }
     84  if (!options.photcode) {
     85    fprintf (stderr, "ERROR: please supply a photcode name with [-p name]\n");
     86    exit (2);
     87  }
     88
     89  /* provide a time for dataset */
     90  options.timeref = 0;
     91  if ((N = get_argument (*argc, argv, "-time"))) {
     92    time_t tmp;
     93    remove_argument (N, argc, argv);
     94    if (!ohana_str_to_time (argv[N], &tmp)) {
     95      fprintf (stderr, "syntax error in time\n");
     96      exit (1);
     97    }
     98    options.timeref = tmp;
     99    remove_argument (N, argc, argv);
     100  }
    84101
    85102  /* extra error messages */
     
    91108
    92109  /* other addstar options which cannot be used in loadgaia */
    93   options.timeref = 0;
     110  // options.timeref = 0;
    94111  options.mosaic = FALSE;
    95112  options.skip_missed = FALSE;
  • branches/czw_branch/20160809/Ohana/src/addstar/src/loadgaia.c

    r39710 r39711  
    1111int main (int argc, char **argv) {
    1212
    13   int i;
    1413  SkyTable *sky;
    1514  SkyList *skylist = NULL;
     
    2827  skylist = SkyListByPatch (sky, -1, &UserPatch);
    2928
    30   for (i = 1; i < argc; i++) {
    31     fprintf (stderr, "loading %s\n", argv[i]);
    32     loadgaia_table (skylist, NULL, argv[i], &options);
     29  int Nstart = 1;
     30  int Nend = argc;
     31  while (Nstart < Nend) {
     32    Nstart = loadgaia_table (Nstart, Nend, skylist, NULL, argv, &options);
    3333  }
     34
     35  SkyTableFree (sky);
     36  SkyListFree(skylist);
     37  FreePhotcodeTable();
     38  free (CATDIR);
     39
     40  ohana_memcheck (VERBOSE);
     41  ohana_memdump (VERBOSE);
    3442  exit (0);
    3543
  • branches/czw_branch/20160809/Ohana/src/addstar/src/loadgaia_readstars.c

    r39710 r39711  
    66  myAssert (!strcmp(type, #TYPE), "wrong column type");
    77
    8 Gaia_Stars *loadgaia_readstars (char *filename, int *nstars) {
     8Gaia_Stars *loadgaia_readstars (char *filename, Gaia_Stars *stars, int *nstars, AddstarClientOptions *options) {
    99
    1010  // read in the full FITS files
     
    2424    if (VERBOSE) fprintf (stderr, "can't read image subset header\n");
    2525    fclose (f);
    26     return NULL;
     26    return stars;
    2727  }
    2828  if (!gfits_fread_matrix (f, &matrix, &header)) {
     
    3030    gfits_free_header (&header);
    3131    fclose (f);
    32     return NULL;
     32    return stars;
    3333  }
    3434
     
    3838  if (!gfits_load_header (f, &theader)) {
    3939    fclose (f);
    40     return NULL;
     40    return stars;
    4141  }
    4242  if (!gfits_fread_ftable_data (f, &ftable, FALSE)) {
    4343    fclose (f);
    44     return (NULL);
     44    return stars;
    4545  }
    4646
     
    5353  GET_COLUMN (gMag,    "PHOT_G_MEAN_MAG",        float);
    5454  GET_COLUMN (dgFlux,  "PHOT_G_MEAN_FLUX_ERROR", float);
    55   GET_COLUMN (Nobs,    "PHOT_G_N_OBS",           float);
     55  GET_COLUMN (Nobs,    "PHOT_G_N_OBS",           short);
     56
     57  int NstarsIn = Nrow;
    5658
    5759  // free the memory associated with the FITS files
     
    6365  fclose (f);
    6466
    65   int NstarsIn = matrix.Naxis[2];
    66 
    6767  double Rmin = +360.0;
    6868  double Rmax = -360.0;
     
    7070  double Dmax = -360.0;
    7171
    72   int Nstars = 0;
    73   int NSTARS = 0.1*NstarsIn;
     72  // start off where we finished on a previous read
     73  int Nstars = *nstars;
     74  int NSTARS = Nstars + 0.1*NstarsIn;
    7475
    75   Gaia_Stars *stars = NULL;
    76   ALLOCATE (stars, Gaia_Stars, NSTARS);
     76  if (!stars) {
     77    ALLOCATE (stars, Gaia_Stars, NSTARS);
     78  } else {
     79    REALLOCATE (stars, Gaia_Stars, NSTARS);
     80  }
    7781
    7882  for (i = 0; i < NstarsIn; i++) {
     
    102106    stars[Nstars].measure.FluxPSF = flux;
    103107    stars[Nstars].measure.dFluxPSF = dgFlux[i];
     108
     109    stars[Nstars].measure.photcode = options->photcode;
     110    stars[Nstars].measure.t = options->timeref;
    104111
    105112    Nstars ++;
  • branches/czw_branch/20160809/Ohana/src/addstar/src/loadgaia_table.c

    r39710 r39711  
    11# include "addstar.h"
    22# include "gaia.h"
     3# define NSTARS_MAX 1000000
    34
    4 int loadgaia_table (SkyList *skylistInput, HostTable *hosts, char *filename, AddstarClientOptions *options) {
     5int loadgaia_table (int Nstart, int Nend, SkyList *skylistInput, HostTable *hosts, char **filename, AddstarClientOptions *options) {
    56  OHANA_UNUSED_PARAM(hosts);
    67 
    7   int i, Nstars;
     8  int i;
    89
    9   Gaia_Stars *stars = loadgaia_readstars (filename, &Nstars);
    10   if (!stars) return FALSE;
     10  int Nstars = 0;
     11  Gaia_Stars *stars = NULL;
     12  for (i = Nstart; (Nstars < NSTARS_MAX) && (i < Nend); i++) {
     13    // read the next file and append to the current set of stars
     14    fprintf (stderr, "loading %s\n", filename[i]);
     15    stars = loadgaia_readstars (filename[i], stars, &Nstars, options);
     16  }
     17  Nstart = i; // we pass back the entry for the next file to be read
     18  if (!stars) return Nstart;
     19
     20  fprintf (stderr, "writing %d stars to dvo\n", Nstars);
    1121
    1222  // sort the stars by RA
     
    4151    // loadgaia_save_remote (subset, Nsubset, hosts, region, skylist[0].filename[0], options);
    4252    loadgaia_catalog (subset, Nsubset, region, skylist[0].filename[0], options);
     53    free (subset);
     54    SkyListFree (skylist);
    4355  }
    4456
     
    4759  // harvest_all ();
    4860
    49   return TRUE;
     61  free (stars);
     62  return Nstart;
    5063}
    5164
Note: See TracChangeset for help on using the changeset viewer.