IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 7, 2020, 12:27:41 PM (6 years ago)
Author:
eugene
Message:

working on adapting IRLS fitting with Priors for zero points

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/relphot/include/relphot.h

    r41428 r41453  
    9191
    9292typedef struct {
    93   unsigned int start;
    94   unsigned int stop;
    9593  short photcode;
    9694  float McalPSF;
     
    110108  off_t NMEASURE;
    111109  off_t *measure;
    112 
    113   off_t Ncatalog; // XX not needed
    114   off_t NCATALOG; // XX not needed
    115110  off_t *catalog;
     111
     112  void *parent;
    116113} TGroup;
     114
     115// we have an array of TGroup times, each pointing to N sets of data values
     116typedef struct {
     117  unsigned int start;
     118  unsigned int stop;
     119  TGroup *byCode; // each of these contains the collection of images for the time and photcode
     120  int      nCode;
     121} TGTimes;
    117122
    118123typedef enum {
     
    163168
    164169} StatDataSet;
     170
     171typedef struct {
     172  double *xVector;            // complete list of values in independent variable (optional)
     173  double *yVector;            // complete list of values available
     174  double *dyVector;           // complete list of errors available
     175} FitDataType;
     176 
     177// this structure carries the data and pre-allocated arrays for
     178// 1D fitting with arbitrary order for data with external weights,
     179// optional priors, irls iterations, and bootstrap resampling
     180typedef struct {
     181  int     order;              // order of fit (e.g., y = C0 + C1*x has order = 1)
     182  int     nterm;              // number of fitted parameters (order + 1)
     183  int     mterm;              // number of summations needed for OLS (2*order + 1)
     184
     185  int     Nlist;              // total number of measurements in list (may be more than the number to use)
     186  int     Nbootstrap;         // number of bootstrap iterations
     187
     188  // input data & parameters:
     189  FitDataType *alldata;       // full data set
     190
     191  double *bPriorValue;        // prior value
     192  double *bPriorSigma;        // prior sigma
     193
     194  // internal / temporary arrays:
     195  FitDataType *keepdata;      // unclipped data for bootstrap analysis
     196  FitDataType *sample;        // sample for a bootstrap iteration
     197
     198  double *yOffVector;         // difference between yFit and yObs
     199
     200  double *tmpVector;          // internal copy of values to use in, e.g., calculation of median
     201  double *wtIRLS;             // IRLS weights (distance from model value weighted by standard error)
     202
     203  double **cArray;
     204  double  *sumVector;         // pre-allocated to mterm (2*order + 1)
     205
     206  double **bArray;
     207  double **bSaveArray;
     208  double **bBootArray;        // values generated by the bootstrap resampling
     209
     210  // output results:
     211  double *bSigma;             // 1 sigma range of parameters
     212
     213  double  min;                // min of bSigma[0] values
     214  double  max;                // max of bSigma[0] values
     215  double  sigma;              // (sample) standard deviation of bSigma[0] values
     216  double  chisq;              // chisq of fit (unmasked values only)
     217  int     Nmeas;              // number of unmasked values used in fit
     218} FitDataSet;
    165219
    166220typedef struct {
     
    311365double IMAGE_SCATTER;
    312366double IMAGE_OFFSET;
     367double NIGHT_SCATTER;
     368double NIGHT_OFFSET;
    313369double STAR_SCATTER;
    314370double STAR_CHISQ;
     
    497553int           liststats_irls      PROTO((StatDataSet *dataset, int Npoints, StatType *stats));
    498554int           liststats_fit1d     PROTO((double *value, double *err, double *x, int Npts, StatType *stats, double *dk));
     555double        weight_cauchy       PROTO((double x));
     556double        VectorFractionInterpolate PROTO((double *values, float fraction, int Npoints));
     557
     558// fit1d_irls:
     559int           fit1d_irls          PROTO((FitDataSet *dataset, int Npoints));
     560void          FitDataSetFree      PROTO((FitDataSet *dataset));
     561void          FitDataSetAlloc     PROTO((FitDataSet *dataset, int Nmax, int order, int Nbootstrap));
     562void          FitDataSetAddPriors PROTO((FitDataSet *dataset));
    499563
    500564unsigned int *ReadTGroupFile      PROTO((FILE *f, int *nelem));
     
    502566void          initTGroupsMcal     PROTO((void));
    503567TGroup       *getTGroupForImage   PROTO((off_t im));
    504 off_t         findTGroup          PROTO((unsigned int start, int photcode));
     568TGroup       *findTGroup          PROTO((unsigned int start, int photcode));
    505569
    506570Catalog      *load_catalogs       PROTO((SkyList *skylist, int *Ncatalog, int hostID, char *hostpath, char *syncfile));
     
    527591void          plot_star_coords    PROTO((Catalog *catalog, int Ncatalog));
    528592void          plot_stars          PROTO((Catalog *catalog, int Ncatalog));
     593void          plot_setMcal        PROTO((double *list, int Npts));
    529594
    530595void          plot_list_add       PROTO((Graphdata *graphdata, double *xlist, double *ylist, int N));
Note: See TracChangeset for help on using the changeset viewer.