IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Sep 12, 2005, 3:04:48 PM (21 years ago)
Author:
eugene
Message:

substantial work to enable mode and format selections for DVO:image and DVO:secfilt

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

Legend:

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

    r4864 r5014  
    124124int        Shutdown               PROTO((char *message, ...); )
    125125void       TrapSignal             PROTO((int sig));
    126 short      airmass                PROTO((short secz_image, double ra, double dec, double st, double latitude));
     126float      airmass                PROTO((float secz_image, double ra, double dec, double st, double latitude));
    127127void       aregion                PROTO((GSCRegion *region, FILE *f, double ra, double dec));
    128128int        args                   PROTO((int argc, char **argv));
  • trunk/Ohana/src/addstar/src/airmass.c

    r3361 r5014  
    11# include "addstar.h"
    22
    3 short airmass (short secz_image, double ra, double dec, double st, double latitude) {
     3float airmass (float secz_image, double ra, double dec, double st, double latitude) {
    44
    55  double hour, cosz, secz;
    … …  
    1313  hour = 15.0*st - ra;
    1414  cosz = sin (RAD_DEG*dec) * sin (RAD_DEG*latitude) + cos (RAD_DEG*dec) * cos (RAD_DEG*hour) * cos (RAD_DEG*latitude);
    15  
    16   /* modify to match storage units (millimags) */
    17   secz = 1000.0 / cosz;
     15  secz = 1.000 / cosz;
    1816  return (secz);
    1917}
  • trunk/Ohana/src/addstar/src/calibrate.c

    r4865 r5014  
    9595  if (MaxN == -1) {
    9696    fprintf (stderr, "no clean stars\n");
    97     image[0].Mcal = 10000;
    98     image[0].dMcal = 10000;
     97    image[0].Mcal_PS = 10.000;
     98    image[0].dMcal_PS = 10.000;
    9999    return;
    100100  }
    … …  
    137137  if (Nkeep < 5) {
    138138    fprintf (stderr, "too few stars\n");
    139     image[0].Mcal = 10000;
    140     image[0].dMcal = 10000;
     139    image[0].Mcal_PS = 10.000;
     140    image[0].dMcal_PS = 10.000;
    141141    return;
    142142  }
    … …  
    169169    Mw = W1 / W2;
    170170    fprintf (stderr, "N: %.0f, mean: %f, wt mean: %f, stdev: %f, precision: %f\n", N, M1, Mw, M2, M2 / sqrt (N));
    171     image[0].Mcal = 1000 * M1;
    172     image[0].dMcal = 1000 * M2 / sqrt (N);
     171    image[0].Mcal_PS = M1;
     172    image[0].dMcal_PS = M2 / sqrt (N);
    173173    image[0].Mxxxx = N;
    174174  } else {
    175175    fprintf (stderr, "too few stars\n");
    176     image[0].Mcal = 10000;
    177     image[0].dMcal = 10000;
     176    image[0].Mcal_PS = 10.000;
     177    image[0].dMcal_PS = 10.000;
    178178    image[0].Mxxxx = 0;
    179179  }
    180180}
    181 
    182 /*** image.Mcal is still in millimags ***/
  • trunk/Ohana/src/addstar/src/find_matches.c

    r4865 r5014  
    1212  Missing *tmpmissing;
    1313  Coords tcoords;
    14   int Nsecfilt, Nsec, MTIME;
    15   float Mcat, *Mval;
     14  int Nsecfilt, Nsec;
     15  float Mcat, *Mval, MTIME;
    1616
    1717  /* photcode data - must by of type DEP, (PRI, SEC) - probably should restrict to DEP */
    … …  
    143143       
    144144      /* calculate accurate per-star airmass */
    145       secz = airmass (image[0].secz, stars[N].R, stars[N].D, SiderealTime, Latitude);
     145      secz = airmass (image[0].secz_PS, stars[N].R, stars[N].D, SiderealTime, Latitude);
    146146     
    147147      /** add measurements for this star **/
    … …  
    151151      catalog[0].measure[Nmeas].M_PS        = MIN (stars[N].M + MTIME, NO_MAG);
    152152      catalog[0].measure[Nmeas].dM_PS       = MIN (stars[N].dM, NO_ERR);  /* error in input files stored in thousandths of mag */
    153       catalog[0].measure[Nmeas].Mcal_PS     = 0.001*image[0].Mcal; /* XXX image.Mcal still millimags */
     153      catalog[0].measure[Nmeas].Mcal_PS     = image[0].Mcal_PS;
    154154      catalog[0].measure[Nmeas].t           = image[0].tzero + 1e-4*stars[N].Y*image[0].trate;  /* trate is in 0.1 msec / row */
    155155      catalog[0].measure[Nmeas].averef      = n;
    … …  
    252252    if (!IN_CATALOG (stars[N].R, stars[N].D)) continue;
    253253
    254     secz = airmass (image[0].secz, stars[N].R, stars[N].D, SiderealTime, Latitude);
     254    secz = airmass (image[0].secz_PS, stars[N].R, stars[N].D, SiderealTime, Latitude);
    255255
    256256    catalog[0].average[Nave].R_PS      = stars[N].R;
    … …  
    277277    catalog[0].measure[Nmeas].M_PS        = MIN (stars[N].M + MTIME, NO_MAG);
    278278    catalog[0].measure[Nmeas].dM_PS       = MIN (stars[N].dM, NO_ERR);
    279     catalog[0].measure[Nmeas].Mcal_PS     = 0.001*image[0].Mcal;
     279    catalog[0].measure[Nmeas].Mcal_PS     = image[0].Mcal_PS;
    280280    catalog[0].measure[Nmeas].t           = image[0].tzero + 1e-4*stars[N].Y*image[0].trate; /* trate is in 0.1 msec / row */
    281281    catalog[0].measure[Nmeas].averef      = Nave;
  • trunk/Ohana/src/addstar/src/gcatalog.c

    r4865 r5014  
    66  char mode;
    77
    8   /* no autodetect for CATMODE yet */
    9   strcpy (catalog[0].catmode, CATMODE);
     8  /* CATMODE and CATFORMAT determined from catalog */
    109
    1110  /* read catalog header */
  • trunk/Ohana/src/addstar/src/gstars.c

    r4988 r5014  
    44
    55  FILE *f;
    6   int j, N, Nbytes;
     6  int j, N, Nbytes, extend;
    77  int itmp, hour, min;
    88  char *c, photcode[64], line[80];
    … …  
    7676  image[0].exptime = tmp;
    7777 
     78  /*** why are we no longer using APMIFIT?? ***/
    7879  tmp = 0;
    7980  /* fits_scan (&header, "APMIFIT",  "%lf", 1, &tmp); */
    80   image[0].apmifit = tmp * 1000.0;
     81  image[0].apmifit_PS = tmp;
    8182
    8283  tmp = 0;
    8384  /* fits_scan (&header, "dAPMIFIT", "%lf", 1, &tmp); */
    84   image[0].dapmifit = tmp * 1000.0;
     85  image[0].dapmifit_PS = tmp;
    8586
    8687  tmp = 0;
    … …  
    110111  tmp = 0;
    111112  fits_scan (&header, AirmassKeyword, "%lf", 1, &tmp);
    112   image[0].secz = MIN (NO_MAG, 1000*tmp);
     113  image[0].secz_PS = MIN (NO_MAG, tmp);
    113114
    114115  if (!fits_scan (&header, CCDNumKeyword, "%d", 1, &itmp)) {
    … …  
    122123
    123124  /* secz is in units milli-airmass */
    124   image[0].Mcal = 0.0;
     125  image[0].Mcal_PS = 0.0;
    125126  image[0].Xm   = NO_MAG;
    126127  image[0].code = 0;
    … …  
    162163  fseek (f, header.size, SEEK_SET);
    163164
     165  /* read from FITS table or from text table */
     166  extend = FALSE;
     167  fits_scan (&header, "EXTEND",  "%t", 1, &extend);
     168  if (extend) {
     169    Nbytes = fits_matrix_size (&header);
     170    fseek (f, Nbytes, SEEK_CUR);
     171    rdstars = rfits (f, &image[0].nstar);
     172  } else {
     173    /* allocate space for stars */
     174    if (!fits_scan (&header, "NSTARS", "%d", 1, &image[0].nstar)) {
     175      fprintf (stderr, "ERROR: failed to find NSTARS\n");
     176      exit (1);
     177    }
     178    rdstars = rtext (f, &image[0].nstar);
     179  }
     180  fclose (f);
     181
     182  /*
    164183  if (FITS_INPUT) {
    165184    Nbytes = fits_matrix_size (&header);
    … …  
    170189  }
    171190  fclose (f);
     191  */
    172192
    173193  /* modify resulting star list */
  • trunk/Ohana/src/addstar/src/image-db.c

    r4864 r5014  
    3939  fits_init_header (&db[0].header);
    4040
     41  /* set the recommended mode */
    4142  if (!strcmp (CATMODE, "RAW")) {
    4243    /* make header a fake image */
    … …  
    4647    db[0].header.Naxis[1] = 1;
    4748    fits_create_header (&db[0].header);
     49    db[0].mode = DVO_MODE_RAW;
    4850  }
    4951
    5052  if (!strcmp (CATMODE, "MEF") || !strcmp (CATMODE, "SPLIT")) {
     53    db[0].header.extend   = TRUE;
    5154    fits_create_header (&db[0].header);
     55    db[0].mode = DVO_MODE_MEF;
     56  }
     57
     58  /* set the recommended format */
     59  db[0].format = DVO_FORMAT_UNDEF;
     60  if (!strcmp (CATFORMAT, "INTERNAL"))  db[0].format = DVO_FORMAT_INTERNAL;
     61  if (!strcmp (CATFORMAT, "LONEOS"))    db[0].format = DVO_FORMAT_LONEOS;
     62  if (!strcmp (CATFORMAT, "ELIXIR"))    db[0].format = DVO_FORMAT_ELIXIR;
     63  if (!strcmp (CATFORMAT, "PANSTARRS")) db[0].format = DVO_FORMAT_PANSTARRS;
     64  if (db[0].format == DVO_FORMAT_UNDEF) {
     65    fprintf (stderr, "invalid output catalog format\n");
     66    exit (1);
    5267  }
    5368
    … …  
    5873  fits_modify (&db[0].header, "ZERO_PT", "%lf", 1, ZeroPt);
    5974  fits_modify (&db[0].header, "NIMAGES", "%d", 1, 0);
     75
     76  if (db[0].format == DVO_FORMAT_INTERNAL)  fits_modify (&db[0].header, "FORMAT", "%s", 1, "INTERNAL");
     77  if (db[0].format == DVO_FORMAT_LONEOS)    fits_modify (&db[0].header, "FORMAT", "%s", 1, "LONEOS");
     78  if (db[0].format == DVO_FORMAT_ELIXIR)    fits_modify (&db[0].header, "FORMAT", "%s", 1, "ELIXIR");
     79  if (db[0].format == DVO_FORMAT_PANSTARRS) fits_modify (&db[0].header, "FORMAT", "%s", 1, "PANSTARRS");
    6080}
    61 
  • trunk/Ohana/src/addstar/src/mkcatalog.c

    r4826 r5014  
    88  if (VERBOSE) fprintf (stderr, "new catalog file: %s\n", region[0].filename);
    99
     10  /* set the recommended CATFORMAT */
     11  catalog[0].catformat = DVO_FORMAT_UNDEF;
     12  if (!strcmp (CATFORMAT, "INTERNAL"))  catalog[0].catformat = DVO_FORMAT_INTERNAL;
     13  if (!strcmp (CATFORMAT, "LONEOS"))    catalog[0].catformat = DVO_FORMAT_LONEOS;
     14  if (!strcmp (CATFORMAT, "ELIXIR"))    catalog[0].catformat = DVO_FORMAT_ELIXIR;
     15  if (!strcmp (CATFORMAT, "PANSTARRS")) catalog[0].catformat = DVO_FORMAT_PANSTARRS;
     16  if (catalog[0].catformat == DVO_FORMAT_UNDEF) {
     17    fprintf (stderr, "invalid output catalog format\n");
     18    exit (1);
     19  }
     20
     21  /* set the recommended CATMODE */
     22  catalog[0].catmode = DVO_MODE_RAW;
     23  if (!strcmp (CATMODE, "RAW"))  catalog[0].catmode = DVO_MODE_RAW;
     24  if (!strcmp (CATMODE, "MEF"))  catalog[0].catmode = DVO_MODE_MEF;
     25
    1026  fits_init_header (&catalog[0].header);
     27
     28  if (catalog[0].catmode == DVO_MODE_RAW) {
     29    /* make header a fake image */
     30    catalog[0].header.bitpix   = 16;
     31    catalog[0].header.Naxes    = 2;
     32    catalog[0].header.Naxis[0] = 1;
     33    catalog[0].header.Naxis[1] = 1;
     34  }
     35
    1136  fits_create_header (&catalog[0].header);
    1237 
    … …  
    3459  ALLOCATE (catalog[0].secfilt, SecFilt, 1);
    3560  catalog[0].Nsecfilt = GetPhotcodeNsecfilt ();
    36 
    37   /* set catalog mode (raw, mef, etc) - no autodetect for CATMODE yet */
    38   strcpy (catalog[0].catmode, CATMODE);
    39 
    40   /* set catalog format (elixir, loneos, etc) */
    41   if (!strcmp (CATFORMAT, "INTERNAL")) {
    42     sprintf (catalog[0].average_format, "DVO_AVERAGE");
    43     sprintf (catalog[0].measure_format, "DVO_MEASURE");
    44   } else {
    45     sprintf (catalog[0].average_format, "DVO_AVERAGE_%s", CATFORMAT);
    46     sprintf (catalog[0].measure_format, "DVO_MEASURE_%s", CATFORMAT);
    47   }
    4861}
  • trunk/Ohana/src/addstar/src/wcatalog.c

    r4826 r5014  
    33void wcatalog (Catalog *catalog) {
    44 
    5   /* set catalog format (elixir, loneos, etc) */
    6   if (!strcmp (CATFORMAT, "INTERNAL")) {
    7     sprintf (catalog[0].average_format, "DVO_AVERAGE");
    8     sprintf (catalog[0].measure_format, "DVO_MEASURE");
    9   } else {
    10     sprintf (catalog[0].average_format, "DVO_AVERAGE_%s", CATFORMAT);
    11     sprintf (catalog[0].measure_format, "DVO_MEASURE_%s", CATFORMAT);
    12   }
     5  /* output CATMODE and CATFORMAT are set by mkcatalog
     6     or by mode and format of existing data */
    137
    148  if (!save_catalog (catalog, VERBOSE)) {
Note: See TracChangeset for help on using the changeset viewer.