IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 38606


Ignore:
Timestamp:
Jul 20, 2015, 8:37:33 AM (11 years ago)
Author:
eugene
Message:

working on relastro

Location:
branches/eam_branches/ipp-20150625/Ohana/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20150625/Ohana/src/addstar/src/loadgalphot_readstars.c

    r38553 r38606  
    1515
    1616static float *chisqFit = NULL;
     17static float ZeroPt = 0;
    1718
    1819GalPhot_Stars *loadgalphot_readstars (char *filename, int *nstars) {
     
    6768    namehash[i][2] = -1;
    6869  }
     70
     71  ZeroPt = GetZeroPoint();
    6972
    7073  char name[256], tmpname[256];
     
    228231    stars[i].galphot.modelType = MODEL_TYPE_gal[i];
    229232    stars[i].galphot.detID     = ID_gal[i];
     233    stars[i].galphot.phtocode  = options->photcode;
    230234
    231235    // I have a grid of measurements with (Flux, dFlux, Chisq) at each point
     
    377381
    378382  // use bilinear interpolation to choose Flux @ (Xmin,Ymin)?
    379   galphot->mag    = -2.5*log10(flux[iMin]); // correct for exptime?
     383  galphot->mag    = -2.5*log10(flux[iMin]) + ZeroPt; // correct for exptime?
    380384  galphot->magErr = sqrt(fluxErr[iMin]) / flux[iMin];
    381385  galphot->chisq  = chisqMin;
  • branches/eam_branches/ipp-20150625/Ohana/src/libautocode/def/average-ps1-v5.d

    r38588 r38606  
    6969FIELD catID,          CAT_ID,      unsigned int,    unique ID for table in which object was first realized
    7070FIELD extID,          EXT_ID,      uint64_t,        external ID for object (eg PSPS objID)
    71 FIELD extIDgc,        EXT_ID_GC,   uint64_t,        external ID for object in galactic coords
     71
     72# replace extIDgc (unused) with uRgal, uDgal:
     73# FIELD extIDgc,      EXT_ID_GC,   uint64_t,        external ID for object in galactic coords
     74FIELD uRgal,          U_RA_GAL,    float,           modeled proper motion based on galactic motion
     75FIELD uDgal,          U_DEC_GAL,   float,           modeled proper motion based on galactic motion
    7276
    7377# 4 double, 2 uint64_t, 17 float, 12 int, 6 short
  • branches/eam_branches/ipp-20150625/Ohana/src/libdvo/src/dvo_catalog.c

    r38595 r38606  
    200200  average->catID           = 0;
    201201  average->extID           = 0;
    202   average->extIDgc         = 0;
     202
     203  average->uRgal           = NAN;
     204  average->uDgal           = NAN;
    203205}
    204206
  • branches/eam_branches/ipp-20150625/Ohana/src/libdvo/src/dvo_convert_PS1_V5.c

    r38553 r38606  
    218218    out[i].catID         = in[i].catID;
    219219    out[i].extID         = in[i].extID;
    220     out[i].extIDgc       = in[i].extIDgc;
     220
     221    out[i].uRgal         = in[i].uRgal;
     222    out[i].uDgal         = in[i].uDgal;
    221223  }
    222224  return (out);
     
    286288    out[i].catID          = in[i].catID;
    287289    out[i].extID          = in[i].extID;
    288     out[i].extIDgc        = in[i].extIDgc;
     290
     291    out[i].uRgal         = in[i].uRgal;
     292    out[i].uDgal         = in[i].uDgal;
    289293  }
    290294  return (out);
     
    13181322    out[i].catID          = in[i].catID;
    13191323    out[i].extID          = in[i].extID;
    1320     out[i].extIDgc        = in[i].extIDgc;
    13211324  }
    13221325  return (out);
  • branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/UpdateObjects.c

    r38605 r38606  
    4242      UpdateObjects_Chips(average, secfilt, measure, measureBig, Nsecfilt, fitStatsChips, i, m);
    4343    }
    44     if (VERBOSE2) fprintf (stderr, "catalog %d : chips "OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par : Nskip "OFF_T_FMT", Noffset "OFF_T_FMT"\n",  i,  fitStatsChips.Nave,  fitStatsChips.Npm,  fitStatsChips.Npar,  fitStatsChips.Nskip, fitStatsChips.Noffset);
    45     if (VERBOSE2) fprintf (stderr, "catalog %d : stack "OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par : Nskip "OFF_T_FMT", Noffset "OFF_T_FMT"\n",  i,  fitStatsStack.Nave,  fitStatsStack.Npm,  fitStatsStack.Npar,  fitStatsStack.Nskip, fitStatsStack.Noffset);
     44    if (VERBOSE2) fprintf (stderr, "catalog %d : chips "OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par : Nskip "OFF_T_FMT", Noffset "OFF_T_FMT"\n",  i,  fitStatsChips->Nave,  fitStatsChips->Npm,  fitStatsChips->Npar,  fitStatsChips->Nskip, fitStatsChips->Noffset);
     45    if (VERBOSE2) fprintf (stderr, "catalog %d : stack "OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par : Nskip "OFF_T_FMT", Noffset "OFF_T_FMT"\n",  i,  fitStatsStack->Nave,  fitStatsStack->Npm,  fitStatsStack->Npar,  fitStatsStack->Nskip, fitStatsStack->Noffset);
    4646    FitStatsSum (fitStatsChips, sumStatsChips);
    4747    FitStatsSum (fitStatsStack, sumStatsStack);
     
    5151  FitStatsFree (fitStatsStack);
    5252
    53   if (VERBOSE && (Ncatalog > 1)) fprintf (stderr, "fitted "OFF_T_FMT" objects ("OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par), skipped "OFF_T_FMT", "OFF_T_FMT" have too large an offset\n",  (sumStatsChips.Nave + sumStatsChips.Npm + sumStatsChips.Npar),  sumStatsChips.Nave,  sumStatsChips.Npm,  sumStatsChips.Npar,  sumStatsChips.Nskip, sumStatsChips.Noffset);
    54   if (VERBOSE && (Ncatalog > 1)) fprintf (stderr, "fitted "OFF_T_FMT" objects ("OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par), skipped "OFF_T_FMT", "OFF_T_FMT" have too large an offset\n",  (sumStatsStack.Nave + sumStatsStack.Npm + sumStatsStack.Npar),  sumStatsStack.Nave,  sumStatsStack.Npm,  sumStatsStack.Npar,  sumStatsStack.Nskip, sumStatsStack.Noffset);
     53  if (VERBOSE && (Ncatalog > 1)) fprintf (stderr, "fitted "OFF_T_FMT" objects ("OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par), skipped "OFF_T_FMT", "OFF_T_FMT" have too large an offset\n",  (sumStatsChips->Nave + sumStatsChips->Npm + sumStatsChips->Npar),  sumStatsChips->Nave,  sumStatsChips->Npm,  sumStatsChips->Npar,  sumStatsChips->Nskip, sumStatsChips->Noffset);
     54  if (VERBOSE && (Ncatalog > 1)) fprintf (stderr, "fitted "OFF_T_FMT" objects ("OFF_T_FMT" ave, "OFF_T_FMT" pm, "OFF_T_FMT" par), skipped "OFF_T_FMT", "OFF_T_FMT" have too large an offset\n",  (sumStatsStack->Nave + sumStatsStack->Npm + sumStatsStack->Npar),  sumStatsStack->Nave,  sumStatsStack->Npm,  sumStatsStack->Npar,  sumStatsStack->Nskip, sumStatsStack->Noffset);
    5555
    5656  FitStatsFree (sumStatsChips);
     
    6363// be called with just MeasureTiny set and Measure == NULL
    6464int UpdateObjects_Chips (Average *average, SecFilt *secfilt, MeasureTiny *measure, Measure *measureBig, int Nsecfilt, FitStats *fitStats, int cat, off_t measOff) {
     65
     66  int k;
    6567
    6668  int setRefColor = areImagesMatched();
     
    8284  // an object with no measurements is externally supplied
    8385  if (average[0].Nmeasure == 0) return TRUE;
    84 
    85   int NcBlue = 0;
    86   int NcRed = 0;
    8786
    8887  int mode = FIT_MODE; // start with the globally-defined fit mode
     
    108107
    109108  double Tmean, Trange, parRange;
    110   UpdateObjects_Project (fitStats->points, fitStats->Npoints, &Tmean, &Trange, &parRange);
     109  FitAstromPoints_Project (fitStats->points, fitStats->Npoints, &Tmean, &Trange, &parRange);
    111110
    112111  // to judge the quality of the PM and PAR fits, we need to fit all three models and compare Chisq
     
    131130    for (k = 0; k < fitStats->NfitAlloc; k++) {
    132131      BootstrapResample (fitStats->sample, fitStats->points, fitStats->Npoints);
    133       // XXX init fitStats->fit[k]? set fitStats->fit[k].getChisq?
    134       if (!FitPM (&fitStats->fit[k], fitStats->fitPM, fitStats->sample, fitStats->Npoints)) continue;
     132      if (!FitPM (&fitStats->fit[k], fitStats->fitdataPM, fitStats->sample, fitStats->Npoints)) continue;
    135133      fitStats->Nfit ++;
    136134    }
     
    143141
    144142    // project Ro, Do back to RA,DEC
    145     XY_to_RD (&fitPM.Ro, &fitPM.Do, fitPM.Ro, fitPM.Do, &coords);
     143    XY_to_RD (&fitPM.Ro, &fitPM.Do, fitPM.Ro, fitPM.Do, &fitStats->coords);
    146144    if (XVERB) fprintf (stderr, "project: %f %f : %f %f : %f\n", fitPM.Ro, fitPM.Do, fitPM.uR, fitPM.uD, fitPM.p);
    147145    if (fabs(fitPM.Ro) < 0.01) fprintf (stderr, "watch out for 0,360 boundary\n");
     
    175173    for (k = 0; k < fitStats->NfitAlloc; k++) {
    176174      BootstrapResample (fitStats->sample, fitStats->points, fitStats->Npoints);
    177       FitPMandPar (&fitStats->fit[k], fitStats->fitPar, fitStats->sample, fitStats->Npoints);
     175      FitPMandPar (&fitStats->fit[k], fitStats->fitdataPar, fitStats->sample, fitStats->Npoints);
    178176      fitStats->Nfit ++;
    179177    }
     
    186184    FitAstromSetChisq (&fitPar, fitStats->points, fitStats->Npoints, FIT_PM_AND_PAR);
    187185
    188     XY_to_RD (&fitPar.Ro, &fitPar.Do, fitPar.Ro, fitPar.Do, &coords);
     186    XY_to_RD (&fitPar.Ro, &fitPar.Do, fitPar.Ro, fitPar.Do, &fitStats->coords);
    189187    average[0].flags |= ID_STAR_FIT_PAR;
    190188    fitStats->Npar ++;
     
    206204    for (k = 0; k < fitStats->NfitAlloc; k++) {
    207205      BootstrapResample (fitStats->sample, fitStats->points, fitStats->Npoints);
    208       FitPosPMfixed (&fitStats->fit[k], fitStats->fitPos, fitStats->sample, fitStats->Npoints);
     206      FitPosPMfixed (&fitStats->fit[k], fitStats->fitdataPos, fitStats->sample, fitStats->Npoints);
    209207      fitStats->Nfit ++;
    210208    }
     
    214212
    215213    // project Ro, Do back to RA,DEC
    216     XY_to_RD (&fitPos.Ro, &fitPos.Do, fitPos.Ro, fitPos.Do, &coords);
     214    XY_to_RD (&fitPos.Ro, &fitPos.Do, fitPos.Ro, fitPos.Do, &fitStats->coords);
    217215    average[0].flags |= ID_STAR_FIT_AVE;
    218216    fitStats->Nave ++;
     
    286284
    287285  // what is the offset relative to the mean fit position?
    288   coords.crval1 = average[0].R;
    289   coords.crval2 = average[0].D;
    290   if (isnan(coords.crval1)) {
     286  fitStats->coords.crval1 = average[0].R;
     287  fitStats->coords.crval2 = average[0].D;
     288  if (isnan(fitStats->coords.crval1)) {
    291289    return (FALSE);
    292290  }
    293   if (isnan(coords.crval2)) {
     291  if (isnan(fitStats->coords.crval2)) {
    294292    return (FALSE);
    295293  }
    296294
    297295  double dXoff, dYoff;
    298   RD_to_XY (&dXoff, &dYoff, fit.Ro, fit.Do, &coords);
     296  RD_to_XY (&dXoff, &dYoff, fit.Ro, fit.Do, &fitStats->coords);
    299297  float dPos = hypot (dXoff, dYoff);
    300298  if (dPos > MaxMeanOffset) {
    301299    if (fitStats->Noffset < 100) {
    302       fprintf (stderr, "(%f,%f) -> (%f,%f) (%f,%f)\n", coords.crval1, coords.crval2, fit.Ro, fit.Do, dXoff, dYoff);
     300      fprintf (stderr, "(%f,%f) -> (%f,%f) (%f,%f)\n", fitStats->coords.crval1, fitStats->coords.crval2, fit.Ro, fit.Do, dXoff, dYoff);
    303301    }
    304302    fitStats->Noffset ++;
     
    333331  average[0].ChiSqPar   = fitPar.chisq;
    334332
    335   average[0].Tmean      = (Tmean * 86400 * 365.25) + T2000;
     333  average[0].Tmean      = (Tmean * 86400 * 365.25) + fitStats->T2000;
    336334  average[0].Trange     = (Trange * 86400 * 365.25);
    337335  average[0].Npos       = fit.Nfit;
     
    456454
    457455  // what is the offset relative to the mean fit position?
    458   coords.crval1 = average[0].R;
    459   coords.crval2 = average[0].D;
     456  fitStats->coords.crval1 = average[0].R;
     457  fitStats->coords.crval2 = average[0].D;
    460458
    461459  double dXoff, dYoff;
    462   RD_to_XY (&dXoff, &dYoff, fitAve.Ro, fitAve.Do, &coords);
     460  RD_to_XY (&dXoff, &dYoff, fitAve.Ro, fitAve.Do, &fitStats->coords);
    463461  float dPos = hypot (dXoff, dYoff);
    464462  if (dPos > MaxMeanOffset) {
    465463    if (fitStats->Noffset < 100) {
    466       fprintf (stderr, "(%f,%f) -> (%f,%f) (%f,%f)\n", coords.crval1, coords.crval2, fitAve.Ro, fitAve.Do, dXoff, dYoff);
     464      fprintf (stderr, "(%f,%f) -> (%f,%f) (%f,%f)\n", fitStats->coords.crval1, fitStats->coords.crval2, fitAve.Ro, fitAve.Do, dXoff, dYoff);
    467465    }
    468466    fitStats->Noffset ++;
     
    490488  for (k = 0; k < average[0].Nmeasure; k++) {
    491489
    492     if (XVERB) {
     490    if (0) {
    493491      char *date = ohana_sec_to_date (measure[k].t);
    494492      int dbFlagsBig = measureBig ? measureBig[k].dbFlags : 0;
     
    520518    // mark (as POOR) any measurements which are deviant from the mean by > ExcludeBogusRadius
    521519    if (ExcludeBogus) {
    522       coords.crval1 = average[0].R;
    523       coords.crval2 = average[0].D;
     520      fitStats->coords.crval1 = average[0].R;
     521      fitStats->coords.crval2 = average[0].D;
    524522      double Xi, Yi;
    525       RD_to_XY (&Xi, &Yi, Ri, Di, &coords);
     523      RD_to_XY (&Xi, &Yi, Ri, Di, &fitStats->coords);
    526524      double radius = hypot(Xi, Yi);
    527525      if (radius > ExcludeBogusRadius) {
     
    546544    // measure[k].t is UNIX seconds, T2000 is UNIX seconds for J2000.
    547545    // T[] is time in years since J2000 (jd = 2451545)
    548     points[Npoints].T = (measure[k].t - T2000) / (86400*365.25) ; // time relative to J2000 in years
     546    points[Npoints].T = (measure[k].t - fit->T2000) / (86400*365.25) ; // time relative to J2000 in years
    549547
    550548    // add measured systematic error in quadrature?  only do this after the fit has
Note: See TracChangeset for help on using the changeset viewer.