Changeset 13443
- Timestamp:
- May 21, 2007, 8:52:42 AM (19 years ago)
- Location:
- branches/kapa-mods-2007-05/Ohana/src/opihi/dvo
- Files:
-
- 6 added
- 2 edited
-
avextract.c (modified) (5 diffs)
-
dbBooleanCond.c (added)
-
dbCheckStack.c (added)
-
dbCmdlineFields.c (added)
-
dbFields.c (added)
-
dbRPN.c (added)
-
dbStackMath.c (modified) (2 diffs)
-
dbStackOps.c (added)
Legend:
- Unmodified
- Added
- Removed
-
branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/avextract.c
r13440 r13443 3 3 int avextract (int argc, char **argv) { 4 4 5 int i, j, m, N, NPTS, param;5 int i, j, m, N, NPTS, last, Nfields; 6 6 int Nsecfilt, mode; 7 7 char *RegionName, *RegionList, *p; … … 11 11 PhotCode *code; 12 12 Vector *vec; 13 14 dvoFields *fields; 13 15 14 16 /* defaults */ … … 27 29 28 30 // parse the fields to be extracted and returned 29 narg = argc; 30 fields = ParseCmdlineFields (argc, argv, DVO_TABLE_AVERAGE, &last, &Nfields); 31 fields = dbCmdlineFields (argc, argv, DVO_TABLE_AVERAGE, &last, &Nfields); 31 32 if (fields == NULL) return (FALSE); 32 33 33 // require 'where' before boolean math34 if ((last != argc) && (strcasecmp(argv[last], "where") || (last >= argc - 2))) {35 gprint (GP_ERR, "syntax error\n");36 free (fields);37 return (FALSE);38 }39 40 34 // parse the remainder of the line as a boolean math expression 41 cstack = isolate_elements (argv-last, &argv[last +1], &Ncstack);35 cstack = isolate_elements (argv-last, &argv[last], &Ncstack); 42 36 43 // construct the db Boolean math stack 44 dbStack = db _convert_to_RPN (Ncstack, cstack, &NdbStack);37 // construct the db Boolean math stack (frees cstack) 38 dbStack = dbRPN (Ncstack, cstack, &NdbStack); 45 39 46 40 Nreturn = Nfields; 47 db_check_stack (dbStack, NdbStack, DVO_TABLE_AVERAGE, fields, &Nfields); 41 dbCheckStack (dbStack, NdbStack, DVO_TABLE_AVERAGE, &fields, &Nfields); 42 // XXX handle errors 48 43 49 44 /* interpret command-line options */ 50 SetSelectionParam (0);45 // this needs to explicitly handles -qregion and -skyregion 51 46 if (!SetRegionSelection (&argc, argv, &RegionName, &RegionList)) goto escape; 52 47 … … 55 50 56 51 /* create output storage vectors */ 57 ALLOCATE ( return, float, Nreturn);52 ALLOCATE (values, float, Nfields); 58 53 ALLOCATE (vec, Vector, Nreturn); 59 54 for (i = 0; i < Nreturn; i++) { … … 81 76 m = catalog.average[j].offset; 82 77 // extract the relevant values 78 // XXX for measure values, this could be optimized for one loop over measures... 83 79 for (n = 0; n < Nfields; n++) { 84 80 values[n] = ExtractAveragesNew (&catalog.average[j], &catalog.secfilt[j*Nsecfilt], &catalog.measure[m], fields[n]); 85 81 } 86 82 // test the conditional statement 87 if (! CheckBooleanCond (dbStack, NdbStack, values, fields, Nfields)) continue;83 if (!dbBooleanCond (dbStack, NdbStack, values, fields, Nfields)) continue; 88 84 for (n = 0; n < Nreturn; n++) { 89 85 vec[n].elements[N] = values[n]; 90 86 } 91 87 N++; 92 CHECK_REALLOCATE (vec[0].elements, float, NPTS, N, 2000); 88 if (N >= NPTS) { 89 NPTS += 2000; 90 for (n = 0; n < Nreturn; n++) { 91 REALLOCATE (vec[n].elements, float, NPTS); 92 } 93 } 93 94 } 94 95 dvo_catalog_free (&catalog); 95 96 } 96 vec[0].Nelements = N; 97 REALLOCATE (vec[0].elements, float, MAX(1,N)); 97 for (n = 0; n < Nreturn; n++) { 98 vec[n].Nelements = N; 99 REALLOCATE (vec[n].elements, float, MAX(1,N)); 100 } 98 101 99 102 SkyListFree (skylist, ((RegionName != NULL) || (RegionList != NULL))); -
branches/kapa-mods-2007-05/Ohana/src/opihi/dvo/dbStackMath.c
r13440 r13443 1 1 # include "opihi.h" 2 2 3 dvoStack *db _binary (dvoStack *V1, dvoStack *V2, char *op, float *fields, int Nfields) {3 dvoStack *dbBinary (dvoStack *V1, dvoStack *V2, char *op, float *fields, int Nfields) { 4 4 5 5 float M1, M2; … … 85 85 } 86 86 87 dvoStack *db _unary (dvoStack *V1, dvoStack *V2, char *op, float *fields, int Nfields) {87 dvoStack *dbUnary (dvoStack *V1, dvoStack *V2, char *op, float *fields, int Nfields) { 88 88 89 89 float M1;
Note:
See TracChangeset
for help on using the changeset viewer.
