Changeset 11723 for trunk/ippTools/src/warptool.c
- Timestamp:
- Feb 8, 2007, 3:21:15 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/warptool.c (modified) (24 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/warptool.c
r11702 r11723 32 32 33 33 static bool definerunMode(pxConfig *config); 34 static bool addinput imfileMode(pxConfig *config);35 static bool to warpedimfileMode(pxConfig *config);36 static bool add warpedimfileMode(pxConfig *config);37 static bool warpedimfileMode(pxConfig *config);34 static bool addinputexpMode(pxConfig *config); 35 static bool toscfileMode(pxConfig *config); 36 static bool addscfileMode(pxConfig *config); 37 static bool scfileMode(pxConfig *config); 38 38 static bool tostackedimfileMode(pxConfig *config); 39 static bool addstackedimfileMode(pxConfig *config);39 //static bool addstackedimfileMode(pxConfig *config); 40 40 static bool stackedimfileMode(pxConfig *config); 41 41 static bool todiffimfileMode(pxConfig *config); 42 static bool adddiffimfileMode(pxConfig *config);42 //static bool adddiffimfileMode(pxConfig *config); 43 43 static bool diffimfileMode(pxConfig *config); 44 44 … … 58 58 switch (config->mode) { 59 59 MODECASE(P4TOOL_MODE_DEFINERUN, definerunMode); 60 MODECASE(P4TOOL_MODE_ADDINPUT IMFILE, addinputimfileMode);61 MODECASE(P4TOOL_MODE_TO WARPEDIMFILE, towarpedimfileMode);62 MODECASE(P4TOOL_MODE_ADD WARPEDIMFILE, addwarpedimfileMode);63 MODECASE(P4TOOL_MODE_ WARPEDIMFILE, warpedimfileMode);60 MODECASE(P4TOOL_MODE_ADDINPUTEXP, addinputexpMode); 61 MODECASE(P4TOOL_MODE_TOSCFILE, toscfileMode); 62 MODECASE(P4TOOL_MODE_ADDSCFILE, addscfileMode); 63 MODECASE(P4TOOL_MODE_SCFILE, scfileMode); 64 64 MODECASE(P4TOOL_MODE_TOSTACKEDIMFILE, tostackedimfileMode); 65 MODECASE(P4TOOL_MODE_ADDSTACKEDIMFILE, addstackedimfileMode);65 // MODECASE(P4TOOL_MODE_ADDSTACKEDIMFILE, addstackedimfileMode); 66 66 MODECASE(P4TOOL_MODE_STACKEDIMFILE, stackedimfileMode); 67 67 MODECASE(P4TOOL_MODE_TODIFFIMFILE, todiffimfileMode); 68 MODECASE(P4TOOL_MODE_ADDDIFFIMFILE, adddiffimfileMode);68 // MODECASE(P4TOOL_MODE_ADDDIFFIMFILE, adddiffimfileMode); 69 69 MODECASE(P4TOOL_MODE_DIFFIMFILE, diffimfileMode); 70 70 default: … … 94 94 // required options 95 95 bool status = false; 96 psString survey_mode = psMetadataLookupStr(&status, config->args, "-survey_mode");96 psString mode = psMetadataLookupStr(&status, config->args, "-mode"); 97 97 if (!status) { 98 98 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -survey_mode"); 99 99 return false; 100 100 } 101 if (! survey_mode) {102 psError(PS_ERR_UNKNOWN, true, "- survery_mode is required");101 if (!mode) { 102 psError(PS_ERR_UNKNOWN, true, "-mode is required"); 103 103 return false; 104 104 } … … 111 111 if (!workdir) { 112 112 psError(PS_ERR_UNKNOWN, true, "-workdir is required"); 113 return false;114 }115 116 psString filter = psMetadataLookupStr(&status, config->args, "-filter");117 if (!status) {118 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -filter");119 return false;120 }121 if (!filter) {122 psError(PS_ERR_UNKNOWN, true, "-survery_mode is required");123 return false;124 }125 126 psString skycell_id = psMetadataLookupStr(&status, config->args, "-skycell_id");127 if (!status) {128 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -skycell_id");129 return false;130 }131 if (!skycell_id) {132 psError(PS_ERR_UNKNOWN, true, "-survery_mode is required");133 return false;134 }135 136 psString tess_id = psMetadataLookupStr(&status, config->args, "-tess_id");137 if (!status) {138 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tess_id");139 return false;140 }141 if (!tess_id) {142 psError(PS_ERR_UNKNOWN, true, "-survery_mode is required");143 return false;144 }145 146 psS32 imfiles = psMetadataLookupS32(&status, config->args, "-imfiles");147 if (!status) {148 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -imfiles");149 return false;150 }151 if (imfiles < 1) {152 psError(PS_ERR_UNKNOWN, true, "-imfiles is required");153 return false;154 }155 156 // optional options157 psF64 ra = psMetadataLookupS32(&status, config->args, "-ra");158 if (!status) {159 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -ra");160 return false;161 }162 163 psF64 decl = psMetadataLookupS32(&status, config->args, "-decl");164 if (!status) {165 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -decl");166 return false;167 }168 169 psString input_ss = psMetadataLookupStr(&status, config->args, "-input_ss");170 if (!status) {171 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -input_ss");172 return false;173 }174 175 psString output_ss = psMetadataLookupStr(&status, config->args, "-output_ss");176 if (!status) {177 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -output_ss");178 113 return false; 179 114 } … … 195 130 196 131 p4RunRow *p4Run = p4RunRowAlloc( 197 0, 198 survey_mode,199 "r un",132 0, // ID 133 mode, 134 "reg", // state 200 135 workdir, 201 filter, 202 skycell_id, 203 tess_id, 204 ra, 205 decl, 206 input_ss, 207 output_ss 136 registered 208 137 ); 209 138 psFree(registered); … … 240 169 } 241 170 242 static bool addinput imfileMode(pxConfig *config)171 static bool addinputexpMode(pxConfig *config) 243 172 { 244 173 PS_ASSERT_PTR_NON_NULL(config, NULL); … … 265 194 } 266 195 267 psString class_id = psMetadataLookupStr(&status, config->args, "-class_id");268 if (!status) {269 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -class_id");270 return false;271 }272 if (!class_id) {273 psError(PS_ERR_UNKNOWN, true, "-class_id is required");274 return false;275 }276 277 196 // defaults to 0 278 197 psS32 p3_version = psMetadataLookupS32(&status, config->args, "-p3_version"); … … 282 201 } 283 202 203 // defaults to false 204 bool magiced = psMetadataLookupBool(&status, config->args, "-p3_version"); 205 if (!status) { 206 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -p3_version"); 207 return false; 208 } 209 284 210 // XXX need to validate the p4_id here 285 if (!p4Input ImfileInsert(config->dbh,211 if (!p4InputExpInsert(config->dbh, 286 212 (psS32)atoi(p4_id), 287 213 exp_tag, 288 214 p3_version, 289 class_id215 magiced 290 216 )) { 291 217 psError(PS_ERR_UNKNOWN, false, "database error"); … … 296 222 } 297 223 298 static bool to warpedimfileMode(pxConfig *config)224 static bool toscfileMode(pxConfig *config) 299 225 { 300 226 PS_ASSERT_PTR_NON_NULL(config, NULL); … … 326 252 327 253 if (config->where) { 328 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p4Input Imfile");254 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p4InputExp"); 329 255 psStringAppend(&query, " AND %s", whereClause); 330 256 psFree(whereClause); … … 360 286 361 287 // negative simple so the default is true 362 if (!ippdbPrintMetadatas(stdout, output, "p4Input Imfile", !simple)) {288 if (!ippdbPrintMetadatas(stdout, output, "p4InputExp", !simple)) { 363 289 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 364 290 psFree(output); … … 371 297 } 372 298 373 static bool add warpedimfileMode(pxConfig *config)299 static bool addscfileMode(pxConfig *config) 374 300 { 375 301 PS_ASSERT_PTR_NON_NULL(config, NULL); … … 386 312 } 387 313 314 psString skycell_id = psMetadataLookupStr(&status, config->args, "-skycell_id"); 315 if (!status) { 316 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -skycell_id"); 317 return false; 318 } 319 if (!skycell_id) { 320 psError(PS_ERR_UNKNOWN, true, "-skycell_id is required"); 321 return false; 322 } 323 324 psString tess_id = psMetadataLookupStr(&status, config->args, "-tess_id"); 325 if (!status) { 326 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -tess_id"); 327 return false; 328 } 329 if (!tess_id) { 330 psError(PS_ERR_UNKNOWN, true, "-tess_id is required"); 331 return false; 332 } 333 388 334 psString exp_tag = psMetadataLookupStr(&status, config->args, "-exp_tag"); 389 335 if (!status) { … … 396 342 } 397 343 398 psString class_id = psMetadataLookupStr(&status, config->args, "-class_id");399 if (!status) {400 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -class_id");401 return false;402 }403 if (!class_id) {404 psError(PS_ERR_UNKNOWN, true, "-class_id is required");405 return false;406 }407 408 344 psString uri = psMetadataLookupStr(&status, config->args, "-uri"); 409 345 if (!status) { … … 424 360 425 361 // optional 426 psString b1_uri = psMetadataLookupStr(&status, config->args, "-b1_uri"); 427 if (!status) { 428 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -b1_uri"); 429 return false; 430 } 431 432 psString b2_uri = psMetadataLookupStr(&status, config->args, "-b2_uri"); 433 if (!status) { 434 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -b2_uri"); 435 return false; 436 } 362 psF64 bg = psMetadataLookupF64(&status, config->args, "-bg"); 363 if (!status) { 364 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -bg"); 365 return false; 366 } 367 368 psF64 bg_mean_stdev = psMetadataLookupF64(&status, config->args, "-bg_mean_stdev"); 369 if (!status) { 370 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -bg_mean_stdev"); 371 return false; 372 } 373 437 374 438 375 // XXX need to validate that this coresponds to an p4InputImfile 439 if (!p4 WarpedImfileInsert(config->dbh,376 if (!p4ScfileInsert(config->dbh, 440 377 (psS32)atoi(p4_id), 378 skycell_id, 379 tess_id, 441 380 exp_tag, 442 381 p3_version, 443 class_id,444 382 uri, 445 b 1_uri,446 b 2_uri383 bg, 384 bg_mean_stdev 447 385 )) { 448 386 psError(PS_ERR_UNKNOWN, false, "database error"); … … 453 391 } 454 392 455 static bool warpedimfileMode(pxConfig *config)393 static bool scfileMode(pxConfig *config) 456 394 { 457 395 PS_ASSERT_PTR_NON_NULL(config, NULL); … … 459 397 psString query = psStringCopy( 460 398 " SELECT DISTINCT" 461 " p4 WarpedImfile.*"399 " p4Scfile.*" 462 400 " FROM p4Run" 463 " JOIN p4 WarpedImfile"401 " JOIN p4Scfile" 464 402 " USING(p4_id)" 465 403 " WHERE" … … 468 406 469 407 if (config->where) { 470 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p4 WarpedImfile");408 psString whereClause = psDBGenerateWhereConditionSQL(config->where, "p4Scfile"); 471 409 psStringAppend(&query, " AND %s", whereClause); 472 410 psFree(whereClause); … … 486 424 } 487 425 if (!psArrayLength(output)) { 488 psError(PS_ERR_UNKNOWN, false, "no p4 WarpedImfile rows found");426 psError(PS_ERR_UNKNOWN, false, "no p4Scfile rows found"); 489 427 psFree(output); 490 428 return true; … … 502 440 503 441 // negative simple so the default is true 504 if (!ippdbPrintMetadatas(stdout, output, "p4 WarpedImfile", !simple)) {442 if (!ippdbPrintMetadatas(stdout, output, "p4Scfile", !simple)) { 505 443 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 506 444 psFree(output); … … 578 516 } 579 517 518 #if 0 580 519 static bool addstackedimfileMode(pxConfig *config) 581 520 { … … 640 579 return true; 641 580 } 581 #endif 642 582 643 583 static bool stackedimfileMode(pxConfig *config) … … 774 714 } 775 715 716 #if 0 776 717 static bool adddiffimfileMode(pxConfig *config) 777 718 { … … 855 796 return true; 856 797 } 798 #endif 857 799 858 800 static bool diffimfileMode(pxConfig *config)
Note:
See TracChangeset
for help on using the changeset viewer.
