IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 27582


Ignore:
Timestamp:
Apr 2, 2010, 3:56:51 PM (16 years ago)
Author:
eugene
Message:

improve tests; extend mkcmf to other cmf types; modifications to support PS1_V2

Location:
trunk/Ohana/src/addstar
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/addstar/Makefile

    r26384 r27582  
    1 default: addstar
     1default: all
    22help:
    33        @echo "make options: addstar (default)"
     
    2727mkcmf       : $(BIN)/mkcmf.$(ARCH)
    2828
    29 all: addstar sedstar load2mass skycells
     29all: addstar sedstar load2mass skycells mkcmf
    3030
    3131# I need to fix the client/server version of addstar now that I have dropped Stars
  • trunk/Ohana/src/addstar/src/find_matches.c

    r27435 r27582  
    272272
    273273    catalog[0].average[Nave].Xp            = 0;
    274     catalog[0].average[Nave].ChiSq         = 0.0;
     274    catalog[0].average[Nave].ChiSqAve      = 0.0;
     275    catalog[0].average[Nave].ChiSqPM       = 0.0;
     276    catalog[0].average[Nave].ChiSqPar      = 0.0;
     277    catalog[0].average[Nave].Tmean         = 0;
     278    catalog[0].average[Nave].Trange        = 0;
    275279    catalog[0].average[Nave].Npos          = 0;
    276280
  • trunk/Ohana/src/addstar/src/find_matches_closest.c

    r27435 r27582  
    267267
    268268    catalog[0].average[Nave].Xp            = 0;
    269     catalog[0].average[Nave].ChiSq         = 0.0;
     269    catalog[0].average[Nave].ChiSqAve      = 0.0;
     270    catalog[0].average[Nave].ChiSqPM       = 0.0;
     271    catalog[0].average[Nave].ChiSqPar      = 0.0;
     272    catalog[0].average[Nave].Tmean         = 0;
     273    catalog[0].average[Nave].Trange        = 0;
    270274    catalog[0].average[Nave].Npos          = 0;
    271275
  • trunk/Ohana/src/addstar/src/find_matches_closest_refstars.c

    r27435 r27582  
    285285
    286286    catalog[0].average[Nave].Xp            = 0;
    287     catalog[0].average[Nave].ChiSq         = 0.0;
     287    catalog[0].average[Nave].ChiSqAve      = 0.0;
     288    catalog[0].average[Nave].ChiSqPM       = 0.0;
     289    catalog[0].average[Nave].ChiSqPar      = 0.0;
     290    catalog[0].average[Nave].Tmean         = 0;
     291    catalog[0].average[Nave].Trange        = 0;
    288292    catalog[0].average[Nave].Npos          = 0;
    289293
  • trunk/Ohana/src/addstar/src/find_matches_refstars.c

    r27435 r27582  
    255255
    256256    catalog[0].average[Nave].Xp            = 0;
    257     catalog[0].average[Nave].ChiSq         = 0.0;
     257    catalog[0].average[Nave].ChiSqAve      = 0.0;
     258    catalog[0].average[Nave].ChiSqPM       = 0.0;
     259    catalog[0].average[Nave].ChiSqPar      = 0.0;
     260    catalog[0].average[Nave].Tmean         = 0;
     261    catalog[0].average[Nave].Trange        = 0;
    258262    catalog[0].average[Nave].Npos          = 0;
    259263
  • trunk/Ohana/src/addstar/src/mkcmf.c

    r27435 r27582  
    11# include "mkcmf.h"
    2 void gauss_init (int Nbin);
    3 double rnd_gauss (double mean, double sigma);
    42
    53# define SKY 100.0
     
    1412# define FLAGS 0x1101
    1513
     14void gauss_init (int Nbin);
     15double rnd_gauss (double mean, double sigma);
     16void writeStars_PS1_V2 (FTable *ftable, double *X, double *Y, double *M, int Nstars);
     17void writeStars_PS1_V1 (FTable *ftable, double *X, double *Y, double *M, int Nstars);
     18void writeStars_PS1_DEV_1 (FTable *ftable, double *X, double *Y, double *M, int Nstars);
     19void writeStars_PS1_DEV_0 (FTable *ftable, double *X, double *Y, double *M, int Nstars);
     20
    1621int main (int argc, char **argv) {
    1722
     
    1924  // load a text table with X,Y,Mag (instrumental?)
    2025
    21   int i, N, Nstars, NSTARS, found;
    22   double *X, *Y, *M;
    23   double Xmax, Ymax;
    24   float flux, fSN;
     26  int N, Nstars, NSTARS, found;
     27  double *X, *Y, *M, Xmax, Ymax;
    2528
    2629  FILE *f, *fits;
    27   Header header, theader;
     30  Header header;
     31  Header theader;
    2832  Matrix matrix;
    2933  FTable ftable;
    3034  Coords coords;
    3135
    32   PS1_DEV_1 *stars;
    33 
    3436  static char *date = "2001-01-01";
    3537  if ((N = get_argument (argc, argv, "-date"))) {
     
    5759
    5860  // add support for all cmf types
    59   static char *type = "PS1_DEV_1";
     61  static char *type = "PS1_V2";
    6062  if ((N = get_argument (argc, argv, "-type"))) {
    6163    remove_argument (N, &argc, argv);
    6264    type = strcreate (argv[N]);
    6365    remove_argument (N, &argc, argv);
    64     fprintf (stderr, "support for other types is broken: see comment at line 97\n");
    65     exit (1);
    6666  }
    6767
     
    7777  }
    7878   
     79  // load test stars from a file:
    7980  Nstars = 0;
    8081  NSTARS = 100;
     
    8485
    8586  Xmax = Ymax = 0;
    86 
    8787  while (fscanf (f, "%lf %lf %lf", &X[Nstars], &Y[Nstars], &M[Nstars]) != EOF) {
     88    Xmax  = MAX(Xmax, X[Nstars]);
     89    Ymax  = MAX(Ymax, Y[Nstars]);
     90
    8891    if (Nstars == NSTARS - 1) {
    8992      NSTARS += 100;
     
    9598  }
    9699
     100  // create primary header
     101  gfits_init_header (&header);   
     102  header.extend = TRUE;
     103  gfits_create_header (&header);
     104  gfits_create_matrix (&header, &matrix);
     105  gfits_print (&header, "NEXTEND", "%d", 1, 1);
     106
     107  // XXX add minimum needed header fields
     108  gfits_print (&header, "IMNAXIS1", "%d", 1, (int)(Xmax + 50));
     109  gfits_print (&header, "IMNAXIS2", "%d", 1, (int)(Ymax + 50));
     110
     111  gfits_modify (&header, "NSTARS",   "%d", 1, Nstars);
     112  gfits_modify (&header, "PHOTCODE", "%s", 1, "SIMTEST.r.Chip");
     113  gfits_modify (&header, "DATE-OBS", "%s", 1, date);
     114  gfits_modify (&header, "UTC-OBS",  "%s", 1, time);
     115  gfits_modify (&header, "ZERO_PT", "%lf", 1, 25.0);
     116  gfits_modify (&header, "EXPTIME", "%lf", 1, 1.0);
     117  gfits_modify (&header, "AIRMASS", "%lf", 1, 1.0);
     118  gfits_modify (&header, "NASTRO",   "%d", 1, 10);
     119
     120  gfits_modify (&header, "IMAGEID",  "%d", 1, (int)(1000*drand48()));
     121  gfits_modify (&header, "SOURCEID", "%d", 1, (int)(100*drand48()));
     122
     123  /* bore site center guess */
     124  strcpy (coords.ctype, "DEC--TAN");
     125  coords.crval1 = RA;
     126  coords.crval2 = DEC;
     127  coords.crpix1 = 0.0;
     128  coords.crpix2 = 0.0;
     129 
     130  coords.cdelt1 = 0.25/3600.0;
     131  coords.cdelt2 = 0.25/3600.0;
     132
     133  coords.pc1_1  = 1;
     134  coords.pc2_2  = 1;
     135  coords.pc1_2  = 0;
     136  coords.pc2_1  = 0;
     137  coords.Npolyterms = 1;
     138
     139  PutCoords (&coords, &header);
     140  gfits_modify (&header, "EXTNAME",   "%s", 1, "Chip.hdr");
     141
     142  ftable.header = &theader;
     143
     144  // set up desired CMF type:
     145  found = FALSE;
     146  if (!strcmp(type, "PS1_DEV_0")) {
     147    writeStars_PS1_DEV_0 (&ftable, X, Y, M, Nstars);
     148    found = TRUE;
     149  }
     150  if (!strcmp(type, "PS1_DEV_1")) {
     151    writeStars_PS1_DEV_1 (&ftable, X, Y, M, Nstars);
     152    found = TRUE;
     153  }
     154  if (!strcmp(type, "PS1_V1")) {
     155    writeStars_PS1_V1 (&ftable, X, Y, M, Nstars);
     156    found = TRUE;
     157  }
     158  if (!strcmp(type, "PS1_V2")) {
     159    writeStars_PS1_V2 (&ftable, X, Y, M, Nstars);
     160    found = TRUE;
     161  }
     162  if (!found) {
     163    fprintf (stderr, "ERROR: unknown CMF type %s\n", type);
     164    exit (1);
     165  }
     166
     167  gfits_modify (ftable.header, "EXTHEAD",   "%s", 1, "Chip.hdr");
     168  gfits_modify (ftable.header, "EXTNAME",   "%s", 1, "Chip.psf");
     169
     170  fits = fopen (argv[2], "w");
     171  if (fits == NULL) {
     172    fprintf (stderr, "ERROR: can't open output file %s\n", argv[2]);
     173    exit (1);
     174  }
     175
     176  gfits_fwrite_header  (fits, &header);
     177  gfits_fwrite_matrix  (fits, &matrix);
     178  gfits_fwrite_Theader (fits, ftable.header);
     179  gfits_fwrite_table   (fits, &ftable);
     180  fclose (fits);
     181
     182  exit (0);
     183}
     184
     185
     186static int Ngaussint = 0;
     187static double *gaussint;
     188
     189extern double drand48();
     190
     191double gaussian (double x, double mean, double sigma) {
     192
     193  double f;
     194
     195  f = exp (-0.5 * SQ(x - mean) / SQ(sigma)) / sqrt(2 * M_PI * SQ(sigma));
     196
     197  return (f);
     198
     199}
     200
     201/* integrate a gaussian from -5 sigma to +5 sigma */
     202void gauss_init (int Nbin) {
     203 
     204  int i;
     205  long A, B;
     206  double val, x, dx, dx1, dx2, dx3, df;
     207  double mean, sigma;
     208 
     209  /* no need to generate this if it already exists */
     210  if (Ngaussint == Nbin) return;
     211
     212  A = time(NULL);
     213  for (B = 0; A == time(NULL); B++);
     214  srand48(B);
     215 
     216  Ngaussint = Nbin;
     217  ALLOCATE (gaussint, double, Ngaussint + 1);
     218
     219  val = 0;
     220  dx = 1.0 / Ngaussint;
     221  dx1 = dx / 3.0;
     222  dx2 = 2.0*dx/3.0;
     223  dx3 = dx;
     224  mean = 0.0;
     225  sigma = 1.0;
     226 
     227  for (i = 0, x = -7.0; (i < Ngaussint) && (x < 7.0); x += dx)  {
     228    df = (3.0*gaussian(x    , mean, sigma) +
     229          9.0*gaussian(x+dx1, mean, sigma) +
     230          9.0*gaussian(x+dx2, mean, sigma) +
     231          3.0*gaussian(x+dx3, mean, sigma)) * (dx1/8.0);
     232    val += df;
     233    if (val > (i + 0.5) / (double) Ngaussint) {
     234      gaussint[i] = x + dx / 2.0;
     235      i++;
     236    }
     237  }
     238}
     239
     240double rnd_gauss (double mean, double sigma) {
     241 
     242  int i;
     243  double y;
     244 
     245  y = drand48();
     246  i = Ngaussint*y;
     247  y = gaussint[i]*sigma + mean;
     248 
     249  return (y);
     250 
     251}
     252 
     253double int_gauss (int i) {
     254  double y;
     255  y = gaussint[i];
     256  return (y);
     257}
     258 
     259void writeStars_PS1_DEV_0 (FTable *ftable, double *X, double *Y, double *M, int Nstars) {
     260
     261  int i;
     262  PS1_DEV_0 *stars;
     263  float flux, fSN;
     264
     265  // XXX add gaussian-distributed noise based on counts
     266  // this needs to make different output 'stars' entries depending on the desired type
     267  ALLOCATE (stars, PS1_DEV_0, Nstars);
     268  gauss_init (2048);
     269  for (i = 0; i < Nstars; i++) {
     270    stars[i].detID = i;
     271
     272    flux = pow (10.0, -0.4*M[i]);
     273    fSN = 1.0 / sqrt(flux);
     274
     275    stars[i].X = X[i] + FX * fSN * rnd_gauss(0.0, 1.0);
     276    stars[i].Y = Y[i] + FY * fSN * rnd_gauss(0.0, 1.0);
     277    stars[i].M = M[i] + fSN*rnd_gauss(0.0, 1.0);
     278
     279    stars[i].dX = FX * fSN;
     280    stars[i].dY = FY * fSN;
     281    stars[i].dM = fSN;
     282
     283    stars[i].Mpeak     = M[i] + 1.0;
     284    stars[i].sky       = SKY;
     285    stars[i].dSky      = DSKY;
     286    stars[i].psfChisq  = PSFCHI;
     287    stars[i].fx        = FX;
     288    stars[i].fy        = FY;
     289    stars[i].df        = DF;
     290    stars[i].psfQual   = PSFQUAL;
     291    stars[i].nFrames   = 1;
     292  }
     293
     294  gfits_table_set_PS1_DEV_0 (ftable, stars, Nstars);
     295  gfits_modify (ftable->header, "EXTTYPE",   "%s", 1, "PS1_DEV_0");
     296}
     297
     298void writeStars_PS1_DEV_1 (FTable *ftable, double *X, double *Y, double *M, int Nstars) {
     299
     300  int i;
     301  PS1_DEV_1 *stars;
     302  float flux, fSN;
     303
    97304  // XXX add gaussian-distributed noise based on counts
    98305  // this needs to make different output 'stars' entries depending on the desired type
     
    108315    stars[i].Y = Y[i] + FY * fSN * rnd_gauss(0.0, 1.0);
    109316    stars[i].M = M[i] + fSN*rnd_gauss(0.0, 1.0);
    110 
    111     Xmax  = MAX(Xmax, X[i]);
    112     Ymax  = MAX(Ymax, Y[i]);
    113317
    114318    stars[i].dX = FX * fSN;
     
    130334  }
    131335
    132   // create primary header
    133   gfits_init_header (&header);   
    134   header.extend = TRUE;
    135   gfits_create_header (&header);
    136   gfits_create_matrix (&header, &matrix);
    137   gfits_print (&header, "NEXTEND", "%d", 1, 1);
    138 
    139   // XXX add minimum needed header fields
    140   gfits_print (&header, "IMNAXIS1", "%d", 1, (int)(Xmax + 50));
    141   gfits_print (&header, "IMNAXIS2", "%d", 1, (int)(Ymax + 50));
    142 
    143   gfits_modify (&header, "NSTARS",   "%d", 1, Nstars);
    144   gfits_modify (&header, "PHOTCODE", "%s", 1, "SIMTEST.r.Chip");
    145   gfits_modify (&header, "DATE-OBS", "%s", 1, date);
    146   gfits_modify (&header, "UTC-OBS",  "%s", 1, time);
    147   gfits_modify (&header, "ZERO_PT", "%lf", 1, 25.0);
    148   gfits_modify (&header, "EXPTIME", "%lf", 1, 1.0);
    149   gfits_modify (&header, "AIRMASS", "%lf", 1, 1.0);
    150   gfits_modify (&header, "NASTRO",   "%d", 1, 10);
    151 
    152   gfits_modify (&header, "IMAGEID",  "%d", 1, (int)(1000*drand48()));
    153   gfits_modify (&header, "SOURCEID", "%d", 1, (int)(100*drand48()));
    154 
    155   /* bore site center guess */
    156   strcpy (coords.ctype, "DEC--TAN");
    157   coords.crval1 = RA;
    158   coords.crval2 = DEC;
    159   coords.crpix1 = 0.0;
    160   coords.crpix2 = 0.0;
    161  
    162   coords.cdelt1 = 0.25/3600.0;
    163   coords.cdelt2 = 0.25/3600.0;
    164 
    165   coords.pc1_1  = 1;
    166   coords.pc2_2  = 1;
    167   coords.pc1_2  = 0;
    168   coords.pc2_1  = 0;
    169   coords.Npolyterms = 1;
    170 
    171   PutCoords (&coords, &header);
    172   gfits_modify (&header, "EXTNAME",   "%s", 1, "Chip.hdr");
    173 
    174   ftable.header = &theader;
    175 
    176   // set up desired CMF type:
    177   found = FALSE;
    178 # if 0
    179   if (!strcmp(type, "PS1_DEV_0")) {
    180     gfits_table_set_PS1_DEV_0 (&ftable, stars, Nstars);
    181     gfits_modify (&theader, "EXTTYPE",   "%s", 1, "PS1_DEV_0");
    182     found = TRUE;
    183   }
    184 # endif
    185   if (!strcmp(type, "PS1_DEV_1")) {
    186     gfits_table_set_PS1_DEV_1 (&ftable, stars, Nstars);
    187     gfits_modify (&theader, "EXTTYPE",   "%s", 1, "PS1_DEV_1");
    188     found = TRUE;
    189   }
    190 # if 0
    191   if (!strcmp(type, "PS1_V1")) {
    192     gfits_table_set_CMF_PS1_V1 (&ftable, stars, Nstars);
    193     gfits_modify (&theader, "EXTTYPE",   "%s", 1, "PS1_V1");
    194     found = TRUE;
    195   }
    196   if (!strcmp(type, "PS1_V2")) {
    197     gfits_table_set_CMF_PS1_V2 (&ftable, stars, Nstars);
    198     gfits_modify (&theader, "EXTTYPE",   "%s", 1, "PS1_V2");
    199     found = TRUE;
    200   }
    201 # endif
    202   if (!found) {
    203     fprintf (stderr, "ERROR: unknown CMF type %s\n", type);
    204     exit (1);
    205   }
    206 
    207   gfits_modify (&theader, "EXTHEAD",   "%s", 1, "Chip.hdr");
    208   gfits_modify (&theader, "EXTNAME",   "%s", 1, "Chip.psf");
    209 
    210   fits = fopen (argv[2], "w");
    211   if (fits == NULL) {
    212     fprintf (stderr, "ERROR: can't open output file %s\n", argv[2]);
    213     exit (1);
    214   }
    215 
    216   gfits_fwrite_header  (fits, &header);
    217   gfits_fwrite_matrix  (fits, &matrix);
    218   gfits_fwrite_Theader (fits, &theader);
    219   gfits_fwrite_table   (fits, &ftable);
    220   fclose (fits);
    221 
    222   exit (0);
    223 }
    224 
    225 
    226 static int Ngaussint = 0;
    227 static double *gaussint;
    228 
    229 extern double drand48();
    230 
    231 double gaussian (double x, double mean, double sigma) {
    232 
    233   double f;
    234 
    235   f = exp (-0.5 * SQ(x - mean) / SQ(sigma)) / sqrt(2 * M_PI * SQ(sigma));
    236 
    237   return (f);
    238 
    239 }
    240 
    241 /* integrate a gaussian from -5 sigma to +5 sigma */
    242 void gauss_init (int Nbin) {
    243  
    244   int i;
    245   long A, B;
    246   double val, x, dx, dx1, dx2, dx3, df;
    247   double mean, sigma;
    248  
    249   /* no need to generate this if it already exists */
    250   if (Ngaussint == Nbin) return;
    251 
    252   A = time(NULL);
    253   for (B = 0; A == time(NULL); B++);
    254   srand48(B);
    255  
    256   Ngaussint = Nbin;
    257   ALLOCATE (gaussint, double, Ngaussint + 1);
    258 
    259   val = 0;
    260   dx = 1.0 / Ngaussint;
    261   dx1 = dx / 3.0;
    262   dx2 = 2.0*dx/3.0;
    263   dx3 = dx;
    264   mean = 0.0;
    265   sigma = 1.0;
    266  
    267   for (i = 0, x = -7.0; (i < Ngaussint) && (x < 7.0); x += dx)  {
    268     df = (3.0*gaussian(x    , mean, sigma) +
    269           9.0*gaussian(x+dx1, mean, sigma) +
    270           9.0*gaussian(x+dx2, mean, sigma) +
    271           3.0*gaussian(x+dx3, mean, sigma)) * (dx1/8.0);
    272     val += df;
    273     if (val > (i + 0.5) / (double) Ngaussint) {
    274       gaussint[i] = x + dx / 2.0;
    275       i++;
    276     }
    277   }
    278 }
    279 
    280 double rnd_gauss (double mean, double sigma) {
    281  
    282   int i;
    283   double y;
    284  
    285   y = drand48();
    286   i = Ngaussint*y;
    287   y = gaussint[i]*sigma + mean;
    288  
    289   return (y);
    290  
    291 }
    292  
    293 double int_gauss (int i) {
    294   double y;
    295   y = gaussint[i];
    296   return (y);
    297 }
    298  
     336  gfits_table_set_PS1_DEV_1 (ftable, stars, Nstars);
     337  gfits_modify (ftable->header, "EXTTYPE",   "%s", 1, "PS1_DEV_1");
     338}
     339
     340void writeStars_PS1_V1 (FTable *ftable, double *X, double *Y, double *M, int Nstars) {
     341
     342  int i;
     343  CMF_PS1_V1 *stars;
     344  float flux, fSN;
     345
     346  // XXX add gaussian-distributed noise based on counts
     347  // this needs to make different output 'stars' entries depending on the desired type
     348  ALLOCATE (stars, CMF_PS1_V1, Nstars);
     349  gauss_init (2048);
     350  for (i = 0; i < Nstars; i++) {
     351    stars[i].detID = i;
     352
     353    flux = pow (10.0, -0.4*M[i]);
     354    fSN = 1.0 / sqrt(flux);
     355
     356    stars[i].X = X[i] + FX * fSN * rnd_gauss(0.0, 1.0);
     357    stars[i].Y = Y[i] + FY * fSN * rnd_gauss(0.0, 1.0);
     358    stars[i].M = M[i] + fSN*rnd_gauss(0.0, 1.0);
     359
     360    stars[i].dX = FX * fSN;
     361    stars[i].dY = FY * fSN;
     362    stars[i].dM = fSN;
     363
     364    stars[i].Mpeak     = M[i] + 1.0;
     365    stars[i].sky       = SKY;
     366    stars[i].dSky      = DSKY;
     367    stars[i].psfChisq  = PSFCHI;
     368    stars[i].crNsigma  = CRN;
     369    stars[i].extNsigma = EXTN;
     370    stars[i].fx        = FX;
     371    stars[i].fy        = FY;
     372    stars[i].df        = DF;
     373    stars[i].psfQual   = PSFQUAL;
     374    stars[i].nFrames   = 1;
     375    stars[i].flags     = FLAGS;
     376  }
     377
     378  gfits_table_set_CMF_PS1_V1 (ftable, stars, Nstars);
     379  gfits_modify (ftable->header, "EXTTYPE",   "%s", 1, "PS1_V1");
     380}
     381
     382void writeStars_PS1_V2 (FTable *ftable, double *X, double *Y, double *M, int Nstars) {
     383
     384  int i;
     385  CMF_PS1_V2 *stars;
     386  float flux, fSN;
     387
     388  // XXX add gaussian-distributed noise based on counts
     389  // this needs to make different output 'stars' entries depending on the desired type
     390  ALLOCATE (stars, CMF_PS1_V2, Nstars);
     391  gauss_init (2048);
     392  for (i = 0; i < Nstars; i++) {
     393    stars[i].detID = i;
     394
     395    flux = pow (10.0, -0.4*M[i]);
     396    fSN = 1.0 / sqrt(flux);
     397
     398    stars[i].X = X[i] + FX * fSN * rnd_gauss(0.0, 1.0);
     399    stars[i].Y = Y[i] + FY * fSN * rnd_gauss(0.0, 1.0);
     400    stars[i].M = M[i] + fSN*rnd_gauss(0.0, 1.0);
     401
     402    stars[i].dX = FX * fSN;
     403    stars[i].dY = FY * fSN;
     404    stars[i].dM = fSN;
     405
     406    stars[i].Mpeak     = M[i] + 1.0;
     407    stars[i].sky       = SKY;
     408    stars[i].dSky      = DSKY;
     409    stars[i].psfChisq  = PSFCHI;
     410    stars[i].crNsigma  = CRN;
     411    stars[i].extNsigma = EXTN;
     412    stars[i].fx        = FX;
     413    stars[i].fy        = FY;
     414    stars[i].df        = DF;
     415    stars[i].psfQual   = PSFQUAL;
     416    stars[i].nFrames   = 1;
     417    stars[i].flags     = FLAGS;
     418  }
     419
     420  gfits_table_set_CMF_PS1_V2 (ftable, stars, Nstars);
     421  gfits_modify (ftable->header, "EXTTYPE",   "%s", 1, "PS1_V2");
     422}
     423
  • trunk/Ohana/src/addstar/test/relastro.dvo

    r27435 r27582  
    22
    33input tap.dvo
     4
     5macro test.all
     6  test.relastro PS1_DEV_0 PS1_V1
     7  test.relastro PS1_DEV_1 PS1_V1
     8  test.relastro PS1_V1  PS1_V1
     9  test.relastro PS1_V2  PS1_V1
     10  test.relastro PS1_DEV_0 PS1_V2
     11  test.relastro PS1_DEV_1 PS1_V2
     12  test.relastro PS1_V1  PS1_V2
     13  test.relastro PS1_V2  PS1_V2
     14end 
    415
    516# this set fails because the match radius does not equal the keep radius:
     
    3344# create a populated catdir with a couple of cmf files
    3445macro test.relastro
     46  if ($0 != 3)
     47    echo "test.relastro (cmftype) (dvotype)"
     48    break
     49  end
    3550
    3651  tapPLAN 42
     
    4459  for i 0 $offset:n
    4560    mkinput $offset:$i
    46     exec mkcmf test.in.txt test.cmf -date 2008/1/1 -time $i\:00:00 -radec $RA $DEC
    47     exec addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf
     61    exec mkcmf test.in.txt test.cmf -date 2008/1/1 -time $i\:00:00 -radec $RA $DEC -type $1
     62    exec addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf -D CATFORMAT $2
    4863  end
    4964
  • trunk/Ohana/src/addstar/test/relphot.dvo

    r27435 r27582  
    22
    33input tap.dvo
     4
     5macro test.all
     6  test.relphot PS1_DEV_0 PS1_V1
     7  test.relphot PS1_DEV_1 PS1_V1
     8  test.relphot PS1_V1   PS1_V1
     9  test.relphot PS1_V2   PS1_V1
     10  test.relphot PS1_DEV_0 PS1_V2
     11  test.relphot PS1_DEV_1 PS1_V2
     12  test.relphot PS1_V1   PS1_V2
     13  test.relphot PS1_V2   PS1_V2
     14end 
    415
    516list offset
     
    1223# create a populated catdir with a couple of cmf files
    1324macro test.relphot
     25  if ($0 != 3)
     26    echo "test.relphot (cmftype) (dvotype)"
     27    break
     28  end
    1429
    1530  tapPLAN 4
     
    2237  for i 0 $offset:n
    2338    mkinput $offset:$i
    24     exec mkcmf test.in.txt test.cmf -date 2008/1/1 -time $i\:00:00 -radec $RA $DEC
    25     exec addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf
     39    exec mkcmf test.in.txt test.cmf -date 2008/1/1 -time $i\:00:00 -radec $RA $DEC -type $1
     40    exec addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf -D CATFORMAT $2
    2641  end
    2742
  • trunk/Ohana/src/addstar/test/simple.dvo

    r27435 r27582  
    44
    55macro test.all
    6   test.fields.type PS1_V1
    7 
     6  test.fields PS1_DEV_0 PS1_V1
     7  test.fields PS1_DEV_1 PS1_V1
     8  test.fields PS1_V1    PS1_V1
     9  test.fields PS1_V2    PS1_V1
     10
     11  test.fields PS1_DEV_0 PS1_V2
     12  test.fields PS1_DEV_1 PS1_V2
     13  test.fields PS1_V1    PS1_V2
     14  test.fields PS1_V2    PS1_V2
    815end 
    916
    1017# create a populated catdir with a single cmf -- test each field
    11 macro test.fields.type
    12   if ($0 != 2)
    13     echo "USAGE: test.fields.type (cmftype) (dvotype?)"
     18macro test.fields
     19  if ($0 != 3)
     20    echo "USAGE: test.fields (cmftype) (dvotype?)"
    1421    break
    1522  end
     
    2431  mkinput
    2532  exec mkcmf test.in.txt test.cmf -date 2008/1/1 -time 01:00:00 -radec $RA $DEC -type $1
    26   exec addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf
     33  exec addstar -D CATDIR catdir.test -D CAMERA simtest test.cmf -D CATFORMAT $2
     34
     35  list testfields -copy testfields_$1
    2736
    2837  catdir catdir.test
     
    7685  end   
    7786
    78   exec rm test.cmf test.in.txt
    79   exec rm -r catdir.test
     87  # exec rm test.cmf test.in.txt
     88  # exec rm -r catdir.test
    8089
    8190  tapDONE
     
    96105
    97106# list of cmf fields to test matched to mextract fields
     107# this list is good for PS1_DEV_0
     108list testfields_PS1_DEV_0
     109  IPP_IDET          : detid
     110  X_PSF             : xccd
     111  Y_PSF             : yccd
     112  X_PSF_SIG         : xccd:err
     113  Y_PSF_SIG         : yccd:err
     114  PSF_INST_MAG      : mag:inst
     115  PSF_INST_MAG_SIG  : mag:err
     116  PEAK_FLUX_AS_MAG  : SKIP
     117  SKY               : sky
     118  SKY_SIG           : sky_err
     119  PSF_CHISQ         : psf_chisq
     120  PSF_WIDTH_X       : FWHM_MAJ
     121  PSF_WIDTH_Y       : FWHM_MIN
     122  PSF_THETA         : THETA
     123  PSF_QF            : PSF_QF
     124  N_FRAMES          : SKIP
     125end
     126
     127# list of cmf fields to test matched to mextract fields
    98128# this list is good for PS1_DEV_1
    99 list testfields_PS1_DEV_V1
     129list testfields_PS1_DEV_1
    100130  IPP_IDET          : detid
    101131  X_PSF             : xccd
     
    119149end
    120150
    121 ... etc ...
    122 # this list is good for PS1_DEV_0
    123 list testfields_PS1_DEV_V0
    124   IPP_IDET          : detid
    125   X_PSF             : xccd
    126   Y_PSF             : yccd
    127   X_PSF_SIG         : xccd:err
    128   Y_PSF_SIG         : yccd:err
    129   PSF_INST_MAG      : mag:inst
    130   PSF_INST_MAG_SIG  : mag:err
    131   PEAK_FLUX_AS_MAG  : SKIP
    132   SKY               : sky
    133   SKY_SIG           : sky_err
    134   PSF_CHISQ         : psf_chisq
    135   CR_NSIGMA         : cr_nsigma
     151# this list is good for PS1_V1
     152list testfields_PS1_V1
     153  IPP_IDET          : detid     
     154  X_PSF             : xccd     
     155  Y_PSF             : yccd     
     156  X_PSF_SIG         : xccd:err #  FAIL
     157  Y_PSF_SIG         : yccd:err # FAIL
     158  RA_PSF            : SKIP # astrometry is not calibrated in the cmf
     159  DEC_PSF           : SKIP # astrometry is not calibrated in the cmf
     160  POSANGLE          : SKIP # astrometry is not calibrated in the cmf
     161  PLTSCALE          : SKIP # astrometry is not calibrated in the cmf
     162  PSF_INST_MAG      : mag:inst 
     163  PSF_INST_MAG_SIG  : mag:err   
     164  AP_MAG_STANDARD   : mag:ap # FAIL
     165  AP_MAG_RADIUS     : SKIP # no accessor
     166  PEAK_FLUX_AS_MAG  : SKIP # no accessor
     167  CAL_PSF_MAG       : SKIP # photometry is not calibrated in the cmf
     168  CAL_PSF_MAG_SIG   : SKIP # photometry is not calibrated in the cmf
     169  SKY               : sky       
     170  SKY_SIG           : sky_err   
     171  PSF_CHISQ         : psf_chisq
     172  CR_NSIGMA         : cr_nsigma
    136173  EXT_NSIGMA        : ext_nsigma
    137   PSF_WIDTH_X       : FWHM_MAJ
    138   PSF_WIDTH_Y       : FWHM_MIN
    139   PSF_THETA         : THETA
    140   PSF_QF            : PSF_QF
    141   N_FRAMES          : SKIP
     174  PSF_MAJOR         : FWHM_MAJ 
     175  PSF_MINOR         : FWHM_MIN 
     176  PSF_THETA         : THETA # FAIL
     177  PSF_QF            : PSF_QF   
     178  PSF_NDOF          : SKIP # no accessor
     179  PSF_NPIX          : SKIP # no accessor
     180  MOMENTS_XX        : SKIP # no accessor
     181  MOMENTS_XY        : SKIP # no accessor
     182  MOMENTS_YY        : SKIP # no accessor
    142183  FLAGS             : phot_flags
    143 end
    144 
     184  N_FRAMES          : SKIP # no accessor       
     185end
     186
     187# this list is good for PS1_V2
     188list testfields_PS1_V2
     189  IPP_IDET          : detid     
     190  X_PSF             : xccd     
     191  Y_PSF             : yccd     
     192  X_PSF_SIG         : xccd:err # FAIL
     193  Y_PSF_SIG         : yccd:err # FAIL
     194  RA_PSF            : SKIP # astrometry is not calibrated in the cmf
     195  DEC_PSF           : SKIP # astrometry is not calibrated in the cmf
     196  POSANGLE          : SKIP # astrometry is not calibrated in the cmf
     197  PLTSCALE          : SKIP # astrometry is not calibrated in the cmf
     198  PSF_INST_MAG      : mag:inst 
     199  PSF_INST_MAG_SIG  : mag:err   
     200  AP_MAG_STANDARD   : mag:ap # FAIL
     201  AP_MAG_RADIUS     : SKIP # no accessor
     202  PEAK_FLUX_AS_MAG  : SKIP # no accessor
     203  CAL_PSF_MAG       : SKIP # photometry is not calibrated in the cmf
     204  CAL_PSF_MAG_SIG   : SKIP # photometry is not calibrated in the cmf
     205  SKY               : sky       
     206  SKY_SIG           : sky_err   
     207  PSF_CHISQ         : psf_chisq
     208  CR_NSIGMA         : cr_nsigma
     209  EXT_NSIGMA        : ext_nsigma
     210  PSF_MAJOR         : FWHM_MAJ 
     211  PSF_MINOR         : FWHM_MIN 
     212  PSF_THETA         : THETA # FAIL
     213  PSF_QF            : PSF_QF   
     214  PSF_NDOF          : SKIP # no accessor
     215  PSF_NPIX          : SKIP # no accessor
     216  MOMENTS_XX        : SKIP # no accessor
     217  MOMENTS_XY        : SKIP # no accessor
     218  MOMENTS_YY        : SKIP # no accessor
     219  FLAGS             : phot_flags
     220  N_FRAMES          : SKIP # no accessor       
     221end
Note: See TracChangeset for help on using the changeset viewer.