Changeset 40836
- Timestamp:
- Jul 19, 2019, 5:31:16 PM (7 years ago)
- Location:
- branches/eam_branches/ohana.20190329/src/opihi/cmd.data
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ohana.20190329/src/opihi/cmd.data/peak.c
r20936 r40836 39 39 if (*X < start) continue; 40 40 if (*X > end) continue; 41 if (!isfinite(*Y)) continue; 41 42 if (*Y < ymax) continue; 42 43 xmax = *X; … … 63 64 if (*X < start) continue; 64 65 if (*X > end) continue; 66 if (!isfinite(*Y)) continue; 65 67 if (*Y < ymax) continue; 66 68 xmax = *X; -
branches/eam_branches/ohana.20190329/src/opihi/cmd.data/spline_commands.c
r40813 r40836 28 28 if (xvec->Nelements != yvec->Nelements) { 29 29 gprint (GP_ERR, "x and y vectors must be the same length\n"); 30 return FALSE; 31 } 32 33 if (xvec->Nelements < 3) { 34 gprint (GP_ERR, "cannot make a spline with fewer than 3 knots\n"); 30 35 return FALSE; 31 36 } … … 132 137 133 138 int N, status; 134 Spline *spline;135 139 136 140 int QUIET = FALSE; … … 145 149 } 146 150 147 spline = FindSpline (argv[1]);151 Spline *spline = FindSpline (argv[1]); 148 152 if (spline == NULL) { 149 153 if (QUIET) return TRUE; … … 159 163 int spline_rename (int argc, char **argv) { 160 164 161 Spline *spline;162 163 165 if (argc != 3) { 164 166 gprint (GP_ERR, "USAGE: spline rename (spline) (newname)\n"); … … 166 168 } 167 169 168 spline = FindSpline (argv[1]);170 Spline *spline = FindSpline (argv[1]); 169 171 if (spline == NULL) { 170 172 gprint (GP_ERR, "spline %s not found\n", argv[1]); 171 173 return FALSE; 174 } 175 176 Spline *newname = FindSpline (argv[2]); 177 if (newname != NULL) { 178 DeleteSpline (newname); 172 179 } 173 180 … … 176 183 return TRUE; 177 184 } 178 179 /*180 int spline_listspline (int argc, char **argv) {181 182 Spline *spline;183 184 if (argc != 2) {185 gprint (GP_ERR, "USAGE: spline listspline (spline)\n");186 return FALSE;187 }188 189 spline = FindSpline (argv[1]);190 if (spline == NULL) {191 gprint (GP_ERR, "spline %s not found\n", argv[1]);192 return FALSE;193 }194 195 ListPages (spline);196 return TRUE;197 }198 */199 -
branches/eam_branches/ohana.20190329/src/opihi/cmd.data/vgauss.c
r39457 r40836 3 3 /* local private functions */ 4 4 opihi_flt fgaussOD (opihi_flt, opihi_flt *, int, opihi_flt *); 5 int vgauss_apply (int argc, char **argv); 5 6 6 7 # define GET_VAR(V,A) \ … … 20 21 Vector *xvec, *yvec, *svec, *ovec; 21 22 char *c, name[16]; 23 24 if ((N = get_argument (argc, argv, "-apply"))) { 25 remove_argument (N, &argc, argv); 26 int status = vgauss_apply (argc, argv); 27 return status; 28 } 22 29 23 30 Quiet = FALSE; … … 104 111 } 105 112 if (!Quiet) gprint (GP_ERR, "%d iterations\n", i); 113 set_variable ("Chisq", chisq); 114 set_variable ("ChisqNu", chisq / (float) (Npts - Npar)); 106 115 107 116 for (i = 0; i < Npts; i++) { … … 125 134 } 126 135 136 int vgauss_apply (int argc, char **argv) { 137 138 opihi_flt par[4]; 139 Vector *xvec, *ovec; 140 char *c; 141 142 // NOTE: -apply has already been stripped by vgauss call 143 if (argc != 3) { 144 gprint (GP_ERR, "USAGE: vgauss -apply <x> <out>\n"); 145 return (FALSE); 146 } 147 148 if ((xvec = SelectVector (argv[1], OLDVECTOR, TRUE)) == NULL) return (FALSE); 149 if ((ovec = SelectVector (argv[2], ANYVECTOR, TRUE)) == NULL) return (FALSE); 150 151 CastVector (xvec, OPIHI_FLT); 152 153 GET_VAR (par[0], "C0"); 154 GET_VAR (par[1], "C1"); 155 GET_VAR (par[2], "C2"); 156 GET_VAR (par[3], "C3"); 157 int Npar = 4; 158 159 int Npts = xvec[0].Nelements; 160 ResetVector (ovec, OPIHI_FLT, Npts); 161 162 for (int i = 0; i < Npts; i++) { 163 ovec[0].elements.Flt[i] = fgaussOD (xvec[0].elements.Flt[i], par, Npar, NULL); 164 } 165 ovec[0].Nelements = Npts; 166 167 return TRUE; 168 } 169 127 170 /* pars: x_o, sigma, I, back */ 128 171 opihi_flt fgaussOD (opihi_flt x, opihi_flt *par, int Npar, opihi_flt *dpar) { … … 135 178 f = par[2]*r + par[3]; 136 179 137 dpar[0] = par[2]*r*z/par[1]; 138 dpar[1] = par[2]*r*z*z/par[1]; 139 dpar[2] = r; 140 dpar[3] = 1; 180 if (dpar) { 181 dpar[0] = par[2]*r*z/par[1]; 182 dpar[1] = par[2]*r*z*z/par[1]; 183 dpar[2] = r; 184 dpar[3] = 1; 185 } 141 186 142 187 return (f);
Note:
See TracChangeset
for help on using the changeset viewer.
