IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 20861


Ignore:
Timestamp:
Nov 30, 2008, 6:17:46 PM (17 years ago)
Author:
eugene
Message:

convert imextract to SQL-like version

Location:
branches/eam_branch_20081124/Ohana/src/opihi
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20081124/Ohana/src/opihi/dvo/dbFields.c

    r20860 r20861  
    270270  return (TRUE);
    271271}
     272
     273int ParseImageField (dbField *field, char *fieldName) {
     274
     275  int mode;
     276  PhotCode *code;
     277
     278  field->table = DVO_TABLE_IMAGE;
     279  field->name  = strcreate (fieldName);
     280
     281  // if either GLON or GLAT is requested, we set up a static tranformation
     282  // at prepare to calculate the values only once for each row
     283  if (!strcasecmp (fieldName, "GLON"))  {
     284    dbExtractImagesInitTransform (COORD_GALACTIC);
     285    ESCAPE (IMAGE_GLON, MAG_NONE, OPIHI_FLT);
     286  }
     287  if (!strcasecmp (fieldName, "GLAT"))  {
     288    dbExtractImagesInitTransform (COORD_GALACTIC);
     289    ESCAPE (IMAGE_GLAT, MAG_NONE, OPIHI_FLT);
     290  }
     291
     292  // if either ELON or ELAT is requested, we set up a static tranformation
     293  // at prepare to calculate the values only once for each row
     294  if (!strcasecmp (fieldName, "ELON"))  {
     295    dbExtractImagesInitTransform (COORD_ECLIPTIC);
     296    ESCAPE (IMAGE_ELON, MAG_NONE, OPIHI_FLT);
     297  }
     298  if (!strcasecmp (fieldName, "ELAT"))  {
     299    dbExtractImagesInitTransform (COORD_ECLIPTIC);
     300    ESCAPE (IMAGE_ELAT, MAG_NONE, OPIHI_FLT);
     301  }
     302
     303  if (!strcasecmp (fieldName, "RA"       )) ESCAPE (IMAGE_RA,        MAG_NONE, OPIHI_FLT);
     304  if (!strcasecmp (fieldName, "DEC"      )) ESCAPE (IMAGE_DEC,       MAG_NONE, OPIHI_FLT);
     305  if (!strcasecmp (fieldName, "Xm"       )) ESCAPE (IMAGE_XM,        MAG_NONE, OPIHI_FLT);
     306  if (!strcasecmp (fieldName, "airmass"  )) ESCAPE (IMAGE_AIRMASS,   MAG_NONE, OPIHI_FLT);
     307  if (!strcasecmp (fieldName, "Mcal"     )) ESCAPE (IMAGE_MCAL,      MAG_NONE, OPIHI_FLT);
     308  if (!strcasecmp (fieldName, "dMcal"    )) ESCAPE (IMAGE_dMCAL,     MAG_NONE, OPIHI_FLT);
     309  if (!strcasecmp (fieldName, "photcode" )) ESCAPE (IMAGE_PHOTCODE,  MAG_NONE, OPIHI_INT);
     310  if (!strcasecmp (fieldName, "time"     )) ESCAPE (IMAGE_TIME,      MAG_NONE, OPIHI_FLT);
     311  if (!strcasecmp (fieldName, "FWHM"     )) ESCAPE (IMAGE_FWHM,      MAG_NONE, OPIHI_FLT);
     312  if (!strcasecmp (fieldName, "exptime"  )) ESCAPE (IMAGE_EXPTIME,   MAG_NONE, OPIHI_FLT);
     313  if (!strcasecmp (fieldName, "nstar"    )) ESCAPE (IMAGE_NSTAR,     MAG_NONE, OPIHI_INT);
     314  if (!strcasecmp (fieldName, "ncal"     )) ESCAPE (IMAGE_NCAL,      MAG_NONE, OPIHI_INT);
     315  if (!strcasecmp (fieldName, "sky"      )) ESCAPE (IMAGE_SKY,       MAG_NONE, OPIHI_FLT);
     316  if (!strcasecmp (fieldName, "flag"     )) ESCAPE (IMAGE_FLAG,      MAG_NONE, OPIHI_INT);
     317  if (!strcasecmp (fieldName, "NX"       )) ESCAPE (IMAGE_NX_PIX,    MAG_NONE, OPIHI_INT);
     318  if (!strcasecmp (fieldName, "NY"       )) ESCAPE (IMAGE_NY_PIX,    MAG_NONE, OPIHI_INT);
     319  if (!strcasecmp (fieldName, "theta"    )) ESCAPE (IMAGE_THETA,     MAG_NONE, OPIHI_FLT);
     320  if (!strcasecmp (fieldName, "skew"     )) ESCAPE (IMAGE_SKEW,      MAG_NONE, OPIHI_FLT);
     321  if (!strcasecmp (fieldName, "scale"    )) ESCAPE (IMAGE_SCALE,     MAG_NONE, OPIHI_FLT);
     322  if (!strcasecmp (fieldName, "dscale"   )) ESCAPE (IMAGE_DSCALE,    MAG_NONE, OPIHI_FLT);
     323  if (!strcasecmp (fieldName, "imageID"  )) ESCAPE (IMAGE_IMAGE_ID,  MAG_NONE, OPIHI_INT);
     324  if (!strcasecmp (fieldName, "X_LL_CHIP")) ESCAPE (IMAGE_X_LL_CHIP, MAG_NONE, OPIHI_FLT);
     325  if (!strcasecmp (fieldName, "X_LR_CHIP")) ESCAPE (IMAGE_X_LR_CHIP, MAG_NONE, OPIHI_FLT);
     326  if (!strcasecmp (fieldName, "X_UL_CHIP")) ESCAPE (IMAGE_X_UL_CHIP, MAG_NONE, OPIHI_FLT);
     327  if (!strcasecmp (fieldName, "X_UR_CHIP")) ESCAPE (IMAGE_X_UR_CHIP, MAG_NONE, OPIHI_FLT);
     328  if (!strcasecmp (fieldName, "Y_LL_CHIP")) ESCAPE (IMAGE_Y_LL_CHIP, MAG_NONE, OPIHI_FLT);
     329  if (!strcasecmp (fieldName, "Y_LR_CHIP")) ESCAPE (IMAGE_Y_LR_CHIP, MAG_NONE, OPIHI_FLT);
     330  if (!strcasecmp (fieldName, "Y_UL_CHIP")) ESCAPE (IMAGE_Y_UL_CHIP, MAG_NONE, OPIHI_FLT);
     331  if (!strcasecmp (fieldName, "Y_UR_CHIP")) ESCAPE (IMAGE_Y_UR_CHIP, MAG_NONE, OPIHI_FLT);
     332  if (!strcasecmp (fieldName, "X_LL_FP"  )) ESCAPE (IMAGE_X_LL_FP,   MAG_NONE, OPIHI_FLT);
     333  if (!strcasecmp (fieldName, "X_LR_FP"  )) ESCAPE (IMAGE_X_LR_FP,   MAG_NONE, OPIHI_FLT);
     334  if (!strcasecmp (fieldName, "X_UL_FP"  )) ESCAPE (IMAGE_X_UL_FP,   MAG_NONE, OPIHI_FLT);
     335  if (!strcasecmp (fieldName, "X_UR_FP"  )) ESCAPE (IMAGE_X_UR_FP,   MAG_NONE, OPIHI_FLT);
     336  if (!strcasecmp (fieldName, "Y_LL_FP"  )) ESCAPE (IMAGE_Y_LL_FP,   MAG_NONE, OPIHI_FLT);
     337  if (!strcasecmp (fieldName, "Y_LR_FP"  )) ESCAPE (IMAGE_Y_LR_FP,   MAG_NONE, OPIHI_FLT);
     338  if (!strcasecmp (fieldName, "Y_UL_FP"  )) ESCAPE (IMAGE_Y_UL_FP,   MAG_NONE, OPIHI_FLT);
     339  if (!strcasecmp (fieldName, "Y_UR_FP"  )) ESCAPE (IMAGE_Y_UR_FP,   MAG_NONE, OPIHI_FLT);
     340
     341  // for words that don't parse, try a photcode
     342  gprint (GP_ERR, "unknown image field %s\n", fieldName);
     343  return (FALSE);
     344}
  • branches/eam_branch_20081124/Ohana/src/opihi/dvo/imextract.c

    r20859 r20861  
    11# include "dvoshell.h"
    2 
    3 // need to upgrade this to support multiple fields and WHERE clauses
    4 
    5 enum {ZERO,
    6       RA,
    7       DEC,
    8       Xm,
    9       AIRMASS,
    10       MCAL,
    11       dMCAL,
    12       PHOTCODE,
    13       TIME,
    14       FWHM,
    15       EXPTIME,
    16       NSTAR,
    17       NCAL,
    18       SKY,
    19       FLAG,
    20       NX_PIX,
    21       NY_PIX,
    22       THETA,
    23       SKEW,
    24       SCALE,
    25       DSCALE,
    26       IMAGE_ID,
    27       X_LL_CHIP,
    28       X_LR_CHIP,
    29       X_UL_CHIP,
    30       X_UR_CHIP,
    31       Y_LL_CHIP,
    32       Y_LR_CHIP,
    33       Y_UL_CHIP,
    34       Y_UR_CHIP,
    35       X_LL_FP,
    36       X_LR_FP,
    37       X_UL_FP,
    38       X_UR_FP,
    39       Y_LL_FP,
    40       Y_LR_FP,
    41       Y_UL_FP,
    42       Y_UR_FP,
    43 };
    442
    453int imextract (int argc, char **argv) {
     
    5513  Vector *vec;
    5614
    57   if (!InitPhotcodes ()) return (FALSE);
     15  if ((N = get_argument (argc, argv, "-h"))) goto help;
     16  if ((N = get_argument (argc, argv, "--help"))) goto help;
     17
     18  VERBOSE = FALSE;
     19  if ((N = get_argument (argc, argv, "-v"))) {
     20    remove_argument (N, &argc, argv);
     21    VERBOSE = TRUE;
     22  }
     23
     24  if (!InitPhotcodes ()) goto escape;
    5825
    5926  // parse skyregion options
     
    6330  }
    6431
    65   /* check for time-based selection */
    66   TimeSelect = FALSE;
    67   if ((N = get_argument (argc, argv, "-time"))) {
    68     remove_argument (N, &argc, argv);
    69     if (!ohana_str_to_time (argv[N], &tzero)) {
    70       gprint (GP_ERR, "syntax error\n");
    71       return (FALSE);
     32  // command-line is of the form: avextract field,field, field [where (field op value)...]
     33
     34  // parse the fields to be extracted and returned
     35  fields = dbCmdlineFields (argc, argv, DVO_TABLE_IMAGE, &last, &Nfields);
     36  if (fields == NULL) return (FALSE);
     37
     38  // examine line for 'where' or 'match to'.  'match to' is forbidden
     39  state = dbCmdlineConditions (argc, argv, last, &next);
     40  if (state == DVO_DB_CMDLINE_ERROR) goto escape;
     41  if (state == DVO_DB_CMDLINE_IS_MATCH) goto escape; // not allowed for mextract
     42
     43  // parse the remainder of the line as a boolean math expression
     44  cstack = isolate_elements (argc-next, &argv[next], &Ncstack);
     45 
     46  // construct the db Boolean math stack (frees cstack)
     47  stack = dbRPN (Ncstack, cstack, &Nstack);
     48
     49  // add the skyregion limits to the where statement (or create)
     50  dbAstroRegionLimits (&stack, &Nstack, selection, DVO_TABLE_IMAGE);
     51
     52  // parse stack elements into fields and scalars as needed
     53  Nreturn = Nfields;
     54  if (!dbCheckStack (stack, Nstack, DVO_TABLE_IMAGE, &fields, &Nfields)) goto escape;
     55
     56  /* create output storage vectors */
     57  ALLOCATE (values, dbValue, Nfields);
     58  ALLOCATE (vec, Vector *, Nreturn);
     59  for (i = 0; i < Nreturn; i++) {
     60    if (ISNUM(fields[i].name[0])) {
     61      sprintf (name, "v_%s", fields[i].name);
     62    } else {
     63      sprintf (name, "%s", fields[i].name);
    7264    }
    73     remove_argument (N, &argc, argv);
    74     if (!ohana_str_to_dtime (argv[N], &trange)) {
    75       gprint (GP_ERR, "syntax error\n");
    76       return (FALSE);
    77     }
    78     remove_argument (N, &argc, argv);
    79     TimeSelect = TRUE;
     65    if ((vec[i] = SelectVector (name, ANYVECTOR, TRUE)) == NULL) goto escape;
    8066  }
    8167
    82   /* check for region-based selection */
    83   FlagValue = 0;
    84   FlagSelect = FALSE;
    85   if ((N = get_argument (argc, argv, "-flag"))) {
    86     remove_argument (N, &argc, argv);
    87     FlagValue = atoi (argv[N]);
    88     remove_argument (N, &argc, argv);
    89     FlagSelect = TRUE;
    90   }
     68  Npts = 0;
     69  NPTS = 1;
    9170
    92   /* check for photcode-based selection */
    93   code = NULL;
    94   PhotcodeSelect = FALSE;
    95   if ((N = get_argument (argc, argv, "-photcode"))) {
    96     PhotcodeSelect = TRUE;
    97     remove_argument (N, &argc, argv);
    98     if ((code = GetPhotcodebyName (argv[N])) == NULL) {
    99       gprint (GP_ERR, "ERROR: photcode %s not found in photcode table\n", argv[N]);
    100       return (FALSE);
    101     }
    102     if ((code[0].type != PHOT_SEC) && (code[0].type != PHOT_DEP)) {
    103       gprint (GP_ERR, "photcode must be primary, secondary, or dependent code\n");
    104       return (FALSE);
    105     }
    106     remove_argument (N, &argc, argv);
    107   }
    108 
    109   if (argc != 2) {
    110     gprint (GP_ERR, "USAGE: imextract (value) [-region] [-time start range] [-photcode photcode]\n");
    111     return (FALSE);
    112   }
    113  
    114   /* identify selection */
    115   mode = ZERO;
    116   if (!strcasecmp (argv[1], "ra"       )) mode = RA;
    117   if (!strcasecmp (argv[1], "dec"      )) mode = DEC;
    118   if (!strcasecmp (argv[1], "Xm"       )) mode = Xm;
    119   if (!strcasecmp (argv[1], "airmass"  )) mode = AIRMASS;
    120   if (!strcasecmp (argv[1], "Mcal"     )) mode = MCAL;
    121   if (!strcasecmp (argv[1], "dMcal"    )) mode = dMCAL;
    122   if (!strcasecmp (argv[1], "photcode" )) mode = PHOTCODE;
    123   if (!strcasecmp (argv[1], "time"     )) mode = TIME;
    124   if (!strcasecmp (argv[1], "FWHM"     )) mode = FWHM;
    125   if (!strcasecmp (argv[1], "exptime"  )) mode = EXPTIME;
    126   if (!strcasecmp (argv[1], "nstar"    )) mode = NSTAR;
    127   if (!strcasecmp (argv[1], "ncal"     )) mode = NCAL;
    128   if (!strcasecmp (argv[1], "sky"      )) mode = SKY;
    129   if (!strcasecmp (argv[1], "flag"     )) mode = FLAG;
    130   if (!strcasecmp (argv[1], "NX"       )) mode = NX_PIX;
    131   if (!strcasecmp (argv[1], "NY"       )) mode = NY_PIX;
    132   if (!strcasecmp (argv[1], "theta"    )) mode = THETA;
    133   if (!strcasecmp (argv[1], "skew"     )) mode = SKEW;
    134   if (!strcasecmp (argv[1], "scale"    )) mode = SCALE;
    135   if (!strcasecmp (argv[1], "dscale"   )) mode = DSCALE;
    136   if (!strcasecmp (argv[1], "imageID"  )) mode = IMAGE_ID;
    137   if (!strcasecmp (argv[1], "X_LL_CHIP")) mode = X_LL_CHIP;
    138   if (!strcasecmp (argv[1], "X_LR_CHIP")) mode = X_LR_CHIP;
    139   if (!strcasecmp (argv[1], "X_UL_CHIP")) mode = X_UL_CHIP;
    140   if (!strcasecmp (argv[1], "X_UR_CHIP")) mode = X_UR_CHIP;
    141   if (!strcasecmp (argv[1], "Y_LL_CHIP")) mode = Y_LL_CHIP;
    142   if (!strcasecmp (argv[1], "Y_LR_CHIP")) mode = Y_LR_CHIP;
    143   if (!strcasecmp (argv[1], "Y_UL_CHIP")) mode = Y_UL_CHIP;
    144   if (!strcasecmp (argv[1], "Y_UR_CHIP")) mode = Y_UR_CHIP;
    145   if (!strcasecmp (argv[1], "X_LL_FP"  )) mode = X_LL_FP;
    146   if (!strcasecmp (argv[1], "X_LR_FP"  )) mode = X_LR_FP;
    147   if (!strcasecmp (argv[1], "X_UL_FP"  )) mode = X_UL_FP;
    148   if (!strcasecmp (argv[1], "X_UR_FP"  )) mode = X_UR_FP;
    149   if (!strcasecmp (argv[1], "Y_LL_FP"  )) mode = Y_LL_FP;
    150   if (!strcasecmp (argv[1], "Y_LR_FP"  )) mode = Y_LR_FP;
    151   if (!strcasecmp (argv[1], "Y_UL_FP"  )) mode = Y_UL_FP;
    152   if (!strcasecmp (argv[1], "Y_UR_FP"  )) mode = Y_UR_FP;
    153   if (mode == ZERO) {
    154     gprint (GP_ERR, "value may be one of the following:\n");
    155     gprint (GP_ERR, " ra dec airmass Mcal dMcal Xm photcode time fwhm exptime nstar ncal sky flag\n");
    156     return (FALSE);
    157   }
    158   if ((vec = SelectVector (argv[1], ANYVECTOR, TRUE)) == NULL) return (FALSE);
     71  // grab data from all selected sky regions
     72  Signal = signal (SIGINT, handle_interrupt);
     73  interrupt = FALSE;
    15974
    16075  if ((image = LoadImages (&Nimage)) == NULL) return (FALSE);
     76
     77  // XXX do I need to use this, or the region portion
    16178  image_subset (image, Nimage, &subset, &Nsubset, selection, tzero, trange, TimeSelect);
    16279  if ((mode == RA) || (mode == DEC)) BuildChipMatch (image, Nimage);
     
    16784  ResetVector (vec, OPIHI_FLT, Nimage);
    16885 
    169   N = 0;
    170   /* assign vector values */
    171   for (i = 0; i < Nsubset; i++) {
    172     j = subset[i];
    173     if (PhotcodeSelect) {
    174       if (code[0].type == PHOT_DEP) {
    175         if (code[0].code != image[j].photcode) continue;
     86  for (j = 0; (j < Nimage) && !interrupt; j++) {
     87
     88    dbExtractImagesInit (); // reset counters for saved fields
     89    for (n = 0; n < Nfields; n++) {
     90      values[n] = dbExtractImages (&image[j], &fields[n]);
     91    }
     92    // test the conditional statement
     93    if (!dbBooleanCond (stack, Nstack, values)) continue;
     94    for (n = 0; n < Nreturn; n++) {
     95      if (vec[n][0].type == OPIHI_FLT) {
     96        vec[n][0].elements.Flt[Npts] = values[n].Flt;
    17697      } else {
    177         if (code[0].code != GetPhotcodeEquivCodebyCode (image[j].photcode)) continue;
     98        vec[n][0].elements.Int[Npts] = values[n].Int;
    17899      }
    179100    }
    180     if (FlagSelect && (FlagValue != image[j].code)) continue;
    181     switch (mode) {
    182       case RA:
    183         if (!FindMosaicForImage (image, Nimage, j)) continue;
    184         x = 0.5*image[j].NX;
    185         y = 0.5*image[j].NY;
    186         XY_to_RD (&ra, &dec, x, y, &image[j].coords);
    187         vec[0].elements.Flt[N] = ra;
    188         break;
    189       case DEC:
    190         if (!FindMosaicForImage (image, Nimage, j)) continue;
    191         x = 0.5*image[j].NX;
    192         y = 0.5*image[j].NY;
    193         XY_to_RD (&ra, &dec, x, y, &image[j].coords);
    194         vec[0].elements.Flt[N] = dec;
    195         break;
    196       case Xm:
    197         vec[0].elements.Flt[N] = pow(10.0, 0.01*image[j].Xm);
    198         break;
    199       case AIRMASS:
    200         vec[0].elements.Flt[N] = image[j].secz;
    201         break;
    202       case MCAL:
    203         vec[0].elements.Flt[N] = image[j].Mcal;
    204         break;
    205       case dMCAL:
    206         vec[0].elements.Flt[N] = image[j].dMcal;
    207         break;
    208       case PHOTCODE:
    209         vec[0].elements.Flt[N] = image[j].photcode;
    210         break;
    211       case TIME:
    212         t = image[j].tzero + 0.5*image[j].NY * image[j].trate / 10000;
    213         vec[0].elements.Flt[N] = TimeValue (t, TimeReference, TimeFormat);
    214         break;
    215       case FWHM:
    216         vec[0].elements.Flt[N] = image[j].fwhm_x / 25.0;
    217         break;
    218       case EXPTIME:
    219         vec[0].elements.Flt[N] = image[j].exptime;
    220         break;
    221       case NSTAR:
    222         vec[0].elements.Flt[N] = image[j].nstar;
    223         break;
    224       case NCAL:
    225         vec[0].elements.Flt[N] = image[j].Mxxxx;
    226         break;
    227       case SKY:
    228         vec[0].elements.Flt[N] = image[j].Myyyy + 0x8000;
    229         break;
    230       case FLAG:
    231         vec[0].elements.Flt[N] = image[j].code;
    232         break;
    233       case NX_PIX:
    234         vec[0].elements.Flt[N] = image[j].NX;
    235         break;
    236       case NY_PIX:
    237         vec[0].elements.Flt[N] = image[j].NY;
    238         break;
    239       case IMAGE_ID:
    240         vec[0].elements.Flt[N] = image[j].imageID;
    241         break;
    242       case THETA: {
    243         double theta1, theta2, s1, s2;
    244         s1 = SIGN(image[j].coords.pc1_1);
    245         s2 = SIGN(image[j].coords.pc2_2);
    246         theta1 = DEG_RAD*atan2 (+s1*image[j].coords.pc1_2, s1*image[j].coords.pc1_1);
    247         theta2 = DEG_RAD*atan2 (-s2*image[j].coords.pc2_1, s2*image[j].coords.pc2_2);
    248         vec[0].elements.Flt[N] = 0.5*(theta1+theta2);
    249         break; }
    250       case SKEW: {
    251         double theta1, theta2, s1, s2;
    252         s1 = SIGN(image[j].coords.pc1_1);
    253         s2 = SIGN(image[j].coords.pc2_2);
    254         theta1 = DEG_RAD*atan2 (+s1*image[j].coords.pc1_2, s1*image[j].coords.pc1_1);
    255         theta2 = DEG_RAD*atan2 (-s2*image[j].coords.pc2_1, s2*image[j].coords.pc2_2);
    256         vec[0].elements.Flt[N] = (theta1-theta2);
    257         break; }
    258       case SCALE: {
    259         double scale1, scale2;
    260         scale1 = fabs(image[j].coords.cdelt1);
    261         scale2 = fabs(image[j].coords.cdelt2);
    262         vec[0].elements.Flt[N] = 0.5*(scale1+scale2);
    263         break; }
    264       case DSCALE: {
    265         double scale1, scale2;
    266         scale1 = fabs(image[j].coords.cdelt1);
    267         scale2 = fabs(image[j].coords.cdelt2);
    268         vec[0].elements.Flt[N] = (scale1-scale2);
    269         break; }
    270 
    271     // reference pixel extractions
    272     case X_LL_CHIP:
    273     case Y_LL_CHIP:
    274     case Y_LR_CHIP:
    275     case X_UL_CHIP:
    276       vec[0].elements.Flt[N] = 0.0;
    277       break;
    278     case X_LR_CHIP:
    279     case X_UR_CHIP:
    280       vec[0].elements.Flt[N] = image[j].NX;
    281       break;
    282     case Y_UL_CHIP:
    283     case Y_UR_CHIP:
    284       vec[0].elements.Flt[N] = image[j].NX;
    285       break;
    286 
    287     case X_LL_FP:
    288     case Y_LL_FP:
    289       XY_to_LM (&x, &y, 0.0, 0.0, &image[j].coords);
    290       vec[0].elements.Flt[N] = (mode == X_LL_FP) ? x : y;
    291       break;
    292     case X_LR_FP:
    293     case Y_LR_FP:
    294       XY_to_LM (&x, &y, image[j].NX, 0.0, &image[j].coords);
    295       vec[0].elements.Flt[N] = (mode == X_LR_FP) ? x : y;
    296       break;
    297     case X_UL_FP:
    298     case Y_UL_FP:
    299       XY_to_LM (&x, &y, 0.0, image[j].NY, &image[j].coords);
    300       vec[0].elements.Flt[N] = (mode == X_UL_FP) ? x : y;
    301       break;
    302     case X_UR_FP:
    303     case Y_UR_FP:
    304       XY_to_LM (&x, &y, image[j].NX, image[j].NY, &image[j].coords);
    305       vec[0].elements.Flt[N] = (mode == X_UR_FP) ? x : y;
    306       break;
     101    Npts++;
     102    if (Npts >= NPTS) {
     103      NPTS += 2000;
     104      for (n = 0; n < Nreturn; n++) {
     105        REALLOCATE (vec[n][0].elements.Flt, opihi_flt, NPTS);
     106      }
    307107    }
    308     N++;
    309108  }
    310  
    311   vec[0].Nelements = N;
    312   REALLOCATE (vec[0].elements.Flt, opihi_flt, N);
     109  signal (SIGINT, Signal);
     110  interrupt = FALSE;
     111  for (n = 0; n < Nreturn; n++) {
     112    vec[n][0].Nelements = Npts;
     113    REALLOCATE (vec[n][0].elements.Flt, opihi_flt, MAX(1,Npts));
     114  }
    313115
    314116  free (subset);
     
    316118  return (TRUE);
    317119 
     120 escape:
     121  return (FALSE);
     122
     123 help:
     124  gprint (GP_ERR, "USAGE: imextract field[,field,field...] where (expression)\n");
     125
     126  if ((argc > N + 1) && !strcasecmp (argv[N+1], "fields")) {
     127    gprint (GP_ERR, " USAGE: imextract field[,field,field...] where (expression)\n");
     128    gprint (GP_ERR, "  RA : right ascension of field center (J2000)\n");
     129    gprint (GP_ERR, "  DEC : declination of field center\n");
     130    return (FALSE);
     131  }
     132  gprint (GP_ERR, " avextract --help fields : for a complete listing of allowed fields\n");
     133  return (FALSE);
    318134}
    319135 
  • branches/eam_branch_20081124/Ohana/src/opihi/include/dvoshell.h

    r20860 r20861  
    135135};
    136136
     137enum {IMAGE_ZERO,
     138      IMAGE_RA,
     139      IMAGE_DEC,
     140      IMAGE_Xm,
     141      IMAGE_AIRMASS,
     142      IMAGE_MCAL,
     143      IMAGE_dMCAL,
     144      IMAGE_PHOTCODE,
     145      IMAGE_TIME,
     146      IMAGE_FWHM,
     147      IMAGE_EXPTIME,
     148      IMAGE_NSTAR,
     149      IMAGE_NCAL,
     150      IMAGE_SKY,
     151      IMAGE_FLAG,
     152      IMAGE_NX_PIX,
     153      IMAGE_NY_PIX,
     154      IMAGE_THETA,
     155      IMAGE_SKEW,
     156      IMAGE_SCALE,
     157      IMAGE_DSCALE,
     158      IMAGE_IMAGE_ID,
     159      IMAGE_X_LL_CHIP,
     160      IMAGE_X_LR_CHIP,
     161      IMAGE_X_UL_CHIP,
     162      IMAGE_X_UR_CHIP,
     163      IMAGE_Y_LL_CHIP,
     164      IMAGE_Y_LR_CHIP,
     165      IMAGE_Y_UL_CHIP,
     166      IMAGE_Y_UR_CHIP,
     167      IMAGE_X_LL_FP,
     168      IMAGE_X_LR_FP,
     169      IMAGE_X_UL_FP,
     170      IMAGE_X_UR_FP,
     171      IMAGE_Y_LL_FP,
     172      IMAGE_Y_LR_FP,
     173      IMAGE_Y_UL_FP,
     174      IMAGE_Y_UR_FP,
     175};
     176
    137177enum {DVO_TABLE_AVERAGE, DVO_TABLE_MEASURE};
    138178enum {DVO_DB_CMDLINE_ERROR, DVO_DB_CMDLINE_IS_END, DVO_DB_CMDLINE_IS_WHERE, DVO_DB_CMDLINE_IS_MATCH};
Note: See TracChangeset for help on using the changeset viewer.