IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 37402


Ignore:
Timestamp:
Sep 19, 2014, 3:58:14 PM (12 years ago)
Author:
eugene
Message:

working on loadstar

Location:
branches/eam_branches/ipp-20140904/Ohana/src
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/Makefile

    r37357 r37402  
    2424sedstar      : $(BIN)/sedstar.$(ARCH)
    2525load2mass    : $(BIN)/load2mass.$(ARCH)
     26loadstarpar  : $(BIN)/loadstarpar.$(ARCH)
    2627loadwise     : $(BIN)/loadwise.$(ARCH)
    2728dumpskycells : $(BIN)/dumpskycells.$(ARCH)
     
    3132mkcmf        : $(BIN)/mkcmf.$(ARCH)
    3233
    33 all: addstar addstar_client sedstar load2mass skycells mkcmf loadwise loadsupercos dumpskycells findskycell
    34 
    35 INSTALL = addstar addstar_client sedstar load2mass skycells mkcmf loadwise loadsupercos dumpskycells findskycell
     34all: addstar addstar_client sedstar load2mass loadstarpar skycells mkcmf loadwise loadsupercos dumpskycells findskycell
     35
     36INSTALL = addstar addstar_client sedstar load2mass loadstarpar skycells mkcmf loadwise loadsupercos dumpskycells findskycell
    3637
    3738# I need to fix the client/server version of addstar now that I have dropped Stars
     
    241242$(SRC)/psps_ids.$(ARCH).o
    242243
     244LOAD-STARPAR = \
     245$(SRC)/loadstarpar.$(ARCH).o \
     246$(SRC)/loadstarpar_rawdata.$(ARCH).o \
     247$(SRC)/loadstarpar_catalog.$(ARCH).o \
     248$(SRC)/loadstarpar_readstars.$(ARCH).o \
     249$(SRC)/loadstarpar_make_subset.$(ARCH).o \
     250$(SRC)/loadstarpar_save_remote.$(ARCH).o \
     251$(SRC)/loadstarpar_io.$(ARCH).o \
     252$(SRC)/loadstarpar_remote_hosts.$(ARCH).o \
     253$(SRC)/find_matches_refstars.$(ARCH).o \
     254$(SRC)/args_loadstarpar.$(ARCH).o \
     255$(SRC)/replace_match.$(ARCH).o \
     256$(SRC)/update_coords.$(ARCH).o \
     257$(SRC)/SkyRegionUtils.$(ARCH).o \
     258$(SRC)/StarOps.$(ARCH).o \
     259$(SRC)/ConfigInit.$(ARCH).o \
     260$(SRC)/Shutdown.$(ARCH).o \
     261$(SRC)/SetSignals.$(ARCH).o \
     262$(SRC)/psps_ids.$(ARCH).o
     263
    243264LOAD-WISE = \
    244265$(SRC)/loadwise.$(ARCH).o \
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar_client.c

    r37395 r37402  
    1515  StarPar_Stars *stars = loadstarpar_load_stars (INPUT, &Nstars);
    1616
    17   loadstarpar_catalog (stars, Nstars, region);
     17  loadstarpar_catalog (stars, Nstars, region, CPT_FILE);
    1818
    1919  free (stars);
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar_rawdata.c

    r37395 r37402  
    3939    // In parallel mode, write out the subset to a disk file.  Block until a remote host
    4040    // is available.  In serial mode, just match against the appropriate region and save
    41     loadstarpar_save_remote (subset, Nsubset, hosts, region);
     41    loadstarpar_save_remote (subset, Nsubset, hosts, region, skylist[0].filename[0]);
    4242  }
    4343
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/loadstarpar_save_remote.c

    r37395 r37402  
    22# include "loadstarpar.h"
    33
    4 int loadstarpar_save_remote (StarPar_Stars *stars, int Nstars, HostTable *hosts, SkyRegion *region) {
     4int loadstarpar_save_remote (StarPar_Stars *stars, int Nstars, HostTable *hosts, SkyRegion *region, char *fullname) {
    55
    66  char uniquer[12];
     
    1010
    1111  // if this region is a parallel thing, save and launch remote
    12   if (region->hostID) {
     12  if (!region->hostID) {
     13    loadstarpar_catalog (stars, Nstars, region, fullname);
     14  } else {
    1315    int N = hosts->index[region->hostID];
    1416    HostInfo *hostMach = hosts->hosts[N];
  • branches/eam_branches/ipp-20140904/Ohana/src/addstar/src/resort_catalog.c

    r37334 r37402  
    3838  resort_catalog_measure (catalog);
    3939  resort_catalog_lensing (catalog);
     40  resort_catalog_starpar (catalog);
    4041}
    4142
     
    335336}
    336337
     338void resort_catalog_starpar (Catalog *catalog) {
     339
     340  off_t Naverage, Nstarpar;
     341  Starpar *starpar;
     342  Average *average;
     343  off_t i, j, N, currentAve;
     344
     345  off_t *starparSeq = NULL;
     346  off_t *averageSeq = NULL;
     347  Starpar *starparTMP = NULL;
     348
     349  // struct timeval start, stop;
     350  // gettimeofday (&start, NULL);
     351
     352  /* internal counters */
     353  Nstarpar = catalog[0].Nstarpar;
     354  Naverage = catalog[0].Naverage;
     355
     356  if (!Nstarpar) return;
     357
     358  starpar = catalog[0].starpar;
     359  average = catalog[0].average;
     360 
     361  // we have a table of average objects and an unsorted table of measurements.  each measurement
     362  // has a reference to the average object sequence (as well as an ID)
     363  // starpar[i].averef -> average[averef]
     364  // starpar[i].objID = average[averef].objID
     365  // starpar[i].catID = average[averef].catID
     366
     367  // we want a sorted starpar array with all averef entries in sequence
     368
     369  ALLOCATE (starparSeq, off_t,   Nstarpar);
     370  ALLOCATE (averageSeq, off_t,   Nstarpar);
     371
     372  for (i = 0; i < Nstarpar; i++) {
     373    starparSeq[i] = i;
     374    averageSeq[i] = starpar[i].averef;
     375   
     376    if (catalog[0].catformat >= DVO_FORMAT_PS1_V1) {
     377      // earlier formats did not carry the objID or catID, so they are not available (we could assign on load, but we don't)
     378      myAssert(average[averageSeq[i]].catID == starpar[starparSeq[i]].catID, "object / detection mismatch");
     379# if (1)
     380      myAssert(average[averageSeq[i]].objID == starpar[starparSeq[i]].objID, "object / detection mismatch");
     381# else
     382      // for reasons I do not understand, the mini dvodbs generated on stsci1X had a handful of detections with an inconsistency between averef and objID. 
     383      // this happened for 28 detections in the dbs on /data/stsci1?.0/eugene/dvo3pi.20130616, but not at all (as far as I know) in the rest of LAP DVO
     384      if (average[averageSeq[i]].objID != starpar[starparSeq[i]].objID) {
     385        fprintf (stderr, "R");
     386        starpar[starparSeq[i]].objID = average[averageSeq[i]].objID; // XXX I don't really like this...
     387      }
     388# endif
     389    }
     390  }
     391 
     392  // check that averageSeq is now in order
     393  // for (i = 1; i < Nstarpar; i++) {
     394  //   if (averageSeq[i] < averageSeq[i-1]) {
     395  //     fprintf (stderr, "%d ", (int) i);
     396  //   }
     397  // }
     398  // fprintf (stderr, "\n");
     399
     400  SortAveMatch(starparSeq, averageSeq, Nstarpar);
     401  // MARKTIME("sort : %f sec\n", dtime);
     402
     403  // check that averageSeq is now in order
     404  // for (i = 1; i < Nstarpar; i++) {
     405  //   if (averageSeq[i] < averageSeq[i-1]) {
     406  //     fprintf (stderr, "%d ", (int) i);
     407  //   }
     408  // }
     409  // fprintf (stderr, "\n");
     410
     411  // copy the starpar entries in the sorted order
     412  ALLOCATE (starparTMP, Starpar, Nstarpar);
     413  for (i = 0; i < Nstarpar; i++) {
     414    j = starparSeq[i];
     415    starparTMP[i] = starpar[j];
     416  }
     417  // MARKTIME("assign starpar : %f sec\n", dtime);
     418
     419  // update the values of average.starparOffset and average.Nstarpar
     420  FREE(starpar);
     421  catalog[0].starpar = starparTMP;
     422
     423  N = 0;
     424  currentAve = averageSeq[0];
     425  average[currentAve].starparOffset = 0;
     426  for (i = 0; i < Nstarpar; i++) {
     427    if (averageSeq[i] != currentAve) {
     428      // we have hit the next entry in the list
     429      average[currentAve].Nstarpar = N;
     430      N = 0;
     431      currentAve = averageSeq[i];
     432      average[currentAve].starparOffset = i;
     433    }
     434    N++;
     435  }
     436  // N++;
     437  average[currentAve].Nstarpar = N;
     438  // MARKTIME("update Nstarpar : %f sec\n", dtime);
     439
     440  int NstarparTotal = 0;
     441  int starparOffsetOK = TRUE;
     442  for (i = 0; i < Naverage; i++) {
     443    NstarparTotal += catalog[0].average[i].Nstarpar;
     444    if (VERBOSE && !(NstarparTotal <= catalog[0].Nstarpar)) {
     445      fprintf (stderr, "too few starpar: %d %d %d\n", (int) i, NstarparTotal, (int) catalog[0].Nstarpar);
     446    }
     447    starparOffsetOK &= (catalog[0].average[i].starparOffset < catalog[0].Nstarpar);
     448    if (VERBOSE && !(catalog[0].average[i].starparOffset < catalog[0].Nstarpar)) {
     449      fprintf (stderr, "offset too large: %d %d %d\n", (int) i, catalog[0].average[i].Nstarpar, (int) catalog[0].Nstarpar);
     450    }
     451    starparOffsetOK &= (catalog[0].average[i].starparOffset + catalog[0].average[i].Nstarpar <= catalog[0].Nstarpar);
     452    if (VERBOSE && !(catalog[0].average[i].starparOffset + catalog[0].average[i].Nstarpar <= catalog[0].Nstarpar)) {
     453      fprintf (stderr, "orrset + Nstarpar too large: %d + %d > %d %d\n", (int) i, catalog[0].average[i].starparOffset, catalog[0].average[i].Nstarpar, (int) catalog[0].Nstarpar);
     454    }
     455  }
     456
     457  if (!starparOffsetOK) {
     458    fprintf (stderr, "ERROR: catalog %s has an invalid starparOffset\n", catalog[0].filename);
     459  }
     460
     461  if (NstarparTotal != catalog[0].Nstarpar) {
     462    fprintf (stderr, "ERROR: catalog %s has an invalid Nstarpar\n", catalog[0].filename);
     463  }
     464
     465  // MARKTIME("  match time %9.4f sec for %7lld starpars, %6lld average\n", dtime, (long long) Nstarpar, (long long) Naverage);
     466
     467  catalog[0].sorted = TRUE;
     468
     469  FREE (starparSeq);
     470  FREE (averageSeq);
     471
     472  return;
     473}
     474
    337475// sort the measure or lensing Sequence based on the average Sequence entries
    338476void SortAveMatch (off_t *MEAS, off_t *AVE, off_t N) {
  • branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/starpar-ps1-v5.d

    r37390 r37402  
    22EXTNAME      DVO_STELLAR_PARAMS_PS1_V5
    33TYPE         BINTABLE
    4 SIZE         48
     4SIZE         72
    55DESCRIPTION  DVO Table of Stellar Properties
    66
    77FIELD galLat,         GAL_LAT,       double,         galactic latitude
    88FIELD galLon,         GAL_LON,       double,         galactic longitude
    9 FIELD MKtype,         MK_TYPE,       float,          O0 = 0.0?
    10 FIELD Par,            PARALLAX,      float,          1/pc
    11 FIELD dPar,           PARALLAX_ERR,  float,          1/pc
     9FIELD Ebv,            E_BV,          float,          extinction
     10FIELD dEbv,           E_BV_ERR,      float,          extinction error
     11FIELD DistMag,        DISTANCE_MOD,     float,       mag
     12FIELD dDistMag,       DISTANCE_MOD_ERR, float,       mag
     13FIELD M_r,            M_R_ABS,       float,          r-band abs magnitude
     14FIELD dM_r,           M_R_ABS_ERR,   float,          r-band abs magnitude error
     15FIELD FeH,            F_E_H,         float,          metallicity
     16FIELD dFeH,           F_E_H_ERR,     float,          metallicity error
    1217FIELD uRA,            U_RA,          float,          model guess for proper motion
    1318FIELD uDEC,           U_DEC,         float,          model guess for proper motion
     
    1520FIELD objID,          OBJ_ID,        unsigned int,   unique ID for object in table
    1621FIELD catID,          CAT_ID,        unsigned int,   unique ID for table in which object was first realized
    17 
    18 # this is the list of stellar parameters loaded from Greg Green's tables:
     22FIELD dummy,          DUMMY,         unsigned int,   dummy
  • branches/eam_branches/ipp-20140904/Ohana/src/libautocode/def/starpar.d

    r37395 r37402  
    22EXTNAME      DVO_STELLAR_PARAMS
    33TYPE         BINTABLE
    4 SIZE         48
     4SIZE         72
    55DESCRIPTION  DVO Table of Stellar Properties
    66
     
    2020FIELD objID,          OBJ_ID,        unsigned int,   unique ID for object in table
    2121FIELD catID,          CAT_ID,        unsigned int,   unique ID for table in which object was first realized
     22FIELD dummy,          DUMMY,         unsigned int,   dummy
    2223
    2324# this is the list of stellar parameters loaded from Greg Green's tables:
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/coordops.c

    r37395 r37402  
    656656  if (status) {
    657657    char equinoxString[80];
    658     int haveEquinox = gfits_scan (header, "EQUINOX", "%s", 1, &equinoxString);
     658    int haveEquinox = gfits_scan (header, "EQUINOX", "%s", 1, equinoxString);
    659659    if (haveEquinox) {
    660660      // is the string a valid number (it is bad to interpret an error message as year 0.0)
     
    664664    }
    665665    if (!haveEquinox) {
    666       haveEquinox = gfits_scan (header, "EPOCH", "%s", 1, &equinoxString);
     666      haveEquinox = gfits_scan (header, "EPOCH", "%s", 1, equinoxString);
    667667      if (haveEquinox) {
    668668        // is the string a valid number (it is bad to interpret an error message as year 0.0)
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_catalog.c

    r37395 r37402  
    440440// init all data, or just catalog data
    441441void dvo_starpar_init (StarPar *starpar) {
    442   starpar->galLat = NAN;
    443   starpar->galLon = NAN;
    444   starpar->MKtype = NAN;
    445   starpar->Par    = NAN;
    446   starpar->dPar   = NAN;
    447   starpar->uRA    = NAN;
    448   starpar->uDEC   = NAN;
    449   starpar->averef = -1;
    450   starpar->objID  = -1;
    451   starpar->catID  = -1;
     442  starpar->galLat   = NAN;
     443  starpar->galLon   = NAN;
     444  starpar->Ebv      = NAN;
     445  starpar->dEbv     = NAN;
     446  starpar->DistMag  = NAN;
     447  starpar->dDistMag = NAN;
     448  starpar->M_r      = NAN;
     449  starpar->dM_r     = NAN;
     450  starpar->FeH      = NAN;
     451  starpar->dFeH     = NAN;
     452  starpar->uRA      = NAN;
     453  starpar->uDEC     = NAN;
     454  starpar->averef   = -1;
     455  starpar->objID    = -1;
     456  starpar->catID    = -1;
    452457}
    453458
  • branches/eam_branches/ipp-20140904/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c

    r37395 r37402  
    678678    out[i].galLon  = in[i].galLon;     
    679679
    680     out[i].MKtype  = in[i].MKtype;     
    681     out[i].Par     = in[i].Par   ;     
    682     out[i].dPar    = in[i].dPar  ;     
    683     out[i].uRA     = in[i].uRA   ;     
    684     out[i].uDEC    = in[i].uDEC  ;     
     680    out[i].Ebv       = in[i].Ebv     ;     
     681    out[i].dEbv      = in[i].dEbv    ;     
     682    out[i].DistMag   = in[i].DistMag ;     
     683    out[i].dDistMag  = in[i].dDistMag;     
     684    out[i].M_r       = in[i].M_r     ;     
     685    out[i].dM_r      = in[i].dM_r    ;     
     686    out[i].FeH       = in[i].FeH     ;     
     687    out[i].dFeH      = in[i].dFeH    ;     
     688    out[i].uRA       = in[i].uRA     ;     
     689    out[i].uDEC      = in[i].uDEC    ;     
    685690
    686691    out[i].averef  = in[i].averef;
     
    703708    out[i].galLon  = in[i].galLon;     
    704709
    705     out[i].MKtype  = in[i].MKtype;     
    706     out[i].Par     = in[i].Par   ;     
    707     out[i].dPar    = in[i].dPar  ;     
    708     out[i].uRA     = in[i].uRA   ;     
    709     out[i].uDEC    = in[i].uDEC  ;     
     710    out[i].Ebv       = in[i].Ebv     ;     
     711    out[i].dEbv      = in[i].dEbv    ;     
     712    out[i].DistMag   = in[i].DistMag ;     
     713    out[i].dDistMag  = in[i].dDistMag;     
     714    out[i].M_r       = in[i].M_r     ;     
     715    out[i].dM_r      = in[i].dM_r    ;     
     716    out[i].FeH       = in[i].FeH     ;     
     717    out[i].dFeH      = in[i].dFeH    ;     
     718    out[i].uRA       = in[i].uRA     ;     
     719    out[i].uDEC      = in[i].uDEC    ;     
    710720
    711721    out[i].averef  = in[i].averef;
Note: See TracChangeset for help on using the changeset viewer.