IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jul 11, 2012, 10:30:13 AM (14 years ago)
Author:
eugene
Message:

add Mkron, dMkron to measure and secfilt; add accessors to dvo; calculate average of Mkron in relphot; update mkcmf to include Kron; add aperinst accessors in dvo

Location:
branches/eam_branches/ipp-20120627/Ohana/src
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branches/ipp-20120627/Ohana/src/addstar/src/ReadStarsFITS.c

    r31160 r34140  
    1010  Header theader;
    1111  FTable table;
    12   Stars *stars;
     12  Stars *stars; // Stars contains Average and Measure
    1313 
    1414  if (in_theader == NULL) {
     
    8989    InitStar (&stars[i]);
    9090
    91     stars[i].measure.Xccd      = smpdata[i].X;
    92     stars[i].measure.Yccd      = smpdata[i].Y;
     91    stars[i].measure.Xccd       = smpdata[i].X;
     92    stars[i].measure.Yccd       = smpdata[i].Y;
     93    stars[i].measure.dXccd      = NAN_S_SHORT; // not provided by SMPDATA:
     94    stars[i].measure.dYccd      = NAN_S_SHORT; // not provided by SMPDATA:
     95   
     96    stars[i].measure.posangle   = NAN_S_SHORT; // not provided by SMPDATA:
     97    stars[i].measure.pltscale   = NAN;         // not provided by SMPDATA:
    9398
    9499    if ((smpdata[i].M >= ZeroPt) || isnan(smpdata[i].M)) {
    95       stars[i].measure.M       = NAN;
    96       stars[i].measure.Map     = NAN;
    97     } else {
    98       stars[i].measure.M       = smpdata[i].M;
    99       stars[i].measure.Map     = smpdata[i].M;
    100     }
    101 
    102     stars[i].measure.dM        = smpdata[i].dM*0.001;
    103 
     100      stars[i].measure.M        = NAN;
     101      stars[i].measure.Map      = NAN;
     102    } else {
     103      stars[i].measure.M        = smpdata[i].M;
     104      stars[i].measure.Map      = smpdata[i].M;
     105    }
     106    stars[i].measure.dM         = smpdata[i].dM*0.001;
     107    stars[i].measure.dMcal      = NAN; // not provided by SMPDATA:
     108
     109    stars[i].measure.Mkron      = NAN; // not provided by SMPDATA:
     110    stars[i].measure.dMkron     = NAN; // not provided by SMPDATA:
     111
     112    stars[i].measure.Sky        = NAN; // not provided by SMPDATA:
     113    stars[i].measure.dSky       = NAN; // not provided by SMPDATA:
     114
     115    stars[i].measure.psfChisq   = NAN;       // not provided by SMPDATA:
     116    stars[i].measure.psfQual    = NAN;       // not provided by SMPDATA:
     117    stars[i].measure.psfNdof    = NAN_S_INT; // not provided by SMPDATA:
     118    stars[i].measure.psfNpix    = NAN_S_INT; // not provided by SMPDATA:
     119    stars[i].measure.crNsigma   = NAN;       // not provided by SMPDATA:
     120    stars[i].measure.extNsigma  = NAN;       // not provided by SMPDATA:
     121
     122    stars[i].measure.FWx        = ToShortPixels (smpdata[i].fx);
     123    stars[i].measure.FWy        = ToShortPixels (smpdata[i].fy);
     124    stars[i].measure.theta      = ToShortDegrees (smpdata[i].df);
     125
     126    stars[i].measure.Mxx        = NAN_S_SHORT; // not provided by SMPDATA:
     127    stars[i].measure.Mxy        = NAN_S_SHORT; // not provided by SMPDATA:
     128    stars[i].measure.Myy        = NAN_S_SHORT; // not provided by SMPDATA:
     129                       
    104130    // the dophot type information gets pushed into the upper 2 bytes of photFlags
    105     stars[i].measure.photFlags = (smpdata[i].dophot << 16);
    106 
    107     stars[i].measure.FWx       = ToShortPixels (smpdata[i].fx);
    108     stars[i].measure.FWy       = ToShortPixels (smpdata[i].fy);
    109     stars[i].measure.theta     = ToShortDegrees (smpdata[i].df);
     131    stars[i].measure.photFlags  = (smpdata[i].dophot << 16);
    110132  }   
    111133  *nstars = Nstars;
     
    131153  for (i = 0; i < Nstars; i++) {
    132154    InitStar (&stars[i]);
    133     stars[i].measure.Xccd     = ps1data[i].X;
    134     stars[i].measure.Yccd     = ps1data[i].Y;
    135 
    136     stars[i].measure.dXccd    = ToShortPixels(ps1data[i].dX);
    137     stars[i].measure.dYccd    = ToShortPixels(ps1data[i].dY);
     155    stars[i].measure.Xccd       = ps1data[i].X;
     156    stars[i].measure.Yccd       = ps1data[i].Y;
     157    stars[i].measure.dXccd      = ToShortPixels(ps1data[i].dX);
     158    stars[i].measure.dYccd      = ToShortPixels(ps1data[i].dY);
    138159   
     160    stars[i].measure.posangle   = NAN_S_SHORT; // not provided by PS1_DEV_0:
     161    stars[i].measure.pltscale   = NAN;         // not provided by PS1_DEV_0:
     162
    139163    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
    140       stars[i].measure.M      = NAN;
    141     } else {
    142       stars[i].measure.M      = ps1data[i].M + ZeroPt;
    143     }
    144     stars[i].measure.Map      = NAN;
    145     stars[i].measure.dM       = ps1data[i].dM;
    146     stars[i].measure.Sky      = ps1data[i].sky;
    147     stars[i].measure.dSky     = ps1data[i].dSky;
    148 
    149     stars[i].measure.FWx      = ToShortPixels(ps1data[i].fx);
    150     stars[i].measure.FWy      = ToShortPixels(ps1data[i].fy);
    151     stars[i].measure.theta    = ToShortDegrees(ps1data[i].df);
    152 
    153     stars[i].measure.psfChisq = ps1data[i].psfChisq;
    154     stars[i].measure.psfQual  = ps1data[i].psfQual;
    155 
    156     stars[i].measure.detID    = ps1data[i].detID;
     164      stars[i].measure.M        = NAN;
     165    } else {
     166      stars[i].measure.M        = ps1data[i].M + ZeroPt;
     167    }
     168    stars[i].measure.dM         = ps1data[i].dM;
     169    stars[i].measure.dMcal      = NAN; // not provided by PS1_DEV_0:
     170    stars[i].measure.Map        = NAN; // not provided by PS1_DEV_0:
     171
     172    stars[i].measure.Mkron      = NAN; // not provided by PS1_DEV_0:
     173    stars[i].measure.dMkron     = NAN; // not provided by PS1_DEV_0:
     174
     175    stars[i].measure.Sky        = ps1data[i].sky;
     176    stars[i].measure.dSky       = ps1data[i].dSky;
     177
     178    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
     179    stars[i].measure.psfQual    = ps1data[i].psfQual;
     180    stars[i].measure.psfNdof    = NAN_S_INT; // not provided by PS1_DEV_0:
     181    stars[i].measure.psfNpix    = NAN_S_INT; // not provided by PS1_DEV_0:
     182    stars[i].measure.crNsigma   = NAN;       // not provided by PS1_DEV_0:
     183    stars[i].measure.extNsigma  = NAN;        // not provided by PS1_DEV_0:
     184
     185    stars[i].measure.FWx        = ToShortPixels(ps1data[i].fx);
     186    stars[i].measure.FWy        = ToShortPixels(ps1data[i].fy);
     187    stars[i].measure.theta      = ToShortDegrees(ps1data[i].df);
     188
     189    stars[i].measure.Mxx        = NAN_S_SHORT; // not provided by PS1_DEV_0:
     190    stars[i].measure.Mxy        = NAN_S_SHORT; // not provided by PS1_DEV_0:
     191    stars[i].measure.Myy        = NAN_S_SHORT; // not provided by PS1_DEV_0:
     192                       
     193    stars[i].measure.photFlags  = 0; // not provided by PS1_DEV_0:
     194
     195    stars[i].measure.detID      = ps1data[i].detID;
    157196  }   
    158197  *nstars = Nstars;
     
    182221    stars[i].measure.Xccd       = ps1data[i].X;
    183222    stars[i].measure.Yccd       = ps1data[i].Y;
    184 
    185223    stars[i].measure.dXccd      = ToShortPixels(ps1data[i].dX);
    186224    stars[i].measure.dYccd      = ToShortPixels(ps1data[i].dY);
    187225
     226    stars[i].measure.posangle   = NAN_S_SHORT; // not provided by PS1_DEV_1:
     227    stars[i].measure.pltscale   = NAN;         // not provided by PS1_DEV_1:
     228
    188229    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
    189         stars[i].measure.M      = NAN;
    190     } else {
    191         stars[i].measure.M      = ps1data[i].M + ZeroPt;
    192     }
    193     stars[i].measure.Map        = NAN;
     230        stars[i].measure.M      = NAN;
     231    } else {
     232        stars[i].measure.M      = ps1data[i].M + ZeroPt;
     233    }
    194234    stars[i].measure.dM         = ps1data[i].dM;
     235    stars[i].measure.dMcal      = NAN; // not provided by PS1_DEV_1:
     236    stars[i].measure.Map        = NAN; // not provided by PS1_DEV_1:
     237
     238    stars[i].measure.Mkron      = NAN; // not provided by PS1_DEV_1:
     239    stars[i].measure.dMkron     = NAN; // not provided by PS1_DEV_1:
     240
    195241    stars[i].measure.Sky        = ps1data[i].sky;
    196242    stars[i].measure.dSky       = ps1data[i].dSky;
     243
     244    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
     245    stars[i].measure.psfQual    = ps1data[i].psfQual;
     246    stars[i].measure.psfNdof    = NAN_S_INT; // not provided by PS1_DEV_1:
     247    stars[i].measure.psfNpix    = NAN_S_INT; // not provided by PS1_DEV_1:
     248    stars[i].measure.crNsigma   = ps1data[i].crNsigma;
     249    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
    197250
    198251    stars[i].measure.FWx        = ToShortPixels(ps1data[i].fx);
     
    200253    stars[i].measure.theta      = ToShortDegrees(ps1data[i].df);
    201254
    202     stars[i].measure.psfChisq   = ps1data[i].psfChisq;
    203     stars[i].measure.psfQual    = ps1data[i].psfQual;
    204     stars[i].measure.crNsigma   = ps1data[i].crNsigma;
    205     stars[i].measure.extNsigma  = ps1data[i].extNsigma;
    206 
    207     stars[i].measure.detID      = ps1data[i].detID;
     255    stars[i].measure.Mxx        = NAN_S_SHORT; // not provided by PS1_DEV_1:
     256    stars[i].measure.Mxy        = NAN_S_SHORT; // not provided by PS1_DEV_1:
     257    stars[i].measure.Myy        = NAN_S_SHORT; // not provided by PS1_DEV_1:
     258                       
    208259    stars[i].measure.photFlags  = ps1data[i].flags;
     260
     261    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     262    stars[i].measure.detID      = ps1data[i].detID;
    209263  }   
    210264  *nstars = Nstars;
     
    252306
    253307    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
    254         stars[i].measure.M      = NAN;
    255     } else {
    256         stars[i].measure.M      = ps1data[i].M + ZeroPt;
     308        stars[i].measure.M      = NAN;
     309    } else {
     310        stars[i].measure.M      = ps1data[i].M + ZeroPt;
    257311    }
    258312    stars[i].measure.dM         = ps1data[i].dM;
    259313    stars[i].measure.dMcal      = ps1data[i].dMcal;
    260314    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
    261                        
     315                       
     316    stars[i].measure.Mkron      = NAN; // not provided by PS1_V1:
     317    stars[i].measure.dMkron     = NAN; // not provided by PS1_V1:
     318
    262319    stars[i].measure.Sky        = ps1data[i].sky;
    263320    stars[i].measure.dSky       = ps1data[i].dSky;
    264                        
     321                       
    265322    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
    266323    stars[i].measure.psfQual    = ps1data[i].psfQual;
     
    277334    stars[i].measure.Mxy        = ToShortPixels(ps1data[i].Mxy);
    278335    stars[i].measure.Myy        = ToShortPixels(ps1data[i].Myy);
    279                        
     336                       
    280337    stars[i].measure.photFlags  = ps1data[i].flags;
    281338
     
    328385
    329386    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
    330         stars[i].measure.M      = NAN;
    331     } else {
    332         stars[i].measure.M      = ps1data[i].M + ZeroPt;
     387        stars[i].measure.M      = NAN;
     388    } else {
     389        stars[i].measure.M      = ps1data[i].M + ZeroPt;
    333390    }
    334391    stars[i].measure.dM         = ps1data[i].dM;
    335392    stars[i].measure.dMcal      = ps1data[i].dMcal;
    336393    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
    337                        
     394                       
     395    stars[i].measure.Mkron      = NAN; // not provided by PS1_V1_Alt:
     396    stars[i].measure.dMkron     = NAN; // not provided by PS1_V1_Alt:
     397
    338398    stars[i].measure.Sky        = ps1data[i].sky;
    339399    stars[i].measure.dSky       = ps1data[i].dSky;
    340                        
     400                       
    341401    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
    342402    stars[i].measure.psfQual    = ps1data[i].psfQual;
     
    353413    stars[i].measure.Mxy        = ToShortPixels(ps1data[i].Mxy);
    354414    stars[i].measure.Myy        = ToShortPixels(ps1data[i].Myy);
    355                        
     415                       
    356416    stars[i].measure.photFlags  = ps1data[i].flags;
    357417
     
    396456
    397457    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
    398         stars[i].measure.M      = NAN;
    399     } else {
    400         stars[i].measure.M      = ps1data[i].M + ZeroPt;
     458        stars[i].measure.M      = NAN;
     459    } else {
     460        stars[i].measure.M      = ps1data[i].M + ZeroPt;
    401461    }
    402462    stars[i].measure.dM         = ps1data[i].dM;
    403463    stars[i].measure.dMcal      = ps1data[i].dMcal;
    404464    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
    405                        
     465                       
     466    stars[i].measure.Mkron      = NAN; // not provided by PS1_V2:
     467    stars[i].measure.dMkron     = NAN; // not provided by PS1_V2:
     468
    406469    stars[i].measure.Sky        = ps1data[i].sky;
    407470    stars[i].measure.dSky       = ps1data[i].dSky;
    408                        
     471                       
    409472    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
    410473    stars[i].measure.psfQual    = ps1data[i].psfQual;
     
    421484    stars[i].measure.Mxy        = ToShortPixels(ps1data[i].Mxy);
    422485    stars[i].measure.Myy        = ToShortPixels(ps1data[i].Myy);
    423                        
     486                       
    424487    stars[i].measure.photFlags  = ps1data[i].flags;
    425488
     
    464527
    465528    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
    466         stars[i].measure.M      = NAN;
    467     } else {
    468         stars[i].measure.M      = ps1data[i].M + ZeroPt;
     529        stars[i].measure.M      = NAN;
     530    } else {
     531        stars[i].measure.M      = ps1data[i].M + ZeroPt;
    469532    }
    470533    stars[i].measure.dM         = ps1data[i].dM;
    471534    stars[i].measure.dMcal      = ps1data[i].dMcal;
    472535    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
    473                        
     536                       
     537    stars[i].measure.Mkron      = (ps1data[i].kronFlux > 0.0) ? -2.5*log10(ps1data[i].kronFlux) + ZeroPt : NAN;
     538    stars[i].measure.dMkron     = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN;
     539                       
    474540    stars[i].measure.Sky        = ps1data[i].sky;
    475541    stars[i].measure.dSky       = ps1data[i].dSky;
    476                        
     542                       
    477543    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
    478544    stars[i].measure.psfQual    = ps1data[i].psfQual;
     
    489555    stars[i].measure.Mxy        = ToShortPixels(ps1data[i].Mxy);
    490556    stars[i].measure.Myy        = ToShortPixels(ps1data[i].Myy);
    491                        
     557                       
    492558    stars[i].measure.photFlags  = ps1data[i].flags;
    493559
     
    496562
    497563    // the Average fields and the following Measure fields are set in FilterStars after
    498     // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID,
    499     // averef is set in find_matches, dbFlags is zero on ingest.
     564    // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID.
     565
     566    // averef is set in find_matches
     567
     568    // dbFlags is zero on ingest.
    500569
    501570    // the following fields are currently not being set anywhere: t_msec
     
    537606
    538607    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
    539         stars[i].measure.M      = NAN;
    540     } else {
    541         stars[i].measure.M      = ps1data[i].M + ZeroPt;
     608        stars[i].measure.M      = NAN;
     609    } else {
     610        stars[i].measure.M      = ps1data[i].M + ZeroPt;
    542611    }
    543612    stars[i].measure.dM         = ps1data[i].dM;
    544613    stars[i].measure.dMcal      = ps1data[i].dMcal;
    545614    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
    546                        
     615                       
     616    stars[i].measure.Mkron      = (ps1data[i].kronFlux > 0.0) ? -2.5*log10(ps1data[i].kronFlux) + ZeroPt : NAN;
     617    stars[i].measure.dMkron     = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN;
     618
    547619    stars[i].measure.Sky        = ps1data[i].sky;
    548620    stars[i].measure.dSky       = ps1data[i].dSky;
    549                        
     621                       
    550622    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
    551623    stars[i].measure.psfQual    = ps1data[i].psfQual;
     
    562634    stars[i].measure.Mxy        = ToShortPixels(ps1data[i].Mxy);
    563635    stars[i].measure.Myy        = ToShortPixels(ps1data[i].Myy);
    564                        
     636                       
    565637    stars[i].measure.photFlags  = ps1data[i].flags;
    566638
     
    607679
    608680    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
    609         stars[i].measure.M      = NAN;
    610     } else {
    611         stars[i].measure.M      = ps1data[i].M + ZeroPt;
     681        stars[i].measure.M      = NAN;
     682    } else {
     683        stars[i].measure.M      = ps1data[i].M + ZeroPt;
    612684    }
    613685    stars[i].measure.dM         = ps1data[i].dM;
    614686    stars[i].measure.dMcal      = ps1data[i].dMcal;
    615687    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
    616                        
     688                       
     689    stars[i].measure.Mkron      = (ps1data[i].kronFlux > 0.0) ? -2.5*log10(ps1data[i].kronFlux) + ZeroPt : NAN;
     690    stars[i].measure.dMkron     = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN;
     691
    617692    stars[i].measure.Sky        = ps1data[i].sky;
    618693    stars[i].measure.dSky       = ps1data[i].dSky;
    619                        
     694                       
    620695    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
    621696    stars[i].measure.psfQual    = ps1data[i].psfQual;
     
    632707    stars[i].measure.Mxy        = ToShortPixels(ps1data[i].Mxy);
    633708    stars[i].measure.Myy        = ToShortPixels(ps1data[i].Myy);
    634                        
     709                       
    635710    stars[i].measure.photFlags  = ps1data[i].flags;
    636711
  • branches/eam_branches/ipp-20120627/Ohana/src/addstar/src/mkcmf.c

    r33653 r34140  
    1414void gauss_init (int Nbin);
    1515double rnd_gauss (double mean, double sigma);
     16void writeStars_PS1_V3 (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars);
    1617void writeStars_PS1_V2 (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars);
    1718void writeStars_PS1_V1 (FTable *ftable, double *X, double *Y, double *M, int Nstars);
     
    276277  if (!strcmp(type, "PS1_V2")) {
    277278    writeStars_PS1_V2 (&ftable, X, Y, M, Flag, Nstars);
     279    found = TRUE;
     280  }
     281  if (!strcmp(type, "PS1_V3")) {
     282    writeStars_PS1_V3 (&ftable, X, Y, M, Flag, Nstars);
    278283    found = TRUE;
    279284  }
     
    572577}
    573578
     579void writeStars_PS1_V3 (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars) {
     580
     581  int i;
     582  CMF_PS1_V3 *stars;
     583  float flux, fSN;
     584
     585  // XXX add gaussian-distributed noise based on counts
     586  // this needs to make different output 'stars' entries depending on the desired type
     587  ALLOCATE (stars, CMF_PS1_V3, Nstars);
     588  gauss_init (2048);
     589  for (i = 0; i < Nstars; i++) {
     590    stars[i].detID = i;
     591
     592    flux = pow (10.0, -0.4*M[i]);
     593    fSN = 1.0 / sqrt(flux);
     594
     595    stars[i].X = X[i];
     596    stars[i].Y = Y[i];
     597    stars[i].M = M[i];
     598    stars[i].Map = M[i] - 0.05;
     599
     600    if (ADDNOISE) {
     601      stars[i].X += FX * fSN * rnd_gauss(0.0, 1.0);
     602      stars[i].Y += FY * fSN * rnd_gauss(0.0, 1.0);
     603      stars[i].M += fSN*rnd_gauss(0.0, 1.0);
     604    }
     605
     606    // randomly give poor PSFQF values
     607    if ((BAD_PSFQF_FRAC > 0.0) && (drand48() < BAD_PSFQF_FRAC)) {
     608      stars[i].psfQual   = 0.25;
     609    } else {
     610      stars[i].psfQual   = PSFQUAL;
     611    }
     612   
     613    stars[i].dX = FX * fSN;
     614    stars[i].dY = FY * fSN;
     615    stars[i].dM = fSN;
     616
     617    stars[i].Mpeak     = M[i] + 1.0;
     618    stars[i].sky       = SKY;
     619    stars[i].dSky      = DSKY;
     620    stars[i].psfChisq  = PSFCHI;
     621    stars[i].crNsigma  = CRN;
     622    stars[i].extNsigma = EXTN;
     623    stars[i].fx        = FX;
     624    stars[i].fy        = FY;
     625    stars[i].df        = DF;
     626    stars[i].nFrames   = 1;
     627    stars[i].flags     = Flag[i];
     628
     629    stars[i].kronFlux  = flux * 1.25;
     630    stars[i].kronFluxErr = fSN * flux * 1.25;
     631  }
     632
     633  gfits_table_set_CMF_PS1_V3 (ftable, stars, Nstars);
     634  gfits_modify (ftable->header, "EXTTYPE",   "%s", 1, "PS1_V3");
     635}
     636
  • branches/eam_branches/ipp-20120627/Ohana/src/addstar/test/simple.dvo

    r33653 r34140  
    2121  test.fields PS1_V2    PS1_V3
    2222  test.fields PS1_V3    PS1_V3
     23
     24  test.fields PS1_DEV_0 PS1_V4
     25  test.fields PS1_DEV_1 PS1_V4
     26  test.fields PS1_V1    PS1_V4
     27  test.fields PS1_V2    PS1_V4
     28  test.fields PS1_V3    PS1_V4
    2329end 
    2430
     
    8389    sort id1 v1
    8490    sort id2 v2
     91
     92    # some fields require arithmetic manipulations
     93    if ("$name:0" == "KRON_FLUX")
     94     set v1 = -2.5*log(v1)
     95    end
     96    if ("$name:0" == "KRON_FLUX_ERR")
     97     set v1 = KRON_FLUX_ERR / KRON_FLUX
     98    end
     99
    85100    set d = v1 - v2
    86101    vstat -q d
     
    88103    #echo tapOK fabs($MEAN)  < 0.001 "$name:0 vs $name:2 (MEAN)"
    89104    #echo tapOK fabs($SIGMA) < 0.001 "$name:0 vs $name:2 (SIGMA)"
     105
     106    # THETA is stored to only (360/65536) deg accuracy
     107    if ("$name:0" == "PSF_THETA")
     108      echo $MEAN
     109      tapOK {abs($MEAN)  < 0.006} "$name:0 vs $name:2 (MEAN)"
     110      tapOK {abs($SIGMA) < 0.001} "$name:0 vs $name:2 (SIGMA)"
     111      continue
     112    end
    90113
    91114    tapOK {abs($MEAN)  < 0.001} "$name:0 vs $name:2 (MEAN)"
     
    111134  output stdout
    112135end
     136
     137# the following lists define fields in the cmf files which can be compared to their equivalents in DVO
     138# the left column is the cmf field name, the right column is the dvo field name
    113139
    114140# list of cmf fields to test matched to mextract fields
     
    122148  PSF_INST_MAG      : mag:inst
    123149  PSF_INST_MAG_SIG  : mag:err
    124   PEAK_FLUX_AS_MAG  : SKIP
     150  PEAK_FLUX_AS_MAG  : SKIP # not ingested into DVO
    125151  SKY               : sky
    126152  SKY_SIG           : sky_err
     
    130156  PSF_THETA         : THETA
    131157  PSF_QF            : PSF_QF
    132   N_FRAMES          : SKIP
     158  N_FRAMES          : SKIP # not ingested into DVO
    133159end
    134160
     
    143169  PSF_INST_MAG      : mag:inst
    144170  PSF_INST_MAG_SIG  : mag:err
    145   PEAK_FLUX_AS_MAG  : SKIP
     171  PEAK_FLUX_AS_MAG  : SKIP # not ingested into DVO
    146172  SKY               : sky
    147173  SKY_SIG           : sky_err
     
    153179  PSF_THETA         : THETA
    154180  PSF_QF            : PSF_QF
    155   N_FRAMES          : SKIP
     181  N_FRAMES          : SKIP # not ingested into DVO
    156182  FLAGS             : phot_flags
    157183end
     
    236262  X_PSF_SIG         : xccd:err # FAIL
    237263  Y_PSF_SIG         : yccd:err # FAIL
    238   RA_PSF            : SKIP # astrometry is not calibrated in the cmf
    239   DEC_PSF           : SKIP # astrometry is not calibrated in the cmf
    240264  POSANGLE          : SKIP # astrometry is not calibrated in the cmf
    241265  PLTSCALE          : SKIP # astrometry is not calibrated in the cmf
    242266  PSF_INST_MAG      : mag:inst 
    243267  PSF_INST_MAG_SIG  : mag:err   
    244   AP_MAG_STANDARD   : mag:ap # FAIL
    245   AP_MAG_RADIUS     : SKIP # no accessor
    246   PEAK_FLUX_AS_MAG  : SKIP # no accessor
     268  PSF_INST_FLUX     : SKIP # not ingested into DVO
     269  PSF_INST_FLUX_SIG : SKIP # not ingested into DVO
     270  AP_MAG_STANDARD   : mag:aperinst # FAIL
     271  AP_MAG_RAW        : SKIP # not ingested into DVO
     272  AP_MAG_RADIUS     : SKIP # not ingested into DVO
    247273  CAL_PSF_MAG       : SKIP # photometry is not calibrated in the cmf
    248274  CAL_PSF_MAG_SIG   : SKIP # photometry is not calibrated in the cmf
     275  RA_PSF            : SKIP # astrometry is not calibrated in the cmf
     276  DEC_PSF           : SKIP # astrometry is not calibrated in the cmf
     277  PEAK_FLUX_AS_MAG  : SKIP # not ingested into DVO
    249278  SKY               : sky       
    250279  SKY_SIG           : sky_err   
     
    256285  PSF_THETA         : THETA # FAIL
    257286  PSF_QF            : PSF_QF   
    258   PSF_NDOF          : SKIP # no accessor
    259   PSF_NPIX          : SKIP # no accessor
    260   MOMENTS_XX        : SKIP # no accessor
    261   MOMENTS_XY        : SKIP # no accessor
    262   MOMENTS_YY        : SKIP # no accessor
     287  PSF_QF_PERFECT    : SKIP # not ingested into DVO
     288  PSF_NDOF          : PSF_NDOF
     289  PSF_NPIX          : PSF_NPIX
     290  MOMENTS_XX        : MXX
     291  MOMENTS_XY        : MXY
     292  MOMENTS_YY        : MYY
     293  MOMENTS_M3C       : SKIP # not ingested into DVO
     294  MOMENTS_M3S       : SKIP # not ingested into DVO
     295  MOMENTS_M4C       : SKIP # not ingested into DVO
     296  MOMENTS_M4S       : SKIP # not ingested into DVO
     297  MOMENTS_R1        : SKIP # not ingested into DVO
     298  MOMENTS_RH        : SKIP # not ingested into DVO
     299  KRON_FLUX         : mag:kroninst
     300  KRON_FLUX_ERR     : mag:kronerr
     301  KRON_FLUX_INNER   : SKIP # not ingested into DVO
     302  KRON_FLUX_OUTER   : SKIP # not ingested into DVO
    263303  FLAGS             : phot_flags
    264   N_FRAMES          : SKIP # no accessor       
    265 end
     304  N_FRAMES          : SKIP # not ingested into DVO
     305end
  • branches/eam_branches/ipp-20120627/Ohana/src/libautocode/def/cmf-ps1-v1.d

    r24400 r34140  
    4444# model shape parameters: F_major, F_minor, F_theta
    4545# centroid errors: sigma_X, sigma_Y, sigma_XY
    46 
    47 # IPP_IDET         1J  IPP_IDET,           unsigned i
    48 # X_PSF          1E  X_PSF,        float,       
    49 # Y_PSF          1E  Y_PSF,        float,       
    50 # X_PSF_SIG      1E  X_PSF_SIG,            float,       
    51 # Y_PSF_SIG      1E  Y_PSF_SIG,            float,       
    52 # RA_PSF         1E  RA_PSF,               float,       
    53 # DEC_PSF        1E  DEC_PSF,              float,       
    54 # POSANGLE       1E  POSANGLE,             float,       
    55 # PLTSCALE       1E  PLTSCALE,             float,       
    56 # PSF_INST_MAG   1E  PSF_INST_MAG,     float,         
    57 # PSF_INST_MAG_SIG 1E  PSF_INST_MAG_SIG, float,       
    58 # AP_MAG_STANDARD  1E  AP_MAG_STANDARD,  float,       
    59 # AP_MAG_RADIUS    1E     
    60 # PEAK_FLUX_AS_MAG 1E  PEAK_FLUX_AS_MAG, float,       
    61 # CAL_PSF_MAG      1E  CAL_PSF_MAG,      float,       
    62 # CAL_PSF_MAG_SIG  1E  CAL_PSF_MAG_SIG,  float,       
    63 # SKY              1E  SKY,              float,       
    64 # SKY_SIGMA        1E  SKY_SIG,          float,       
    65 # PSF_CHISQ        1E  PSF_CHISQ,        float,       
    66 # CR_NSIGMA        1E  CR_NSIGMA,        float,       
    67 # EXT_NSIGMA       1E  EXT_NSIGMA,       float,       
    68 # PSF_MAJOR        1E  PSF_MAJOR,        float,       
    69 # PSF_MINOR        1E  PSF_MINOR,        float,       
    70 # PSF_THETA        1E  PSF_THETA,        float,       
    71 # PSF_QF           1E  PSF_QF,           float,       
    72 # PSF_NDOF         1J  PSF_NDOF,         int,         
    73 # PSF_NPIX         1J  PSF_NPIX,         int,         
    74 # MOMENTS_XX       1E  MOMENTS_XX,       float,       
    75 # MOMENTS_XY       1E  MOMENTS_XY,       float,       
    76 # MOMENTS_YY       1E  MOMENTS_YY,       float,       
    77 # N_FRAMES         1I  N_FRAMES,         short,       
    78 # FLAGS            1J  FLAGS,            int,         
  • branches/eam_branches/ipp-20120627/Ohana/src/libautocode/def/cmf-ps1-v2.d

    r24400 r34140  
    4040FIELD padding,   PADDING,          short,    padding for 8byte records
    4141
    42 # for an object in an image, we have three triplets that tell us about the shape:
    43 # second moments: Mxx, Mxy, Myy
    44 # model shape parameters: F_major, F_minor, F_theta
    45 # centroid errors: sigma_X, sigma_Y, sigma_XY
    46 
    47 # IPP_IDET         1J  IPP_IDET,           unsigned i
    48 # X_PSF          1E  X_PSF,        float,       
    49 # Y_PSF          1E  Y_PSF,        float,       
    50 # X_PSF_SIG      1E  X_PSF_SIG,            float,       
    51 # Y_PSF_SIG      1E  Y_PSF_SIG,            float,       
    52 # RA_PSF         1E  RA_PSF,               float,       
    53 # DEC_PSF        1E  DEC_PSF,              float,       
    54 # POSANGLE       1E  POSANGLE,             float,       
    55 # PLTSCALE       1E  PLTSCALE,             float,       
    56 # PSF_INST_MAG   1E  PSF_INST_MAG,     float,         
    57 # PSF_INST_MAG_SIG 1E  PSF_INST_MAG_SIG, float,       
    58 # AP_MAG_STANDARD  1E  AP_MAG_STANDARD,  float,       
    59 # AP_MAG_RADIUS    1E     
    60 # PEAK_FLUX_AS_MAG 1E  PEAK_FLUX_AS_MAG, float,       
    61 # CAL_PSF_MAG      1E  CAL_PSF_MAG,      float,       
    62 # CAL_PSF_MAG_SIG  1E  CAL_PSF_MAG_SIG,  float,       
    63 # SKY              1E  SKY,              float,       
    64 # SKY_SIGMA        1E  SKY_SIG,          float,       
    65 # PSF_CHISQ        1E  PSF_CHISQ,        float,       
    66 # CR_NSIGMA        1E  CR_NSIGMA,        float,       
    67 # EXT_NSIGMA       1E  EXT_NSIGMA,       float,       
    68 # PSF_MAJOR        1E  PSF_MAJOR,        float,       
    69 # PSF_MINOR        1E  PSF_MINOR,        float,       
    70 # PSF_THETA        1E  PSF_THETA,        float,       
    71 # PSF_QF           1E  PSF_QF,           float,       
    72 # PSF_NDOF         1J  PSF_NDOF,         int,         
    73 # PSF_NPIX         1J  PSF_NPIX,         int,         
    74 # MOMENTS_XX       1E  MOMENTS_XX,       float,       
    75 # MOMENTS_XY       1E  MOMENTS_XY,       float,       
    76 # MOMENTS_YY       1E  MOMENTS_YY,       float,       
    77 # N_FRAMES         1I  N_FRAMES,         short,       
    78 # FLAGS            1J  FLAGS,            int,         
     42# fields added since PS1_V1:
     43# RA & DEC promoted to double
  • branches/eam_branches/ipp-20120627/Ohana/src/libautocode/def/cmf-ps1-v3.d

    r29537 r34140  
    6464# centroid errors: sigma_X, sigma_Y, sigma_XY
    6565
    66 # # elements of data structure / FITS table
    67 # FIELD detID,          IPP_IDET,          IPP_IDET           1J      unsigned int, detection ID                     
    68 # FIELD X,              X_PSF,             X_PSF              1E      float,    x coord,               pixels
    69 # FIELD Y,              Y_PSF,             Y_PSF              1E      float,    y coord,               pixels
    70 # FIELD dX,             X_PSF_SIG,         X_PSF_SIG          1E      float,    x coord error,         pixels
    71 # FIELD dY,             Y_PSF_SIG,         Y_PSF_SIG          1E      float,    y coord error,         pixels
    72 # FIELD posangle,       POSANGLE,          POSANGLE           1E      float,    Posangle at source,    degrees
    73 # FIELD pltscale,       PLTSCALE,          PLTSCALE           1E      float,    Plate Scale at source, arcsec/pixel
    74 # FIELD M,              PSF_INST_MAG,      PSF_INST_MAG       1E      float,    inst mags,             mags
    75 # FIELD dM,             PSF_INST_MAG_SIG,  PSF_INST_MAG_SIG   1E      float,    inst mag error,        mags
    76 # FIELD flux,           PSF_INST_FLUX,     PSF_INST_FLUX      1E      float,    psf flux,              counts
    77 # FIELD flux,           PSF_INST_FLUX_SIG, PSF_INST_FLUX_SIG  1E      float,    psf flux error,        counts     
    78 # FIELD Map,            AP_MAG_STANDARD,   AP_MAG             1E      float,    standard aperture mag, mags
    79 # FIELD Map,            AP_MAG_RAW,        AP_MAG_RAW         1E      float,    raw aperture mag,      mags
    80 # FIELD apRadius,       AP_MAG_RADIUS,     AP_MAG_RADIUS      1E      float,    radius used for fit,   pixels
    81 # FIELD Mpeak,          PEAK_FLUX_AS_MAG,  PEAK_FLUX_AS_MAG   1E      float,    peak flux as a mag,    mags
    82 # FIELD Mcalib,         CAL_PSF_MAG,       CAL_PSF_MAG        1E      float,    calibrated psf mag,    mags
    83 # FIELD dMcal,          CAL_PSF_MAG_SIG,   CAL_PSF_MAG_SIG    1E      float,    zero point scatter,    mags
    84 # FIELD RA,             RA_PSF,            RA_PSF             1D      double,   PSF RA coord,          degrees
    85 # FIELD DEC,            DEC_PSF,           DEC_PSF            1D      double,   PSF DEC coord,         degrees
    86 # FIELD sky,            SKY,               SKY                1E      float,    sky flux,              cnts/sec
    87 # FIELD dSky,           SKY_SIG,           SKY_SIGMA          1E      float,    sky flux error,        cnts/sec
    88 # FIELD psfChisq,       PSF_CHISQ,         PSF_CHISQ          1E      float,    psf fit chisq
    89 # FIELD crNsigma,       CR_NSIGMA,         CR_NSIGMA          1E      float,    Nsigma deviations from PSF to CF
    90 # FIELD extNsigma,      EXT_NSIGMA,        EXT_NSIGMA         1E      float,    Nsigma deviations from PSF to EXT
    91 # FIELD fx,             PSF_MAJOR,         PSF_MAJOR          1E      float,    psf fit major axis,    pixels
    92 # FIELD fy,             PSF_MINOR,         PSF_MINOR          1E      float,    psf fit minor axis,    pixels
    93 # FIELD df,             PSF_THETA,         PSF_THETA          1E      float,    ellipse angle,         degrees
    94 # FIELD psfQual,        PSF_QF,            PSF_QF             1E      float,    quality factor
    95 # FIELD psfQualPerfect, PSF_QF_PERFECT,    PSF_QF_PERFECT     1E      float,    quality factor perfect
    96 # FIELD psfNdof,        PSF_NDOF,          PSF_NDOF           1J      int,      psf degrees of freedom
    97 # FIELD psfNpix,        PSF_NPIX,          PSF_NPIX           1J      int,      psf number of pixels
    98 # FIELD Mxx,            MOMENTS_XX,        MOMENTS_XX         1E      float,    second moment X,       pixels^2
    99 # FIELD Mxy,            MOMENTS_XY,        MOMENTS_XY         1E      float,    second moment Y,       pixels^2
    100 # FIELD Myy,            MOMENTS_YY,        MOMENTS_YY         1E      float,    second moment XY,      pixels^2
    101 # FIELD M3c,            MOMENTS_M3C,       MOMENTS_M3C        1E      float,    third moment cos(t),   pixels^3
    102 # FIELD M3s,            MOMENTS_M3S,       MOMENTS_M3S        1E      float,    third moment sin(t),   pixels^3
    103 # FIELD M4c,            MOMENTS_M4C,       MOMENTS_M4C        1E      float,    fourth moment cos(t),  pixels^4
    104 # FIELD M4s,            MOMENTS_M4S,       MOMENTS_M4S        1E      float,    fourth moment sin(t),  pixels^4
    105 # FIELD Mr1,            MOMENTS_R1,        MOMENTS_R1         1E      float,    first radial moment,   pixels
    106 # FIELD Mrh,            MOMENTS_RH,        MOMENTS_RH         1E      float,    half radial moment,    pixels^1/2
    107 # FIELD kronFlux,       KRON_FLUX,         KRON_FLUX          1E      float,    kron flux,             counts
    108 # FIELD kronFluxErr,    KRON_FLUX_ERR,     KRON_FLUX_ERR      1E      float,    kron flux error,       counts
    109 # FIELD kronInner,      KRON_FLUX_INNER,   KRON_FLUX_INNER    1E      float,    kron flux 1<R<2.5,     counts
    110 # FIELD kronOuter,      KRON_FLUX_OUTER,   KRON_FLUX_OUTER    1E      float,    kron flux 2.5<R<4,     counts
    111 # FIELD flags,          FLAGS,             FLAGS              1J      int,      analysis flags
    112 # FIELD flags2,         FLAGS,             FLAGS2             1J      int,      analysis flags (2)
    113 # FIELD nFrames,        N_FRAMES,          N_FRAMES           1I      short,    images overlapping peak
    114 # FIELD padding,        PADDING,           PADDING            1I      short,    padding for 8byte records
    115 
    116      
    117 
     66# fields added since PS1_V2:
     67# FIELD Flux,           PSF_INST_FLUX,     float,    psf flux,         counts
     68# FIELD dFlux,          PSF_INST_FLUX_SIG, float,    psf flux error,        counts     
     69# FIELD MapRaw,         AP_MAG_RAW,        float,    raw aperture mag,      mags
     70# FIELD psfQualPerfect, PSF_QF_PERFECT,    float,    quality factor perfect
     71# FIELD M3c,            MOMENTS_M3C,       float,    third moment cos(t),   pixels^3
     72# FIELD M3s,            MOMENTS_M3S,       float,    third moment sin(t),   pixels^3
     73# FIELD M4c,            MOMENTS_M4C,       float,    fourth moment cos(t),  pixels^4
     74# FIELD M4s,            MOMENTS_M4S,       float,    fourth moment sin(t),  pixels^4
     75# FIELD Mr1,            MOMENTS_R1,        float,    first radial moment,   pixels
     76# FIELD Mrh,            MOMENTS_RH,        float,    half radial moment,    pixels^1/2
     77# FIELD kronFlux,       KRON_FLUX,         float,    kron flux,             counts
     78# FIELD kronFluxErr,    KRON_FLUX_ERR,     float,    kron flux error,       counts
     79# FIELD kronInner,      KRON_FLUX_INNER,   float,    kron flux 1<R<2.5,     counts
     80# FIELD kronOuter,      KRON_FLUX_OUTER,   float,    kron flux 2.5<R<4,     counts
     81# FIELD flags2,         FLAGS,             int,      analysis flags (2)
  • branches/eam_branches/ipp-20120627/Ohana/src/libdvo/include/dvo.h

    r34138 r34140  
    449449float PhotCat (Measure *measure);
    450450float PhotAper (Measure *measure);
     451float PhotKron (Measure *measure);
    451452float PhotSys (Measure *measure, Average *average, SecFilt *secfilt);
    452453float PhotRel (Measure *measure, Average *average, SecFilt *secfilt);
     
    456457float PhotXm (PhotCode *code, Average *average, SecFilt *secfilt);
    457458float PhotdM (PhotCode *code, Average *average, SecFilt *secfilt);
     459
     460float PhotAperInst (Measure *measure);
     461float PhotKronInst (Measure *measure);
     462float PhotKronAve (PhotCode *code, Average *average, SecFilt *secfilt);
    458463
    459464float PhotMstdev (PhotCode *code, Average *average, SecFilt *secfilt);
  • branches/eam_branches/ipp-20120627/Ohana/src/libdvo/include/dvodb.h

    r33963 r34140  
    2626      MAG_CAT,
    2727      MAG_APER,
     28      MAG_APER_INST,
     29      MAG_KRON,
     30      MAG_KRON_INST,
     31      MAG_KRON_ERR,
    2832      MAG_SYS,
    2933      MAG_REL,
  • branches/eam_branches/ipp-20120627/Ohana/src/libdvo/src/dbExtractAverages.c

    r33963 r34140  
    233233          break;
    234234
     235        case MAG_KRON:
     236          value.Flt = PhotKronAve (field->photcode, average, secfilt);
     237          break;
     238
    235239        case MAG_20:
    236240          value.Flt = PhotM20 (field->photcode, average, secfilt);
  • branches/eam_branches/ipp-20120627/Ohana/src/libdvo/src/dbExtractMeasures.c

    r33649 r34140  
    117117          break;
    118118        case MAG_APER:
    119           value.Flt = PhotAper  (measure);
     119          value.Flt = PhotAper (measure);
     120          break;
     121        case MAG_APER_INST:
     122          value.Flt = PhotAperInst (measure);
     123          break;
     124        case MAG_KRON:
     125          value.Flt = PhotKron (measure);
     126          break;
     127        case MAG_KRON_INST:
     128          value.Flt = PhotKronInst (measure);
     129          break;
     130        case MAG_KRON_ERR:
     131          value.Flt = measure[0].dMkron;
    120132          break;
    121133        case MAG_ERR:
  • branches/eam_branches/ipp-20120627/Ohana/src/libdvo/src/dbFields.c

    r33963 r34140  
    3939  if (!strcasecmp (string, "ap"))        return (MAG_APER);
    4040  if (!strcasecmp (string, "aper"))      return (MAG_APER);
     41  if (!strcasecmp (string, "aperinst"))  return (MAG_APER_INST);
     42  if (!strcasecmp (string, "aper_inst")) return (MAG_APER_INST);
     43  if (!strcasecmp (string, "kron"))      return (MAG_KRON);
     44  if (!strcasecmp (string, "kroninst"))  return (MAG_KRON_INST);
     45  if (!strcasecmp (string, "kron_inst")) return (MAG_KRON_INST);
     46  if (!strcasecmp (string, "kronerr"))   return (MAG_KRON_ERR);
    4147  if (!strcasecmp (string, "err"))       return (MAG_ERR);
    4248  if (!strcasecmp (string, "aveerr"))    return (MAG_AVE_ERR);
  • branches/eam_branches/ipp-20120627/Ohana/src/libdvo/src/dvo_photcode_ops.c

    r33963 r34140  
    276276 
    277277  return (Mcat);
     278}
     279
     280float PhotAperInst (Measure *measure) {
     281
     282  int Np;
     283  float Minst;
     284
     285  Np = photcodes[0].hashcode[measure[0].photcode];
     286  if (Np == -1) return (NAN);
     287
     288  if (photcodes[0].code[Np].type == PHOT_REF) {
     289    Minst = measure[0].Map;
     290    return (Minst);
     291  }
     292  Minst = measure[0].Map - measure[0].dt - ZERO_POINT;
     293 
     294  return (Minst);
     295}
     296
     297float PhotKron (Measure *measure) {
     298
     299  int Np;
     300  float Mcat;
     301  PhotCode *code;
     302
     303  Np = photcodes[0].hashcode[measure[0].photcode];
     304  if (Np == -1) return (NAN);
     305
     306  if (photcodes[0].code[Np].type == PHOT_REF) {
     307    Mcat = measure[0].Mkron;
     308    return (Mcat);
     309  }
     310  code = &photcodes[0].code[Np];
     311  Mcat = measure[0].Mkron - ZERO_POINT + code[0].K*(measure[0].airmass - 1.000) + SCALE*code[0].C;
     312 
     313  return (Mcat);
     314}
     315
     316float PhotKronInst (Measure *measure) {
     317
     318  int Np;
     319  float Minst;
     320
     321  Np = photcodes[0].hashcode[measure[0].photcode];
     322  if (Np == -1) return (NAN);
     323
     324  if (photcodes[0].code[Np].type == PHOT_REF) {
     325    Minst = measure[0].Mkron;
     326    return (Minst);
     327  }
     328  Minst = measure[0].Mkron - measure[0].dt - ZERO_POINT;
     329 
     330  return (Minst);
    278331}
    279332
     
    488541}
    489542
     543float PhotKronAve (PhotCode *code, Average *average, SecFilt *secfilt) {
     544
     545  int Ns;
     546  float Mkron;
     547
     548  if (code == NULL) return NAN;
     549
     550  Ns = photcodes[0].hashNsec[code[0].code];
     551  Mkron = (Ns == -1) ? NAN : secfilt[Ns].Mkron;
     552  return (Mkron);
     553}
     554
    490555float PhotM20 (PhotCode *code, Average *average, SecFilt *secfilt) {
    491556
  • branches/eam_branches/ipp-20120627/Ohana/src/relphot/src/StarOps.c

    r34088 r34140  
    1515  double *wlist;
    1616  double *aplist;
    17   double *daplist;
     17  double *kronlist;
     18  double *dkronlist;
    1819} SetMrelInfo;
    1920
     
    164165  SetMrelInfoInit (&results, TRUE); // allocates results->list,dlist,wlist
    165166  ALLOCATE (results.aplist, double, Nmax);
    166   ALLOCATE (results.daplist, double, Nmax);
     167  ALLOCATE (results.kronlist, double, Nmax);
     168  ALLOCATE (results.dkronlist, double, Nmax);
    167169
    168170  for (i = 0; i < Ncatalog; i++) {
     
    174176  SetMrelInfoFree (&results);
    175177  free (results.aplist);
    176   free (results.daplist);
     178  free (results.kronlist);
     179  free (results.dkronlist);
    177180  return (TRUE);
    178181}
     
    307310  float Msys, Mcal, Mmos, Mgrid;
    308311
    309   StatType stats, apstats;
     312  StatType stats, apstats, kronstats;
    310313  liststats_setmode (&stats, STATMODE);
    311314  liststats_setmode (&apstats, STATMODE);
    312 
    313   double *list    = results->list;
    314   double *dlist   = results->dlist;
    315   double *wlist   = results->wlist;
    316   double *aplist  = results->aplist;
    317   double *daplist = results->daplist;
     315  liststats_setmode (&kronstats, STATMODE);
     316
     317  double *list      = results->list;
     318  double *dlist     = results->dlist;
     319  double *wlist     = results->wlist;
     320  double *aplist    = results->aplist;
     321  double *kronlist  = results->kronlist;
     322  double *dkronlist = results->dkronlist;
    318323
    319324  SetMrelInfoInit (results, FALSE); // do not allocate list,dlist,wlist arrays
     
    401406          float Map = PhotAper (&catalog[Nc].measure[m]);
    402407          aplist[N] = Map - Mcal - Mmos - Mgrid;
     408
     409          float Mkron = PhotKron (&catalog[Nc].measure[m]);
     410          kronlist[N] = Mkron - Mcal - Mmos - Mgrid;
     411          dkronlist[N] = catalog[Nc].measure[m].dMkron;
    403412
    404413          // special options for PS1 data
     
    549558
    550559        // NOTE : use the modified weight for apmags as well as psf mags
    551         liststats (aplist, daplist, wlist, N, &apstats);
    552 
     560        liststats (aplist, dlist, wlist, N, &apstats);
    553561        catalog[Nc].secfilt[Nsecfilt*j+Nsec].Map  = apstats.mean;
     562
     563        liststats (kronlist, dkronlist, wlist, N, &kronstats);
     564        catalog[Nc].secfilt[Nsecfilt*j+Nsec].Mkron  = kronstats.mean;
     565        catalog[Nc].secfilt[Nsecfilt*j+Nsec].dMkron = kronstats.error;
    554566
    555567        // NOTE: for 2MASS measurements, Next should be 1, as should N
Note: See TracChangeset for help on using the changeset viewer.