IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 5, 2012, 4:25:56 PM (14 years ago)
Author:
eugene
Message:

merging change from eam_branches/ipp-20120805: adding psfQF, psfQFperf to both average and measure; deprecate average.Xp

Location:
trunk/Ohana
Files:
13 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Ohana

  • trunk/Ohana/src/addstar/Makefile

    r34297 r34405  
    4747$(SRC)/SkyTableFromTychoIndex.$(ARCH).o \
    4848$(SRC)/addstar.$(ARCH).o \
     49$(SRC)/addstar_create_ID.$(ARCH).o \
    4950$(SRC)/airmass.$(ARCH).o \
    5051$(SRC)/args.$(ARCH).o \
  • trunk/Ohana/src/addstar/include/addstar.h

    r34260 r34405  
    5959typedef struct sockaddr_in SockAddress;
    6060
    61 enum {ADDSTAR_MODE_NONE, ADDSTAR_MODE_IMAGE, ADDSTAR_MODE_REFLIST, ADDSTAR_MODE_REFCAT, ADDSTAR_MODE_FAKEIMAGE, ADDSTAR_MODE_RESORT};
     61enum {ADDSTAR_MODE_NONE, ADDSTAR_MODE_IMAGE, ADDSTAR_MODE_REFLIST, ADDSTAR_MODE_REFCAT, ADDSTAR_MODE_FAKEIMAGE, ADDSTAR_MODE_RESORT, ADDSTAR_MODE_CREATE_ID};
    6262enum {NONE, SIMPLE_CMP, SIMPLE_CMF, SIMPLE_MEF, MOSAIC_CMP, MOSAIC_CMF, MOSAIC_MEF, MOSAIC_PHU, SDSS_OBJ};
    6363/* note: MEF implies CMF */
     
    269269int        NewReflist_Thread      PROTO((int BindSocket));
    270270
    271 Stars     *Convert_SMPDATA        PROTO((FTable *table, unsigned int *nstars));
    272 Stars     *Convert_PS1_DEV_0      PROTO((FTable *table, unsigned int *nstars));
    273 Stars     *Convert_PS1_DEV_1      PROTO((FTable *table, unsigned int *nstars));
    274 Stars     *Convert_PS1_V1         PROTO((FTable *table, unsigned int *nstars));
    275 Stars     *Convert_PS1_V1_Alt     PROTO((FTable *table, unsigned int *nstars));
    276 Stars     *Convert_PS1_V2         PROTO((FTable *table, unsigned int *nstars));
    277 Stars     *Convert_PS1_V3         PROTO((FTable *table, unsigned int *nstars));
    278 Stars     *Convert_PS1_SV1        PROTO((FTable *table, unsigned int *nstars));
    279 Stars     *Convert_PS1_SV1_Alt    PROTO((FTable *table, unsigned int *nstars));
    280 
    281271int        InitStar               PROTO((Stars *star));
    282272
     
    303293// this is a gnu extension?? caution!
    304294void *memrchr(const void *s, int c, size_t n);
     295int addstar_create_ID ();
    305296
    306297/**
  • trunk/Ohana/src/addstar/src/MatchHeaders.c

    r31160 r34405  
    5858    if (!strcmp (exttype, "PS1_V2")) goto keep;
    5959    if (!strcmp (exttype, "PS1_V3")) goto keep;
     60    if (!strcmp (exttype, "PS1_V4")) goto keep;
    6061    if (!strcmp (exttype, "PS1_SV1")) goto keep;
     62    if (!strcmp (exttype, "PS1_SV2")) goto keep;
    6163    continue;
    6264
  • trunk/Ohana/src/addstar/src/ReadStarsFITS.c

    r34260 r34405  
    11# include "addstar.h"
     2
     3// this is the complete list of FITS format input files the addstar knows
     4// (excluding SDSS data and reference database info, such as 2MASS)
     5// NOTE: these must also be listed in MatchHeaders.c (line ~ 62)
     6Stars     *Convert_SMPDATA        PROTO((FTable *table, unsigned int *nstars));
     7Stars     *Convert_PS1_DEV_0      PROTO((FTable *table, unsigned int *nstars));
     8Stars     *Convert_PS1_DEV_1      PROTO((FTable *table, unsigned int *nstars));
     9Stars     *Convert_PS1_V1         PROTO((FTable *table, unsigned int *nstars));
     10Stars     *Convert_PS1_V1_Alt     PROTO((FTable *table, unsigned int *nstars));
     11Stars     *Convert_PS1_V2         PROTO((FTable *table, unsigned int *nstars));
     12Stars     *Convert_PS1_V3         PROTO((FTable *table, unsigned int *nstars));
     13Stars     *Convert_PS1_V4         PROTO((FTable *table, unsigned int *nstars));
     14Stars     *Convert_PS1_SV1        PROTO((FTable *table, unsigned int *nstars));
     15Stars     *Convert_PS1_SV1_Alt    PROTO((FTable *table, unsigned int *nstars));
     16Stars     *Convert_PS1_SV2        PROTO((FTable *table, unsigned int *nstars));
    217
    318// given a file with the pointer at the start of the table block and the
     
    5469    stars = Convert_PS1_V3 (&table, &Nstars);
    5570  }
     71  if (!strcmp (type, "PS1_V4")) {
     72    stars = Convert_PS1_V4 (&table, &Nstars);
     73  }
    5674  if (!strcmp (type, "PS1_SV1")) {
    5775    stars = Convert_PS1_SV1 (&table, &Nstars);
     76  }
     77  if (!strcmp (type, "PS1_SV2")) {
     78    stars = Convert_PS1_SV2 (&table, &Nstars);
    5879  }
    5980  if (stars == NULL) {
     
    120141
    121142    stars[i].measure.psfChisq   = NAN;       // not provided by SMPDATA:
    122     stars[i].measure.psfQual    = NAN;       // not provided by SMPDATA:
     143    stars[i].measure.psfQF      = NAN;       // not provided by SMPDATA:
    123144    stars[i].measure.psfNdof    = NAN_S_INT; // not provided by SMPDATA:
    124145    stars[i].measure.psfNpix    = NAN_S_INT; // not provided by SMPDATA:
     
    189210
    190211    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
    191     stars[i].measure.psfQual    = ps1data[i].psfQual;
     212    stars[i].measure.psfQF      = ps1data[i].psfQF;
    192213    stars[i].measure.psfNdof    = NAN_S_INT; // not provided by PS1_DEV_0:
    193214    stars[i].measure.psfNpix    = NAN_S_INT; // not provided by PS1_DEV_0:
     
    261282
    262283    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
    263     stars[i].measure.psfQual    = ps1data[i].psfQual;
     284    stars[i].measure.psfQF      = ps1data[i].psfQF;
    264285    stars[i].measure.psfNdof    = NAN_S_INT; // not provided by PS1_DEV_1:
    265286    stars[i].measure.psfNpix    = NAN_S_INT; // not provided by PS1_DEV_1:
     
    345366                       
    346367    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
    347     stars[i].measure.psfQual    = ps1data[i].psfQual;
     368    stars[i].measure.psfQF      = ps1data[i].psfQF;
    348369    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
    349370    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
     
    430451                       
    431452    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
    432     stars[i].measure.psfQual    = ps1data[i].psfQual;
     453    stars[i].measure.psfQF      = ps1data[i].psfQF;
    433454    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
    434455    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
     
    507528                       
    508529    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
    509     stars[i].measure.psfQual    = ps1data[i].psfQual;
     530    stars[i].measure.psfQF      = ps1data[i].psfQF;
    510531    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
    511532    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
     
    584605                       
    585606    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
    586     stars[i].measure.psfQual    = ps1data[i].psfQual;
     607    stars[i].measure.psfQF      = ps1data[i].psfQF;
    587608    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
    588609    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
     
    616637}
    617638
    618 Stars *Convert_PS1_SV1 (FTable *table, unsigned int *nstars) {
     639Stars *Convert_PS1_V4 (FTable *table, unsigned int *nstars) {
    619640
    620641  off_t Nstars;
     
    622643  double ZeroPt;
    623644  Stars *stars;
    624   CMF_PS1_SV1 *ps1data;
    625 
    626   if (table[0].header[0].Naxis[0] == 196) {
    627     stars = Convert_PS1_SV1_Alt (table, nstars);
    628     return (stars);
    629   }
    630 
    631   ps1data = gfits_table_get_CMF_PS1_SV1 (table, &Nstars, NULL);
     645  CMF_PS1_V4 *ps1data;
     646
     647  ps1data = gfits_table_get_CMF_PS1_V4 (table, &Nstars, NULL);
    632648  if (!ps1data) {
    633649    fprintf (stderr, "skipping inconsistent entry\n");
     
    658674    stars[i].measure.Mkron      = (ps1data[i].kronFlux > 0.0) ? -2.5*log10(ps1data[i].kronFlux) + ZeroPt : NAN;
    659675    stars[i].measure.dMkron     = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN;
    660 
     676                       
    661677    // these fluxes are converted from counts to counts/sec in FilterStars.c
    662678    stars[i].measure.FluxPSF    = ps1data[i].Flux;
     
    669685                       
    670686    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
    671     stars[i].measure.psfQual    = ps1data[i].psfQual;
     687    stars[i].measure.psfQF      = ps1data[i].psfQF;
    672688    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
    673689    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
     
    689705
    690706    // the Average fields and the following Measure fields are set in FilterStars after
    691     // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID,
    692     // averef is set in find_matches, dbFlags is zero on ingest.
     707    // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID.
     708
     709    // averef is set in find_matches
     710
     711    // dbFlags is zero on ingest.
    693712
    694713    // the following fields are currently not being set anywhere: t_msec
     
    698717}
    699718
    700 Stars *Convert_PS1_SV1_Alt (FTable *table, unsigned int *nstars) {
     719Stars *Convert_PS1_SV1 (FTable *table, unsigned int *nstars) {
    701720
    702721  off_t Nstars;
     
    706725  CMF_PS1_SV1 *ps1data;
    707726
    708   // some test output files were produced called CMF_PS1_SV1 but with mismatch byte boundaries
    709 
    710   ps1data = gfits_table_get_CMF_PS1_SV1_Alt (table, &Nstars, NULL);
     727  if (table[0].header[0].Naxis[0] == 196) {
     728    stars = Convert_PS1_SV1_Alt (table, nstars);
     729    return (stars);
     730  }
     731
     732  ps1data = gfits_table_get_CMF_PS1_SV1 (table, &Nstars, NULL);
    711733  if (!ps1data) {
    712734    fprintf (stderr, "skipping inconsistent entry\n");
     
    748770                       
    749771    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
    750     stars[i].measure.psfQual    = ps1data[i].psfQual;
     772    stars[i].measure.psfQF      = ps1data[i].psfQF;
    751773    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
    752774    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
     
    777799}
    778800
     801Stars *Convert_PS1_SV1_Alt (FTable *table, unsigned int *nstars) {
     802
     803  off_t Nstars;
     804  unsigned int i;
     805  double ZeroPt;
     806  Stars *stars;
     807  CMF_PS1_SV1 *ps1data;
     808
     809  // some test output files were produced called CMF_PS1_SV1 but with mismatch byte boundaries
     810
     811  ps1data = gfits_table_get_CMF_PS1_SV1_Alt (table, &Nstars, NULL);
     812  if (!ps1data) {
     813    fprintf (stderr, "skipping inconsistent entry\n");
     814    return (NULL);
     815  }
     816  ZeroPt = GetZeroPoint();
     817
     818  ALLOCATE (stars, Stars, Nstars);
     819  for (i = 0; i < Nstars; i++) {
     820    InitStar (&stars[i]);
     821    stars[i].measure.Xccd       = ps1data[i].X;
     822    stars[i].measure.Yccd       = ps1data[i].Y;
     823    stars[i].measure.dXccd      = ToShortPixels(ps1data[i].dX);
     824    stars[i].measure.dYccd      = ToShortPixels(ps1data[i].dY);
     825
     826    stars[i].measure.posangle   = ToShortDegrees(ps1data[i].posangle);
     827    stars[i].measure.pltscale   = ps1data[i].pltscale;
     828
     829    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
     830      stars[i].measure.M      = NAN;
     831    } else {
     832      stars[i].measure.M      = ps1data[i].M + ZeroPt;
     833    }
     834    stars[i].measure.dM         = ps1data[i].dM;
     835    stars[i].measure.dMcal      = ps1data[i].dMcal;
     836    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
     837                       
     838    stars[i].measure.Mkron      = (ps1data[i].kronFlux > 0.0) ? -2.5*log10(ps1data[i].kronFlux) + ZeroPt : NAN;
     839    stars[i].measure.dMkron     = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN;
     840
     841    // these fluxes are converted from counts to counts/sec in FilterStars.c
     842    stars[i].measure.FluxPSF    = ps1data[i].Flux;
     843    stars[i].measure.dFluxPSF   = ps1data[i].dFlux;
     844    stars[i].measure.FluxKron   = ps1data[i].kronFlux;
     845    stars[i].measure.dFluxKron  = ps1data[i].kronFluxErr;
     846
     847    stars[i].measure.Sky        = ps1data[i].sky;
     848    stars[i].measure.dSky       = ps1data[i].dSky;
     849                       
     850    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
     851    stars[i].measure.psfQF      = ps1data[i].psfQF;
     852    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
     853    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
     854    stars[i].measure.crNsigma   = ps1data[i].crNsigma;
     855    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
     856
     857    stars[i].measure.FWx        = ToShortPixels(ps1data[i].fx);
     858    stars[i].measure.FWy        = ToShortPixels(ps1data[i].fy);
     859    stars[i].measure.theta      = ToShortDegrees(ps1data[i].df);
     860
     861    stars[i].measure.Mxx        = ToShortPixels(ps1data[i].Mxx);
     862    stars[i].measure.Mxy        = ToShortPixels(ps1data[i].Mxy);
     863    stars[i].measure.Myy        = ToShortPixels(ps1data[i].Myy);
     864                       
     865    stars[i].measure.photFlags  = ps1data[i].flags;
     866
     867    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     868    stars[i].measure.detID      = ps1data[i].detID;
     869
     870    // the Average fields and the following Measure fields are set in FilterStars after
     871    // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID,
     872    // averef is set in find_matches, dbFlags is zero on ingest.
     873
     874    // the following fields are currently not being set anywhere: t_msec
     875  }   
     876  *nstars = Nstars;
     877  return (stars);
     878}
     879
     880Stars *Convert_PS1_SV2 (FTable *table, unsigned int *nstars) {
     881
     882  off_t Nstars;
     883  unsigned int i;
     884  double ZeroPt;
     885  Stars *stars;
     886  CMF_PS1_SV2 *ps1data;
     887
     888  ps1data = gfits_table_get_CMF_PS1_SV2 (table, &Nstars, NULL);
     889  if (!ps1data) {
     890    fprintf (stderr, "skipping inconsistent entry\n");
     891    return (NULL);
     892  }
     893  ZeroPt = GetZeroPoint();
     894
     895  ALLOCATE (stars, Stars, Nstars);
     896  for (i = 0; i < Nstars; i++) {
     897    InitStar (&stars[i]);
     898    stars[i].measure.Xccd       = ps1data[i].X;
     899    stars[i].measure.Yccd       = ps1data[i].Y;
     900    stars[i].measure.dXccd      = ToShortPixels(ps1data[i].dX);
     901    stars[i].measure.dYccd      = ToShortPixels(ps1data[i].dY);
     902
     903    stars[i].measure.posangle   = ToShortDegrees(ps1data[i].posangle);
     904    stars[i].measure.pltscale   = ps1data[i].pltscale;
     905
     906    if ((ps1data[i].M >= 0.0) || isnan(ps1data[i].M)) {
     907      stars[i].measure.M      = NAN;
     908    } else {
     909      stars[i].measure.M      = ps1data[i].M + ZeroPt;
     910    }
     911    stars[i].measure.dM         = ps1data[i].dM;
     912    stars[i].measure.dMcal      = ps1data[i].dMcal;
     913    stars[i].measure.Map        = ps1data[i].Map + ZeroPt;
     914                       
     915    stars[i].measure.Mkron      = (ps1data[i].kronFlux > 0.0) ? -2.5*log10(ps1data[i].kronFlux) + ZeroPt : NAN;
     916    stars[i].measure.dMkron     = (ps1data[i].kronFlux > 0.0) ? ps1data[i].kronFluxErr / ps1data[i].kronFlux : NAN;
     917
     918    // these fluxes are converted from counts to counts/sec in FilterStars.c
     919    stars[i].measure.FluxPSF    = ps1data[i].Flux;
     920    stars[i].measure.dFluxPSF   = ps1data[i].dFlux;
     921    stars[i].measure.FluxKron   = ps1data[i].kronFlux;
     922    stars[i].measure.dFluxKron  = ps1data[i].kronFluxErr;
     923
     924    stars[i].measure.Sky        = ps1data[i].sky;
     925    stars[i].measure.dSky       = ps1data[i].dSky;
     926                       
     927    stars[i].measure.psfChisq   = ps1data[i].psfChisq;
     928    stars[i].measure.psfQF      = ps1data[i].psfQF;
     929    stars[i].measure.psfNdof    = ps1data[i].psfNdof;
     930    stars[i].measure.psfNpix    = ps1data[i].psfNpix;
     931    stars[i].measure.crNsigma   = ps1data[i].crNsigma;
     932    stars[i].measure.extNsigma  = ps1data[i].extNsigma;
     933
     934    stars[i].measure.FWx        = ToShortPixels(ps1data[i].fx);
     935    stars[i].measure.FWy        = ToShortPixels(ps1data[i].fy);
     936    stars[i].measure.theta      = ToShortDegrees(ps1data[i].df);
     937
     938    stars[i].measure.Mxx        = ToShortPixels(ps1data[i].Mxx);
     939    stars[i].measure.Mxy        = ToShortPixels(ps1data[i].Mxy);
     940    stars[i].measure.Myy        = ToShortPixels(ps1data[i].Myy);
     941                       
     942    stars[i].measure.photFlags  = ps1data[i].flags;
     943
     944    // this is may optionally be replaced by the internal sequence (see FilterStars.c)
     945    stars[i].measure.detID      = ps1data[i].detID;
     946
     947    // the Average fields and the following Measure fields are set in FilterStars after
     948    // the image metadata is in hand:  dR, dD, Mcal, dt, airmass, az, t, imageID, extID,
     949    // averef is set in find_matches, dbFlags is zero on ingest.
     950
     951    // the following fields are currently not being set anywhere: t_msec
     952  }   
     953  *nstars = Nstars;
     954  return (stars);
     955}
     956
     957
  • trunk/Ohana/src/addstar/src/SEDfit.c

    r21508 r34405  
    147147    // construct an average object for this object
    148148    // XXX for now, the output objects will have limited astrometric interpretation...
     149    dvo_average_init (&outcat[0].average[Nave]);
    149150    outcat[0].average[Nave].R         = incat[0].average[i].R;
    150151    outcat[0].average[Nave].D         = incat[0].average[i].D;
    151     outcat[0].average[Nave].dR    = 0;
    152     outcat[0].average[Nave].dD    = 0;
    153     outcat[0].average[Nave].uR    = 0;
    154     outcat[0].average[Nave].uD    = 0;
    155     outcat[0].average[Nave].duR   = 0;
    156     outcat[0].average[Nave].duD   = 0;
    157     outcat[0].average[Nave].P     = 0;
    158     outcat[0].average[Nave].dP    = 0;
    159 
    160     // XXX for now, set the average mag data to NULL
    161     outcat[0].average[Nave].Nmeasure      = 0;
    162     outcat[0].average[Nave].Nmissing      = 0;
    163     outcat[0].average[Nave].Xp            = NAN_S_SHORT;
    164     outcat[0].average[Nave].measureOffset = Nmeas;
    165     outcat[0].average[Nave].missingOffset = -1;
    166     outcat[0].average[Nave].flags         = 0;
    167152
    168153    for (j = 0; j < Nsec; j++) {
    169       outcat[0].secfilt[Nave*Nsec+j].M  = NAN;
    170       outcat[0].secfilt[Nave*Nsec+j].dM = NAN;
    171       outcat[0].secfilt[Nave*Nsec+j].Xm = NAN_S_SHORT;
     154      dvo_secfilt_init (&outcat[0].secfilt[Nave*Nsec+j]);
    172155    }
    173156
     
    181164    for (j = 0; valid && (j < Nmodel); j++) {
    182165      n = modelRow[j];
     166      dvo_measure_init (&outcat[0].measure[Nmeas]);
    183167      outcat[0].measure[Nmeas].dR        = 0.0;
    184168      outcat[0].measure[Nmeas].dD        = 0.0;
  • trunk/Ohana/src/addstar/src/addstar.c

    r33963 r34405  
    2727  options = args (argc, argv, options);
    2828
     29  if (options.mode == ADDSTAR_MODE_CREATE_ID) {
     30    addstar_create_ID ();
     31    exit (0);
     32  }
     33
    2934  sky = SkyTableLoadOptimal (CATDIR, SKY_TABLE, GSCFILE, TRUE, SKY_DEPTH, VERBOSE);
    3035  if (sky == NULL) {
  • trunk/Ohana/src/addstar/src/args.c

    r33963 r34405  
    3232  if ((N = get_argument (argc, argv, "-resort"))) {
    3333    options.mode = ADDSTAR_MODE_RESORT;
     34    remove_argument (N, &argc, argv);
     35  }
     36  if ((N = get_argument (argc, argv, "-create-id"))) {
     37    options.mode = ADDSTAR_MODE_CREATE_ID;
    3438    remove_argument (N, &argc, argv);
    3539  }
     
    101105      if (options.mode == ADDSTAR_MODE_FAKEIMAGE) goto allow;
    102106      if (options.mode == ADDSTAR_MODE_REFLIST) goto allow;
     107      if (options.mode == ADDSTAR_MODE_CREATE_ID) goto allow;
    103108      if (options.mode == ADDSTAR_MODE_REFCAT) {
    104109          fprintf (stderr, "you have requested uploading from a catalog to the entire sky in one pass\n");
     
    364369  }
    365370
     371  if ((options.mode == ADDSTAR_MODE_CREATE_ID) && (argc == 1)) return (options);
    366372  if ((options.mode == ADDSTAR_MODE_RESORT) && (argc == 1)) return (options);
    367373  if (argc == 2) return (options);
     
    378384  fprintf (stderr, "USAGE: addstar -fakeimage (ra) (dec) (theta) (name)\n");
    379385  fprintf (stderr, "USAGE: addstar -resort (SkyRegion)\n");
     386  fprintf (stderr, "USAGE: addstar -add-id\n");
    380387  fprintf (stderr, "USAGE: addstar -ppm (filename)\n");
    381388  exit (2);
  • trunk/Ohana/src/addstar/src/load2mass_catalog.c

    r21508 r34405  
    3434    catalog[0].average[Nave].Nmeasure      = 0;
    3535    catalog[0].average[Nave].Nmissing      = 0;
    36     catalog[0].average[Nave].Xp            = NAN_S_SHORT;
     36    catalog[0].average[Nave].ChiSqAve      = NAN_S_SHORT;
    3737    catalog[0].average[Nave].measureOffset = Nmeas;
    3838    catalog[0].average[Nave].missingOffset = -1;
  • trunk/Ohana/src/addstar/src/mkcmf.c

    r34260 r34405  
    1414void gauss_init (int Nbin);
    1515double rnd_gauss (double mean, double sigma);
     16void writeStars_PS1_V4 (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars);
    1617void writeStars_PS1_V3 (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars);
    1718void writeStars_PS1_V2 (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars);
     
    283284    found = TRUE;
    284285  }
     286  if (!strcmp(type, "PS1_V4")) {
     287    writeStars_PS1_V4 (&ftable, X, Y, M, Flag, Nstars);
     288    found = TRUE;
     289  }
    285290  if (!found) {
    286291    fprintf (stderr, "ERROR: unknown CMF type %s\n", type);
     
    419424    stars[i].fy        = FY;
    420425    stars[i].df        = DF;
    421     stars[i].psfQual   = PSFQUAL;
     426    stars[i].psfQF   = PSFQUAL;
    422427    stars[i].nFrames   = 1;
    423428  }
     
    466471    stars[i].fy        = FY;
    467472    stars[i].df        = DF;
    468     stars[i].psfQual   = PSFQUAL;
     473    stars[i].psfQF   = PSFQUAL;
    469474    stars[i].nFrames   = 1;
    470475    stars[i].flags     = FLAGS;
     
    514519    stars[i].fy        = FY;
    515520    stars[i].df        = DF;
    516     stars[i].psfQual   = PSFQUAL;
     521    stars[i].psfQF   = PSFQUAL;
    517522    stars[i].nFrames   = 1;
    518523    stars[i].flags     = FLAGS;
     
    551556    // randomly give poor PSFQF values
    552557    if ((BAD_PSFQF_FRAC > 0.0) && (drand48() < BAD_PSFQF_FRAC)) {
    553       stars[i].psfQual   = 0.25;
     558      stars[i].psfQF   = 0.25;
    554559    } else {
    555       stars[i].psfQual   = PSFQUAL;
     560      stars[i].psfQF   = PSFQUAL;
    556561    }
    557562   
     
    606611    // randomly give poor PSFQF values
    607612    if ((BAD_PSFQF_FRAC > 0.0) && (drand48() < BAD_PSFQF_FRAC)) {
    608       stars[i].psfQual   = 0.25;
     613      stars[i].psfQF   = 0.25;
    609614    } else {
    610       stars[i].psfQual   = PSFQUAL;
     615      stars[i].psfQF   = PSFQUAL;
    611616    }
    612617   
     
    635640}
    636641
     642void writeStars_PS1_V4 (FTable *ftable, double *X, double *Y, double *M, unsigned int *Flag, int Nstars) {
     643
     644  int i;
     645  CMF_PS1_V4 *stars;
     646  float flux, fSN;
     647
     648  // XXX add gaussian-distributed noise based on counts
     649  // this needs to make different output 'stars' entries depending on the desired type
     650  ALLOCATE (stars, CMF_PS1_V4, Nstars);
     651  gauss_init (2048);
     652  for (i = 0; i < Nstars; i++) {
     653    stars[i].detID = i;
     654
     655    flux = pow (10.0, -0.4*M[i]);
     656    fSN = 1.0 / sqrt(flux);
     657
     658    stars[i].X = X[i];
     659    stars[i].Y = Y[i];
     660    stars[i].M = M[i];
     661    stars[i].Map = M[i] - 0.05;
     662
     663    if (ADDNOISE) {
     664      stars[i].X += FX * fSN * rnd_gauss(0.0, 1.0);
     665      stars[i].Y += FY * fSN * rnd_gauss(0.0, 1.0);
     666      stars[i].M += fSN*rnd_gauss(0.0, 1.0);
     667    }
     668
     669    // randomly give poor PSFQF values
     670    if ((BAD_PSFQF_FRAC > 0.0) && (drand48() < BAD_PSFQF_FRAC)) {
     671      stars[i].psfQF     = 0.25;
     672      stars[i].psfQFperf = 0.24;
     673    } else {
     674      stars[i].psfQF     = PSFQUAL;
     675      stars[i].psfQFperf = MAX(PSFQUAL - 0.01, 0.0);
     676    }
     677   
     678    stars[i].dX = FX * fSN;
     679    stars[i].dY = FY * fSN;
     680    stars[i].dM = fSN;
     681
     682    stars[i].Mpeak     = M[i] + 1.0;
     683    stars[i].sky       = SKY;
     684    stars[i].dSky      = DSKY;
     685    stars[i].psfChisq  = PSFCHI;
     686    stars[i].crNsigma  = CRN;
     687    stars[i].extNsigma = EXTN;
     688    stars[i].fx        = FX;
     689    stars[i].fy        = FY;
     690    stars[i].df        = DF;
     691    stars[i].nFrames   = 1;
     692    stars[i].flags     = Flag[i];
     693
     694    stars[i].kronFlux  = flux * 1.25;
     695    stars[i].kronFluxErr = fSN * flux * 1.25;
     696  }
     697
     698  gfits_table_set_CMF_PS1_V4 (ftable, stars, Nstars);
     699  gfits_modify (ftable->header, "EXTTYPE",   "%s", 1, "PS1_V4");
     700}
     701
  • trunk/Ohana/src/addstar/src/update_coords.c

    r27435 r34405  
    4747  dR2 = r2 / Npt - r*r;
    4848  dD2 = d2 / Npt - d*d;
    49   average[0].Xp = sqrt (dD2 + dR2 / SQ(cos(d*RAD_DEG)));
    50   /* Xp is scatter in position in hundredths of arcsec */
     49  average[0].ChiSqAve = sqrt (dD2 + dR2 / SQ(cos(d*RAD_DEG)));
     50  /* ChiSqAve is supposed to be a chisq */
    5151
    5252  return;
  • trunk/Ohana/src/addstar/test/simple.dvo

    r34260 r34405  
    44
    55macro test.all
     6  # test.fields (DVO schema) (CMF format)
    67  test.fields PS1_DEV_0 PS1_V1
    78  test.fields PS1_DEV_1 PS1_V1
     
    910  test.fields PS1_V2    PS1_V1
    1011  test.fields PS1_V3    PS1_V1
     12  test.fields PS1_V4    PS1_V1
    1113
    1214  test.fields PS1_DEV_0 PS1_V2
     
    1517  test.fields PS1_V2    PS1_V2
    1618  test.fields PS1_V3    PS1_V2
     19  test.fields PS1_V4    PS1_V4
    1720
    1821  test.fields PS1_DEV_0 PS1_V3
     
    2124  test.fields PS1_V2    PS1_V3
    2225  test.fields PS1_V3    PS1_V3
     26  test.fields PS1_V4    PS1_V4
    2327
    2428  test.fields PS1_DEV_0 PS1_V4
     
    2731  test.fields PS1_V2    PS1_V4
    2832  test.fields PS1_V3    PS1_V4
     33  test.fields PS1_V4    PS1_V4
    2934end 
    3035
     
    3641  end
    3742
    38   tapPLAN 51
     43  echo ""
     44  echo "testing --- CMF = $1, DVO = $2 ---"
    3945
    4046  exec rm -rf catdir.test
     
    4551  mkinput
    4652  exec mkcmf test.in.txt test.cmf -date 2008/1/1 -time 01:00:00 -radec $RA $DEC -type $1
    47   exec addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf -D CATFORMAT $2 -quick-airmass
     53  if ($TAP_VERBOSE)
     54    exec addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf -D CATFORMAT $2 -quick-airmass
     55  else
     56    exec addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf -D CATFORMAT $2 -quick-airmass >& tmp.log
     57  end
    4858
    4959  list testfields -copy testfields_$1
     60
     61  # set the number of tests based on the testfields list
     62  tapPLAN {3 + 3*($testfields:n - 1)}
    5063
    5164  catdir catdir.test
     
    7790  for i 1 $testfields:n
    7891    list name -split $testfields:$i
    79     if ("$name:0" == "SKIP") continue
    80     if ("$name:2" == "SKIP") continue
     92    if ("$name:0" == "SKIP")
     93      tapSKIP 3
     94      continue
     95    end
     96    if ("$name:2" == "SKIP")
     97      tapSKIP 3
     98      continue
     99    end
    81100    # must be the same length
    82101    set v1 = $name:0
     
    106125    # THETA is stored to only (360/65536) deg accuracy
    107126    if ("$name:0" == "PSF_THETA")
    108       echo $MEAN
     127      # echo $MEAN
    109128      tapOK {abs($MEAN)  < 0.006} "$name:0 vs $name:2 (MEAN)"
    110129      tapOK {abs($SIGMA) < 0.001} "$name:0 vs $name:2 (SIGMA)"
     
    304323  N_FRAMES          : SKIP # not ingested into DVO
    305324end
     325
     326# this list is good for PS1_V4
     327list testfields_PS1_V4
     328  IPP_IDET          : detid     
     329  X_PSF             : xccd     
     330  Y_PSF             : yccd     
     331  X_PSF_SIG         : xccd:err # FAIL
     332  Y_PSF_SIG         : yccd:err # FAIL
     333  POSANGLE          : SKIP # astrometry is not calibrated in the cmf
     334  PLTSCALE          : SKIP # astrometry is not calibrated in the cmf
     335  PSF_INST_MAG      : mag:inst 
     336  PSF_INST_MAG_SIG  : mag:err   
     337  PSF_INST_FLUX     : SKIP # not ingested into DVO
     338  PSF_INST_FLUX_SIG : SKIP # not ingested into DVO
     339  AP_MAG_STANDARD   : mag:aperinst # FAIL
     340  AP_MAG_RAW        : SKIP # not ingested into DVO
     341  AP_MAG_RADIUS     : SKIP # not ingested into DVO
     342  CAL_PSF_MAG       : SKIP # photometry is not calibrated in the cmf
     343  CAL_PSF_MAG_SIG   : SKIP # photometry is not calibrated in the cmf
     344  RA_PSF            : SKIP # astrometry is not calibrated in the cmf
     345  DEC_PSF           : SKIP # astrometry is not calibrated in the cmf
     346  PEAK_FLUX_AS_MAG  : SKIP # not ingested into DVO
     347  SKY               : sky       
     348  SKY_SIG           : sky_err   
     349  PSF_CHISQ         : psf_chisq
     350  CR_NSIGMA         : cr_nsigma
     351  EXT_NSIGMA        : ext_nsigma
     352  PSF_MAJOR         : FWHM_MAJ 
     353  PSF_MINOR         : FWHM_MIN 
     354  PSF_THETA         : THETA # FAIL
     355  PSF_QF            : PSF_QF   
     356  PSF_QF_PERFECT    : SKIP # not ingested into DVO
     357  PSF_NDOF          : PSF_NDOF
     358  PSF_NPIX          : PSF_NPIX
     359  MOMENTS_XX        : MXX
     360  MOMENTS_XY        : MXY
     361  MOMENTS_YY        : MYY
     362  MOMENTS_M3C       : SKIP # not ingested into DVO
     363  MOMENTS_M3S       : SKIP # not ingested into DVO
     364  MOMENTS_M4C       : SKIP # not ingested into DVO
     365  MOMENTS_M4S       : SKIP # not ingested into DVO
     366  MOMENTS_R1        : SKIP # not ingested into DVO
     367  MOMENTS_RH        : SKIP # not ingested into DVO
     368  KRON_FLUX         : mag:kroninst
     369  KRON_FLUX_ERR     : mag:kronerr
     370  KRON_FLUX_INNER   : SKIP # not ingested into DVO
     371  KRON_FLUX_OUTER   : SKIP # not ingested into DVO
     372  FLAGS             : phot_flags
     373  N_FRAMES          : SKIP # not ingested into DVO
     374end
  • trunk/Ohana/src/addstar/test/tap.dvo

    r33653 r34405  
    22
    33if (not($?TAP_BREAK)) set TAP_BREAK = 0
     4if (not($?TAP_VERBOSE)) set TAP_VERBOSE = 0
    45
    56macro tapOK
     
    1011
    1112  if ($1)
    12     echo "ok : $2"
     13    if ($TAP_VERBOSE)
     14      echo "ok : $2"
     15    end
    1316    $TAP_LAST = 1
    1417  else
     
    4245  end
    4346
    44   $TAP_NSKIP ++
    45   $TAP_NDONE ++
     47  $TAP_NSKIP += $1
     48  $TAP_NDONE += $1
    4649end
    4750
Note: See TracChangeset for help on using the changeset viewer.