Changeset 42946
- Timestamp:
- Nov 23, 2025, 4:33:16 PM (8 months ago)
- Location:
- branches/eam_branches/ipp-ppmerge-20241229/Ohana/src/opihi
- Files:
-
- 1 added
- 6 edited
-
cmd.data/Makefile (modified) (1 diff)
-
cmd.data/init.c (modified) (2 diffs)
-
cmd.data/spline_commands.c (modified) (1 diff)
-
cmd.data/test/spline.sh (modified) (2 diffs)
-
cmd.data/vweave.c (added)
-
include/data.h (modified) (2 diffs)
-
lib.data/spline.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-ppmerge-20241229/Ohana/src/opihi/cmd.data/Makefile
r42456 r42946 183 183 $(SRC)/vbin.$(ARCH).o \ 184 184 $(SRC)/vgroup.$(ARCH).o \ 185 $(SRC)/vweave.$(ARCH).o \ 185 186 $(SRC)/vclip.$(ARCH).o \ 186 187 $(SRC)/vgauss.$(ARCH).o \ -
branches/eam_branches/ipp-ppmerge-20241229/Ohana/src/opihi/cmd.data/init.c
r42456 r42946 168 168 int vbin PROTO((int, char **)); 169 169 int vgroup PROTO((int, char **)); 170 int vweave PROTO((int, char **)); 170 171 int vclip PROTO((int, char **)); 171 172 int vect_select PROTO((int, char **)); … … 382 383 {1, "vbin", vbin, "rebin vector data by a factor of N"}, 383 384 {1, "vgroup", vgroup, "group y vector into bins defined by x vector values"}, 385 {1, "vweave", vweave, "drizzle input vectors to output vector with correct fractional bin weighting"}, 384 386 {1, "vclip", vclip, "clip values in a vector to be within a range"}, 385 387 {1, "vectors", list_vectors, "list vectors"}, -
branches/eam_branches/ipp-ppmerge-20241229/Ohana/src/opihi/cmd.data/spline_commands.c
r42332 r42946 62 62 int spline_apply (int argc, char **argv) { 63 63 64 int i ;64 int i, N; 65 65 Vector *xvec, *yvec; 66 67 spline_contruct_mode (SPLINE_SATURATE); 68 if ((N = get_argument (argc, argv, "-extrapolate"))) { 69 spline_contruct_mode (SPLINE_EXTRAPOLATE); 70 remove_argument (N, &argc, argv); 71 } 66 72 67 73 if (argc != 4) { -
branches/eam_branches/ipp-ppmerge-20241229/Ohana/src/opihi/cmd.data/test/spline.sh
r41341 r42946 1 1 2 2 macro test1 3 4 3 for i 0 100 5 4 create x 0 50 … … 10 9 end 11 10 end 11 12 macro mytest.saturate 13 vlist x 400 500 600 700 800 900 14 vlist y 15 425 610 700 745 775 15 16 spline create t1 x y 17 18 create X 300 1000 5 19 spline apply t1 X Y 20 21 lim X Y; clear; box; plot x y; plot -c red -x line X Y 22 end 23 24 macro mytest.extrapolate 25 vlist x 400 500 600 700 800 900 26 vlist y 15 425 610 700 745 775 27 28 spline create t1 x y 29 30 create X 300 1000 5 31 spline apply t1 X Y -extrapolate 32 33 lim X Y; clear; box; plot x y; plot -c red -x line X Y 34 end 35 -
branches/eam_branches/ipp-ppmerge-20241229/Ohana/src/opihi/include/data.h
r42456 r42946 33 33 char **pageIDs; 34 34 } Book; 35 36 typedef enum {SPLINE_SATURATE, SPLINE_EXTRAPOLATE} SplineMode; 35 37 36 38 // the interpolating spline has valu … … 138 140 void spline_construct_dbl (opihi_flt *x, opihi_flt *y, int N, opihi_flt *y2, opihi_flt dyLower, opihi_flt dyUpper); 139 141 opihi_flt spline_apply_dbl (opihi_flt *x, opihi_flt *y, opihi_flt *y2, int N, opihi_flt X); 142 int spline_contruct_mode (SplineMode mode); 140 143 141 144 /* in svdcmp.c */ -
branches/eam_branches/ipp-ppmerge-20241229/Ohana/src/opihi/lib.data/spline.c
r42332 r42946 1 1 # include "data.h" 2 3 static SplineMode MODE = SPLINE_SATURATE; // SATURATE or EXTRAPOLATE? 4 5 int spline_contruct_mode (SplineMode mode) { 6 7 switch (mode) { 8 case SPLINE_SATURATE: 9 case SPLINE_EXTRAPOLATE: 10 MODE = mode; 11 break; 12 default: 13 return FALSE; 14 } 15 return TRUE; 16 } 2 17 3 18 /* construct the natural spline for x, y in y2 */ … … 36 51 37 52 // saturate correction at high and low ends 38 if (X < x[0]) return y[0]; 39 if (X > x[N-1]) return y[N-1]; 53 if (MODE == SPLINE_SATURATE) { 54 if (X < x[0]) return y[0]; 55 if (X > x[N-1]) return y[N-1]; 56 } 40 57 41 58 /* find correct element in array (x must be sorted) */ … … 114 131 115 132 // saturate correction at high and low ends 116 if (X < x[0]) return y[0]; 117 if (X > x[N-1]) return y[N-1]; 133 if (MODE == SPLINE_SATURATE) { 134 if (X < x[0]) return y[0]; 135 if (X > x[N-1]) return y[N-1]; 136 } 118 137 119 138 /* find correct element in array (x must be sorted) */
Note:
See TracChangeset
for help on using the changeset viewer.
