Changeset 15828
- Timestamp:
- Dec 14, 2007, 1:35:32 PM (18 years ago)
- Location:
- trunk/ippTools
- Files:
-
- 2 added
- 1 deleted
- 6 edited
-
scripts/dettest.sh (modified) (1 diff)
-
share/Makefile.am (modified) (1 diff)
-
share/dettool_correct_pendingimfiles.sql (deleted)
-
share/dettool_tocorrectexp.sql (added)
-
share/dettool_tocorrectimfile.sql (added)
-
src/dettool.c (modified) (1 diff)
-
src/dettool.h (modified) (2 diffs)
-
src/dettoolConfig.c (modified) (2 diffs)
-
src/dettool_correction.c (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/scripts/dettest.sh
r14271 r15828 62 62 dettool -updateresidexp -det_id $det_id -iteration 0 -exp_id 2 || exit 1 63 63 64 dettool -adddetrunsummary -det_id $det_id -iteration 0 -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -accept -again|| exit 164 dettool -adddetrunsummary -det_id $det_id -iteration 0 -bg 1 -bg_stdev 2 -bg_mean_stdev 3 -accept || exit 1 65 65 66 66 dettool -todetrunsummary || exit 1 -
trunk/ippTools/share/Makefile.am
r15825 r15828 13 13 detselect_search.sql \ 14 14 detselect_select.sql \ 15 dettool_correct_pendingimfiles.sql \ 15 dettool_tocorrectimfile.sql \ 16 dettool_tocorrectexp.sql \ 16 17 dettool_find_completed_runs.sql \ 17 18 dettool_normalizedstat.sql \ -
trunk/ippTools/src/dettool.c
r15786 r15828 128 128 MODECASE(DETTOOL_MODE_DEFINEBYQUERY, definebyqueryMode); 129 129 MODECASE(DETTOOL_MODE_DEFINEBYDETRUN, definebydetrunMode); 130 MODECASE(DETTOOL_MODE_MAKECORRECTION, makecorrectionMode);131 130 MODECASE(DETTOOL_MODE_RUNS, runsMode); 132 131 MODECASE(DETTOOL_MODE_CHILDLESSRUN, childlessrunMode); 133 132 MODECASE(DETTOOL_MODE_INPUT, inputMode); 134 133 MODECASE(DETTOOL_MODE_RAW, rawMode); 134 // correction 135 MODECASE(DETTOOL_MODE_TOCORRECTEXP, tocorrectexpMode); 136 MODECASE(DETTOOL_MODE_TOCORRECTIMFILE, tocorrectimfileMode); 135 137 // imfile 136 138 MODECASE(DETTOOL_MODE_TOPROCESSEDIMFILE,toprocessedimfileMode); -
trunk/ippTools/src/dettool.h
r15783 r15828 30 30 DETTOOL_MODE_DEFINEBYDETRUN, 31 31 DETTOOL_MODE_MAKECORRECTION, 32 DETTOOL_MODE_TOCORRECTEXP, 33 DETTOOL_MODE_TOCORRECTIMFILE, 32 34 DETTOOL_MODE_RUNS, 33 35 DETTOOL_MODE_CHILDLESSRUN, … … 80 82 81 83 bool makecorrectionMode(pxConfig *config); 84 bool tocorrectexpMode(pxConfig *config); 85 bool tocorrectimfileMode(pxConfig *config); 82 86 83 87 #endif // DETTOOL_H -
trunk/ippTools/src/dettoolConfig.c
r15783 r15828 274 274 psMetadataAddStr(makecorrectionArgs, PS_LIST_TAIL, "-det_id", 0, 275 275 "det ID to be corrected (required)", NULL); 276 psMetadataAddBool(makecorrectionArgs, PS_LIST_TAIL, "-simple", 0, 277 "use the simple output format", false); 278 279 // -tocorrectexp 280 psMetadata *tocorrectexpArgs = psMetadataAlloc(); 281 psMetadataAddU64(tocorrectexpArgs, PS_LIST_TAIL, "-limit", 0, 282 "limit result set to N items", 0); 283 psMetadataAddBool(tocorrectexpArgs, PS_LIST_TAIL, "-simple", 0, 284 "use the simple output format", false); 285 286 // -tocorrectimfile 287 psMetadata *tocorrectimfileArgs = psMetadataAlloc(); 288 psMetadataAddStr(tocorrectimfileArgs, PS_LIST_TAIL, "-det_id", 0, 289 "search for detrend ID", NULL); 290 psMetadataAddU64(tocorrectimfileArgs, PS_LIST_TAIL, "-limit", 0, 291 "limit result set to N items", 0); 292 psMetadataAddBool(tocorrectimfileArgs, PS_LIST_TAIL, "-simple", 0, 293 "use the simple output format", false); 276 294 277 295 // -runs … … 1070 1088 PXTOOL_ADD_MODE("-definebydetrun", "", DETTOOL_MODE_DEFINEBYDETRUN, definebydetrunArgs); 1071 1089 PXTOOL_ADD_MODE("-makecorrection", "", DETTOOL_MODE_MAKECORRECTION, makecorrectionArgs); 1090 PXTOOL_ADD_MODE("-tocorrectexp", "", DETTOOL_MODE_TOCORRECTEXP, tocorrectexpArgs); 1091 PXTOOL_ADD_MODE("-tocorrectimfile", "", DETTOOL_MODE_TOCORRECTIMFILE, tocorrectimfileArgs); 1072 1092 PXTOOL_ADD_MODE("-raw", "", DETTOOL_MODE_RAW, rawArgs); 1073 1093 PXTOOL_ADD_MODE("-runs", "", DETTOOL_MODE_RUNS, runsArgs); -
trunk/ippTools/src/dettool_correction.c
r15783 r15828 95 95 psFree(runs); 96 96 97 98 // point of no return for det_id creation 97 // print the new detRun 98 psS64 new_det_id = psDBLastInsertID(config->dbh); 99 99 100 if (!psDBCommit(config->dbh)) { 100 101 psError(PS_ERR_UNKNOWN, false, "database error"); 102 return false; 103 } 104 105 psArray *detRuns = NULL; 106 { 107 psMetadata *where = psMetadataAlloc(); 108 psMetadataAddS64(where, PS_LIST_TAIL, "det_id", 0, "==", new_det_id); 109 detRuns = psDBSelectRows(config->dbh, "detRun", where, 0); 110 psFree(where); 111 } 112 if (!detRuns) { 113 psError(PS_ERR_UNKNOWN, false, "can't find the detRun we just created"); 114 return false; 115 } 116 // sanity check results 117 if (psArrayLength(detRuns) != 1) { 118 psAbort("found more then one detRun matching det_id %" PRId64 "(this should not happen)", new_det_id); 119 return false; 120 } 121 122 if (!convertIdToStr(detRuns)) { 123 psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings"); 124 psFree(detRuns); 101 125 return false; 102 126 } … … 112 136 } 113 137 114 #if 0115 // print the new det_id116 psArray *detRuns = NULL;117 {118 psMetadata *where = psMetadataAlloc();119 psMetadataAddS64(where, PS_LIST_TAIL, "det_id", 0, "==", det_id);120 detRuns = psDBSelectRows(config->dbh, "detRun", where, 0);121 psFree(where);122 }123 if (!detRuns) {124 psError(PS_ERR_UNKNOWN, false, "can't find the detRun we just created");125 return false;126 }127 // sanity check results128 if (psArrayLength(detRuns) != 1) {129 psAbort("found more then one detRun matching det_id %" PRId64 " (this should not happen)", det_id);130 return false;131 }132 133 if (!convertIdToStr(detRuns)) {134 psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");135 psFree(detRuns);136 return false;137 }138 139 138 // negative simple so the default is true 140 139 if (!ippdbPrintMetadatas(stdout, detRuns, "detRun", !simple)) { … … 144 143 } 145 144 psFree(detRuns); 146 #endif147 145 148 146 return true; 149 147 } 148 149 bool tocorrectexpMode(pxConfig *config) 150 { 151 PS_ASSERT_PTR_NON_NULL(config, false); 152 153 bool status = false; 154 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 155 if (!status) { 156 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -limit"); 157 return false; 158 } 159 160 psString query = pxDataGet("dettool_tocorrectexp.sql"); 161 if (!query) { 162 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 163 return false; 164 } 165 166 // treat limit == 0 as "no limit" 167 if (limit) { 168 psString limitString = psDBGenerateLimitSQL(limit); 169 psStringAppend(&query, " %s", limitString); 170 psFree(limitString); 171 } 172 173 if (!p_psDBRunQuery(config->dbh, query)) { 174 psError(PS_ERR_UNKNOWN, false, "database error"); 175 psFree(query); 176 return false; 177 } 178 psFree(query); 179 180 psArray *output = p_psDBFetchResult(config->dbh); 181 if (!output) { 182 psError(PS_ERR_UNKNOWN, false, "database error"); 183 return false; 184 } 185 if (!psArrayLength(output)) { 186 psTrace("dettool", PS_LOG_INFO, "no rows found"); 187 psFree(output); 188 return true; 189 } 190 191 bool simple = false; 192 { 193 bool status = false; 194 simple = psMetadataLookupBool(&status, config->args, "-simple"); 195 if (!status) { 196 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple"); 197 return false; 198 } 199 } 200 201 // negative simple so the default is true 202 if (!ippdbPrintMetadatas(stdout, output, "detRun", !simple)) { 203 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 204 psFree(output); 205 return false; 206 } 207 208 psFree(output); 209 210 return true; 211 } 212 213 bool tocorrectimfileMode(pxConfig *config) 214 { 215 PS_ASSERT_PTR_NON_NULL(config, false); 216 217 bool status = false; 218 psU64 limit = psMetadataLookupU64(&status, config->args, "-limit"); 219 if (!status) { 220 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -limit"); 221 return false; 222 } 223 224 psString query = pxDataGet("dettool_tocorrectimfile.sql"); 225 if (!query) { 226 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 227 return false; 228 } 229 230 if (config->where) { 231 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "det1"); 232 psStringAppend(&query, " AND %s", whereClause); 233 psFree(whereClause); 234 } 235 236 // treat limit == 0 as "no limit" 237 if (limit) { 238 psString limitString = psDBGenerateLimitSQL(limit); 239 psStringAppend(&query, " %s", limitString); 240 psFree(limitString); 241 } 242 243 if (!p_psDBRunQuery(config->dbh, query)) { 244 psError(PS_ERR_UNKNOWN, false, "database error"); 245 psFree(query); 246 return false; 247 } 248 psFree(query); 249 250 psArray *output = p_psDBFetchResult(config->dbh); 251 if (!output) { 252 psError(PS_ERR_UNKNOWN, false, "database error"); 253 return false; 254 } 255 if (!psArrayLength(output)) { 256 psTrace("dettool", PS_LOG_INFO, "no rows found"); 257 psFree(output); 258 return true; 259 } 260 261 bool simple = false; 262 { 263 bool status = false; 264 simple = psMetadataLookupBool(&status, config->args, "-simple"); 265 if (!status) { 266 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple"); 267 return false; 268 } 269 } 270 271 // negative simple so the default is true 272 if (!ippdbPrintMetadatas(stdout, output, "detPendingCorrectImfile", !simple)) { 273 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 274 psFree(output); 275 return false; 276 } 277 278 psFree(output); 279 280 return true; 281 }
Note:
See TracChangeset
for help on using the changeset viewer.
