Changeset 20873
- Timestamp:
- Dec 2, 2008, 6:24:28 PM (17 years ago)
- Location:
- branches/eam_branch_20081124/Ohana/src/opihi
- Files:
-
- 2 deleted
- 34 edited
-
cmd.astro/cgrid.c (modified) (1 diff)
-
cmd.astro/cplot.c (modified) (1 diff)
-
cmd.astro/czplot.c (modified) (1 diff)
-
cmd.basic/test/sprintf.sh (modified) (1 diff)
-
cmd.data/grid.c (modified) (1 diff)
-
cmd.data/test/applyfit2d.sh (modified) (2 diffs)
-
cmd.data/test/vgauss.sh (modified) (4 diffs)
-
cmd.data/test/vmaxwell.sh (modified) (1 diff)
-
cmd.data/vmaxwell.c (modified) (2 diffs)
-
cmd.data/zplot.c (modified) (1 diff)
-
dvo/Makefile (modified) (1 diff)
-
dvo/avextract.c (modified) (3 diffs)
-
dvo/dbCheckStack.c (modified) (2 diffs)
-
dvo/dbCmdlineFields.c (modified) (2 diffs)
-
dvo/dbExtractImages.c (modified) (3 diffs)
-
dvo/dbFields.c (modified) (3 diffs)
-
dvo/dbStackOps.c (modified) (1 diff)
-
dvo/dvodb.c (deleted)
-
dvo/dvofields.c (deleted)
-
dvo/images.c (modified) (2 diffs)
-
dvo/imbox.c (modified) (1 diff)
-
dvo/imdense.c (modified) (1 diff)
-
dvo/imextract.c (modified) (3 diffs)
-
dvo/imstats.c (modified) (1 diff)
-
dvo/lcurve.c (modified) (1 diff)
-
dvo/mextract.c (modified) (5 diffs)
-
dvo/mmextract.c (modified) (6 diffs)
-
dvo/procks.c (modified) (1 diff)
-
dvo/showtile.c (modified) (1 diff)
-
dvo/simage.c (modified) (1 diff)
-
dvo/skycat.c (modified) (1 diff)
-
include/dvomath.h (modified) (2 diffs)
-
include/dvoshell.h (modified) (1 diff)
-
lib.data/graphtools.c (modified) (1 diff)
-
lib.shell/VectorOps.c (modified) (1 diff)
-
lib.shell/stack_math.c (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branch_20081124/Ohana/src/opihi/cmd.astro/cgrid.c
r20860 r20873 95 95 96 96 /* prepare vectors to hold data */ 97 N = 0; 97 98 NELEMENTS = 200; 98 ALLOCATE (Xvec.elements.Flt, opihi_flt, NELEMENTS); 99 ALLOCATE (Yvec.elements.Flt, opihi_flt, NELEMENTS); 100 N = 0; 99 SetVector (&Xvec, OPIHI_FLT, NELEMENTS); 100 SetVector (&Yvec, OPIHI_FLT, NELEMENTS); 101 101 102 102 /*** do consecutive RA lines, first increasing **/ -
branches/eam_branch_20081124/Ohana/src/opihi/cmd.astro/cplot.c
r20860 r20873 31 31 } 32 32 33 ResetVector (&Xvec, OPIHI_FLT, xvec[0].Nelements);34 ResetVector (&Yvec, OPIHI_FLT, xvec[0].Nelements);33 SetVector (&Xvec, OPIHI_FLT, xvec[0].Nelements); 34 SetVector (&Yvec, OPIHI_FLT, xvec[0].Nelements); 35 35 36 36 r = xvec[0].elements.Flt; -
branches/eam_branch_20081124/Ohana/src/opihi/cmd.astro/czplot.c
r20860 r20873 38 38 return (FALSE); 39 39 } 40 ResetVector (&Xvec, OPIHI_FLT, xvec[0].Nelements);41 ResetVector (&Yvec, OPIHI_FLT, xvec[0].Nelements);42 ResetVector (&Zvec, OPIHI_FLT, xvec[0].Nelements);40 SetVector (&Xvec, OPIHI_FLT, xvec[0].Nelements); 41 SetVector (&Yvec, OPIHI_FLT, xvec[0].Nelements); 42 SetVector (&Zvec, OPIHI_FLT, xvec[0].Nelements); 43 43 44 44 r = xvec[0].elements.Flt; -
branches/eam_branch_20081124/Ohana/src/opihi/cmd.basic/test/sprintf.sh
r10311 r20873 35 35 $PASS = 1 36 36 37 if ( $endmem - $startmem > 10)37 if (($endmem - $startmem)/10000 > 1.0) 38 38 $PASS = 0 39 39 echo "growth: {$endmem-$startmem}" -
branches/eam_branch_20081124/Ohana/src/opihi/cmd.data/grid.c
r20860 r20873 23 23 24 24 N = 0; 25 ResetVector (&Xvec, OPIHI_FLT, 200);26 ResetVector (&Yvec, OPIHI_FLT, 200);25 SetVector (&Xvec, OPIHI_FLT, 200); 26 SetVector (&Yvec, OPIHI_FLT, 200); 27 27 28 28 major = minor = 1; -
branches/eam_branch_20081124/Ohana/src/opihi/cmd.data/test/applyfit2d.sh
r16056 r20873 32 32 33 33 # Memory test 34 # NOTE: requires test1 to be run first 34 35 macro memtest1 35 36 … … 48 49 $PASS = 1 49 50 50 if ( $endmem - $startmem > 10)51 if (($endmem - $startmem)/1000 > 1.0) 51 52 $PASS = 0 52 53 echo "growth: {$endmem-$startmem}" -
branches/eam_branch_20081124/Ohana/src/opihi/cmd.data/test/vgauss.sh
r10069 r20873 20 20 21 21 vgauss -q x y dy yfit 22 # lim x y; clear; box; plot -x 1 -c black x y; plot -c red x yfit 23 # cursor 22 24 23 25 if (abs($C0 - 0.0) > 0.01) … … 51 53 52 54 vgauss -q x y dy yfit 55 # lim x y; clear; box; plot -x 1 -c black x y; plot -c red x yfit 56 # cursor 53 57 54 58 if (abs($C0 - 0.0) > 0.01) … … 71 75 break -auto off 72 76 77 $C0o = 0.5 78 $C1o = 2 79 $C2o = 900 80 $C3o = 1 81 73 82 create x -10 10 0.1 74 set y = 1000 * exp(-0.5*x^2/3^2)83 set y = $C3o + $C2o * exp(-0.5*(x - $C0o)^2/$C1o^2) 75 84 76 85 gaussdev dY y[] 0.0 1.0 … … 78 87 set y = y + dy 79 88 80 $C0 = 0.581 $C1 = 282 $C2 = 90083 $C3 = 189 $C0 = $C0o + 2 90 $C1 = $C1o + 2 91 $C2 = $C2o + 50 92 $C3 = $C3o + 10 84 93 85 94 vgauss -q x y dy yfit 95 # lim x y; clear; box; plot -x 1 -c black x y; plot -c red x yfit 96 # cursor 86 97 87 if (abs($C0 - 0.0) > 0.01) 98 $dS = 3.0 / sqrt(y[]) 99 100 if (abs($C0 - $C0o) > $dS) 88 101 $PASS = 0 89 102 end 90 if (abs($C1 - 3.0) > 0.01)103 if (abs($C1 - $C1o)/$C1o > $dS) 91 104 $PASS = 0 92 105 end 93 if (abs($C2 - 1000.0) > 1)106 if (abs($C2 - $C2o)/$C2o > $dS) 94 107 $PASS = 0 95 108 end 96 if (abs($C3 - 0.0) > 0.2)109 if (abs($C3 - $C3o) > $dS) 97 110 $PASS = 0 98 111 end -
branches/eam_branch_20081124/Ohana/src/opihi/cmd.data/test/vmaxwell.sh
r10069 r20873 40 40 break -auto off 41 41 42 $C0o = 250 43 $C1o = 25 44 $C2o = 100 45 $C3o = 1 46 $C4o = 10 47 42 48 create x 0 1000 1 43 set y = 1000 * (x-200)^2 * exp(-0.5*(x-300)^2/30^2) 44 set dy = (rnd(y) - 0.5)/0.5 49 set y = $C2o * (x-$C4o)^2 * exp(-0.5*(x-$C0o)^2/$C1o^2) + $C3o 50 gaussdev dY y[] 0.0 1.0 51 set dy = dY * sqrt(y) 45 52 set y = y + dy 46 53 47 lim x y; clear; box; plot -x 1 -c black x y 54 $C0 = $C0o + 20 55 $C1 = $C1o + 2 56 $C2 = $C2o + 100 57 $C3 = $C3o + 10 58 $C4 = $C4o + 20 48 59 49 $C0 = 250 50 $C1 = 25 51 $C2 = 900 52 $C3 = 1 53 $C4 = 190 60 vmaxwell -q x y dy yfit 61 lim x y; clear; box; plot -x 1 -c black x y; plot x yfit -c red 54 62 55 vmaxwell x y dy yfit 56 plot x yfit -c red 63 $dS = 6.0 / sqrt(y[]) 57 64 58 if (abs($C0 - 0.0) > 0.01)65 if (abs($C0 - $C0o) > $dS) 59 66 $PASS = 0 60 67 end 61 if (abs($C1 - 3.0) > 0.01)68 if (abs($C1 - $C1o)/$C1o > $dS) 62 69 $PASS = 0 63 70 end 64 if (abs($C2 - 1000.0) > 0.1)71 if (abs($C2 - $C2o)/$C2o > $dS) 65 72 $PASS = 0 66 73 end 67 if (abs($C3 - 0.0) > 0.1) 74 if (abs($C3 - $C3o) > $dS) 75 $PASS = 0 76 end 77 if (abs($C4 - $C4o)/$C4o > $dS) 68 78 $PASS = 0 69 79 end -
branches/eam_branch_20081124/Ohana/src/opihi/cmd.data/vmaxwell.c
r20857 r20873 65 65 dchisq = ochisq + 2*Npts; 66 66 67 for (i = 0; (i < 20) && ((dchisq > 0.1*(Npts - Npar)) || (dchisq <= 0.0)); i++) {67 for (i = 0; (i < 30) && ((dchisq > 0.1*(Npts - Npar)) || (dchisq <= 0.0)); i++) { 68 68 chisq = mrqmin (xvec[0].elements.Flt, yvec[0].elements.Flt, dy, Npts, par, Npar, fmaxwellOD, !Quiet); 69 69 dchisq = ochisq - chisq; … … 94 94 95 95 /* pars: x_o, -0.5/sigma^2, I, back, ref */ 96 // f = C3 + C2*(x - C4)^2 * exp(-0.5*(x - C0)^2 / C1^2) 96 97 opihi_flt fmaxwellOD (opihi_flt x, opihi_flt *par, int Npar, opihi_flt *dpar) { 97 98 -
branches/eam_branch_20081124/Ohana/src/opihi/cmd.data/zplot.c
r20860 r20873 31 31 return (FALSE); 32 32 } 33 Zvec.Nelements = zvec[0].Nelements; 34 ALLOCATE (Zvec.elements.Flt, opihi_flt, Zvec.Nelements); 33 SetVector (&Zvec, OPIHI_FLT, zvec[0].Nelements); 35 34 out = Zvec.elements.Flt; 36 35 -
branches/eam_branch_20081124/Ohana/src/opihi/dvo/Makefile
r20862 r20873 29 29 $(SRC)/dvomisc.$(ARCH).o \ 30 30 $(SRC)/region_list.$(ARCH).o \ 31 $(SRC)/dvomisc.$(ARCH).o \32 31 $(SRC)/dbBooleanCond.$(ARCH).o \ 33 32 $(SRC)/dbCheckStack.$(ARCH).o \ -
branches/eam_branch_20081124/Ohana/src/opihi/dvo/avextract.c
r20862 r20873 11 11 12 12 Vector **vec; 13 PhotCode *code;14 13 dbStack *stack; 15 14 dbField *fields; … … 20 19 /* defaults */ 21 20 vec = NULL; 22 code = NULL;23 21 stack = NULL; 24 22 fields = NULL; … … 51 49 // parse the fields to be extracted and returned 52 50 fields = dbCmdlineFields (argc, argv, DVO_TABLE_AVERAGE, &last, &Nfields); 53 if (fields == NULL) return (FALSE); 51 if (fields == NULL) goto escape; 52 if (Nfields == 0) { 53 FreeSkyRegionSelection (selection); 54 dbFreeFields (fields, Nfields); 55 dvo_catalog_free (&catalog); 56 goto help; 57 } 54 58 55 59 // examine line for 'where' or 'match to'. 'match to' is forbidden -
branches/eam_branch_20081124/Ohana/src/opihi/dvo/dbCheckStack.c
r20860 r20873 83 83 84 84 // this must be a field : is it a valid name? 85 status = FALSE; 85 86 if (table == DVO_TABLE_MEASURE) { 86 87 status = ParseMeasureField (&fields[Nfields], stack[i].name); … … 89 90 status = ParseAverageField (&fields[Nfields], stack[i].name); 90 91 } 92 if (table == DVO_TABLE_IMAGE) { 93 status = ParseImageField (&fields[Nfields], stack[i].name); 94 } 91 95 if (!status) { 92 gprint (GP_ERR, "unknown database field %s\n", stack[i].name);93 96 goto failure; 94 97 } -
branches/eam_branch_20081124/Ohana/src/opihi/dvo/dbCmdlineFields.c
r20860 r20873 77 77 status = ParseAverageField (&fields[Nfields], field); 78 78 } 79 if (table == DVO_TABLE_IMAGE) { 80 status = ParseImageField (&fields[Nfields], field); 81 } 79 82 if (!status) { 80 gprint (GP_ERR, "unknown database field %s\n", field);81 83 free (field); 82 84 dbFreeFields (fields, Nfields); … … 143 145 REALLOCATE (*stack, dbStack, N + 20); 144 146 147 Rname = Dname = NULL; 148 if (table == DVO_TABLE_MEASURE) { 149 Rname = strcreate ("RA:AVE"); 150 Dname = strcreate ("DEC:AVE"); 151 } 145 152 if (table == DVO_TABLE_AVERAGE) { 146 153 Rname = strcreate ("RA"); 147 154 Dname = strcreate ("DEC"); 148 } else { 149 Rname = strcreate ("RA:AVE"); 150 Dname = strcreate ("DEC:AVE"); 151 } 155 } 156 if (table == DVO_TABLE_IMAGE) { 157 Rname = strcreate ("RA"); 158 Dname = strcreate ("DEC"); 159 } 160 if (Rname == NULL) return (FALSE); 152 161 153 162 // add: ((ra > rmin) && (ra < rmax) && (dec > dmin) && (dec < dmax)) -
branches/eam_branch_20081124/Ohana/src/opihi/dvo/dbExtractImages.c
r20872 r20873 154 154 break; 155 155 case IMAGE_PHOTCODE: 156 value. Flt = image[N].photcode;156 value.Int = image[N].photcode; 157 157 break; 158 158 case IMAGE_TIME: … … 167 167 break; 168 168 case IMAGE_NSTAR: 169 value. Flt = image[N].nstar;169 value.Int = image[N].nstar; 170 170 break; 171 171 case IMAGE_NCAL: 172 value. Flt = image[N].Mxxxx;172 value.Int = image[N].Mxxxx; 173 173 break; 174 174 case IMAGE_SKY: … … 176 176 break; 177 177 case IMAGE_FLAG: 178 value. Flt = image[N].code;178 value.Int = image[N].code; 179 179 break; 180 180 case IMAGE_NX_PIX: 181 value. Flt = image[N].NX;181 value.Int = image[N].NX; 182 182 break; 183 183 case IMAGE_NY_PIX: 184 value. Flt = image[N].NY;184 value.Int = image[N].NY; 185 185 break; 186 186 case IMAGE_IMAGE_ID: 187 value. Flt = image[N].imageID;187 value.Int = image[N].imageID; 188 188 break; 189 189 case IMAGE_THETA: { -
branches/eam_branch_20081124/Ohana/src/opihi/dvo/dbFields.c
r20872 r20873 197 197 // check for code:mode in photcode name 198 198 code = ParsePhotcodeField (fieldName, &mode, MAG_REL); 199 if (code == NULL) return (FALSE); 199 if (code == NULL) { 200 gprint (GP_ERR, "unknown field '%s' for measurement table in DVO database\n", fieldName); 201 return (FALSE); 202 } 200 203 201 204 field->ID = MEAS_MAG; … … 257 260 // check for code:mode in photcode name 258 261 code = ParsePhotcodeField (fieldName, &mode, MAG_AVE); 259 if (code == NULL) return (FALSE); 262 if (code == NULL) { 263 gprint (GP_ERR, "unknown field '%s' for average table in DVO database\n", fieldName); 264 return (FALSE); 265 } 266 260 267 if (code[0].type == PHOT_MAG) { 261 268 gprint (GP_ERR, "'mag' is ambiguous for avextract\n"); … … 337 344 338 345 // for words that don't parse, try a photcode 339 gprint (GP_ERR, "unknown image field %s\n", fieldName);346 gprint (GP_ERR, "unknown field '%s' for image table in DVO database\n", fieldName); 340 347 return (FALSE); 341 348 } -
branches/eam_branch_20081124/Ohana/src/opihi/dvo/dbStackOps.c
r20860 r20873 34 34 void dbFreeTempEntry (dbStack *stack) { 35 35 36 if ( stack->type & DB_STACK_TEMP) return;36 if (!(stack->type & DB_STACK_TEMP)) return; 37 37 38 38 if (stack[0].name != NULL) free (stack[0].name); -
branches/eam_branch_20081124/Ohana/src/opihi/dvo/images.c
r20860 r20873 113 113 114 114 npts = NPTS = 200; 115 ResetVector (&Xvec, OPIHI_FLT, NPTS);116 ResetVector (&Yvec, OPIHI_FLT, NPTS);115 SetVector (&Xvec, OPIHI_FLT, NPTS); 116 SetVector (&Yvec, OPIHI_FLT, NPTS); 117 117 118 118 ALLOCATE (plist, int, NPTS); … … 276 276 277 277 gprint (GP_ERR, "plotting %d images\n", n); 278 Xvec.Nelements = Xvec.Nelements = N;278 Xvec.Nelements = Yvec.Nelements = N; 279 279 if (N > 0) { 280 280 graphmode.style = 2; /* points */ -
branches/eam_branch_20081124/Ohana/src/opihi/dvo/imbox.c
r20860 r20873 36 36 37 37 /* project this image to screen display coords */ 38 ResetVector (&Xvec, OPIHI_FLT, 8);39 ResetVector (&Yvec, OPIHI_FLT, 8);38 SetVector (&Xvec, OPIHI_FLT, 8); 39 SetVector (&Yvec, OPIHI_FLT, 8); 40 40 41 41 while (gfits_fread_header (f, &header)) { -
branches/eam_branch_20081124/Ohana/src/opihi/dvo/imdense.c
r20860 r20873 32 32 N = 0; 33 33 NPTS = 200; 34 ResetVector (&Xvec, OPIHI_FLT, NPTS);35 ResetVector (&Yvec, OPIHI_FLT, NPTS);34 SetVector (&Xvec, OPIHI_FLT, NPTS); 35 SetVector (&Yvec, OPIHI_FLT, NPTS); 36 36 37 37 for (i = 0; i < Nimage; i++) { -
branches/eam_branch_20081124/Ohana/src/opihi/dvo/imextract.c
r20872 r20873 39 39 if ((selection = SetRegionSelection (&argc, argv)) == NULL) { 40 40 gprint (GP_ERR, "invalid sky region selection\n"); 41 return FALSE;41 goto escape; 42 42 } 43 43 … … 46 46 // parse the fields to be extracted and returned 47 47 fields = dbCmdlineFields (argc, argv, DVO_TABLE_IMAGE, &last, &Nfields); 48 if (fields == NULL) return (FALSE); 48 if (fields == NULL) goto escape; 49 if (Nfields == 0) { 50 FreeSkyRegionSelection (selection); 51 dbFreeFields (fields, Nfields); 52 goto help; 53 } 49 54 50 55 // examine line for 'where' or 'match to'. 'match to' is forbidden … … 158 163 gprint (GP_ERR, " RA : right ascension of field center (J2000)\n"); 159 164 gprint (GP_ERR, " DEC : declination of field center\n"); 165 gprint (GP_ERR, " Xm : chisq of photometry calibration\n"); 166 gprint (GP_ERR, " airmass : mean airmass of exposure\n"); 167 gprint (GP_ERR, " Mcal : photometry calibration (mags)\n"); 168 gprint (GP_ERR, " dMcal : photometry calibration error (mags)\n"); 169 gprint (GP_ERR, " photcode : numeric photcode value for image\n"); 170 gprint (GP_ERR, " time : time of exposure\n"); 171 gprint (GP_ERR, " FWHM : mean fwhm of exposure\n"); 172 gprint (GP_ERR, " exptime : exposure duration (seconds)\n"); 173 gprint (GP_ERR, " nstar : number of stars detected in exposure\n"); 174 gprint (GP_ERR, " ncal : number of stars used for photometry calibration\n"); 175 gprint (GP_ERR, " sky : mean background flux\n"); 176 gprint (GP_ERR, " flag : processing bit flags\n"); 177 gprint (GP_ERR, " NX : image dimensions\n"); 178 gprint (GP_ERR, " NY : image dimensions\n"); 179 gprint (GP_ERR, " theta : position angle of image\n"); 180 gprint (GP_ERR, " skew : distortion from rectangle\n"); 181 gprint (GP_ERR, " scale : pixel scale\n"); 182 gprint (GP_ERR, " dscale : pixel-scale error (or variation?)\n"); 183 gprint (GP_ERR, " imageID : unique image identifier\n"); 184 gprint (GP_ERR, " X_LL_CHIP : chip x-pixel coordinate of lower left corner\n"); 185 gprint (GP_ERR, " X_LR_CHIP : chip x-pixel coordinate of lower right corner\n"); 186 gprint (GP_ERR, " X_UL_CHIP : chip x-pixel coordinate of upper left corner\n"); 187 gprint (GP_ERR, " X_UR_CHIP : chip x-pixel coordinate of upper right corner\n"); 188 gprint (GP_ERR, " Y_LL_CHIP : chip y-pixel coordinate of lower left corner\n"); 189 gprint (GP_ERR, " Y_LR_CHIP : chip y-pixel coordinate of lower right corner\n"); 190 gprint (GP_ERR, " Y_UL_CHIP : chip y-pixel coordinate of upper left corner\n"); 191 gprint (GP_ERR, " Y_UR_CHIP : chip y-pixel coordinate of upper right corner\n"); 192 gprint (GP_ERR, " X_LL_FP : focal-plane x-pixel coordinate of lower left corner\n"); 193 gprint (GP_ERR, " X_LR_FP : focal-plane x-pixel coordinate of lower right corner\n"); 194 gprint (GP_ERR, " X_UL_FP : focal-plane x-pixel coordinate of upper left corner\n"); 195 gprint (GP_ERR, " X_UR_FP : focal-plane x-pixel coordinate of upper right corner\n"); 196 gprint (GP_ERR, " Y_LL_FP : focal-plane y-pixel coordinate of lower left corner\n"); 197 gprint (GP_ERR, " Y_LR_FP : focal-plane y-pixel coordinate of lower right corner\n"); 198 gprint (GP_ERR, " Y_UL_FP : focal-plane y-pixel coordinate of upper left corner\n"); 199 gprint (GP_ERR, " Y_UR_FP : focal-plane y-pixel coordinate of upper right corner\n"); 160 200 return (FALSE); 161 201 } -
branches/eam_branch_20081124/Ohana/src/opihi/dvo/imstats.c
r20860 r20873 33 33 34 34 /* assign vector values */ 35 ResetVector (&Xvec, OPIHI_FLT, Nimage);36 ResetVector (&Yvec, OPIHI_FLT, Nimage);35 SetVector (&Xvec, OPIHI_FLT, Nimage); 36 SetVector (&Yvec, OPIHI_FLT, Nimage); 37 37 38 38 gprint (GP_LOG, "seq ra (J2000) dec time (s) Nstars\n"); -
branches/eam_branch_20081124/Ohana/src/opihi/dvo/lcurve.c
r20860 r20873 104 104 N = 0; 105 105 NPTS = 100; 106 ResetVector (&Xvec, OPIHI_FLT, NPTS);107 ResetVector (&Yvec, OPIHI_FLT, NPTS);106 SetVector (&Xvec, OPIHI_FLT, NPTS); 107 SetVector (&Yvec, OPIHI_FLT, NPTS); 108 108 dYvec.elements.Flt = NULL; 109 109 if (ErrorBars) { 110 ResetVector (&dYvec, OPIHI_FLT, NPTS);110 SetVector (&dYvec, OPIHI_FLT, NPTS); 111 111 } 112 112 -
branches/eam_branch_20081124/Ohana/src/opihi/dvo/mextract.c
r20860 r20873 11 11 Catalog catalog; 12 12 SkyList *skylist; 13 PhotCode *code;14 13 Vector **vec; 15 14 dbField *fields; … … 18 17 19 18 /* defaults */ 19 vec = NULL; 20 stack = NULL; 21 fields = NULL; 22 values = NULL; 20 23 skylist = NULL; 21 code = NULL; 22 fields = NULL; 23 stack = NULL; 24 selection = NULL; 24 25 25 26 if ((N = get_argument (argc, argv, "-h"))) goto help; … … 49 50 fields = dbCmdlineFields (argc, argv, DVO_TABLE_MEASURE, &last, &Nfields); 50 51 if (fields == NULL) return (FALSE); 52 if (Nfields == 0) { 53 FreeSkyRegionSelection (selection); 54 dbFreeFields (fields, Nfields); 55 dvo_catalog_free (&catalog); 56 goto help; 57 } 51 58 52 59 // examine line for 'where' or 'match to'. 'match to' is forbidden … … 168 175 } 169 176 170 free (values); 177 if (vec) free (vec); 178 if (values) free (values); 171 179 dbFreeFields (fields, Nfields); 172 180 dbFreeStack (stack, Nstack); … … 178 186 179 187 escape: 188 if (vec) free (vec); 180 189 free (values); 181 190 dbFreeFields (fields, Nfields); -
branches/eam_branch_20081124/Ohana/src/opihi/dvo/mmextract.c
r20857 r20873 13 13 Catalog catalog; 14 14 SkyList *skylist; 15 PhotCode *code;16 15 Vector **vec; 17 16 dbField *fields; … … 21 20 22 21 /* defaults */ 23 skylist = NULL; 24 code = NULL; 25 fields = NULL; 22 vec = NULL; 26 23 stack1 = NULL; 27 24 stack2 = NULL; 25 fields = NULL; 26 values = NULL; 27 skylist = NULL; 28 selection = NULL; 28 29 29 30 if ((N = get_argument (argc, argv, "-h"))) goto help; … … 57 58 // parse the fields to be extracted and returned : last points to end, or first 'where' or 'matched' 58 59 fields = dbCmdlineFields (argc, argv, DVO_TABLE_MEASURE, &last, &Nfields); 59 if (fields == NULL) return (FALSE); 60 if (fields == NULL) goto escape; 61 if (Nfields == 0) { 62 FreeSkyRegionSelection (selection); 63 dbFreeFields (fields, Nfields); 64 dvo_catalog_free (&catalog); 65 goto help; 66 } 60 67 61 68 // examine line for 'where' and 'match to'. neither is required, but order is fixed … … 298 305 299 306 escape: 307 if (vec) free (vec); 308 if (values) free (values); 300 309 dbFreeFields (fields, Nfields); 301 310 dbFreeStack (stack1, Nstack1); … … 310 319 311 320 help: 312 gprint (GP_ERR, "USAGE: mextract field[,field,field...] where (expression)\n"); 321 gprint (GP_ERR, "USAGE: mmextract field[,field,field...] where (expression) match to (expression)\n"); 322 gprint (GP_ERR, " pairs of fields are returned: the first set are restricted by the 'where' expression, the second by the 'match to' expression\n"); 313 323 314 324 if ((argc > N + 1) && !strcasecmp (argv[N+1], "fields")) { … … 362 372 return (FALSE); 363 373 } 364 gprint (GP_ERR, " m extract --help fields : for a complete listing of allowed fields\n");374 gprint (GP_ERR, " mmextract --help fields : for a complete listing of allowed fields\n"); 365 375 return (FALSE); 366 376 } -
branches/eam_branch_20081124/Ohana/src/opihi/dvo/procks.c
r20860 r20873 95 95 96 96 /* data has been loaded, get ready to plot it */ 97 ResetVector (&Xvec, OPIHI_FLT, 3*Nrocks);98 ResetVector (&Yvec, OPIHI_FLT, 3*Nrocks);97 SetVector (&Xvec, OPIHI_FLT, 3*Nrocks); 98 SetVector (&Yvec, OPIHI_FLT, 3*Nrocks); 99 99 100 100 /* project stars to screen display coords */ -
branches/eam_branch_20081124/Ohana/src/opihi/dvo/showtile.c
r20860 r20873 22 22 N = 0; 23 23 NPTS = 200; 24 ResetVector (&Xvec, OPIHI_FLT, NPTS);25 ResetVector (&Yvec, OPIHI_FLT, NPTS);24 SetVector (&Xvec, OPIHI_FLT, NPTS); 25 SetVector (&Yvec, OPIHI_FLT, NPTS); 26 26 27 27 /* starting position */ -
branches/eam_branch_20081124/Ohana/src/opihi/dvo/simage.c
r20860 r20873 92 92 93 93 /* set up storage buffers */ 94 ResetVector (&Xvec, OPIHI_FLT, Nstars);95 ResetVector (&Yvec, OPIHI_FLT, Nstars);96 ResetVector (&Zvec, OPIHI_FLT, Nstars);94 SetVector (&Xvec, OPIHI_FLT, Nstars); 95 SetVector (&Yvec, OPIHI_FLT, Nstars); 96 SetVector (&Zvec, OPIHI_FLT, Nstars); 97 97 ALLOCATE (buffer, char, (BLOCK*BYTES_STAR)); 98 98 -
branches/eam_branch_20081124/Ohana/src/opihi/dvo/skycat.c
r20860 r20873 55 55 Npts = 0; 56 56 NPTS = 200; 57 ResetVector (&Xvec, OPIHI_FLT, NPTS);58 ResetVector (&Yvec, OPIHI_FLT, NPTS);57 SetVector (&Xvec, OPIHI_FLT, NPTS); 58 SetVector (&Yvec, OPIHI_FLT, NPTS); 59 59 60 60 regions = skylist[0].regions; -
branches/eam_branch_20081124/Ohana/src/opihi/include/dvomath.h
r20860 r20873 8 8 # define NCHARS 256 9 9 # define opihi_flt double 10 # define opihi_int unsigned int 10 # define opihi_int int 11 // NOTE: if opihi_int is changed to unsigned, all subtraction and negation operations 12 // need to result in a float value (or 3 - 5 will yield the unexpected value 2^32 - 2) 11 13 12 14 # define REQUIRE_VECTOR_FLT(VECT,RVAL) { \ … … 110 112 int CopyVector PROTO((Vector *out, Vector *in)); 111 113 int ResetVector PROTO((Vector *vec, char type, int Nelements)); 114 int SetVector PROTO((Vector *vec, char type, int Nelements)); 112 115 int CastVector PROTO((Vector *vec, char type)); 113 116 int MatchVector PROTO((Vector *out, Vector *in, char type)); -
branches/eam_branch_20081124/Ohana/src/opihi/include/dvoshell.h
r20862 r20873 309 309 int ParseMeasureField PROTO((dbField *field, char *fieldName)); 310 310 int ParseAverageField PROTO((dbField *field, char *fieldName)); 311 int ParseImageField PROTO((dbField *field, char *fieldName)); 311 312 312 313 dbValue dbExtractAverages PROTO((Average *average, SecFilt *secfilt, Measure *measure, dbField *field)); -
branches/eam_branch_20081124/Ohana/src/opihi/lib.data/graphtools.c
r20859 r20873 32 32 33 33 if (yvec != NULL) { 34 if ( xvec->type == OPIHI_FLT) {34 if (yvec->type == OPIHI_FLT) { 35 35 maxY = minY = yvec[0].elements.Flt[0]; 36 36 for (i = 1; i < yvec[0].Nelements; i++) { -
branches/eam_branch_20081124/Ohana/src/opihi/lib.shell/VectorOps.c
r20860 r20873 187 187 } 188 188 189 // SetVector (vecx, OPIHI_FLT, MAX (Npts, 1)); 190 int SetVector (Vector *vec, char type, int Nelements) { 191 192 vec[0].Nelements = Nelements; 193 if (type == OPIHI_FLT) { 194 ALLOCATE (vec[0].elements.Flt, opihi_flt, Nelements); 195 vec[0].type = OPIHI_FLT; 196 } else { 197 ALLOCATE (vec[0].elements.Int, opihi_int, Nelements); 198 vec[0].type = OPIHI_INT; 199 } 200 return TRUE; 201 } 202 189 203 // recast the vector to the specified type 190 204 int CastVector (Vector *vec, char type) { -
branches/eam_branch_20081124/Ohana/src/opihi/lib.shell/stack_math.c
r20856 r20873 819 819 } \ 820 820 if ((FTYPE == 's') && (V1->type == 's')) { \ 821 opihi_int M1 = V1[0]. FltValue; \821 opihi_int M1 = V1[0].IntValue; \ 822 822 OUT[0].type = 's'; \ 823 823 OUT[0].IntValue = OP; \ … … 855 855 if (!strcmp (op, "rnd")) S_FUNC(M1*0.0 + drand48(), 'S'); 856 856 if (!strcmp (op, "not")) S_FUNC(!(M1), 's'); 857 if (!strcmp (op, "--")) S_FUNC(- (M1), 's');857 if (!strcmp (op, "--")) S_FUNC(-1*M1, 's'); // NOTE: opihi_int is signed, 858 858 if (!strcmp (op, "isinf")) S_FUNC(!finite(M1), 'S'); // XXX modify in future 859 859 if (!strcmp (op, "isnan")) S_FUNC(isnan(M1), 'S'); // XXX modify in future … … 939 939 if (!strcmp (op, "zero")) V_FUNC(0, 's'); 940 940 if (!strcmp (op, "not")) V_FUNC(!(*M1), 's'); 941 if (!strcmp (op, "--")) V_FUNC(- (*M1), 's');941 if (!strcmp (op, "--")) V_FUNC(-1*(*M1), 's'); // NOTE: opihi_int is signed 942 942 if (!strcmp (op, "isinf")) V_FUNC(!finite(*M1), 'S'); 943 943 if (!strcmp (op, "isnan")) V_FUNC(isnan(*M1), 'S'); … … 980 980 if (!strcmp (op, "=")) { } 981 981 if (!strcmp (op, "abs")) { for (i = 0; i < Nx*Ny; i++, out++, M1++) { *out = fabs(*M1); }} 982 if (!strcmp (op, "int")) { for (i = 0; i < Nx*Ny; i++, out++, M1++) { *out = ( float)(int)(*M1); }}982 if (!strcmp (op, "int")) { for (i = 0; i < Nx*Ny; i++, out++, M1++) { *out = (opihi_flt)(int)(*M1); }} 983 983 if (!strcmp (op, "exp")) { for (i = 0; i < Nx*Ny; i++, out++, M1++) { *out = exp(*M1); }} 984 984 if (!strcmp (op, "ten")) { for (i = 0; i < Nx*Ny; i++, out++, M1++) { *out = pow(10.0,*M1); }}
Note:
See TracChangeset
for help on using the changeset viewer.
