Changeset 42361
- Timestamp:
- Feb 4, 2023, 7:36:15 AM (3 years ago)
- Location:
- branches/eam_branches/ipp-20220316/Ohana
- Files:
-
- 11 edited
-
. (modified) (1 prop)
-
src/opihi/cmd.data/imspline_apply.c (modified) (1 diff)
-
src/opihi/cmd.data/imspline_construct.c (modified) (1 diff)
-
src/opihi/cmd.data/spline_commands.c (modified) (2 diffs)
-
src/opihi/cmd.data/threshold.c (modified) (5 diffs)
-
src/opihi/include/data.h (modified) (1 diff)
-
src/opihi/lib.data/spline.c (modified) (4 diffs)
-
src/opihi/lib.shell/parse.c (modified) (1 diff)
-
src/opihi/lib.shell/stack_math.c (modified) (1 diff)
-
src/relastro/src (modified) (1 prop)
-
src/relphot (modified) (1 prop)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20220316/Ohana
- Property svn:mergeinfo changed
/tags/ipp-ops-20220303-rc/Ohana (added) merged: 42123 /trunk/Ohana merged: 42277-42278,42285,42311,42332
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20220316/Ohana/src/opihi/cmd.data/imspline_apply.c
r40549 r42361 77 77 Tx1[i] = spline_apply_flt (Tyc, Ty1, Ty2, Ny, y); 78 78 } 79 spline_construct_flt (Txc, Tx1, Nx, Tx2 );79 spline_construct_flt (Txc, Tx1, Nx, Tx2, NAN, NAN); 80 80 81 81 /* apply x-dir spline to new image */ -
branches/eam_branches/ipp-20220316/Ohana/src/opihi/cmd.data/imspline_construct.c
r40549 r42361 55 55 } 56 56 57 spline_construct_flt (Tx, Ty, Ny, Ty2 );57 spline_construct_flt (Tx, Ty, Ny, Ty2, NAN, NAN); 58 58 59 59 /* copy derivatives to output buffer */ -
branches/eam_branches/ipp-20220316/Ohana/src/opihi/cmd.data/spline_commands.c
r41341 r42361 15 15 int spline_create (int argc, char **argv) { 16 16 17 int i ;17 int i, N; 18 18 Vector *xvec, *yvec; 19 20 double dyLower = NAN; 21 double dyUpper = NAN; 22 if ((N = get_argument (argc, argv, "-dyLower"))) { 23 remove_argument (N, &argc, argv); 24 dyLower = atof(argv[N]); 25 remove_argument (N, &argc, argv); 26 } 27 if ((N = get_argument (argc, argv, "-dyUpper"))) { 28 remove_argument (N, &argc, argv); 29 dyUpper = atof(argv[N]); 30 remove_argument (N, &argc, argv); 31 } 19 32 20 33 if (argc != 4) { … … 43 56 } 44 57 45 spline_construct_dbl (myspline->xk, myspline->yk, myspline->Nknots, myspline->y2 );58 spline_construct_dbl (myspline->xk, myspline->yk, myspline->Nknots, myspline->y2, dyLower, dyUpper); 46 59 return TRUE; 47 60 } -
branches/eam_branches/ipp-20220316/Ohana/src/opihi/cmd.data/threshold.c
r42156 r42361 1 1 # include "data.h" 2 3 int QUIET = FALSE; 4 5 void _threshold_set_values (double value, int Nbin, double level, int thresherr) { 6 7 set_variable ("threshval", value); 8 set_int_variable ("threshbin", Nbin); 9 set_variable ("threshold", level); 10 set_int_variable ("thresherr", thresherr); 11 12 if (!QUIET) gprint (GP_LOG, "theshold %f (bin %d is %f)\n", level, Nbin, value); 13 return; 14 } 2 15 3 16 int threshold (int argc, char **argv) { … … 6 19 Vector *vecx, *vecy; 7 20 8 int QUIET = FALSE;9 21 if ((N = get_argument (argc, argv, "-q"))) { 10 22 QUIET = TRUE; 23 remove_argument (N, &argc, argv); 24 } 25 26 int SATURATE = FALSE; 27 if ((N = get_argument (argc, argv, "-saturate"))) { 28 SATURATE = TRUE; 29 remove_argument (N, &argc, argv); 30 } 31 if ((N = get_argument (argc, argv, "-sat"))) { 32 SATURATE = TRUE; 11 33 remove_argument (N, &argc, argv); 12 34 } … … 95 117 // this algorithm assumes vecy[BinMax] > threshold, vecy[BinMin] < threshold 96 118 if (vecy[0].elements.Flt[BinMin] > value) { 97 if (!QUIET) gprint (GP_ERR, "ERROR: all values above threshold\n"); 98 set_int_variable ("threshbin", BinMin); 99 set_variable ("threshval", vecy[0].elements.Flt[BinMin]); 100 set_variable ("threshold", vecx[0].elements.Flt[BinMin]); 101 set_int_variable ("thresherr", 1); 102 if (!QUIET) gprint (GP_LOG, "theshold %f (bin %d is %f)\n", 103 vecx[0].elements.Flt[BinMin], BinMin, 104 vecy[0].elements.Flt[BinMin]); 105 return TRUE; 119 if (SATURATE) { 120 _threshold_set_values (vecy[0].elements.Flt[BinMin], BinMin, vecx[0].elements.Flt[BinMin], 1); 121 return TRUE; 122 } else { 123 gprint (GP_ERR, "ERROR: all values above threshold\n"); 124 _threshold_set_values (NAN, -1, NAN, 1); 125 return FALSE; 126 } 106 127 } 107 128 if (vecy[0].elements.Flt[BinMax] < value) { 108 if (!QUIET) gprint (GP_ERR, "ERROR: all values below threshold\n"); 109 set_int_variable ("threshbin", BinMax); 110 set_variable ("threshval", vecy[0].elements.Flt[BinMax]); 111 set_variable ("threshold", vecx[0].elements.Flt[BinMax]); 112 set_int_variable ("thresherr", 1); 113 if (!QUIET) gprint (GP_LOG, "theshold %f (bin %d is %f)\n", 114 vecx[0].elements.Flt[BinMax], BinMax, 115 vecy[0].elements.Flt[BinMax]); 116 return TRUE; 129 if (SATURATE) { 130 _threshold_set_values (vecy[0].elements.Flt[BinMax], BinMax, vecx[0].elements.Flt[BinMax], 1); 131 return TRUE; 132 } else { 133 gprint (GP_ERR, "ERROR: all values below threshold\n"); 134 _threshold_set_values (NAN, -1, NAN, 1); 135 return FALSE; 136 } 117 137 } 118 138 while (Nhi - Nlo > 10) { … … 136 156 // this algorithm assumes vecy[BinMin] > threshold, vecy[BinMax] < threshold 137 157 if (vecy[0].elements.Flt[BinMin] < value) { 138 if (!QUIET) gprint (GP_ERR, "ERROR: all values below threshold\n"); 139 set_int_variable ("threshbin", BinMin); 140 set_variable ("threshval", vecy[0].elements.Flt[BinMin]); 141 set_variable ("threshold", vecx[0].elements.Flt[BinMin]); 142 set_int_variable ("thresherr", 1); 143 if (!QUIET) gprint (GP_LOG, "theshold %f (bin %d is %f)\n", 144 vecx[0].elements.Flt[BinMin], BinMin, 145 vecy[0].elements.Flt[BinMin]); 146 return TRUE; 158 if (SATURATE) { 159 _threshold_set_values (vecy[0].elements.Flt[BinMin], BinMin, vecx[0].elements.Flt[BinMin], 1); 160 return TRUE; 161 } else { 162 gprint (GP_ERR, "ERROR: all values below threshold\n"); 163 _threshold_set_values (NAN, -1, NAN, 1); 164 return FALSE; 165 } 147 166 } 148 167 if (vecy[0].elements.Flt[BinMax] > value) { 149 if (!QUIET) gprint (GP_ERR, "ERROR: all values above threshold\n"); 150 set_int_variable ("threshbin", BinMax); 151 set_variable ("threshval", vecy[0].elements.Flt[BinMax]); 152 set_variable ("threshold", vecx[0].elements.Flt[BinMax]); 153 set_int_variable ("thresherr", 1); 154 if (!QUIET) gprint (GP_LOG, "theshold %f (bin %d is %f)\n", 155 vecx[0].elements.Flt[BinMax], BinMax, 156 vecy[0].elements.Flt[BinMax]); 157 return TRUE; 168 if (SATURATE) { 169 _threshold_set_values (vecy[0].elements.Flt[BinMax], BinMax, vecx[0].elements.Flt[BinMax], 1); 170 return TRUE; 171 } else { 172 gprint (GP_ERR, "ERROR: all values above threshold\n"); 173 _threshold_set_values (NAN, -1, NAN, 1); 174 return FALSE; 175 } 158 176 } 159 177 while (Nhi - Nlo > 10) { … … 202 220 } 203 221 204 set_variable ("threshval", y1); 205 set_variable ("threshold", Xvalue); 206 set_int_variable ("threshbin", Nhi); 207 set_int_variable ("thresherr", 0); 208 209 if (!QUIET) gprint (GP_LOG, "theshold %f (bin %d is %f)\n", Xvalue, Nhi, y1); 210 222 _threshold_set_values (y1, Nhi, Xvalue, 0); 211 223 return (TRUE); 212 224 } -
branches/eam_branches/ipp-20220316/Ohana/src/opihi/include/data.h
r41891 r42361 133 133 134 134 /* in spline.c */ 135 void spline_construct_flt (float *x, float *y, int N, float *y2 );135 void spline_construct_flt (float *x, float *y, int N, float *y2, float dyLower, float dyUpper); 136 136 float spline_apply_flt (float *x, float *y, float *y2, int N, float X); 137 void spline_construct_dbl (opihi_flt *x, opihi_flt *y, int N, opihi_flt *y2 );137 void spline_construct_dbl (opihi_flt *x, opihi_flt *y, int N, opihi_flt *y2, opihi_flt dyLower, opihi_flt dyUpper); 138 138 opihi_flt spline_apply_dbl (opihi_flt *x, opihi_flt *y, opihi_flt *y2, int N, opihi_flt X); 139 139 -
branches/eam_branches/ipp-20220316/Ohana/src/opihi/lib.data/spline.c
r41341 r42361 2 2 3 3 /* construct the natural spline for x, y in y2 */ 4 void spline_construct_flt (float *x, float *y, int N, float *y2 ) {4 void spline_construct_flt (float *x, float *y, int N, float *y2, float dyLower, float dyUpper) { 5 5 6 6 int i; … … 67 67 68 68 /* construct the natural spline for x, y in y2 */ 69 void spline_construct_dbl (opihi_flt *x, opihi_flt *y, int N, opihi_flt *y2 ) {69 void spline_construct_dbl (opihi_flt *x, opihi_flt *y, int N, opihi_flt *y2, opihi_flt dyLower, opihi_flt dyUpper) { 70 70 71 71 int i; … … 77 77 ALLOCATE (tmp, opihi_flt, N); 78 78 79 y2[0] = tmp[0] = 0.0; 79 if (isnan(dyLower)) { 80 y2[0] = tmp[0] = 0.0; 81 } else { 82 y2[0] = -0.5; 83 tmp[0] = (3.0/(x[1]-x[0])) * ((y[1]-y[0])/(x[1]-x[0]) - dyLower); 84 } 80 85 81 86 for (i = 1; i < N-1; i++) { … … 86 91 tmp[i] = (6.0 * tmp[i] / (x[i+1] - x[i-1]) - dx*tmp[i-1]) / dy; 87 92 } 93 94 if (isfinite(dyUpper)) { 95 opihi_flt qn = 0.5; 96 tmp[N-1] = (3.0/(x[N-1]-x[N-2])) * (dyUpper - (y[N-1]-y[N-2])/(x[N-1]-x[N-2])); 97 y2[N-1] = (tmp[N-1] - (qn * tmp[N-2])) / ((qn * y2[N-2]) + 1.0); 98 } else { 99 y2[N-1] = 0; 100 } 88 101 89 y2[N-1] = 0; 90 for (i = N-2; i >= 1; i--) 102 for (i = N-2; i >= 0; i--) { 91 103 y2[i] = y2[i]*y2[i+1] + tmp[i]; 104 } 92 105 93 106 free (tmp); -
branches/eam_branches/ipp-20220316/Ohana/src/opihi/lib.shell/parse.c
r42268 r42361 124 124 free (B); 125 125 126 // XXX make this error output conditional 126 127 if (filestatus) gprint (GP_ERR, "warning: exit status of command %d\n", filestatus); 127 128 set_int_variable ("EXECSTATUS", filestatus); -
branches/eam_branches/ipp-20220316/Ohana/src/opihi/lib.shell/stack_math.c
r42165 r42361 1619 1619 OUT[0].vector = InitVector (); 1620 1620 OUT[0].type = ST_VECTOR_TMP; /*** <<--- says this is a temporary matrix ***/ 1621 1622 if (V1->vector->type == OPIHI_STR) { 1623 ResetVector (OUT->vector, V1->vector->type, V1->vector->Nelements); 1624 for (i = 0; i < V1->vector->Nelements; i++) { 1625 OUT->vector->elements.Str[i] = strcreate (V1->vector->elements.Str[i]); 1626 } 1627 goto escape; 1628 } 1621 1629 1622 1630 # define V_FUNC(OP,FTYPE) { \ -
branches/eam_branches/ipp-20220316/Ohana/src/relastro/src
- Property svn:mergeinfo changed
/trunk/Ohana/src/relastro/src (added) merged: 42285
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20220316/Ohana/src/relphot
- Property svn:mergeinfo changed
/trunk/Ohana/src/relphot merged: 42285
- Property svn:mergeinfo changed
Note:
See TracChangeset
for help on using the changeset viewer.
