Changeset 8250 for trunk/ippTools/src/regtool.c
- Timestamp:
- Aug 8, 2006, 6:27:04 PM (20 years ago)
- File:
-
- 1 edited
-
trunk/ippTools/src/regtool.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippTools/src/regtool.c
r8188 r8250 8 8 #include "p0search.h" 9 9 10 static bool pendingMode(pxConfig *config); 11 static bool updateMode(pxConfig *config); 10 static bool pendingexpMode(pxConfig *config); 11 static bool pendingimfileMode(pxConfig *config); 12 static bool updateexpMode(pxConfig *config); 13 static bool updateimfileMode(pxConfig *config); 12 14 static psArray *newFrameSearchPending(pxConfig *config); 13 15 static p1PendingExpRow *newToP1PendingExp(newExpRow *newExp); … … 16 18 static rawScienceFrame *newToRawScienceFrame(pxConfig *config, newFrame *newFrame); 17 19 static rawScienceExpRow *newToRawScienceExp(pxConfig *config, newExpRow *exp); 20 static rawDetrendExpRow *newToRawDetrendExp(pxConfig *config, newExpRow *exp); 21 static rawImfileRow *newToRawImfile(pxConfig *config, newImfileRow *exp); 18 22 19 23 … … 32 36 33 37 switch (config->mode) { 34 MODECASE(P0SEARCH_MODE_PENDING, pendingMode); 35 MODECASE(P0SEARCH_MODE_UPDATE, updateMode); 38 MODECASE(P0SEARCH_MODE_PENDINGEXP, pendingexpMode); 39 MODECASE(P0SEARCH_MODE_PENDINGIMFILE, pendingimfileMode); 40 MODECASE(P0SEARCH_MODE_UPDATEEXP, updateexpMode); 41 MODECASE(P0SEARCH_MODE_UPDATEIMFILE, updateimfileMode); 36 42 default: 37 43 psAbort(argv[0], "invalid option (this should not happen)"); … … 52 58 } 53 59 54 static bool pending Mode(pxConfig *config)60 static bool pendingexpMode(pxConfig *config) 55 61 { 56 62 PS_ASSERT_PTR_NON_NULL(config, false); 57 63 58 psArray *new = newFrameSearchPending(config); 59 if (!new) { 60 psError(PS_ERR_UNKNOWN, false, "no newFrames found"); 61 return false; 62 } 63 64 bool status = newFramePrint(stdout, config, new); 65 if (!status) { 66 psError(PS_ERR_UNKNOWN, false,"newFramePrint() failed"); 67 psFree(new); 68 return false; 69 } 70 71 psFree(new); 64 // return only exps that are not in rawScienceExp or rawDetrendExp and have 65 // ALL of their imfiles in rawImfile (by count) and have no associated 66 // imfiles left in newImfile 67 68 char *query = 69 "SELECT newExp.* FROM newExp" 70 " LEFT JOIN rawScienceExp USING(exp_id)" 71 " LEFT JOIN rawDetrendExp USING (exp_id)" 72 " LEFT JOIN newImfile USING (exp_id)" 73 " WHERE newExp.exp_id is NOT NULL" 74 " AND rawScienceExp.exp_id IS NULL" 75 " AND rawDetrendExp.exp_id IS NULL" 76 " AND newImfile.exp_id IS NULL" 77 " AND newExp.imfiles = (SELECT COUNT(exp_id)" 78 " FROM rawImfile GROUP BY exp_id)"; 79 80 if (!p_psDBRunQuery(config->dbh, query)) { 81 psError(PS_ERR_UNKNOWN, false, "database error"); 82 return false; 83 } 84 85 psArray *output = p_psDBFetchResult(config->dbh); 86 if (!output) { 87 // XXX check psError here 88 psError(PS_ERR_UNKNOWN, false, "failed to fetch the database result"); 89 return false; 90 } 91 92 bool simple = false; 93 { 94 bool status = false; 95 simple = psMetadataLookupBool(&status, config->args, "-simple"); 96 if (!status) { 97 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple"); 98 return false; 99 } 100 } 101 102 // negate simple so the default is true 103 if (!ippdbPrintMetadatas(stdout, output, "newImfile", !simple)) { 104 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 105 psFree(output); 106 return false; 107 } 108 109 psFree(output); 72 110 73 111 return true; 74 112 } 75 113 76 static bool updateMode(pxConfig *config)114 static bool pendingimfileMode(pxConfig *config) 77 115 { 78 116 PS_ASSERT_PTR_NON_NULL(config, false); 117 118 // select newImfiles who's exp_id is in newExp AND don't have their exp_id 119 // in rawScienceExp or rawDetrendExp 120 // XXX having the same exp_id in newExp and raw*Exp is probably an error 121 // that should be checked for 122 char *query = 123 "SELECT newImfile.* FROM newImfile" 124 " LEFT JOIN newExp USING(exp_id)" 125 " LEFT JOIN rawScienceExp USING(exp_id)" 126 " LEFT JOIN rawDetrendExp USING (exp_id)" 127 " WHERE newExp.exp_id is NOT NULL" 128 " AND rawScienceExp.exp_id IS NULL" 129 " AND rawDetrendExp.exp_id IS NULL"; 130 131 if (!p_psDBRunQuery(config->dbh, query)) { 132 psError(PS_ERR_UNKNOWN, false, "database error"); 133 return false; 134 } 135 136 psArray *output = p_psDBFetchResult(config->dbh); 137 if (!output) { 138 // XXX check psError here 139 psError(PS_ERR_UNKNOWN, false, "failed to fetch the database result"); 140 return false; 141 } 142 143 bool simple = false; 144 { 145 bool status = false; 146 simple = psMetadataLookupBool(&status, config->args, "-simple"); 147 if (!status) { 148 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -simple"); 149 return false; 150 } 151 } 152 153 // negate simple so the default is true 154 if (!ippdbPrintMetadatas(stdout, output, "newImfile", !simple)) { 155 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 156 psFree(output); 157 return false; 158 } 159 160 psFree(output); 161 162 return true; 163 } 164 165 static bool updateexpMode(pxConfig *config) 166 { 167 PS_ASSERT_PTR_NON_NULL(config, false); 168 169 // make sure that the exp_id(s) are ready to be updated based on the same 170 // critera used in pendingexpMode 171 char *query = 172 "SELECT newImfile.* FROM newImfile" 173 " LEFT JOIN newExp USING(exp_id)" 174 " LEFT JOIN rawScienceExp USING(exp_id)" 175 " LEFT JOIN rawDetrendExp USING (exp_id)" 176 " WHERE newExp.exp_id is NOT NULL" 177 " AND rawScienceExp.exp_id IS NULL" 178 " AND rawDetrendExp.exp_id IS NULL"; 179 180 if (!p_psDBRunQuery(config->dbh, query)) { 181 psError(PS_ERR_UNKNOWN, false, "database error"); 182 return false; 183 } 184 185 psArray *output = p_psDBFetchResult(config->dbh); 186 if (!output) { 187 // XXX check psError here 188 psError(PS_ERR_UNKNOWN, false, "failed to fetch the database result"); 189 return false; 190 } 79 191 80 192 bool status = false; … … 85 197 } 86 198 87 psArray *new = newFrameSearchPending(config); 88 if (!new) { 89 psError(PS_ERR_UNKNOWN, false, "no newFrames found"); 90 return true; 91 } 92 93 // insert 'new' rawScience & detrendframes 94 if (psArrayLength(new) > 0) { 95 // start a transaction so we don't end up file raw* frames but no 96 // p2Pending*, etc. 199 for (long i = 0; psArrayLength(output) > i; i++) { 200 } 201 202 return true; 203 } 204 205 static bool updateimfileMode(pxConfig *config) 206 { 207 PS_ASSERT_PTR_NON_NULL(config, false); 208 209 // XXX search by the whole frame some imfiles without a newExp don't get 210 // processed -- this may not be the correct thing to do 211 char *query = 212 "SELECT * FROM" 213 " (SELECT newImfile.* FROM newImfile" 214 " LEFT JOIN newExp USING(exp_id)" 215 " LEFT JOIN rawScienceExp USING(exp_id)" 216 " LEFT JOIN rawDetrendExp USING (exp_id)" 217 " WHERE newExp.exp_id IS NOT NULL" 218 " AND rawScienceExp.exp_id IS NULL" 219 " AND rawDetrendExp.exp_id IS NULL) AS foo" 220 " %s"; // WHERE class is generated from exp_id, class, & class_id 221 222 char *whereClaus = NULL; 223 { 224 psMetadata *where = psMetadataAlloc(); 225 bool status = false; 226 psString exp_id = psMetadataLookupStr(&status, config->args, "-exp_id"); 227 if (!status) { 228 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_id"); 229 return false; 230 } 231 if (exp_id) { 232 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", exp_id)) { 233 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id"); 234 psFree(where); 235 return false; 236 } 237 } 238 psString class = psMetadataLookupStr(&status, config->args, "-class"); 239 if (!status) { 240 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -class"); 241 return false; 242 } 243 if (class) { 244 if (!psMetadataAddStr(where, PS_LIST_TAIL, "class", 0, "==", class)) { 245 psError(PS_ERR_UNKNOWN, false, "failed to add item class"); 246 psFree(where); 247 return false; 248 } 249 } 250 psString class_id = psMetadataLookupStr(&status, config->args, "-class_id"); 251 if (!status) { 252 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -class_id"); 253 return false; 254 } 255 if (class_id) { 256 if (!psMetadataAddStr(where, PS_LIST_TAIL, "class_id", 0, "==", class_id)) { 257 psError(PS_ERR_UNKNOWN, false, "failed to add item class_id"); 258 psFree(where); 259 return false; 260 } 261 } 262 263 // there's not 264 whereClaus = psDBGenerateWhereSQL(where); 265 psFree(where); 266 } 267 268 if (!p_psDBRunQuery(config->dbh, query, whereClaus)) { 269 psError(PS_ERR_UNKNOWN, false, "database error"); 270 psFree(whereClaus); 271 return false; 272 } 273 psFree(whereClaus); 274 275 psArray *newImfiles = p_psDBFetchResult(config->dbh); 276 if (!newImfiles) { 277 // XXX check psError here 278 psError(PS_ERR_UNKNOWN, false, "failed to fetch the database result"); 279 return false; 280 } 281 282 // insert 'newImfile's into rawImfile 283 if (psArrayLength(newImfiles) > 0) { 284 // start a transaction so we don't end up half of the imfiles we were 285 // trying to update uninserted 97 286 if (!psDBTransaction(config->dbh)) { 98 287 psError(PS_ERR_UNKNOWN, false, "database error"); 99 psFree(exp); 100 psFree(new); 288 psFree(newImfiles); 101 289 return false; 102 290 } 103 291 104 for (long i = 0; i < psArrayLength(new); i++) { 105 newFrame *newFrame = new->data[i]; 106 if (detrend) { 107 // it's a detrend frame 108 rawDetrendFrame *frame = newToRawDetrendFrame(config, newFrame); 109 if (!frame) { 110 psError(PS_ERR_UNKNOWN, false, "failed to convert new frame into a detrend frame"); 111 psFree(new); 112 return false; 113 } 114 if (!rawDetrendFrameInsert(config, frame)) { 115 // rollback 116 if (!psDBRollback(config->dbh)) { 117 psError(PS_ERR_UNKNOWN, false, "database error"); 118 } 119 psError(PS_ERR_UNKNOWN, false, "failed to insert frame into the database"); 120 psFree(frame); 121 psFree(new); 122 return false; 123 } 124 psFree(frame); 125 continue; 126 } 127 128 // else 129 // it's a science frame 130 // insert into into rawScienceExp 131 rawScienceFrame *frame = newToRawScienceFrame(config, newFrame); 132 if (!frame) { 292 for (long i = 0; i < psArrayLength(newImfiles); i++) { 293 newImfileRow *object = newImfileObjectFromMetadata(newImfiles->data[i]); 294 rawImfileRow *imfile = newToRawImfile(config, object); 295 psFree(object); 296 if (!imfile) { 133 297 // rollback 134 298 if (!psDBRollback(config->dbh)) { 135 299 psError(PS_ERR_UNKNOWN, false, "database error"); 136 300 } 137 psError(PS_ERR_UNKNOWN, false, "failed to c onvert new frame into a science frame");138 psFree(new );301 psError(PS_ERR_UNKNOWN, false, "failed to create a new rawImfile row"); 302 psFree(newImfiles); 139 303 return false; 140 304 } 141 if (!raw ScienceFrameInsert(config, frame)) {305 if (!rawImfileInsertObject(config->dbh, imfile)) { 142 306 // rollback 143 307 if (!psDBRollback(config->dbh)) { 144 308 psError(PS_ERR_UNKNOWN, false, "database error"); 145 309 } 146 psError(PS_ERR_UNKNOWN, false, "failed to insert frameinto the database");147 psFree( frame);148 psFree(new );310 psError(PS_ERR_UNKNOWN, false, "failed to insert row into the database"); 311 psFree(imfile); 312 psFree(newImfiles); 149 313 return false; 150 314 } 151 psFree(frame); 152 153 // insert into into p2PendingExp 154 // XXX add a newToP2PendingFrame() 155 // XXX add a p2PendingFrameInsert() 156 p2PendingExpRow *exp = newToP2PendingExp(config, newFrame->exposure); 157 if (!exp) { 158 // rollback 159 if (!psDBRollback(config->dbh)) { 160 psError(PS_ERR_UNKNOWN, false, "database error"); 161 } 162 psError(PS_ERR_UNKNOWN, false, "failed to convert newExp into a p2PendingExp"); 163 psFree(new); 164 return false; 165 } 166 167 if (!p2PendingExpInsertObject(config->dbh, exp)) { 168 // rollback 169 if (!psDBRollback(config->dbh)) { 170 psError(PS_ERR_UNKNOWN, false, "database error"); 171 } 172 psError(PS_ERR_UNKNOWN, false, "failed to insert p2PendingExp into the database"); 173 psFree(exp); 174 psFree(new); 175 return false; 176 } 177 psFree(exp); 178 179 // insert into into p2PendingImfiles 180 for (long i = 0; i < psArrayLength(newFrame->images); i++) { 181 p2PendingImfileRow *imfile = newImfileToP2PendingImfile(newFrame->images->data[i]); 182 if (!p2PendingImfileInsertObject(config->dbh, imfile)) { 183 // rollback 184 if (!psDBRollback(config->dbh)) { 185 psError(PS_ERR_UNKNOWN, false, "database error"); 186 } 187 psError(PS_ERR_UNKNOWN, false, "failed to insert p2PendingImfile into the database"); 188 psFree(imfile); 189 psFree(new); 190 return false; 191 } 192 psFree(imfile); 193 } 194 } 195 // point of no return for p2Pending[Exp|Imfile] 315 psFree(imfile); 316 } 317 318 // point of no return for rawImfile 196 319 if (!psDBCommit(config->dbh)) { 197 320 psError(PS_ERR_UNKNOWN, false, "database error"); 321 psFree(newImfiles); 198 322 return false; 199 323 } 200 324 } 201 325 202 psFree(new );326 psFree(newImfiles); 203 327 204 328 return true; 205 329 } 206 330 331 #if 0 207 332 static psArray *newFrameSearchPending(pxConfig *config) 208 333 { 209 334 PS_ASSERT_PTR_NON_NULL(config, NULL); 210 335 211 psArray *new = newFrameSearch(config); 212 if (!new) { 213 psError(PS_ERR_UNKNOWN, false, "no newFrames found"); 214 return false; 215 } 216 217 psArray *raw = rawScienceFrameSearch(config); 218 if (!raw) { 219 psError(PS_ERR_UNKNOWN, false, "no rawScienceFrames found"); 220 // return false; 221 } 222 223 psArray *rawDetrend = rawDetrendFrameSearch(config); 224 if (!rawDetrend) { 225 psError(PS_ERR_UNKNOWN, false, "no rawDetrendFrames found"); 226 // return false; 227 } 228 229 // ignore duplicate raw frames 230 if (raw) { 231 for (long i = 0; i < new->n; i++) { 232 newFrame *newFrame = new->data[i]; 233 for (long j = 0; j < raw->n; j++) { 234 rawScienceFrame *rawScienceFrame = raw->data[j]; 235 if (strcmp(newFrame->exposure->exp_id, 236 rawScienceFrame->exposure->exp_id) == 0) { 237 psArrayRemove(new, newFrame); 238 // dec the counter as the array just got shorter 239 //and we don't want to skip elemnts 240 i--; 241 break; 242 } 243 } 244 } 245 psFree(raw); 246 } 247 248 // ignore duplicate rawDetrend frames 249 if (rawDetrend) { 250 for (long i = 0; i < new->n; i++) { 251 newFrame *newFrame = new->data[i]; 252 for (long j = 0; j < rawDetrend->n; j++) { 253 rawDetrendFrame *rawDetrendFrame = rawDetrend->data[j]; 254 if (strcmp(newFrame->exposure->exp_id, 255 rawDetrendFrame->exposure->exp_id) == 0) { 256 psArrayRemove(new, newFrame); 257 // dec the counter as the array just got shorter 258 //and we don't want to skip elemnts 259 i--; 260 break; 261 } 262 } 263 } 264 psFree(rawDetrend); 265 } 336 char *query = "select newImfile.* from newImfile 337 LEFT JOIN newExp USING(exp_id) 338 LEFT JOIN rawScienceExp USING(exp_id) 339 LEFT JOIN rawDetrendExp USING (exp_id) 340 WHERE newExp.exp_id is NOT NULL 341 AND rawScienceExp.exp_id IS NULL 342 AND rawDetrendExp.exp_id IS NULL"; 343 344 if (!p_psDBRunQuery(config->dbh, query)) { 345 psError(PS_ERR_UNKNOWN, false, "database error"); 346 return false; 347 } 348 349 psArray *newExp = p_psDBFetchResult(config->dbh); 350 if (!output) { 351 // XXX check psError here 352 psError(PS_ERR_UNKNOWN, false, "failed to fetch the database result"); 353 return false; 354 } 355 356 for (long i = 0; i < psArrayLength(newExp); i++) { 357 newExpRow *exp = newExp->data[i]; 358 psMetadata *where = psMetadataAlloc(); 359 if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, NULL, exp->exp_id)) { 360 psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id"); 361 psFree(where); 362 psFree(newExp); 363 return NULL; 364 } 365 new 366 367 psFree(where); 368 } 369 266 370 267 371 return new; 268 372 } 269 373 374 #endif 270 375 271 376 static p1PendingExpRow *newToP1PendingExp(newExpRow *newExp) … … 379 484 } 380 485 486 #if 0 381 487 static rawScienceFrame *newToRawScienceFrame(pxConfig *config, newFrame *newFrame) 382 488 { … … 411 517 return rawScienceFrame; 412 518 } 519 520 #endif 413 521 414 522 static rawScienceExpRow *newToRawScienceExp(pxConfig *config, newExpRow *exp) … … 488 596 } 489 597 490 598 static rawDetrendExpRow *newToRawDetrendExp(pxConfig *config, newExpRow *exp) 599 { 600 PS_ASSERT_PTR_NON_NULL(config, NULL); 601 PS_ASSERT_PTR_NON_NULL(exp, NULL); 602 603 bool status = false; 604 psString filter = psMetadataLookupStr(&status, config->args, "-filter"); 605 if (!status) { 606 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -filter"); 607 return false; 608 } 609 if (!filter) { 610 psError(PS_ERR_UNKNOWN, true, "-filter is required"); 611 return false; 612 } 613 psF32 airmass = psMetadataLookupF32(&status, config->args, "-airmass"); 614 if (!status) { 615 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -airmass"); 616 return false; 617 } 618 if (isnan(airmass)) { 619 psError(PS_ERR_UNKNOWN, true, "-airmass is required"); 620 return false; 621 } 622 psF64 ra = psMetadataLookupF64(&status, config->args, "-ra"); 623 if (!status) { 624 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -ra"); 625 return false; 626 } 627 if (isnan(ra)) { 628 psError(PS_ERR_UNKNOWN, true, "-airmass is required"); 629 return false; 630 } 631 psF64 decl = psMetadataLookupF64(&status, config->args, "-decl"); 632 if (!status) { 633 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -decl"); 634 return false; 635 } 636 if (isnan(decl)) { 637 psError(PS_ERR_UNKNOWN, true, "-decl is required"); 638 return false; 639 } 640 psF32 exp_time = psMetadataLookupF32(&status, config->args, "-exp_time"); 641 if (isnan(exp_time)) { 642 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_time"); 643 return false; 644 } 645 if (!exp_time) { 646 psError(PS_ERR_UNKNOWN, true, "-exp_time is required"); 647 return false; 648 } 649 psF64 background = psMetadataLookupF64(&status, config->args, "-background"); 650 if (!status) { 651 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -background"); 652 return false; 653 } 654 if (!exp_time) { 655 psError(PS_ERR_UNKNOWN, true, "-background is required"); 656 return false; 657 } 658 659 return rawDetrendExpRowAlloc( 660 exp->exp_id, 661 exp->camera, 662 exp->telescope, 663 exp->exp_type, 664 exp->imfiles, 665 filter, 666 airmass, 667 ra, 668 decl, 669 exp_time, 670 background 671 ); 672 } 673 674 static rawImfileRow *newToRawImfile(pxConfig *config, newImfileRow *imfile) 675 { 676 PS_ASSERT_PTR_NON_NULL(config, NULL); 677 PS_ASSERT_PTR_NON_NULL(exp, NULL); 678 679 bool status = false; 680 psString filter = psMetadataLookupStr(&status, config->args, "-filter"); 681 if (!status) { 682 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -filter"); 683 return false; 684 } 685 if (!filter) { 686 psError(PS_ERR_UNKNOWN, true, "-filter is required"); 687 return false; 688 } 689 psF32 airmass = psMetadataLookupF32(&status, config->args, "-airmass"); 690 if (!status) { 691 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -airmass"); 692 return false; 693 } 694 if (isnan(airmass)) { 695 psError(PS_ERR_UNKNOWN, true, "-airmass is required"); 696 return false; 697 } 698 psF64 ra = psMetadataLookupF64(&status, config->args, "-ra"); 699 if (!status) { 700 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -ra"); 701 return false; 702 } 703 if (isnan(ra)) { 704 psError(PS_ERR_UNKNOWN, true, "-ra is required"); 705 return false; 706 } 707 psF64 decl = psMetadataLookupF64(&status, config->args, "-decl"); 708 if (!status) { 709 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -decl"); 710 return false; 711 } 712 if (isnan(decl)) { 713 psError(PS_ERR_UNKNOWN, true, "-decl is required"); 714 return false; 715 } 716 psF32 exp_time = psMetadataLookupF32(&status, config->args, "-exp_time"); 717 if (isnan(exp_time)) { 718 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -exp_time"); 719 return false; 720 } 721 if (isnan(exp_time)) { 722 psError(PS_ERR_UNKNOWN, true, "-exp_time is required"); 723 return false; 724 } 725 psF64 bg = psMetadataLookupF64(&status, config->args, "-bg"); 726 if (!status) { 727 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -bg"); 728 return false; 729 } 730 if (isnan(bg)) { 731 psError(PS_ERR_UNKNOWN, true, "-bg is required"); 732 return false; 733 } 734 psF64 bg_stdev = psMetadataLookupF64(&status, config->args, "-bg"); 735 if (!status) { 736 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -bg_stdev"); 737 return false; 738 } 739 if (isnan(bg_stdev)) { 740 psError(PS_ERR_UNKNOWN, true, "-bg_stdev is required"); 741 return false; 742 } 743 psF64 bg_mean_stdev = psMetadataLookupF64(&status, config->args, "-bg"); 744 if (!status) { 745 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -bg_mean_stdev"); 746 return false; 747 } 748 if (isnan(bg_mean_stdev)) { 749 psError(PS_ERR_UNKNOWN, true, "-bg_mean_stdev is required"); 750 return false; 751 } 752 psF64 alt = psMetadataLookupF64(&status, config->args, "-bg"); 753 if (!status) { 754 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -alt"); 755 return false; 756 } 757 if (isnan(alt)) { 758 psError(PS_ERR_UNKNOWN, true, "-alt is required"); 759 return false; 760 } 761 psF64 az = psMetadataLookupF64(&status, config->args, "-bg"); 762 if (!status) { 763 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -az"); 764 return false; 765 } 766 if (isnan(az)) { 767 psError(PS_ERR_UNKNOWN, true, "-az is required"); 768 return false; 769 } 770 psF32 ccd_temp = psMetadataLookupF32(&status, config->args, "-bg"); 771 if (!status) { 772 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -ccd_temp"); 773 return false; 774 } 775 if (isnan(ccd_temp)) { 776 psError(PS_ERR_UNKNOWN, true, "-ccd_temp is required"); 777 return false; 778 } 779 psF64 posang = psMetadataLookupF32(&status, config->args, "-bg"); 780 if (!status) { 781 psError(PS_ERR_UNKNOWN, false, "failed to lookup value for -posang"); 782 return false; 783 } 784 if (isnan(posang)) { 785 psError(PS_ERR_UNKNOWN, true, "-posang is required"); 786 return false; 787 } 788 789 return rawImfileRowAlloc( 790 imfile->exp_id, 791 imfile->class, 792 imfile->class_id, 793 imfile->uri, 794 filter, 795 airmass, 796 ra, 797 decl, 798 exp_time, 799 bg, 800 bg_stdev, 801 bg_mean_stdev, 802 alt, 803 az, 804 ccd_temp, 805 posang 806 ); 807 } 808
Note:
See TracChangeset
for help on using the changeset viewer.
