IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 126


Ignore:
Timestamp:
Oct 29, 2003, 4:27:13 AM (23 years ago)
Author:
eugene
Message:

update photcode api

Location:
trunk/Ohana/src/imregister
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/imregister/photreg/args.photreg.c

    r90 r126  
    66int regargs (int argc, char **argv, PhotPars *newdata) {
    77
    8   int N, Np, required, photcode, Ntimes;
     8  int N, required, Ntimes;
    99  double dtime;
    1010  unsigned long *tstart, *tstop;
     11  PhotCode *photcode;
    1112
    1213  ConfigInit (&argc, argv);
     
    1920  if (get_argument (argc, argv, "--help")) usage ();
    2021
     22  /* load photcode data */
     23  if (!LoadPhotcodes (PhotCodeFile)) {
     24    fprintf (stderr, "error loading photcodes from %s\n", PhotCodeFile);
     25    exit (1);
     26  }
     27
    2128  /* set the required database */
    22   set_db ("phot");
     29  output.db = strcreate ("phot");
    2330  if (N = get_argument (argc, argv, "-trans")) {
    2431    remove_argument (N, &argc, argv);
    25     set_db ("trans");
    26   }
    27 
    28   /* load photcode data */
    29   if (!LoadPhotcodes (PhotCodeFile, &photcodes)) {
    30     fprintf (stderr, "error loading photcodes from %s\n", PhotCodeFile);
    31     exit (1);
     32    output.db = strcreate ("trans");
    3233  }
    3334
     
    8384  }
    8485
    85   /* error on observed zero point */
     86  /* photcode system */
    8687  if (N = get_argument (argc, argv, "-photcode")) {
    8788    remove_argument (N, &argc, argv);
    88     if (!GetPhotcodeRefs (&photcodes, argv[N], &photcode, &Np)) {
     89    if ((photcode = GetPhotcodebyName (argv[N])) == NULL) {
    8990      fprintf (stderr, "ERROR: photcode not found in photcode table\n");
    9091      exit (1);
    9192    }
    92     newdata[0].photcode = photcode;
    9393    remove_argument (N, &argc, argv);
    9494    required |= 0x10;
     
    106106  */
    107107 
    108   newdata[0].ZPo = 0.001*photcodes.code[Np].C;
    109   if (output.offset) {
    110     newdata[0].ZP += newdata[0].ZPo;
    111   }
    112   newdata[0].K = photcodes.code[Np].K;
    113   newdata[0].X = photcodes.code[Np].X;
    114   newdata[0].c1 = photcodes.code[Np].c1;
    115   newdata[0].c2 = photcodes.code[Np].c2;
     108  newdata[0].photcode = photcode[0].code;
     109  newdata[0].refcode  = photcode[0].equiv;
     110  newdata[0].K        = photcode[0].K;
     111  newdata[0].X        = photcode[0].X;
     112  newdata[0].c1       = photcode[0].c1;
     113  newdata[0].c2       = photcode[0].c2;
    116114 
     115  newdata[0].ZPo      = 0.001*photcode[0].C;
     116  if (output.offset) newdata[0].ZP += newdata[0].ZPo;
    117117}
    118118
  • trunk/Ohana/src/imregister/photreg/args.photsearch.c

    r90 r126  
    44int args (int argc, char **argv) {
    55
    6   int N;
     6  int N, equiv;
    77
    88  ConfigInit (&argc, argv);
    99  ConfigCamera ();
    1010  ConfigFilter ();
     11
     12  /* load photcode data */
     13  if (!LoadPhotcodes (PhotCodeFile)) {
     14    fprintf (stderr, "error loading photcodes from %s\n", PhotCodeFile);
     15    exit (1);
     16  }
    1117
    1218  criteria.Ntimes = 0;
     
    1925  if (N = get_argument (argc, argv, "-photcode")) {
    2026    remove_argument (N, &argc, argv);
    21     criteria.PhotCode = strcreate (argv[N]);
     27    if ((criteria.photcode = GetPhotcodeCodebyName (argv[N])) == NULL) {
     28      fprintf (stderr, "ERROR: photcode not found in table\n");
     29      exit (1);
     30    }
    2231    remove_argument (N, &argc, argv);
    2332    criteria.PhotCodeSelect = TRUE;
     
    106115  }
    107116 
    108   /* load photcode data */
    109   if (!LoadPhotcodes (PhotCodeFile, &photcodes)) {
    110     fprintf (stderr, "error loading photcodes from %s\n", PhotCodeFile);
    111     exit (1);
    112   }
    113 
    114117  /* set up photcode information */
    115   if (criteria.PhotCodeSelect) {
    116     if (output.equiv) {
    117       if (!GetPhotcodeEquiv (&photcodes, criteria.PhotCode, &criteria.PHOTCODE, &N)) {
    118         fprintf (stderr, "ERROR: photcode not found in photcode table\n");
    119         exit (1);
    120       }
    121     } else {
    122       if (!GetPhotcodeRefs (&photcodes, criteria.PhotCode, &criteria.PHOTCODE, &N)) {
    123         fprintf (stderr, "ERROR: photcode not found in photcode table\n");
    124         exit (1);
    125       }
     118  if (criteria.PhotCodeSelect && output.equiv) {
     119    if (!(equiv = GetPhotcodeEquivCodebyCode (criteria.photcode))) {
     120      fprintf (stderr, "ERROR: photcode not found in photcode table\n");
     121      exit (1);
    126122    }
     123    criteria.photcode = equiv;
    127124  }
    128125}
  • trunk/Ohana/src/imregister/photreg/define.c

    r90 r126  
    3030  fits_define_bintable_column (theader, "I",   "C2_CODE",    "code 2 for color",          "photcode",                      1.0, 0.0);
    3131  fits_define_bintable_column (theader, "I",   "PHOTCODE",   "photcode",                  "photcode",                      1.0, 0.0);
    32   fits_define_bintable_column (theader, "66A", "LABEL",      "data label",                "",                              1.0, 0.0);
     32  fits_define_bintable_column (theader, "64A", "LABEL",      "data label",                "",                              1.0, 0.0);
     33  fits_define_bintable_column (theader, "I",   "REFCODE",    "photcode",                  "photcode",                      1.0, 0.0);
    3334  fits_define_bintable_column (theader, "J",   "N_TIME",     "number of times",           "",                              1.0, 0.0);
    3435  fits_define_bintable_column (theader, "J",   "N_MEAS",     "number of measurements",    "",                              1.0, 0.0);
  • trunk/Ohana/src/imregister/photreg/getImageData.c

    r90 r126  
    55
    66  Header header;
    7   char detector[64], filter[64], *PhotCode;
     7  char detector[64], filter[64], photcode[64];
    88  int i, ccd, Nfilter;
    99 
     
    6060  }
    6161
    62   ALLOCATE (PhotCode, char, 64);
    63   sprintf (PhotCode, "%s.%s.%02d", detector, filter, ccd);
     62  sprintf (photcode, "%s.%s.%02d", detector, filter, ccd);
     63  if (!(criteria.photcode = GetPhotcodeCodebyName (photcode))) {
     64    fprintf (stderr, "ERROR: photcode not found table\n");
     65    exit (1);
     66  }
    6467  criteria.PhotCodeSelect = TRUE;
    65   criteria.PhotCode = PhotCode;
    6668
    6769}
  • trunk/Ohana/src/imregister/photreg/match.c

    r90 r126  
    2323    }
    2424    if (criteria.Ntimes && reject) continue;
    25     if (criteria.PhotCodeSelect && (photdata[i].photcode != criteria.PHOTCODE)) continue;
     25    if (criteria.PhotCodeSelect && (photdata[i].photcode != criteria.photcode)) continue;
    2626    if (criteria.LabelSelect && strcmp (photdata[i].label, criteria.Label)) continue;
    2727
  • trunk/Ohana/src/imregister/src/imphotsearch.c

    r90 r126  
    11# include "imregister.h"
    2 FILE *fsetlockfile (char *filename, double timeout, int type, int *state);
    3 char *sec_to_date (unsigned long second);
     2
    43static char PhotError[] = "unknown";
    5 PhotCodeData photcodes;
    6 static char *version = "imphotsearch $Revision: 1.1 $";
     4static char *version = "imphotsearch $Revision: 1.2 $";
    75
    86main (int argc, char **argv) {
    97 
    108  FILE *f;
    11   Header header, theader;
    12   Matrix matrix;
    13   FTable table;
    14   int i, j, status, N, TimeSelect;
    15   char *dBFile, *Label, *PhotCode, *timestr, *photstr;
    16   int Nimage, nimage, Nskip, *index, Ntimes;
     9  Header header;
     10  int i, j, status, N;
     11  char *dBFile, *timestr, *photstr;
     12  int Nimage, nimage, *index, Ntimes;
    1713  unsigned long *tstart, *tstop;
    1814  int VERBOSE, FORCE_READ, PHOTCODE, dbstate, lockstate;
    1915  Image *image;
    20   int PhotCodeSelect, LabelSelect, Np, Nin;
    21   int Delete, *Dellist, Nkeep;
     16  int PhotCodeSelect, Nin;
    2217  char *FitsOutput, *NameSelect;
    2318  int NameSelectLength;
     
    2823  ConfigInit (&argc, argv);
    2924
     25  /* load photcode data */
     26  if (!LoadPhotcodes (PhotCodeFile)) {
     27    fprintf (stderr, "error loading photcodes from %s\n", PhotCodeFile);
     28    exit (1);
     29  }
     30
    3031  /* interpret command-line arguments */
    3132  if (!get_trange_arguments (&argc, argv, &tstart, &tstop, &Ntimes)) {
     
    3435  }
    3536
     37  /* select by image photcode */
    3638  PhotCodeSelect = FALSE;
    3739  if (N = get_argument (argc, argv, "-photcode")) {
    3840    remove_argument (N, &argc, argv);
    39     PhotCode = strcreate (argv[N]);
     41    if (!(PHOTCODE = GetPhotcodeCodebyName (argv[N]))) {
     42      fprintf (stderr, "ERROR: photcode not found in photcode table\n");
     43      exit (1);
     44    }
    4045    remove_argument (N, &argc, argv);
    4146    PhotCodeSelect = TRUE;
     
    7580  }
    7681 
    77   /* load photcode data */
    78   if (!LoadPhotcodes (PhotCodeFile, &photcodes)) {
    79     fprintf (stderr, "error loading photcodes from %s\n", PhotCodeFile);
    80     exit (1);
    81   }
    82   if (PhotCodeSelect) {
    83     if (!GetPhotcodeRefs (&photcodes, argv[1], &PHOTCODE, &Np)) {
    84       fprintf (stderr, "ERROR: photcode not found in photcode table\n");
    85       exit (1);
    86     }
    87   }
    88 
    8982  /* load image database - still a non-FITS file */
    9083  dBFile = ImPhotDB;
     
    158151     
    159152      /* convert photcode to filter name */
    160       photstr = GetPhotnamebyCode (&photcodes, image[i].source);
     153      photstr = GetPhotcodeNamebyCode (image[i].source);
    161154      if (photstr == (char *) NULL) photstr = PhotError;
    162155     
    163       fprintf (stdout, "%s %s %s  %7.4f %d\n", image[i].name, photstr, timestr, image[i].secz, image[i].nstar);
     156      fprintf (stdout, "%s %s %s  %7.4f %7.4f  %7.4f %d\n", image[i].name, photstr, timestr,
     157               0.001*image[i].Mcal, 0.001*image[i].dMcal, 0.001*image[i].secz, image[i].nstar);
    164158      free (timestr);
    165159    }
     
    238232    newdata  = &image[index[i]];
    239233    startstr = sec_to_date (newdata[0].tzero);
    240     filtstr  = GetPhotnamebyCode (&photcodes, newdata[0].source);
     234    filtstr  = GetPhotcodeNamebyCode (newdata[0].source);
    241235    zp       = 0.001*newdata[0].Mcal;
    242236    dzp      = 0.001*newdata[0].dMcal;
     
    251245    free (line);
    252246    free (startstr);
    253     free (filtstr);
    254247  }
    255248   
Note: See TracChangeset for help on using the changeset viewer.