IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 2798


Ignore:
Timestamp:
Dec 23, 2004, 7:33:48 AM (22 years ago)
Author:
eugene
Message:

moved typename/modename funcs to libohana

Location:
trunk/Ohana/src/opihi/dvo
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Ohana/src/opihi/dvo/detrend.c

    r2598 r2798  
    1212  double trange;
    1313  int TypeSelect, CCDSelect, FilterSelect;
    14   char *Filter, *Type;
    15   int type, mode, CCD;
     14  char *Filter;
     15  int Type, mode, CCD;
    1616  int NVALUE;
    1717  float *value;
     
    6666  if (N = get_argument (argc, argv, "-type")) {
    6767    remove_argument (N, &argc, argv);
    68     Type = strcreate (argv[N]);
     68    Type = get_image_type (argv[N]);
     69    if (Type == T_UNDEF) {
     70      fprintf (stderr, "ERROR: invalid image type %s\n", argv[N]);
     71      return (FALSE);
     72    }
    6973    remove_argument (N, &argc, argv);
    7074    TypeSelect = TRUE;
    71   }
    72   type = TYPE_NONE;
    73   if (TypeSelect) {
    74     if (!strncasecmp (Type, "obj", 3)) {
    75       type = TYPE_OBJECT;
    76     }
    77     if (!strncasecmp (Type, "bias", 4)) {
    78       type = TYPE_BIAS;
    79     }
    80     if (!strncasecmp (Type, "dark", 4)) {
    81       type = TYPE_DARK;
    82     }
    83     if (!strncasecmp (Type, "flat", 4)) {
    84       type = TYPE_FLAT;
    85     }
    86     if (type == TYPE_NONE) {
    87       fprintf (stderr, "invalid image type %s\n", Type);
    88       return (FALSE);
    89     }
    9075  }
    9176
     
    173158    if (FilterSelect && (strcasecmp (pimage[i].filter, Filter))) continue;
    174159    if (CCDSelect && (pimage[i].ccd != CCD)) continue;
    175     if (TypeSelect && (pimage[i].type != type)) continue;
     160    if (TypeSelect && (pimage[i].type != Type)) continue;
    176161
    177162    /* assign correct value */
  • trunk/Ohana/src/opihi/dvo/imsearch.c

    r2598 r2798  
    11# include "dvo.h"
    2 
    3 static char typename[5][32] = {"none", "object", "dark", "bias", "flat"};
    4 static char modename[3][32] = {"none", "mef", "single"};
    52
    63imsearch (int argc, char **argv) {
     
    129  int i, Nimage, status, N, TimeSelect, SaveNames;
    1310  int ModeSelect, TypeSelect, CCDSelect, FilterSelect;
    14   char *Filter, *Type, *Mode, *pmode, *ptype, *obstime;
    15   int type, mode, CCD;
     11  char *Filter, *obstime;
     12  int Type, Mode, CCD;
    1613  unsigned long int tzero;
    1714  double trange;
     
    4441  if (N = get_argument (argc, argv, "-type")) {
    4542    remove_argument (N, &argc, argv);
    46     Type = strcreate (argv[N]);
     43    Type = get_image_type (argv[N]);
     44    if (Type == T_UNDEF) {
     45      fprintf (stderr, "ERROR: invalid image type %s\n", argv[N]);
     46      return (FALSE);
     47    }
    4748    remove_argument (N, &argc, argv);
    4849    TypeSelect = TRUE;
     
    5253  if (N = get_argument (argc, argv, "-mode")) {
    5354    remove_argument (N, &argc, argv);
    54     Mode = strcreate (argv[N]);
     55    Mode = get_image_mode (argv[N]);
     56    if (Mode == M_UNDEF) {
     57      fprintf (stderr, "ERROR: invalid image mode %s\n", argv[N]);
     58      exit (1);
     59    }
    5560    remove_argument (N, &argc, argv);
    5661    ModeSelect = TRUE;
     
    7984    fprintf (stderr, "USAGE: imsearch [-time start range] [-type type] [-mode mode] [-ccd N] [-filter name]\n");
    8085    exit (1);
    81   }
    82 
    83   type = TYPE_NONE;
    84   if (TypeSelect) {
    85     if (!strncasecmp (Type, "obj", 3)) {
    86       type = TYPE_OBJECT;
    87     }
    88     if (!strncasecmp (Type, "bias", 4)) {
    89       type = TYPE_BIAS;
    90     }
    91     if (!strncasecmp (Type, "dark", 4)) {
    92       type = TYPE_DARK;
    93     }
    94     if (!strncasecmp (Type, "flat", 4)) {
    95       type = TYPE_FLAT;
    96     }
    97     if (type == TYPE_NONE) {
    98       fprintf (stderr, "invalid image type %s\n", Type);
    99       return (FALSE);
    100     }
    101   }
    102 
    103   mode = MODE_NONE;
    104   if (ModeSelect) {
    105     if (!strncasecmp (Mode, "mef", 3)) {
    106       mode = MODE_MEF;
    107     }
    108     if (!strncasecmp (Mode, "single", 4) || !strncasecmp (Mode, "split", 4)) {
    109       mode = MODE_SINGLE;
    110     }
    111     if (mode == MODE_NONE) {
    112       fprintf (stderr, "invalid image mode %s\n", Mode);
    113       return (FALSE);
    114     }
    11586  }
    11687
     
    149120    if (ModeSelect && (pimage[i].mode != mode)) continue;
    150121    if (CCDSelect && (pimage[i].ccd != CCD)) continue;
    151     if (TypeSelect && (pimage[i].type != type)) continue;
    152 
    153     if ((pimage[i].mode < 0) || (pimage[i].mode > 2))
    154       pmode = modename[0];
    155     else
    156       pmode = modename[(int)pimage[i].mode];
    157 
    158     if ((pimage[i].type < 0) || (pimage[i].type > 4))
    159       ptype = typename[0];
    160     else
    161       ptype = typename[(int)pimage[i].type];
     122    if (TypeSelect && (pimage[i].type != Type)) continue;
    162123
    163124    obstime = ctime (&pimage[i].obstime);
    164125    obstime[strlen(obstime)-1] = 0;
    165     fprintf (stdout, "%5d %6s %6s %2d %2d   ", i, ptype, pmode, pimage[i].ccd, pimage[i].type);
     126
     127    fprintf (stdout, "%5d %6s %6s %2d %2d   ", i, get_type_name(pimage[i].type), get_mode_name(pimage[i].mode), pimage[i].ccd, pimage[i].type);
    166128    fprintf (stdout, "%s %s  ", pimage[i].pathname, pimage[i].filename);
    167129    fprintf (stdout, "%s %s %f %s\n", pimage[i].filter, pimage[i].instrument, pimage[i].exptime, obstime);
Note: See TracChangeset for help on using the changeset viewer.