IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 39367 for trunk


Ignore:
Timestamp:
Feb 21, 2016, 9:50:41 AM (10 years ago)
Author:
eugene
Message:

working on UpdateObjects + IRLS

Location:
trunk/Ohana/src/relastro
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/relastro/src/FitPosPMfixed.c

    r39364 r39367  
    229229  fit->dRo = sqrt(data->A[0][0]);
    230230  fit->dDo = sqrt(data->A[1][1]);
    231   fit->duR = NAN;
    232   fit->duD = NAN;
     231  fit->duR = 0.0;
     232  fit->duD = 0.0;
    233233  fit->dp  = 0.0;
    234234
  • trunk/Ohana/src/relastro/src/UpdateObjects.c

    r39364 r39367  
    255255        for (k = 0; k < fitStats->NfitAlloc; k++) {
    256256          BootstrapResample (fitStats->sample, fitStats->nomask, Nnomask);
    257           if (!FitPM_Basic (&fitStats->fit[k], fitStats->fitdataPM, fitStats->sample, fitStats->Npoints)) continue;
     257          if (!FitPM_Basic (&fitStats->fit[k], fitStats->fitdataPM, fitStats->sample, Nnomask)) continue;
    258258          fitStats->Nfit ++;
    259259        }
     
    296296
    297297    FitAstromResultSetPM (&fitPos, 1, average);
     298    // fprintf (stderr, "fit 1: %f %f : %f %f\n", fitPos.Ro, fitPos.Do, fitPos.uR, fitPos.uD);
    298299    if ((average[0].flags & ID_STAR_USE_PAR) || (average[0].flags & ID_STAR_USE_PM)) {
    299300      if (!FitPosPMfixed_Basic (&fitPos, fitStats->fitdataPos, fitStats->points, fitStats->Npoints)) {
     
    301302      }
    302303    } else {
    303       FitAstromResultSetPM (&fitPos, 1, average);
    304304      if (!FitPosPMfixed_IRLS (&fitPos, fitStats->fitdataPos, fitStats->points, fitStats->Npoints)) {
    305305        goto doneWithFit;
    306306      }
     307      // fprintf (stderr, "fit 2: %f %f : %f %f\n", fitPos.Ro, fitPos.Do, fitPos.uR, fitPos.uD);
    307308      if (N_BOOTSTRAP_SAMPLES) {
    308309        fitStats->Nfit = 0;
     
    314315        for (k = 0; k < fitStats->NfitAlloc; k++) {
    315316          BootstrapResample (fitStats->sample, fitStats->nomask, Nnomask);
    316           if (!FitPosPMfixed_Basic (&fitStats->fit[k], fitStats->fitdataPos, fitStats->sample, fitStats->Npoints)) continue;
     317          if (!FitPosPMfixed_Basic (&fitStats->fit[k], fitStats->fitdataPos, fitStats->sample, Nnomask)) continue;
    317318          fitStats->Nfit ++;
    318319        }
     
    325326    // project Ro, Do back to RA,DEC
    326327    XY_to_RD (&fitPos.Ro, &fitPos.Do, fitPos.Ro, fitPos.Do, &fitStats->coords);
    327     if (fabs(fitPM.Ro) < 0.01) fprintf (stderr, "watch out for 0,360 boundary\n");
     328    if (fabs(fitPos.Ro) < 0.01) fprintf (stderr, "watch out for 0,360 boundary\n");
    328329
    329330    average[0].flags |= ID_STAR_FIT_AVE;
  • trunk/Ohana/src/relastro/src/fitobj.c

    r39364 r39367  
    6666  }
    6767
     68
    6869  if (argc != 2) {
    6970    fprintf (stderr, "USAGE: %s (mode)\n", argv[0]);
     
    7273    exit (2);
    7374  }
     75
     76  FIT_MODE = FIT_NONE;
     77  if (!strcasecmp(argv[1], "pos")) {
     78    FIT_MODE = FIT_AVERAGE;
     79  }
     80  if (!strcasecmp(argv[1], "pm")) {
     81    FIT_MODE = FIT_PM_ONLY;
     82  }
     83  if (!strcasecmp(argv[1], "plx")) {
     84    FIT_MODE = FIT_PM_AND_PAR;
     85  }
     86  if (FIT_MODE == FIT_NONE) {
     87    fprintf (stderr, "USAGE: %s (mode)\n", argv[0]);
     88    fprintf (stderr, "  mode: pos, pm, plx\n");
     89    fprintf (stderr, " options: -Nstars [3000], -Npoints [100], -Noutliers [10], -Nbootstrap [100]\n");
     90    exit (2);
     91  }
     92
     93  // some relastro globals need to be set
     94  N_BOOTSTRAP_SAMPLES = N_BOOTSTRAP;
     95  USE_GALAXY_MODEL = TRUE;
     96  MaxMeanOffset = 10.0;
    7497
    7598  // load reference table here
     
    104127    double uD  = 0.5*(drand48() - 0.5);
    105128
    106     double plx = 0.5*(drand48() + 0.0);
     129    double plx = (FIT_MODE == FIT_PM_AND_PAR) ? 0.5*(drand48() + 0.0) : 0.0;
    107130
    108131    // generate a single fake star with N_POINTS real points and N_OUTLIERS bad points
     
    112135
    113136    double Tmean = ohana_sec_to_mjd(catalog->average->Tmean);
     137    double Tyear = (Tmean - MJD_J2000) / 365.25;
    114138    fprintf (stdout, "%12.8f %12.8f %8.6f %8.6f %8.6f | %12.8f %12.8f %8.6f %8.6f %8.6f | %12.8f |  %8.6f %8.6f %8.6f %8.6f %8.6f  %d | %f %f %f\n",
    115139             Ro, Do, uR, uD, plx,
    116              catalog->average->R,  catalog->average->D,  catalog->average->uR,  catalog->average->uD,  catalog->average->P, Tmean,
     140             catalog->average->R,  catalog->average->D,  catalog->average->uR,  catalog->average->uD,  catalog->average->P, Tyear,
    117141             catalog->average->dR, catalog->average->dD, catalog->average->duR, catalog->average->duD, catalog->average->dP, catalog->average->Npos,
    118142             catalog->average->ChiSqAve, catalog->average->ChiSqPM, catalog->average->ChiSqPar);
     
    146170  }
    147171
     172  catalog->average->objID = 1;
     173  catalog->average->catID = 1;
     174
     175  catalog->average->R = Ro;
     176  catalog->average->D = Do;
     177  catalog->average->uR = uR;
     178  catalog->average->uD = uD;
     179  catalog->average->uRgal = uR;
     180  catalog->average->uDgal = uD;
    148181  for (i = 0; i < Npoints; i++) {
    149182    // ParFactor expects a time which is in years since J2000 (MJD_..._YRS is so defined)
     
    162195    catalog->measureT[i].D = Do + (dD + plx*pD + uD*(Tyears - MJD_REF_YRS))/3600;
    163196
    164     catalog->measureT[i].dXccd = POS_ERROR;
    165     catalog->measureT[i].dYccd = POS_ERROR;
     197    catalog->measureT[i].dXccd = ToShortPixels(POS_ERROR);
     198    catalog->measureT[i].dYccd = ToShortPixels(POS_ERROR);
    166199
    167200    catalog->measureT[i].photcode = 10233;
     201
     202    // nominal values to avoid dropping in MeasFilterTest
     203    catalog->measureT[i].M = 20.0;
     204    catalog->measureT[i].dM = 0.02;
     205    catalog->measureT[i].dt = 2.5*log10(30.0);
    168206  }
    169207
     
    188226
    189227    catalog->measureT[i].photcode = 10233;
     228
     229    // nominal values to avoid dropping in MeasFilterTest
     230    catalog->measureT[i].M = 20.0;
     231    catalog->measureT[i].dM = 0.02;
     232    catalog->measureT[i].dt = 2.5*log10(30.0);
    190233  }
    191234  catalog->average->Nmeasure = Ntotal;
  • trunk/Ohana/src/relastro/test/mana.sh

    r39363 r39367  
    3737
    3838  foreach nboot 20 30 100 300 1000
    39     exec bin/fitpm.lin64 -Nstars 3000 -Noutliers 20 -Npoints 100 -Nbootstrap $nboot $1 > test.$1.dat
     39    exec ../bin/fitpm.lin64 -Nstars 3000 -Noutliers 20 -Npoints 100 -Nbootstrap $nboot $1 > test.$1.dat
    4040    reload test.$1.dat
    4141
     
    5151
    5252  foreach outliers 0 3 10 30 100
    53     exec bin/fitpm.lin64 -Nstars 3000 -Noutliers $outliers -Npoints 100 -Nbootstrap 100 $1 > test.$1.dat
     53    exec ../bin/fitpm.lin64 -Nstars 3000 -Noutliers $outliers -Npoints 100 -Nbootstrap 100 $1 > test.$1.dat
    5454    reload test.$1.dat
    5555
Note: See TracChangeset for help on using the changeset viewer.