Changeset 17591 for trunk/ippTools/src/chiptool.c
- Timestamp:
- May 8, 2008, 1:32:07 PM (18 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/chiptool.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/chiptool.c
r17226 r17591 105 105 106 106 psMetadata *where = psMetadataAlloc(); 107 // convert exp_id into a psS64 108 if (exp_id) { 109 if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", 0, "==", (psS64)atoll(exp_id))) { 110 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id"); 111 psFree(where); 112 return false; 113 } 114 } 115 116 PXOPT_COPY_STR(config->args, where, "-exp_name", "exp_name", "=="); 117 PXOPT_COPY_STR(config->args, where, "-inst", "camera", "=="); 118 PXOPT_COPY_STR(config->args, where, "-telescope", "telescope", "=="); 119 PXOPT_COPY_TIME(config->args, where, "-dateobs_begin", "dateobs", ">="); 120 PXOPT_COPY_TIME(config->args, where, "-dateobs_end", "dateobs", "<="); 121 PXOPT_COPY_STR(config->args, where, "-exp_tag", "exp_tag", "=="); 122 PXOPT_COPY_STR(config->args, where, "-filelevel", "filelevel", "=="); 123 PXOPT_COPY_STR(config->args, where, "-reduction", "reduction", "=="); 124 PXOPT_COPY_STR(config->args, where, "-filter", "filter", "=="); 125 PXOPT_COPY_F64(config->args, where, "-airmass_min", "airmass", ">="); 126 PXOPT_COPY_F64(config->args, where, "-airmass_max", "airmass", "<"); 127 PXOPT_COPY_F64(config->args, where, "-ra_min", "ra", ">="); 128 PXOPT_COPY_F64(config->args, where, "-ra_max", "ra", "<"); 129 PXOPT_COPY_F64(config->args, where, "-decl_min", "decl", ">="); 130 PXOPT_COPY_F64(config->args, where, "-decl_max", "decl", "<"); 131 PXOPT_COPY_F32(config->args, where, "-exp_time_min", "exp_time", ">="); 132 PXOPT_COPY_F32(config->args, where, "-exp_time_max", "exp_time", "<"); 133 PXOPT_COPY_F32(config->args, where, "-sat_pixel_frac_min", "sat_pixel_frac", ">="); 134 PXOPT_COPY_F32(config->args, where, "-sat_pixel_frac_max", "sat_pixel_frac", "<"); 135 PXOPT_COPY_F64(config->args, where, "-bg_min", "bg", ">="); 136 PXOPT_COPY_F64(config->args, where, "-bg_max", "bg", "<"); 137 PXOPT_COPY_F64(config->args, where, "-bg_stdev_min", "bg_stdev", ">="); 138 PXOPT_COPY_F64(config->args, where, "-bg_stdev_max", "bg_stdev", "<"); 139 PXOPT_COPY_F64(config->args, where, "-bg_mean_stdev_min", "bg_mean_stdev", ">="); 140 PXOPT_COPY_F64(config->args, where, "-bg_mean_stdev_max", "bg_mean_stdev", "<"); 141 PXOPT_COPY_F64(config->args, where, "-alt_min", "alt", ">="); 142 PXOPT_COPY_F64(config->args, where, "-alt_max", "alt", "<"); 143 PXOPT_COPY_F64(config->args, where, "-az_min", "az", ">="); 144 PXOPT_COPY_F64(config->args, where, "-az_max", "az", "<"); 145 PXOPT_COPY_F32(config->args, where, "-ccd_temp_min", "ccd_temp", ">="); 146 PXOPT_COPY_F32(config->args, where, "-ccd_temp_max", "ccd_temp", "<"); 147 PXOPT_COPY_F64(config->args, where, "-posang_min", "posang", ">="); 148 PXOPT_COPY_F64(config->args, where, "-posang_max", "posang", "<"); 149 PXOPT_COPY_STR(config->args, where, "-object", "object", "=="); 150 PXOPT_COPY_F32(config->args, where, "-solang_min", "solang", ">="); 151 PXOPT_COPY_F32(config->args, where, "-solang_max", "solang", "<"); 152 153 if (!psListLength(where->list) 154 && !psMetadataLookupBool(NULL, config->args, "-all")) { 155 psFree(where); 156 psError(PXTOOLS_ERR_DATA, false, "search parameters are required"); 157 return false; 158 } 159 160 PXOPT_LOOKUP_STR(workdir, config->args, "-set_workdir", false, false); 161 PXOPT_LOOKUP_STR(label, config->args, "-set_label", false, false); 162 PXOPT_LOOKUP_STR(reduction, config->args, "-set_reduction", false, false); 163 PXOPT_LOOKUP_STR(expgroup, config->args, "-set_expgroup", false, false); 164 PXOPT_LOOKUP_STR(dvodb, config->args, "-set_dvodb", false, false); 165 PXOPT_LOOKUP_STR(tess_id, config->args, "-set_tess_id", false, false); 166 PXOPT_LOOKUP_STR(end_stage, config->args, "-set_end_stage", false, false); 167 168 // default 169 PXOPT_COPY_STR(config->args, where, "-exp_type", "exp_type", "=="); 170 PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false); 171 172 // find the exp_id of all the exposures that we want to queue up. 173 psString query = pxDataGet("chiptool_find_rawexp.sql"); 174 if (!query) { 175 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 176 psFree(where); 177 return false; 178 } 179 180 if (where && psListLength(where->list)) { 181 psString whereClause = psDBGenerateWhereConditionSQL(where, "rawExp"); 182 psStringAppend(&query, " AND %s", whereClause); 183 psFree(whereClause); 184 } 185 186 psFree(where); 187 188 if (pretend) { 189 // then stop before running the query 190 fprintf(stderr, "%s\n", query); 191 psFree(query); 192 return true; 193 } 194 195 if (!p_psDBRunQuery(config->dbh, query)) { 196 psError(PS_ERR_UNKNOWN, false, "database error"); 197 psFree(query); 198 return false; 199 } 200 psFree(query); 201 202 psArray *output = p_psDBFetchResult(config->dbh); 203 if (!output) { 204 psError(PS_ERR_UNKNOWN, false, "database error"); 205 return false; 206 } 207 if (!psArrayLength(output)) { 208 psTrace("chiptool", PS_LOG_INFO, "no rows found"); 209 psFree(output); 210 return true; 211 } 212 213 // start a transaction so we don't end up with an exp without any associted 214 // imfiles 215 if (!psDBTransaction(config->dbh)) { 216 psError(PS_ERR_UNKNOWN, false, "database error"); 217 psFree(output); 218 return false; 219 } 220 221 // loop over our list of exp_ids 222 for (long i = 0; i < psArrayLength(output); i++) { 223 psMetadata *md = output->data[i]; 224 225 bool status; 226 psS64 exp_id = psMetadataLookupS64(&status, md, "exp_id"); 227 if (!status) { 228 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for exp_id"); 229 psFree(output); 230 return false; 231 } 232 233 // queue the exp 234 if (!pxchipQueueByExpTag(config, exp_id, workdir, label, reduction, expgroup, dvodb, tess_id, end_stage)) { 235 if (!psDBRollback(config->dbh)) { 236 psError(PS_ERR_UNKNOWN, false, "database error"); 237 } 238 psError(PS_ERR_UNKNOWN, false, 239 "failed to trying to queue exp_id: %" PRId64, exp_id); 240 psFree(output); 241 return false; 242 } 243 } 244 psFree(output); 245 246 if (!psDBCommit(config->dbh)) { 247 psError(PS_ERR_UNKNOWN, false, "database error"); 248 return false; 249 } 250 251 return true; 252 } 253 254 255 static bool updaterunMode(pxConfig *config) 256 { 257 PS_ASSERT_PTR_NON_NULL(config, NULL); 258 259 psMetadata *where = psMetadataAlloc(); 260 PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false); 261 // convert chip_id into a psS64 262 if (chip_id) { 263 if (!psMetadataAddS64(where, PS_LIST_TAIL, "chip_id", 0, "==", (psS64)atoll(chip_id))) { 264 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id"); 265 psFree(where); 266 return false; 267 } 268 } 269 270 PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false); 271 // convert exp_id into a psS64 272 if (exp_id) { 273 if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", 0, "==", (psS64)atoll(exp_id))) { 274 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id"); 275 psFree(where); 276 return false; 277 } 278 } 279 280 PXOPT_COPY_STR(config->args, where, "-chip_id", "chip_id", "=="); 281 PXOPT_COPY_STR(config->args, where, "-exp_id", "exp_id", "=="); 282 PXOPT_COPY_STR(config->args, where, "-exp_name", "exp_name", "=="); 283 PXOPT_COPY_STR(config->args, where, "-inst", "camera", "=="); 284 PXOPT_COPY_STR(config->args, where, "-telescope", "telescope", "=="); 285 PXOPT_COPY_TIME(config->args, where, "-dateobs_begin", "dateobs", ">="); 286 PXOPT_COPY_TIME(config->args, where, "-dateobs_end", "dateobs", "<="); 287 PXOPT_COPY_STR(config->args, where, "-exp_tag", "exp_tag", "=="); 288 PXOPT_COPY_STR(config->args, where, "-exp_type", "exp_type", "=="); 289 PXOPT_COPY_STR(config->args, where, "-filelevel", "filelevel", "=="); 290 PXOPT_COPY_STR(config->args, where, "-reduction", "reduction", "=="); 291 PXOPT_COPY_STR(config->args, where, "-filter", "filter", "=="); 292 PXOPT_COPY_F64(config->args, where, "-airmass_min", "airmass", ">="); 293 PXOPT_COPY_F64(config->args, where, "-airmass_max", "airmass", "<"); 294 PXOPT_COPY_F64(config->args, where, "-ra_min", "ra", ">="); 295 PXOPT_COPY_F64(config->args, where, "-ra_max", "ra", "<"); 296 PXOPT_COPY_F64(config->args, where, "-decl_min", "decl", ">="); 297 PXOPT_COPY_F64(config->args, where, "-decl_max", "decl", "<"); 298 PXOPT_COPY_F32(config->args, where, "-exp_time_min", "exp_time", ">="); 299 PXOPT_COPY_F32(config->args, where, "-exp_time_max", "exp_time", "<"); 300 PXOPT_COPY_F32(config->args, where, "-sat_pixel_frac_min", "sat_pixel_frac", ">="); 301 PXOPT_COPY_F32(config->args, where, "-sat_pixel_frac_max", "sat_pixel_frac", "<"); 302 PXOPT_COPY_F64(config->args, where, "-bg_min", "bg", ">="); 303 PXOPT_COPY_F64(config->args, where, "-bg_max", "bg", "<"); 304 PXOPT_COPY_F64(config->args, where, "-bg_stdev_min", "bg_stdev", ">="); 305 PXOPT_COPY_F64(config->args, where, "-bg_stdev_max", "bg_stdev", "<"); 306 PXOPT_COPY_F64(config->args, where, "-bg_mean_stdev_min", "bg_mean_stdev", ">="); 307 PXOPT_COPY_F64(config->args, where, "-bg_mean_stdev_max", "bg_mean_stdev", "<"); 308 PXOPT_COPY_F64(config->args, where, "-alt_min", "alt", ">="); 309 PXOPT_COPY_F64(config->args, where, "-alt_max", "alt", "<"); 310 PXOPT_COPY_F64(config->args, where, "-az_min", "az", ">="); 311 PXOPT_COPY_F64(config->args, where, "-az_max", "az", "<"); 312 PXOPT_COPY_F32(config->args, where, "-ccd_temp_min", "ccd_temp", ">="); 313 PXOPT_COPY_F32(config->args, where, "-ccd_temp_max", "ccd_temp", "<"); 314 PXOPT_COPY_F64(config->args, where, "-posang_min", "posang", ">="); 315 PXOPT_COPY_F64(config->args, where, "-posang_max", "posang", "<"); 316 PXOPT_COPY_STR(config->args, where, "-object", "object", "=="); 317 PXOPT_COPY_F32(config->args, where, "-solang_min", "solang", ">="); 318 PXOPT_COPY_F32(config->args, where, "-solang_max", "solang", "<"); 319 PXOPT_COPY_STR(config->args, where, "-label", "label", "=="); 320 321 if (!psListLength(where->list) 322 && !psMetadataLookupBool(NULL, config->args, "-all")) { 323 psFree(where); 324 where = NULL; 325 psError(PXTOOLS_ERR_DATA, false, "search parameters are required"); 326 return false; 327 } 328 329 PXOPT_LOOKUP_STR(state, config->args, "-state", false, false); 330 PXOPT_LOOKUP_STR(label, config->args, "-set_label", false, false); 331 332 if ((!state) && (!label)) { 333 psError(PXTOOLS_ERR_DATA, false, "parameters are required"); 334 psFree(where); 335 return false; 336 } 337 338 if (state) { 339 // set chipRun.state to state 340 if (!pxchipRunSetStateByQuery(config, where, state)) { 341 psFree(where); 342 return false; 343 } 344 } 345 346 if (label) { 347 // set chipRun.label to label 348 if (!pxchipRunSetLabelByQuery(config, where, label)) { 349 psFree(where); 350 return false; 351 } 352 } 353 354 psFree(where); 355 356 return true; 357 } 358 359 360 static bool pendingimfileMode(pxConfig *config) 361 { 362 PS_ASSERT_PTR_NON_NULL(config, NULL); 363 364 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 365 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 366 367 psMetadata *where = psMetadataAlloc(); 368 PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false); 369 // convert chip_id into a psS64 370 if (chip_id) { 371 if (!psMetadataAddS64(where, PS_LIST_TAIL, "chipRun.chip_id", 0, "==", (psS64)atoll(chip_id))) { 372 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id"); 373 psFree(where); 374 return false; 375 } 376 } 377 378 PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false); 379 // convert exp_id into a psS64 380 if (exp_id) { 381 if (!psMetadataAddS64(where, PS_LIST_TAIL, "rawExp.exp_id", 0, "==", (psS64)atoll(exp_id))) { 382 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id"); 383 psFree(where); 384 return false; 385 } 386 } 387 388 PXOPT_COPY_STR(config->args, where, "-class_id", "rawImfile.class_id", "=="); 389 PXOPT_COPY_STR(config->args, where, "-inst", "rawExp.telescope", "=="); 390 PXOPT_COPY_STR(config->args, where, "-filter", "rawExp.filter", "=="); 391 392 psString query = pxDataGet("chiptool_pendingimfile.sql"); 393 if (!query) { 394 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 395 return false; 396 } 397 398 if (where && psListLength(where->list)) { 399 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 400 psStringAppend(&query, " AND %s", whereClause); 401 psFree(whereClause); 402 } 403 psFree(where); 404 405 // treat limit == 0 as "no limit" 406 if (limit) { 407 psString limitString = psDBGenerateLimitSQL(limit); 408 psStringAppend(&query, " %s", limitString); 409 psFree(limitString); 410 } 411 412 if (!p_psDBRunQuery(config->dbh, query)) { 413 psError(PS_ERR_UNKNOWN, false, "database error"); 414 psFree(query); 415 return false; 416 } 417 psFree(query); 418 419 psArray *output = p_psDBFetchResult(config->dbh); 420 if (!output) { 421 psError(PS_ERR_UNKNOWN, false, "database error"); 422 return false; 423 } 424 if (!psArrayLength(output)) { 425 psTrace("chiptool", PS_LOG_INFO, "no rows found"); 426 psFree(output); 427 return true; 428 } 429 430 if (!convertIdToStr(output)) { 431 psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings"); 432 psFree(output); 433 return false; 434 } 435 436 // negative simple so the default is true 437 if (!ippdbPrintMetadatas(stdout, output, "chipPendingImfile", !simple)) { 438 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 439 psFree(output); 440 return false; 441 } 442 443 psFree(output); 444 445 return true; 446 } 447 448 449 static bool addprocessedimfileMode(pxConfig *config) 450 { 451 PS_ASSERT_PTR_NON_NULL(config, false); 452 453 // chip_id, ext_tag, class_id are required 454 PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", true, false); 455 PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", true, false); 456 PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", true, false); 457 458 // optional 459 PXOPT_LOOKUP_STR(uri, config->args, "-uri", false, false); 460 PXOPT_LOOKUP_F32(bg, config->args, "-bg", false, false); 461 PXOPT_LOOKUP_F32(bg_stdev, config->args, "-bg_stdev", false, false); 462 PXOPT_LOOKUP_F32(bg_mean_stdev, config->args, "-bg_mean_stdev", false, false); 463 PXOPT_LOOKUP_F32(bias, config->args, "-bias", false, false); 464 PXOPT_LOOKUP_F32(bias_stdev, config->args, "-bias_stdev", false, false); 465 PXOPT_LOOKUP_F32(fringe_0, config->args, "-fringe_0", false, false); 466 PXOPT_LOOKUP_F32(fringe_1, config->args, "-fringe_1", false, false); 467 PXOPT_LOOKUP_F32(fringe_2, config->args, "-fringe_2", false, false); 468 PXOPT_LOOKUP_F32(sigma_ra, config->args, "-sigma_ra", false, false); 469 PXOPT_LOOKUP_F32(sigma_dec, config->args, "-sigma_dec", false, false); 470 PXOPT_LOOKUP_F32(ap_resid, config->args, "-ap_resid", false, false); 471 PXOPT_LOOKUP_F32(ap_resid_stdev, config->args, "-ap_resid_stdev", false, false); 472 PXOPT_LOOKUP_F32(zp_mean, config->args, "-zp_mean", false, false); 473 PXOPT_LOOKUP_F32(zp_stdev, config->args, "-zp_stdev", false, false); 474 PXOPT_LOOKUP_F32(fwhm_major, config->args, "-fwhm_major", false, false); 475 PXOPT_LOOKUP_F32(fwhm_minor, config->args, "-fwhm_minor", false, false); 476 PXOPT_LOOKUP_F32(dtime_detrend, config->args, "-dtime_detrend", false, false); 477 PXOPT_LOOKUP_F32(dtime_photom, config->args, "-dtime_photom", false, false); 478 PXOPT_LOOKUP_F32(dtime_astrom, config->args, "-dtime_astrom", false, false); 479 PXOPT_LOOKUP_STR(hostname, config->args, "-hostname", false, false); 480 PXOPT_LOOKUP_F32(n_stars, config->args, "-n_stars", false, false); 481 PXOPT_LOOKUP_F32(n_extended, config->args, "-n_extended", false, false); 482 PXOPT_LOOKUP_F32(n_cr, config->args, "-n_cr", false, false); 483 PXOPT_LOOKUP_F32(n_astrom, config->args, "-n_astrom", false, false); 484 PXOPT_LOOKUP_STR(path_base, config->args, "-path_base", false, false); 485 486 // default values 487 PXOPT_LOOKUP_S16(code, config->args, "-code", false, false); 488 489 if (!psDBTransaction(config->dbh)) { 490 psError(PS_ERR_UNKNOWN, false, "database error"); 491 return false; 492 } 493 494 if (!chipProcessedImfileInsert(config->dbh, 495 (psS64)atoll(chip_id), 496 (psS64)atoll(exp_id), 497 class_id, 498 uri, 499 bg, 500 bg_stdev, 501 bg_mean_stdev, 502 bias, 503 bias_stdev, 504 fringe_0, 505 fringe_1, 506 fringe_2, 507 sigma_ra, 508 sigma_dec, 509 ap_resid, 510 ap_resid_stdev, 511 zp_mean, 512 zp_stdev, 513 fwhm_major, 514 fwhm_minor, 515 dtime_detrend, 516 dtime_photom, 517 dtime_astrom, 518 hostname, 519 n_stars, 520 n_extended, 521 n_cr, 522 n_astrom, 523 path_base, 524 code 525 )) { 526 // rollback 527 if (!psDBRollback(config->dbh)) { 528 psError(PS_ERR_UNKNOWN, false, "database error"); 529 } 530 psError(PS_ERR_UNKNOWN, false, "database error"); 531 return false; 532 } 533 534 // XXX I've decided to make the transaction cover the Exp migration as 535 // well. Otherwise, if the last imfile in an exp is moved and the exp 536 // migration fails then the data base is left in a satuation where the exp 537 // migration can't happen. 538 539 if (!chipProcessedCompleteExp(config)) { 540 // rollback 541 if (!psDBRollback(config->dbh)) { 542 psError(PS_ERR_UNKNOWN, false, "database error"); 543 } 544 psError(PS_ERR_UNKNOWN, false, "database error"); 545 return false; 546 } 547 548 if (!psDBCommit(config->dbh)) { 549 psError(PS_ERR_UNKNOWN, false, "database error"); 550 return false; 551 } 552 553 return true; 554 } 555 556 557 static bool processedimfileMode(pxConfig *config) 558 { 559 PS_ASSERT_PTR_NON_NULL(config, NULL); 560 561 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 562 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 563 PXOPT_LOOKUP_BOOL(faulted, config->args, "-faulted", false); 564 565 psMetadata *where = psMetadataAlloc(); 566 PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false); 567 // convert chip_id into a psS64 568 if (chip_id) { 569 if (!psMetadataAddS64(where, PS_LIST_TAIL, "chipRun.chip_id", 0, "==", (psS64)atoll(chip_id))) { 570 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id"); 571 psFree(where); 572 return false; 573 } 574 } 575 576 PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false); 577 // convert exp_id into a psS64 578 if (exp_id) { 579 if (!psMetadataAddS64(where, PS_LIST_TAIL, "rawExp.exp_id", 0, "==", (psS64)atoll(exp_id))) { 580 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id"); 581 psFree(where); 582 return false; 583 } 584 } 585 586 PXOPT_COPY_STR(config->args, where, "-class_id", "rawImfile.class_id", "=="); 587 PXOPT_COPY_STR(config->args, where, "-inst", "rawExp.telescope", "=="); 588 PXOPT_COPY_STR(config->args, where, "-filter", "rawExp.filter", "=="); 589 590 psString query = pxDataGet("chiptool_processedimfile.sql"); 591 if (!query) { 592 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 593 return false; 594 } 595 596 if (where && psListLength(where->list)) { 597 psString whereClause = psDBGenerateWhereConditionSQL(where, "chipProcessedImfile"); 598 psStringAppend(&query, " AND %s", whereClause); 599 psFree(whereClause); 600 } 601 psFree(where); 602 603 if (faulted) { 604 // list only faulted rows 605 psStringAppend(&query, " %s", "AND chipProcessedImfile.fault != 0"); 606 } else { 607 // don't list faulted rows 608 psStringAppend(&query, " %s", "AND chipProcessedImfile.fault = 0"); 609 } 610 611 // treat limit == 0 as "no limit" 612 if (limit) { 613 psString limitString = psDBGenerateLimitSQL(limit); 614 psStringAppend(&query, " %s", limitString); 615 psFree(limitString); 616 } 617 618 if (!p_psDBRunQuery(config->dbh, query)) { 619 psError(PS_ERR_UNKNOWN, false, "database error"); 620 psFree(query); 621 return false; 622 } 623 psFree(query); 624 625 psArray *output = p_psDBFetchResult(config->dbh); 626 if (!output) { 627 psError(PS_ERR_UNKNOWN, false, "database error"); 628 return false; 629 } 630 if (!psArrayLength(output)) { 631 psTrace("chiptool", PS_LOG_INFO, "no rows found"); 632 psFree(output); 633 return true; 634 } 635 636 if (!convertIdToStr(output)) { 637 psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings"); 638 psFree(output); 639 return false; 640 } 641 642 // negative simple so the default is true 643 if (!ippdbPrintMetadatas(stdout, output, "chipProcessedImfile", !simple)) { 644 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 645 psFree(output); 646 return false; 647 } 648 649 psFree(output); 650 651 return true; 652 } 653 654 static bool revertprocessedimfileMode(pxConfig *config) 655 { 656 PS_ASSERT_PTR_NON_NULL(config, false); 657 658 psMetadata *where = psMetadataAlloc(); 659 PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false); 660 // convert chip_id into a psS64 661 if (chip_id) { 662 if (!psMetadataAddS64(where, PS_LIST_TAIL, "chip_id", 0, "==", (psS64)atoll(chip_id))) { 663 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id"); 664 psFree(where); 665 return false; 666 } 667 } 668 669 PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false); 107 670 // convert exp_id into a psS64 108 671 if (exp_id) { … … 158 721 } 159 722 160 PXOPT_LOOKUP_STR(workdir, config->args, "-set_workdir", false, false);161 PXOPT_LOOKUP_STR(label, config->args, "-set_label", false, false);162 PXOPT_LOOKUP_STR(reduction, config->args, "-set_reduction", false, false);163 PXOPT_LOOKUP_STR(expgroup, config->args, "-set_expgroup", false, false);164 PXOPT_LOOKUP_STR(dvodb, config->args, "-set_dvodb", false, false);165 PXOPT_LOOKUP_STR(tess_id, config->args, "-set_tess_id", false, false);166 PXOPT_LOOKUP_STR(end_stage, config->args, "-set_end_stage", false, false);167 168 // default169 PXOPT_COPY_STR(config->args, where, "-exp_type", "exp_type", "==");170 PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false);171 172 // find the exp_id of all the exposures that we want to queue up.173 psString query = pxDataGet("chiptool_find_rawexp.sql");174 if (!query) {175 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");176 psFree(where);177 return false;178 }179 180 if (where && psListLength(where->list)) {181 psString whereClause = psDBGenerateWhereConditionSQL(where, "rawExp");182 psStringAppend(&query, " AND %s", whereClause);183 psFree(whereClause);184 }185 186 psFree(where);187 188 if (pretend) {189 // then stop before running the query190 fprintf(stderr, "%s\n", query);191 psFree(query);192 return true;193 }194 195 if (!p_psDBRunQuery(config->dbh, query)) {196 psError(PS_ERR_UNKNOWN, false, "database error");197 psFree(query);198 return false;199 }200 psFree(query);201 202 psArray *output = p_psDBFetchResult(config->dbh);203 if (!output) {204 psError(PS_ERR_UNKNOWN, false, "database error");205 return false;206 }207 if (!psArrayLength(output)) {208 psTrace("chiptool", PS_LOG_INFO, "no rows found");209 psFree(output);210 return true;211 }212 213 // start a transaction so we don't end up with an exp without any associted214 // imfiles215 if (!psDBTransaction(config->dbh)) {216 psError(PS_ERR_UNKNOWN, false, "database error");217 psFree(output);218 return false;219 }220 221 // loop over our list of exp_ids222 for (long i = 0; i < psArrayLength(output); i++) {223 psMetadata *md = output->data[i];224 225 bool status;226 psS64 exp_id = psMetadataLookupS64(&status, md, "exp_id");227 if (!status) {228 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for exp_id");229 psFree(output);230 return false;231 }232 233 // queue the exp234 if (!pxchipQueueByExpTag(config, exp_id, workdir, label, reduction, expgroup, dvodb, tess_id, end_stage)) {235 if (!psDBRollback(config->dbh)) {236 psError(PS_ERR_UNKNOWN, false, "database error");237 }238 psError(PS_ERR_UNKNOWN, false,239 "failed to trying to queue exp_id: %" PRId64, exp_id);240 psFree(output);241 return false;242 }243 }244 psFree(output);245 246 if (!psDBCommit(config->dbh)) {247 psError(PS_ERR_UNKNOWN, false, "database error");248 return false;249 }250 251 return true;252 }253 254 255 static bool updaterunMode(pxConfig *config)256 {257 PS_ASSERT_PTR_NON_NULL(config, NULL);258 259 psMetadata *where = psMetadataAlloc();260 PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false);261 // convert chip_id into a psS64262 if (chip_id) {263 if (!psMetadataAddS64(where, PS_LIST_TAIL, "chip_id", 0, "==", (psS64)atoll(chip_id))) {264 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");265 psFree(where);266 return false;267 }268 }269 270 PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);271 // convert exp_id into a psS64272 if (exp_id) {273 if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", 0, "==", (psS64)atoll(exp_id))) {274 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");275 psFree(where);276 return false;277 }278 }279 280 PXOPT_COPY_STR(config->args, where, "-exp_name", "exp_name", "==");281 PXOPT_COPY_STR(config->args, where, "-inst", "camera", "==");282 PXOPT_COPY_STR(config->args, where, "-telescope", "telescope", "==");283 PXOPT_COPY_TIME(config->args, where, "-dateobs_begin", "dateobs", ">=");284 PXOPT_COPY_TIME(config->args, where, "-dateobs_end", "dateobs", "<=");285 PXOPT_COPY_STR(config->args, where, "-exp_tag", "exp_tag", "==");286 PXOPT_COPY_STR(config->args, where, "-filelevel", "filelevel", "==");287 PXOPT_COPY_STR(config->args, where, "-reduction", "reduction", "==");288 PXOPT_COPY_STR(config->args, where, "-filter", "filter", "==");289 PXOPT_COPY_F64(config->args, where, "-airmass_min", "airmass", ">=");290 PXOPT_COPY_F64(config->args, where, "-airmass_max", "airmass", "<");291 PXOPT_COPY_F64(config->args, where, "-ra_min", "ra", ">=");292 PXOPT_COPY_F64(config->args, where, "-ra_max", "ra", "<");293 PXOPT_COPY_F64(config->args, where, "-decl_min", "decl", ">=");294 PXOPT_COPY_F64(config->args, where, "-decl_max", "decl", "<");295 PXOPT_COPY_F32(config->args, where, "-exp_time_min", "exp_time", ">=");296 PXOPT_COPY_F32(config->args, where, "-exp_time_max", "exp_time", "<");297 PXOPT_COPY_F32(config->args, where, "-sat_pixel_frac_min", "sat_pixel_frac", ">=");298 PXOPT_COPY_F32(config->args, where, "-sat_pixel_frac_max", "sat_pixel_frac", "<");299 PXOPT_COPY_F64(config->args, where, "-bg_min", "bt", ">=");300 PXOPT_COPY_F64(config->args, where, "-bg_max", "bt", "<");301 PXOPT_COPY_F64(config->args, where, "-bg_stdev_min", "bg_stdev", ">=");302 PXOPT_COPY_F64(config->args, where, "-bg_stdev_max", "bg_stdev", "<");303 PXOPT_COPY_F64(config->args, where, "-bg_mean_stdev_min", "bg_mean_stdev", ">=");304 PXOPT_COPY_F64(config->args, where, "-bg_mean_stdev_max", "bg_mean_stdev", "<");305 PXOPT_COPY_F64(config->args, where, "-alt_min", "alt", ">=");306 PXOPT_COPY_F64(config->args, where, "-alt_max", "alt", "<");307 PXOPT_COPY_F64(config->args, where, "-az_min", "az", ">=");308 PXOPT_COPY_F64(config->args, where, "-az_max", "az", "<");309 PXOPT_COPY_F32(config->args, where, "-ccd_temp_min", "ccd_temp", ">=");310 PXOPT_COPY_F32(config->args, where, "-ccd_temp_max", "ccd_temp", "<");311 PXOPT_COPY_F64(config->args, where, "-posang_min", "posang", ">=");312 PXOPT_COPY_F64(config->args, where, "-posang_max", "posang", "<");313 PXOPT_COPY_STR(config->args, where, "-object", "object", "==");314 PXOPT_COPY_F32(config->args, where, "-solang_min", "solang", ">=");315 PXOPT_COPY_F32(config->args, where, "-solang_max", "solang", "<");316 317 if (!psListLength(where->list)318 && !psMetadataLookupBool(NULL, config->args, "-all")) {319 psFree(where);320 where = NULL;321 psError(PXTOOLS_ERR_DATA, false, "search parameters are required");322 return false;323 }324 325 PXOPT_LOOKUP_STR(state, config->args, "-state", false, false);326 PXOPT_LOOKUP_STR(label, config->args, "-label", false, false);327 328 if ((!state) && (!label)) {329 psError(PXTOOLS_ERR_DATA, false, "parameters are required");330 psFree(where);331 return false;332 }333 334 if (state) {335 // set chipRun.state to state336 if (!pxchipRunSetStateByQuery(config, where, state)) {337 psFree(where);338 return false;339 }340 }341 342 if (label) {343 // set chipRun.label to label344 if (!pxchipRunSetLabelByQuery(config, where, label)) {345 psFree(where);346 return false;347 }348 }349 350 psFree(where);351 352 return true;353 }354 355 356 static bool pendingimfileMode(pxConfig *config)357 {358 PS_ASSERT_PTR_NON_NULL(config, NULL);359 360 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);361 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);362 363 psMetadata *where = psMetadataAlloc();364 PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false);365 // convert chip_id into a psS64366 if (chip_id) {367 if (!psMetadataAddS64(where, PS_LIST_TAIL, "chipRun.chip_id", 0, "==", (psS64)atoll(chip_id))) {368 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");369 psFree(where);370 return false;371 }372 }373 374 PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);375 // convert exp_id into a psS64376 if (exp_id) {377 if (!psMetadataAddS64(where, PS_LIST_TAIL, "rawExp.exp_id", 0, "==", (psS64)atoll(exp_id))) {378 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");379 psFree(where);380 return false;381 }382 }383 384 PXOPT_COPY_STR(config->args, where, "-class_id", "rawImfile.class_id", "==");385 PXOPT_COPY_STR(config->args, where, "-inst", "rawExp.telescope", "==");386 PXOPT_COPY_STR(config->args, where, "-filter", "rawExp.filter", "==");387 388 psString query = pxDataGet("chiptool_pendingimfile.sql");389 if (!query) {390 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");391 return false;392 }393 394 if (where && psListLength(where->list)) {395 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL);396 psStringAppend(&query, " AND %s", whereClause);397 psFree(whereClause);398 }399 psFree(where);400 401 // treat limit == 0 as "no limit"402 if (limit) {403 psString limitString = psDBGenerateLimitSQL(limit);404 psStringAppend(&query, " %s", limitString);405 psFree(limitString);406 }407 408 if (!p_psDBRunQuery(config->dbh, query)) {409 psError(PS_ERR_UNKNOWN, false, "database error");410 psFree(query);411 return false;412 }413 psFree(query);414 415 psArray *output = p_psDBFetchResult(config->dbh);416 if (!output) {417 psError(PS_ERR_UNKNOWN, false, "database error");418 return false;419 }420 if (!psArrayLength(output)) {421 psTrace("chiptool", PS_LOG_INFO, "no rows found");422 psFree(output);423 return true;424 }425 426 if (!convertIdToStr(output)) {427 psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");428 psFree(output);429 return false;430 }431 432 // negative simple so the default is true433 if (!ippdbPrintMetadatas(stdout, output, "chipPendingImfile", !simple)) {434 psError(PS_ERR_UNKNOWN, false, "failed to print array");435 psFree(output);436 return false;437 }438 439 psFree(output);440 441 return true;442 }443 444 445 static bool addprocessedimfileMode(pxConfig *config)446 {447 PS_ASSERT_PTR_NON_NULL(config, false);448 449 // chip_id, ext_tag, class_id are required450 PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", true, false);451 PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", true, false);452 PXOPT_LOOKUP_STR(class_id, config->args, "-class_id", true, false);453 454 // optional455 PXOPT_LOOKUP_STR(uri, config->args, "-uri", false, false);456 PXOPT_LOOKUP_F32(bg, config->args, "-bg", false, false);457 PXOPT_LOOKUP_F32(bg_stdev, config->args, "-bg_stdev", false, false);458 PXOPT_LOOKUP_F32(bg_mean_stdev, config->args, "-bg_mean_stdev", false, false);459 PXOPT_LOOKUP_F32(bias, config->args, "-bias", false, false);460 PXOPT_LOOKUP_F32(bias_stdev, config->args, "-bias_stdev", false, false);461 PXOPT_LOOKUP_F32(fringe_0, config->args, "-fringe_0", false, false);462 PXOPT_LOOKUP_F32(fringe_1, config->args, "-fringe_1", false, false);463 PXOPT_LOOKUP_F32(fringe_2, config->args, "-fringe_2", false, false);464 PXOPT_LOOKUP_F32(sigma_ra, config->args, "-sigma_ra", false, false);465 PXOPT_LOOKUP_F32(sigma_dec, config->args, "-sigma_dec", false, false);466 PXOPT_LOOKUP_F32(ap_resid, config->args, "-ap_resid", false, false);467 PXOPT_LOOKUP_F32(ap_resid_stdev, config->args, "-ap_resid_stdev", false, false);468 PXOPT_LOOKUP_F32(zp_mean, config->args, "-zp_mean", false, false);469 PXOPT_LOOKUP_F32(zp_stdev, config->args, "-zp_stdev", false, false);470 PXOPT_LOOKUP_F32(fwhm_major, config->args, "-fwhm_major", false, false);471 PXOPT_LOOKUP_F32(fwhm_minor, config->args, "-fwhm_minor", false, false);472 PXOPT_LOOKUP_F32(dtime_detrend, config->args, "-dtime_detrend", false, false);473 PXOPT_LOOKUP_F32(dtime_photom, config->args, "-dtime_photom", false, false);474 PXOPT_LOOKUP_F32(dtime_astrom, config->args, "-dtime_astrom", false, false);475 PXOPT_LOOKUP_STR(hostname, config->args, "-hostname", false, false);476 PXOPT_LOOKUP_F32(n_stars, config->args, "-n_stars", false, false);477 PXOPT_LOOKUP_F32(n_extended, config->args, "-n_extended", false, false);478 PXOPT_LOOKUP_F32(n_cr, config->args, "-n_cr", false, false);479 PXOPT_LOOKUP_F32(n_astrom, config->args, "-n_astrom", false, false);480 PXOPT_LOOKUP_STR(path_base, config->args, "-path_base", false, false);481 482 // default values483 PXOPT_LOOKUP_S16(code, config->args, "-code", false, false);484 485 if (!psDBTransaction(config->dbh)) {486 psError(PS_ERR_UNKNOWN, false, "database error");487 return false;488 }489 490 if (!chipProcessedImfileInsert(config->dbh,491 (psS64)atoll(chip_id),492 (psS64)atoll(exp_id),493 class_id,494 uri,495 bg,496 bg_stdev,497 bg_mean_stdev,498 bias,499 bias_stdev,500 fringe_0,501 fringe_1,502 fringe_2,503 sigma_ra,504 sigma_dec,505 ap_resid,506 ap_resid_stdev,507 zp_mean,508 zp_stdev,509 fwhm_major,510 fwhm_minor,511 dtime_detrend,512 dtime_photom,513 dtime_astrom,514 hostname,515 n_stars,516 n_extended,517 n_cr,518 n_astrom,519 path_base,520 code521 )) {522 // rollback523 if (!psDBRollback(config->dbh)) {524 psError(PS_ERR_UNKNOWN, false, "database error");525 }526 psError(PS_ERR_UNKNOWN, false, "database error");527 return false;528 }529 530 // XXX I've decided to make the transaction cover the Exp migration as531 // well. Otherwise, if the last imfile in an exp is moved and the exp532 // migration fails then the data base is left in a satuation where the exp533 // migration can't happen.534 535 if (!chipProcessedCompleteExp(config)) {536 // rollback537 if (!psDBRollback(config->dbh)) {538 psError(PS_ERR_UNKNOWN, false, "database error");539 }540 psError(PS_ERR_UNKNOWN, false, "database error");541 return false;542 }543 544 if (!psDBCommit(config->dbh)) {545 psError(PS_ERR_UNKNOWN, false, "database error");546 return false;547 }548 549 return true;550 }551 552 553 static bool processedimfileMode(pxConfig *config)554 {555 PS_ASSERT_PTR_NON_NULL(config, NULL);556 557 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false);558 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false);559 PXOPT_LOOKUP_BOOL(faulted, config->args, "-faulted", false);560 561 psMetadata *where = psMetadataAlloc();562 PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false);563 // convert chip_id into a psS64564 if (chip_id) {565 if (!psMetadataAddS64(where, PS_LIST_TAIL, "chipRun.chip_id", 0, "==", (psS64)atoll(chip_id))) {566 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");567 psFree(where);568 return false;569 }570 }571 572 PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);573 // convert exp_id into a psS64574 if (exp_id) {575 if (!psMetadataAddS64(where, PS_LIST_TAIL, "rawExp.exp_id", 0, "==", (psS64)atoll(exp_id))) {576 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");577 psFree(where);578 return false;579 }580 }581 582 PXOPT_COPY_STR(config->args, where, "-class_id", "rawImfile.class_id", "==");583 PXOPT_COPY_STR(config->args, where, "-inst", "rawExp.telescope", "==");584 PXOPT_COPY_STR(config->args, where, "-filter", "rawExp.filter", "==");585 586 psString query = pxDataGet("chiptool_processedimfile.sql");587 if (!query) {588 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement");589 return false;590 }591 592 if (where && psListLength(where->list)) {593 psString whereClause = psDBGenerateWhereConditionSQL(where, "chipProcessedImfile");594 psStringAppend(&query, " AND %s", whereClause);595 psFree(whereClause);596 }597 psFree(where);598 599 if (faulted) {600 // list only faulted rows601 psStringAppend(&query, " %s", "AND chipProcessedImfile.fault != 0");602 } else {603 // don't list faulted rows604 psStringAppend(&query, " %s", "AND chipProcessedImfile.fault = 0");605 }606 607 // treat limit == 0 as "no limit"608 if (limit) {609 psString limitString = psDBGenerateLimitSQL(limit);610 psStringAppend(&query, " %s", limitString);611 psFree(limitString);612 }613 614 if (!p_psDBRunQuery(config->dbh, query)) {615 psError(PS_ERR_UNKNOWN, false, "database error");616 psFree(query);617 return false;618 }619 psFree(query);620 621 psArray *output = p_psDBFetchResult(config->dbh);622 if (!output) {623 psError(PS_ERR_UNKNOWN, false, "database error");624 return false;625 }626 if (!psArrayLength(output)) {627 psTrace("chiptool", PS_LOG_INFO, "no rows found");628 psFree(output);629 return true;630 }631 632 if (!convertIdToStr(output)) {633 psError(PS_ERR_UNKNOWN, false, "failed to convert id fields into a strings");634 psFree(output);635 return false;636 }637 638 // negative simple so the default is true639 if (!ippdbPrintMetadatas(stdout, output, "chipProcessedImfile", !simple)) {640 psError(PS_ERR_UNKNOWN, false, "failed to print array");641 psFree(output);642 return false;643 }644 645 psFree(output);646 647 return true;648 }649 650 static bool revertprocessedimfileMode(pxConfig *config)651 {652 PS_ASSERT_PTR_NON_NULL(config, false);653 654 psMetadata *where = psMetadataAlloc();655 PXOPT_LOOKUP_STR(chip_id, config->args, "-chip_id", false, false);656 // convert chip_id into a psS64657 if (chip_id) {658 if (!psMetadataAddS64(where, PS_LIST_TAIL, "chip_id", 0, "==", (psS64)atoll(chip_id))) {659 psError(PS_ERR_UNKNOWN, false, "failed to add item chip_id");660 psFree(where);661 return false;662 }663 }664 665 PXOPT_LOOKUP_STR(exp_id, config->args, "-exp_id", false, false);666 // convert exp_id into a psS64667 if (exp_id) {668 if (!psMetadataAddS64(where, PS_LIST_TAIL, "exp_id", 0, "==", (psS64)atoll(exp_id))) {669 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");670 psFree(where);671 return false;672 }673 }674 675 PXOPT_COPY_STR(config->args, where, "-exp_name", "exp_name", "==");676 PXOPT_COPY_STR(config->args, where, "-inst", "camera", "==");677 PXOPT_COPY_STR(config->args, where, "-telescope", "telescope", "==");678 PXOPT_COPY_TIME(config->args, where, "-dateobs_begin", "dateobs", ">=");679 PXOPT_COPY_TIME(config->args, where, "-dateobs_end", "dateobs", "<=");680 PXOPT_COPY_STR(config->args, where, "-exp_tag", "exp_tag", "==");681 PXOPT_COPY_STR(config->args, where, "-filelevel", "filelevel", "==");682 PXOPT_COPY_STR(config->args, where, "-reduction", "reduction", "==");683 PXOPT_COPY_STR(config->args, where, "-filter", "filter", "==");684 PXOPT_COPY_F64(config->args, where, "-airmass_min", "airmass", ">=");685 PXOPT_COPY_F64(config->args, where, "-airmass_max", "airmass", "<");686 PXOPT_COPY_F64(config->args, where, "-ra_min", "ra", ">=");687 PXOPT_COPY_F64(config->args, where, "-ra_max", "ra", "<");688 PXOPT_COPY_F64(config->args, where, "-decl_min", "decl", ">=");689 PXOPT_COPY_F64(config->args, where, "-decl_max", "decl", "<");690 PXOPT_COPY_F32(config->args, where, "-exp_time_min", "exp_time", ">=");691 PXOPT_COPY_F32(config->args, where, "-exp_time_max", "exp_time", "<");692 PXOPT_COPY_F32(config->args, where, "-sat_pixel_frac_min", "sat_pixel_frac", ">=");693 PXOPT_COPY_F32(config->args, where, "-sat_pixel_frac_max", "sat_pixel_frac", "<");694 PXOPT_COPY_F64(config->args, where, "-bg_min", "bt", ">=");695 PXOPT_COPY_F64(config->args, where, "-bg_max", "bt", "<");696 PXOPT_COPY_F64(config->args, where, "-bg_stdev_min", "bg_stdev", ">=");697 PXOPT_COPY_F64(config->args, where, "-bg_stdev_max", "bg_stdev", "<");698 PXOPT_COPY_F64(config->args, where, "-bg_mean_stdev_min", "bg_mean_stdev", ">=");699 PXOPT_COPY_F64(config->args, where, "-bg_mean_stdev_max", "bg_mean_stdev", "<");700 PXOPT_COPY_F64(config->args, where, "-alt_min", "alt", ">=");701 PXOPT_COPY_F64(config->args, where, "-alt_max", "alt", "<");702 PXOPT_COPY_F64(config->args, where, "-az_min", "az", ">=");703 PXOPT_COPY_F64(config->args, where, "-az_max", "az", "<");704 PXOPT_COPY_F32(config->args, where, "-ccd_temp_min", "ccd_temp", ">=");705 PXOPT_COPY_F32(config->args, where, "-ccd_temp_max", "ccd_temp", "<");706 PXOPT_COPY_F64(config->args, where, "-posang_min", "posang", ">=");707 PXOPT_COPY_F64(config->args, where, "-posang_max", "posang", "<");708 PXOPT_COPY_STR(config->args, where, "-object", "object", "==");709 PXOPT_COPY_F32(config->args, where, "-solang_min", "solang", ">=");710 PXOPT_COPY_F32(config->args, where, "-solang_max", "solang", "<");711 712 if (!psListLength(where->list)713 && !psMetadataLookupBool(NULL, config->args, "-all")) {714 psFree(where);715 psError(PXTOOLS_ERR_DATA, false, "search parameters are required");716 return false;717 }718 719 723 psString query = pxDataGet("chiptool_revertprocessedimfile.sql"); 720 724 if (!query) {
Note:
See TracChangeset
for help on using the changeset viewer.
