IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 19, 2015, 6:26:28 AM (11 years ago)
Author:
eugene
Message:

big re-work of UpdateObjects to allow bootstrap resampling, outlier rejection, and fixed-pm fitting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20150625/Ohana/src/relastro/src/FitAstromOps.c

    r38599 r38604  
    1212  fitStats->Noffset = 0;
    1313
    14   // container to hold the fit results (Nboot > 1 for bootstrap resampling)
    15   fitStats->fit = NULL;
     14  fitStats->values = NULL; // pre-allocated array for median & robust sigma
     15  fitStats->fit = NULL; // container to hold the fit results (Nboot > 1 for bootstrap resampling)
    1616  fitStats->Nfit = 0;
    1717  fitStats->NfitAlloc = Nboot;
    1818  if (Nboot > 0) {
    1919    ALLOCATE (fitStats->fit, FitAstromResult, Nboot);
     20    ALLOCATE (fitStats->values, double, Nboot);
    2021  }
    2122
     
    3132
    3233  // pre-allocated fit matrices for the 3 fit options
    33   fitStats->fitPos = NULL;
    34   fitStats->fitPM  = NULL;
    35   fitStats->fitPar = NULL;
     34  fitStats->fitdataPos = NULL;
     35  fitStats->fitdataPM  = NULL;
     36  fitStats->fitdataPar = NULL;
    3637
    3738  if (Nmax > 0) {
    38     fitStats->fitPos = FitAstromDataInit (2);
    39     fitStats->fitPM  = FitAstromDataInit (4);
    40     fitStats->fitPar = FitAstromDataInit (5);
     39    fitStats->fitdataPos = FitAstromDataInit (2);
     40    fitStats->fitdataPM  = FitAstromDataInit (4);
     41    fitStats->fitdataPar = FitAstromDataInit (5);
    4142  }
    4243
     
    7273
    7374  FREE (fitStats->fit);
     75  FREE (fitStats->values);
    7476  FREE (fitStats->points);
    7577  FREE (fitStats->sample);
    7678
    77   FitAstromDataFree (fitStats->fitPos);
    78   FitAstromDataFree (fitStats->fitPM);
    79   FitAstromDataFree (fitStats->fitPar);
     79  FitAstromDataFree (fitStats->fitdataPos);
     80  FitAstromDataFree (fitStats->fitdataPM);
     81  FitAstromDataFree (fitStats->fitdataPar);
    8082
    8183  free (fitStats);
     
    105107}
    106108
    107 
    108 
    109 void FitAstromObjectInit (FitAstromObject *object) {
     109void FitAstromPointInit (FitAstromObject *object) {
    110110  object->X      = 0.0;
    111111  object->Y      = 0.0;
     
    125125}
    126126
    127 void freeObjectData () {
     127void FitAstromResultInit (FitAstromResult *fit) {
    128128
    129   free (R);
    130   free (D);
    131   free (T);
    132   free (X);
    133   free (Y);
     129  fit->Ro  = 0.0;
     130  fit->dRo = 0.0;
     131  fit->Do  = 0.0;
     132  fit->dDo = 0.0;
     133  fit->uR  = 0.0;
     134  fit->duR = 0.0;
     135  fit->uD  = 0.0;
     136  fit->duD = 0.0;
     137  fit->p   = 0.0;
     138  fit->dp  = 0.0;
    134139
    135   free (dR);
    136   free (dD);
    137   free (dT);
    138   free (dX);
    139   free (dY);
    140 
    141   free (pX);
    142   free (pY);
    143 
    144   free (C_blue);
    145   free (C_red);
    146 
    147 
     140  fit->chisq = NAN;
     141  fit->Nfit = 0;
     142 
     143  return;
     144}
Note: See TracChangeset for help on using the changeset viewer.