- Timestamp:
- Sep 8, 2009, 5:32:55 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 47 edited
- 14 copied
-
. (modified) (1 prop)
-
DataStore/scripts/dsget (modified) (1 diff)
-
dbconfig/add.md (copied) (copied from branches/czw_branch/cleanup/dbconfig/add.md )
-
dbconfig/changes.txt (modified) (1 diff)
-
dbconfig/ipp.m4 (modified) (1 diff)
-
doc/misc/docgen.pl (modified) (1 prop)
-
extsrc/gpcsw/gpcsrc/fits/burntool/burnparams.h (modified) (1 diff)
-
extsrc/gpcsw/gpcsrc/fits/burntool/burntool.c (modified) (2 diffs)
-
extsrc/gpcsw/gpcsrc/fits/burntool/man/burntool.1 (modified) (3 diffs)
-
extsrc/gpcsw/gpcsrc/fits/burntool/persist_fits.c (modified) (6 diffs)
-
extsrc/gpcsw/gpcsrc/fits/burntool/persistio.c (modified) (4 diffs)
-
extsrc/gpcsw/gpcsrc/fits/burntool/trailfit.c (modified) (1 diff)
-
extsrc/gpcsw/gpcsrc/fits/libfh/fh.c (modified) (3 diffs)
-
extsrc/gpcsw/gpcsrc/fits/libfh/fh.h (modified) (3 diffs)
-
ippScripts/Build.PL (modified) (1 diff)
-
ippScripts/scripts/addstar_run.pl (copied) (copied from branches/czw_branch/cleanup/ippScripts/scripts/addstar_run.pl )
-
ippScripts/scripts/camera_exp.pl (modified) (4 diffs)
-
ippScripts/scripts/ipp_cleanup.pl (modified) (18 diffs)
-
ippScripts/scripts/magic_destreak_revert.pl (modified) (1 prop)
-
ippScripts/scripts/stack_skycell.pl (modified) (8 diffs)
-
ippTasks/Makefile.am (modified) (1 diff)
-
ippTasks/addstar.pro (copied) (copied from branches/czw_branch/cleanup/ippTasks/addstar.pro )
-
ippTasks/pantasks.pro (modified) (3 diffs)
-
ippTasks/summit.copy.pro (modified) (1 diff)
-
ippTools/doc/addstar_flow.txt (copied) (copied from branches/czw_branch/cleanup/ippTools/doc/addstar_flow.txt )
-
ippTools/share/Makefile.am (modified) (1 diff)
-
ippTools/share/addtool_find_pendingexp.sql (copied) (copied from branches/czw_branch/cleanup/ippTools/share/addtool_find_pendingexp.sql )
-
ippTools/share/addtool_queue_cam_id.sql (copied) (copied from branches/czw_branch/cleanup/ippTools/share/addtool_queue_cam_id.sql )
-
ippTools/share/addtool_reset_faulted_runs.sql (copied) (copied from branches/czw_branch/cleanup/ippTools/share/addtool_reset_faulted_runs.sql )
-
ippTools/share/addtool_revertprocessedexp.sql (copied) (copied from branches/czw_branch/cleanup/ippTools/share/addtool_revertprocessedexp.sql )
-
ippTools/share/dettool_pendingcleanup_normalizedimfile.sql (modified) (1 diff)
-
ippTools/share/dettool_pendingcleanup_stacked.sql (modified) (1 diff)
-
ippTools/share/pxadmin_create_tables.sql (modified) (2 diffs)
-
ippTools/share/pxadmin_drop_tables.sql (modified) (1 diff)
-
ippTools/src/Makefile.am (modified) (5 diffs)
-
ippTools/src/addtool.c (copied) (copied from branches/czw_branch/cleanup/ippTools/src/addtool.c )
-
ippTools/src/addtool.h (copied) (copied from branches/czw_branch/cleanup/ippTools/src/addtool.h )
-
ippTools/src/addtoolConfig.c (copied) (copied from branches/czw_branch/cleanup/ippTools/src/addtoolConfig.c )
-
ippTools/src/camtool.c (modified) (1 diff)
-
ippTools/src/dettoolConfig.c (modified) (2 diffs)
-
ippTools/src/pxadd.c (copied) (copied from branches/czw_branch/cleanup/ippTools/src/pxadd.c )
-
ippTools/src/pxadd.h (copied) (copied from branches/czw_branch/cleanup/ippTools/src/pxadd.h )
-
ippTools/src/pxtools.h (modified) (1 diff)
-
ippTools/src/regtool.c (modified) (3 diffs)
-
ippTools/src/warptool.c (modified) (1 diff)
-
ippconfig/gpc1/format_20090220.config (modified) (2 diffs)
-
ippconfig/recipes/masks.16bit.config (modified) (1 diff)
-
ippconfig/recipes/ppImage.config (modified) (2 diffs)
-
ippconfig/recipes/psastro.config (modified) (1 diff)
-
ppImage/src/Makefile.am (modified) (1 diff)
-
ppImage/src/ppImage.h (modified) (4 diffs)
-
ppImage/src/ppImageBurntoolMask.c (copied) (copied from branches/czw_branch/cleanup/ppImage/src/ppImageBurntoolMask.c )
-
ppImage/src/ppImageDetrendReadout.c (modified) (1 diff)
-
ppImage/src/ppImageOptions.c (modified) (4 diffs)
-
ppImage/src/ppImageSetMaskBits.c (modified) (1 diff)
-
psModules/src/astrom/pmAstrometryWCS.c (modified) (6 diffs)
-
psModules/src/astrom/pmAstrometryWCS.h (modified) (1 diff)
-
psModules/src/camera/pmFPA.h (modified) (1 diff)
-
psModules/src/camera/pmReadoutFake.c (modified) (1 prop)
-
psastro/src/psastroChipAstrom.c (modified) (1 diff)
-
tools/ipp_apply_burntool.pl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/czw_branch/cleanup (added) merged: 25050-25051,25088,25143-25155,25157-25159,25161,25210-25212
- Property svn:mergeinfo changed
-
trunk/DataStore/scripts/dsget
r25280 r25299 69 69 undef $copies; 70 70 } 71 if ($copies < 1) {71 elsif ($copies < 1) { 72 72 die "--copies must be >= 1"; 73 73 } -
trunk/dbconfig/changes.txt
r25256 r25299 1211 1211 ALTER TABLE publishDone ADD COLUMN hostname VARCHAR(64) AFTER path_base; 1212 1212 ALTER TABLE publishDone ADD COLUMN dtime_script FLOAT AFTER hostname; 1213 1214 -- Version 1.1.55 1215 -- addstar stage tables: 1216 1217 CREATE TABLE addRun ( 1218 add_id BIGINT AUTO_INCREMENT, 1219 cam_id BIGINT, 1220 state VARCHAR(64), 1221 workdir VARCHAR(255), 1222 workdir_state VARCHAR(64), 1223 label VARCHAR(64), 1224 dvodb VARCHAR(255), 1225 magicked BIGINT, 1226 PRIMARY KEY(add_id), 1227 KEY(add_id), 1228 KEY(cam_id), 1229 KEY(state), 1230 KEY(workdir_state), 1231 KEY(label), 1232 INDEX(add_id, cam_id), 1233 FOREIGN KEY(cam_id) REFERENCES camRun(cam_id) 1234 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1235 1236 CREATE TABLE addProcessedExp ( 1237 add_id BIGINT AUTO_INCREMENT, 1238 dtime_addstar FLOAT, 1239 n_stars INT, 1240 path_base VARCHAR(255), 1241 fault SMALLINT NOT NULL, 1242 PRIMARY KEY(add_id), 1243 FOREIGN KEY(add_id) REFERENCES addRun(add_id) 1244 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1245 1246 CREATE TABLE addMask ( 1247 label VARCHAR(64), 1248 PRIMARY KEY(label) 1249 ) ENGINE=innodb DEFAULT CHARSET=latin1; -
trunk/dbconfig/ipp.m4
r24512 r25299 14 14 include(chip.md) 15 15 include(cam.md) 16 include(add.md) 16 17 include(fake.md) 17 18 include(warp.md) -
trunk/doc/misc/docgen.pl
- Property svn:mergeinfo changed
/branches/czw_branch/cleanup/doc/misc/docgen.pl (added) merged: 25051,25150,25158,25212
- Property svn:mergeinfo changed
-
trunk/extsrc/gpcsw/gpcsrc/fits/burntool/burnparams.h
r23924 r25299 55 55 EXTERN int EXPIRE_TRAIL_TIME; /* Expire trails after this interval */ 56 56 57 EXTERN int PERSIST_RETAIN; /* Retain bad-slope persistence fits */ 58 57 59 #endif /* _INCLUDED_burnparams_ */ -
trunk/extsrc/gpcsw/gpcsrc/fits/burntool/burntool.c
r24391 r25299 100 100 EXPIRE_TRAIL_TIME = 2000; /* Expire a persist after this [sec] */ 101 101 102 PERSIST_RETAIN = 0; /* Retain persists with bad slopes? */ 103 102 104 /* Parse the args */ 103 105 cellxy = -1; … … 174 176 } else if(strncmp(argv[i], "infits=", 7) == 0) { /* infits=fname */ 175 177 persistfitsfile = argv[i] + 7; 178 179 /* Keep persistence streaks which had a bad slope? */ 180 } else if(strncmp(argv[i], "persist=", 8) == 0) {/* persist={t|f} */ 181 PERSIST_RETAIN = argv[i][8] == 'y' || argv[i][8] == '1' || argv[i][8] == 't'; 176 182 177 183 /* Output file for PSF gallery */ -
trunk/extsrc/gpcsw/gpcsrc/fits/burntool/man/burntool.1
r24391 r25299 53 53 power laws; downward burns as exponentials. 54 54 55 The fit to downward, persistence burns may have an unreasonable "slope" 56 (meaning exponential sign), increasing away from the burn origin. 57 These are discarded unless "persist=t" is invoked. It is possible 58 for the fit to be fooled by uncataloged stars, so the persistence 59 can be kept in the output file with "persist=t" (although no fit 60 correction is applied) and they will propagate from input to output 61 until they finally achieve a legal fit with negligible amplitude. 62 55 63 Burntool also identifies really blasted areas which are saturated from 56 64 top to bottom. These cannot be fitted, but are carried along for … … 231 239 'in' takes precedence. 232 240 241 persist={t|f} 242 Retain persistence streaks whose fit slope turned out to be 243 unreasonable. 244 233 245 out=fname 234 246 Output file for burn streaks … … 332 344 BUGS: 333 345 090224: Still in development 346 090810: Squished a few memory bugs 334 347 335 348 SEE ALSO: -
trunk/extsrc/gpcsw/gpcsrc/fits/burntool/persist_fits.c
r23924 r25299 222 222 for(k=0; k<cell[j].npersist; k++) 223 223 { 224 if(cell[j].persist[k].fiterr) continue; 225 if(cell[j].persist[k].nfit <= 0) continue; 224 if(PERSIST_RETAIN) { 225 /* Keep fits which have a dubious slope */ 226 if(cell[j].persist[k].fiterr != FIT_SLOPE_ERROR) { 227 if(cell[j].persist[k].fiterr) continue; 228 if(cell[j].persist[k].nfit <= 0) continue; 229 } 230 } else { 231 if(cell[j].persist[k].fiterr) continue; 232 if(cell[j].persist[k].nfit <= 0) continue; 233 } 226 234 num_areas++; 227 235 num_fits += cell[j].persist[k].nfit; … … 232 240 { 233 241 if(!cell[j].burn[k].burned) continue; 234 if(cell[j].burn[k].fiterr && 235 cell[j].burn[k].fiterr != FIT_TOP_ERROR) continue; 236 if(cell[j].burn[k].nfit <= 0) continue; 242 if(PERSIST_RETAIN) { 243 /* Keep fits which have a dubious slope */ 244 if(cell[j].burn[k].fiterr != FIT_SLOPE_ERROR) { 245 if(cell[j].burn[k].fiterr && 246 cell[j].burn[k].fiterr != FIT_TOP_ERROR) continue; 247 if(cell[j].burn[k].nfit <= 0) continue; 248 } 249 } else { 250 if(cell[j].burn[k].fiterr && 251 cell[j].burn[k].fiterr != FIT_TOP_ERROR) continue; 252 if(cell[j].burn[k].nfit <= 0) continue; 253 } 237 254 num_areas++; 238 255 num_fits += cell[j].burn[k].nfit; … … 329 346 for(k=0; k<cell[j].npersist; k++) 330 347 { 331 if(cell[j].persist[k].fiterr) continue; 332 if(cell[j].persist[k].nfit <= 0) continue; 348 if(PERSIST_RETAIN) { 349 /* Keep fits which have a dubious slope */ 350 if(cell[j].persist[k].fiterr != FIT_SLOPE_ERROR) { 351 if(cell[j].persist[k].fiterr) continue; 352 if(cell[j].persist[k].nfit <= 0) continue; 353 } 354 } else { 355 if(cell[j].persist[k].fiterr) continue; 356 if(cell[j].persist[k].nfit <= 0) continue; 357 } 333 358 334 359 result = write_area_row(hu, data, table, row++, &(cell[j].persist[k])); … … 340 365 { 341 366 if(!cell[j].burn[k].burned) continue; 342 if(cell[j].burn[k].fiterr && 343 cell[j].burn[k].fiterr != FIT_TOP_ERROR) continue; 344 if(cell[j].burn[k].nfit <= 0) continue; 367 if(PERSIST_RETAIN) { 368 /* Keep fits which have a dubious slope */ 369 if(cell[j].burn[k].fiterr != FIT_SLOPE_ERROR) { 370 if(cell[j].burn[k].fiterr && 371 cell[j].burn[k].fiterr != FIT_TOP_ERROR) continue; 372 if(cell[j].burn[k].nfit <= 0) continue; 373 } 374 } else { 375 if(cell[j].burn[k].fiterr && 376 cell[j].burn[k].fiterr != FIT_TOP_ERROR) continue; 377 if(cell[j].burn[k].nfit <= 0) continue; 378 } 345 379 346 380 result = write_area_row(hu, data, table, row++, &(cell[j].burn[k])); … … 426 460 for(k=0; k<cell[j].npersist; k++) 427 461 { 428 if(cell[j].persist[k].fiterr) continue; 462 if(PERSIST_RETAIN) { 463 /* Keep fits which have a dubious slope */ 464 if(cell[j].persist[k].fiterr != FIT_SLOPE_ERROR) { 465 if(cell[j].persist[k].fiterr) continue; 466 } 467 } else { 468 if(cell[j].persist[k].fiterr) continue; 469 } 429 470 for(i=0; i<cell[j].persist[k].nfit; i++) 430 471 { … … 441 482 { 442 483 if(!cell[j].burn[k].burned) continue; 443 if(cell[j].burn[k].fiterr && 444 cell[j].burn[k].fiterr != FIT_TOP_ERROR) continue; 484 if(PERSIST_RETAIN) { 485 /* Keep fits which have a dubious slope */ 486 if(cell[j].burn[k].fiterr != FIT_SLOPE_ERROR) { 487 if(cell[j].burn[k].fiterr && 488 cell[j].burn[k].fiterr != FIT_TOP_ERROR) continue; 489 } 490 } else { 491 if(cell[j].burn[k].fiterr && 492 cell[j].burn[k].fiterr != FIT_TOP_ERROR) continue; 493 } 445 494 446 495 for(i=0; i<cell[j].burn[k].nfit; i++) -
trunk/extsrc/gpcsw/gpcsrc/fits/burntool/persistio.c
r23924 r25299 51 51 &boxbuf[nbox].slope, &boxbuf[nbox].nfit, 52 52 &boxbuf[nbox].sxfit, &boxbuf[nbox].exfit); 53 if(boxbuf[nbox].nfit <= 0) continue; 54 boxbuf[nbox].zero = (double *)calloc(boxbuf[nbox].nfit, sizeof(double)); 55 boxbuf[nbox].xfit = (int *)calloc(boxbuf[nbox].nfit, sizeof(int)); 56 boxbuf[nbox].yfit = (int *)calloc(boxbuf[nbox].nfit, sizeof(int)); 57 for(i=0; i<boxbuf[nbox].nfit; i++) { 58 if(fgets(line, 1024, fp) == NULL) { 59 fprintf(stderr, "\rerror: short read of burn lines\n"); 60 return(-1); 61 } 62 sscanf(line, "%d %d %lf\n", &boxbuf[nbox].xfit[i], 63 &boxbuf[nbox].yfit[i], &boxbuf[nbox].zero[i]); 53 if(boxbuf[nbox].nfit > 0) { 54 boxbuf[nbox].zero = (double *)calloc(boxbuf[nbox].nfit, sizeof(double)); 55 boxbuf[nbox].xfit = (int *)calloc(boxbuf[nbox].nfit, sizeof(int)); 56 boxbuf[nbox].yfit = (int *)calloc(boxbuf[nbox].nfit, sizeof(int)); 57 for(i=0; i<boxbuf[nbox].nfit; i++) { 58 if(fgets(line, 1024, fp) == NULL) { 59 fprintf(stderr, "\rerror: short read of burn lines\n"); 60 return(-1); 61 } 62 sscanf(line, "%d %d %lf\n", &boxbuf[nbox].xfit[i], 63 &boxbuf[nbox].yfit[i], &boxbuf[nbox].zero[i]); 64 } 64 65 } 65 66 boxbuf[nbox].fiterr = 0; … … 147 148 for(kp=0; kp<n; kp++) { 148 149 k = boxid[kp]; 149 zk = box[k].zero[box[k].nfit/2]; 150 zk = 0.0; 151 if(box[k].nfit > 0) zk = box[k].zero[box[k].nfit/2]; 150 152 for(jp=kp+1; jp<n; jp++) { 151 153 j = boxid[jp]; 152 zj = box[j].zero[box[j].nfit/2]; 154 zj = 0.0; 155 if(box[j].nfit > 0) zj = box[j].zero[box[j].nfit/2]; 153 156 if(ABS(yctr[jp]-yctr[kp]) > DIFFERENT_STREAK) { 154 157 /* Trim back the feebler streak */ … … 238 241 /* First: patched up persists */ 239 242 for(k=0; k<cell[j].npersist; k++) { 240 if(cell[j].persist[k].fiterr) continue; 241 if(cell[j].persist[k].nfit <= 0) continue; 243 244 if(PERSIST_RETAIN) { 245 /* Keep fits which have a dubious slope */ 246 if(cell[j].persist[k].fiterr != FIT_SLOPE_ERROR) { 247 if(cell[j].persist[k].fiterr) continue; 248 if(cell[j].persist[k].nfit <= 0) continue; 249 } 250 } else { 251 if(cell[j].persist[k].fiterr) continue; 252 if(cell[j].persist[k].nfit <= 0) continue; 253 } 242 254 fprintf(fp, "%3d %7d %3d %3d %5d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %3d %1d %1d %9.6f %3d %3d %3d\n", 243 255 j, cell[j].persist[k].time, … … 262 274 for(k=0; k<cell[j].nburn; k++) { 263 275 if(!cell[j].burn[k].burned) continue; 264 if(cell[j].burn[k].fiterr && 265 cell[j].burn[k].fiterr != FIT_TOP_ERROR) continue; 266 if(cell[j].burn[k].nfit <= 0) continue; 276 if(PERSIST_RETAIN) { 277 /* Keep fits which have a dubious slope */ 278 if(cell[j].burn[k].fiterr != FIT_SLOPE_ERROR) { 279 if(cell[j].burn[k].fiterr && 280 cell[j].burn[k].fiterr != FIT_TOP_ERROR) continue; 281 if(cell[j].burn[k].nfit <= 0) continue; 282 } 283 } else { 284 if(cell[j].burn[k].fiterr && 285 cell[j].burn[k].fiterr != FIT_TOP_ERROR) continue; 286 if(cell[j].burn[k].nfit <= 0) continue; 287 } 267 288 268 289 i = (cell[j].burn[k].ex - cell[j].burn[k].sx + 1) / 2; -
trunk/extsrc/gpcsw/gpcsrc/fits/burntool/trailfit.c
r25070 r25299 226 226 /* FIXME: sanity check fits */ 227 227 if(slope >= FIT_MAX_SLOPE || slope < FIT_MIN_SLOPE) { 228 box->slope = slope; 229 box->nfit = 0; 228 230 box->fiterr = FIT_SLOPE_ERROR; 229 231 return(-1); -
trunk/extsrc/gpcsw/gpcsrc/fits/libfh/fh.c
r24391 r25299 1039 1039 newval[strlen(newval) - 1] = '\0'; 1040 1040 fh_set_str(hu, idx, name, newval, comment); 1041 free(newval); 1041 1042 return; 1042 1043 } … … 1519 1520 i++; 1520 1521 } 1522 return FH_SUCCESS; 1523 } 1524 1525 static void 1526 pad_header(HeaderUnit hu, int n) 1527 { 1528 int i; 1529 double idx = 900000000; 1530 1531 for (i = 0; i < n; i++) 1532 { 1533 fh_set_card(hu, idx++, FH_RESERVE); 1534 } 1535 } 1536 1537 fh_result 1538 fh_copy(HeaderUnit hu, const HeaderUnit source_) 1539 { 1540 fh_result result; 1541 int reserve; 1542 1543 result = fh_merge(hu, source_); 1544 if (result != FH_SUCCESS) return result; 1545 reserve = fh_get_reserve(source_); 1546 if (reserve) pad_header(hu, reserve); 1521 1547 return FH_SUCCESS; 1522 1548 } … … 1757 1783 } 1758 1784 1785 int 1786 fh_get_reserve(HeaderUnit hu) 1787 { 1788 HeaderUnitStruct* list = FH_HU(hu); 1789 1790 if (!list) 1791 { 1792 log_error("invalid argument to fh_get_reserve()"); 1793 return -1; 1794 } 1795 1796 if (list->reserve) 1797 return list->reserve; 1798 else 1799 return list->reserve_found; 1800 } 1801 1759 1802 fh_result 1760 1803 fh_rewrite(HeaderUnit hu) -
trunk/extsrc/gpcsw/gpcsrc/fits/libfh/fh.h
r23924 r25299 174 174 * is used to create a new FITS header. NOT for use with fh_rewrite(). 175 175 */ 176 int fh_get_reserve(HeaderUnit hu); 177 /* 178 * Get the current setting or the number of reserve cards found in 179 * a header unit. Returns -1 if hu is invalid. 180 */ 176 181 fh_result fh_validate(HeaderUnit hu); /* fh_validate.c; for use by fhtool.c */ 177 182 … … 386 391 double fh_idx(HeaderUnit hu); /* idx of the last card returned by fh_next */ 387 392 fh_result fh_merge(HeaderUnit hu, const HeaderUnit source); /* source unchanged */ 393 fh_result fh_copy(HeaderUnit hu, const HeaderUnit source); /* fh_merge+keep reserve */ 388 394 389 395 /* --------------------------------------------------------- … … 459 465 */ 460 466 461 462 467 #endif /* _INCLUDED_fh */ -
trunk/ippScripts/Build.PL
r24726 r25299 49 49 scripts/chip_imfile.pl 50 50 scripts/camera_exp.pl 51 scripts/addstar_run.pl 51 52 scripts/fake_imfile.pl 52 53 scripts/warp_overlap.pl -
trunk/ippScripts/scripts/camera_exp.pl
r24465 r25299 93 93 &my_die("Unrecognised JPEG recipe", $cam_id, $PS_EXIT_CONFIG_ERROR) unless defined $recipe2; 94 94 95 my $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR'); # Recipe to use96 &my_die("Unrecognised ADDSTAR recipe", $cam_id, $PS_EXIT_CONFIG_ERROR) unless defined $recipe_addstar;95 #my $recipe_addstar = $ipprc->reduction($reduction, 'ADDSTAR'); # Recipe to use 96 #&my_die("Unrecognised ADDSTAR recipe", $cam_id, $PS_EXIT_CONFIG_ERROR) unless defined $recipe_addstar; 97 97 98 98 my $recipe_psastro = $ipprc->reduction($reduction, 'PSASTRO'); # Recipe to use … … 205 205 } 206 206 207 my $dtime_addstar = 0;207 #my $dtime_addstar = 0; 208 208 209 209 unless ($no_op) { … … 297 297 298 298 # run addstar on the output fpaObjects (if a DVO database is defined) 299 if (defined $dvodbReal and ($run_state eq 'new')) {300 301 ## XXX the camera analysis can either save the full set of302 ## detections, or just the image metadata, in the dvodb303 304 ## get the addstar recipe for this camera and CAMERA reduction305 $command = "$ppConfigDump -camera $camera -recipe ADDSTAR $recipe_addstar -dump-recipe ADDSTAR -";306 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =307 run(command => $command, verbose => $verbose);308 unless ($success) {309 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);310 &my_die("Unable to perform ppConfigDump: $error_code", $cam_id, $PS_EXIT_SYS_ERROR);311 }312 my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or313 &my_die("Unable to parse metadata config doc", $cam_id, $PS_EXIT_SYS_ERROR);314 315 ## allow the dvodb to save only images, or the full detection set316 my $imagesOnly = metadataLookupBool($recipeData, 'IMAGES.ONLY');317 318 # XXX this construct requires the user to have a valid .ptolemyrc319 # XXX which in turn points at ippconfig/dvo.site320 # require a defined output dvo database to run addstar (ie, refuse to use the .ptolemyrc default)321 # XXX this needs to be converted to addstar_client...322 323 my $camdir = $ipprc->dvo_cameradir(); # Camera directory for addstar324 my $command;325 $command = "$addstar -D CAMERA $camdir -update";326 $command .= " -image" if $imagesOnly;327 $command .= " -D CATDIR $dvodbReal";328 329 my $realFile = $ipprc->file_resolve($fpaObjects);330 $command .= " $realFile";331 332 my $mjd_addstar_start = DateTime->now->mjd; # MJD of starting script333 334 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =335 run(command => $command, verbose => $verbose);336 unless ($success) {337 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);338 &my_die("Unable to perform addstar: $error_code", $cam_id, $error_code);339 }340 $dtime_addstar = 86400.0*(DateTime->now->mjd - $mjd_addstar_start); # MJD of starting script341 }299 # if (defined $dvodbReal and ($run_state eq 'new')) { 300 301 # ## XXX the camera analysis can either save the full set of 302 # ## detections, or just the image metadata, in the dvodb 303 304 # ## get the addstar recipe for this camera and CAMERA reduction 305 # $command = "$ppConfigDump -camera $camera -recipe ADDSTAR $recipe_addstar -dump-recipe ADDSTAR -"; 306 # ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 307 # run(command => $command, verbose => $verbose); 308 # unless ($success) { 309 # $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 310 # &my_die("Unable to perform ppConfigDump: $error_code", $cam_id, $PS_EXIT_SYS_ERROR); 311 # } 312 # my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or 313 # &my_die("Unable to parse metadata config doc", $cam_id, $PS_EXIT_SYS_ERROR); 314 315 # ## allow the dvodb to save only images, or the full detection set 316 # my $imagesOnly = metadataLookupBool($recipeData, 'IMAGES.ONLY'); 317 318 # # XXX this construct requires the user to have a valid .ptolemyrc 319 # # XXX which in turn points at ippconfig/dvo.site 320 # # require a defined output dvo database to run addstar (ie, refuse to use the .ptolemyrc default) 321 # # XXX this needs to be converted to addstar_client... 322 323 # my $camdir = $ipprc->dvo_cameradir(); # Camera directory for addstar 324 # my $command; 325 # $command = "$addstar -D CAMERA $camdir -update"; 326 # $command .= " -image" if $imagesOnly; 327 # $command .= " -D CATDIR $dvodbReal"; 328 329 # my $realFile = $ipprc->file_resolve($fpaObjects); 330 # $command .= " $realFile"; 331 332 # my $mjd_addstar_start = DateTime->now->mjd; # MJD of starting script 333 334 # my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 335 # run(command => $command, verbose => $verbose); 336 # unless ($success) { 337 # $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 338 # &my_die("Unable to perform addstar: $error_code", $cam_id, $error_code); 339 # } 340 # $dtime_addstar = 86400.0*(DateTime->now->mjd - $mjd_addstar_start); # MJD of starting script 341 # } 342 342 } 343 343 } … … 353 353 $fpaCommand .= " -hostname $host" if defined $host; 354 354 $fpaCommand .= " -dtime_script $dtime_script"; 355 $fpaCommand .= " -dtime_addstar $dtime_addstar";355 # $fpaCommand .= " -dtime_addstar $dtime_addstar"; 356 356 } else { 357 357 $fpaCommand .= " -updaterun -state full"; -
trunk/ippScripts/scripts/ipp_cleanup.pl
r24642 r25299 60 60 61 61 62 my %stages = ( chip => 1, camera => 1, fake => 1, warp => 1, stack => 1, diff=> 1,63 detrend.process.imfile => 1, detrend.process.exp => 1, detrend.stack.imfile=> 1,64 detrend.normstat.imfile => 1, detrend.norm.imfile => 1, detrend.norm.exp=> 1,65 detrend.resid.imfile => 1, detrend.resid.exp=> 1 );62 my %stages = ( "chip" => 1, "camera" => 1, "fake" => 1, "warp" => 1, "stack" => 1, "diff" => 1, 63 "detrend.process.imfile" => 1, "detrend.process.exp" => 1, "detrend.stack.imfile" => 1, 64 "detrend.normstat.imfile" => 1, "detrend.norm.imfile" => 1, "detrend.norm.exp" => 1, 65 "detrend.resid.imfile" => 1, "detrend.resid.exp" => 1 ); 66 66 unless ($stages{$stage}) { 67 67 die "unknown stage $stage for ipp_cleanup.pl\n"; … … 119 119 # don't clean up unless the data needed to update is available 120 120 # modes goto_purged and goto_scrubbed will remove files even if the config is non-existent 121 # goto_scrubbed now requires the config file to not exist. 121 122 if ($mode eq "goto_cleaned") { 122 123 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base, $class_id); 123 print STDERR "CHIP: CONFIG_FILE : $config_file\n"; 124 124 125 if (!$config_file or ! -e $config_file) { 125 126 print STDERR "skipping cleanup for chipRun $stage_id $class_id " … … 128 129 } 129 130 } 131 elsif ($mode eq "goto_scrubbed") { 132 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base, $class_id); 133 134 if ($config_file and -e $config_file) { 135 print STDERR "skipping scrubbed for chipRun $stage_id $class_id " 136 . " because config file is present\n"; 137 $status = 0; 138 } 139 } 130 140 131 141 if ($status) { … … 160 170 if ($mode eq "goto_purged") { 161 171 $command .= " -topurgedimfile"; 162 } else { 172 } 173 elsif ($mode eq "goto_cleaned") { 163 174 $command .= " -tocleanedimfile"; 164 175 } 176 elsif ($mode eq "goto_scrubbed") { 177 $command .= " -toscrubbedimfile"; 178 } 179 165 180 $command .= " -dbname $dbname" if defined $dbname; 166 181 … … 218 233 my $status = 1; 219 234 # don't clean up unless the data needed to update is available 235 # goto_scrubbed now requires the config file to not be present 220 236 if ($mode eq "goto_cleaned") { 221 237 my $config_file = $ipprc->filename("PSASTRO.CONFIG", $path_base); … … 225 241 $status = 0; 226 242 } 243 } 244 elsif ($mode eq "goto_scrubbed") { 245 my $config_file = $ipprc->filename("PSASTRO.CONFIG", $path_base); 246 247 if ($config_file and -e $config_file) { 248 print STDERR "skipping cleanup for camRun $stage_id because config file ($config_file) is present\n"; 249 $status = 0; 250 } 227 251 } 228 252 if ($status) { … … 246 270 } 247 271 if ($mode eq "goto_scrubbed") { 248 $command = "$camtool -updaterun -cam_id $stage_id -set_state cleaned";272 $command = "$camtool -updaterun -cam_id $stage_id -set_state scrubbed"; 249 273 } 250 274 if ($mode eq "goto_purged") { … … 311 335 } 312 336 } 337 elsif ($mode eq "goto_scrubbed") { 338 my $config_file = $ipprc->filename("PSWARP.CONFIG", $path_base, $skycell_id); 339 340 if ($config_file and -e $config_file) { 341 print STDERR "skipping scrubbed for warpRun $stage_id $skycell_id" . 342 " because config file is present\n"; 343 $status = 0; 344 } 345 } 313 346 if ($status) { 314 347 # delete the temporary image datafiles … … 337 370 if ($mode eq "goto_purged") { 338 371 $command .= " -topurgedskyfile"; 339 } else { 372 } 373 elsif ($mode eq "goto_cleaned") { 340 374 $command .= " -tocleanedskyfile"; 341 375 } 376 elsif ($mode eq "goto_scrubbed") { 377 $command .= " -toscrubbedskyfile"; 378 } 342 379 $command .= " -dbname $dbname" if defined $dbname; 343 380 … … 395 432 if ($mode eq "goto_cleaned") { 396 433 my $config_file = $ipprc->filename("PPSTACK.CONFIG", $path_base, $skycell_id); 397 print STDERR "MY CONFIG FILE = $config_file\n"; 398 printf(STDERR "BOOLS: %d %d %d %s\n",!$config_file, ! -e $config_file, -e $config_file,$config_file); 434 399 435 $config_file =~ s%^file://%%; 400 436 if (!$config_file or ! -e $config_file) { … … 404 440 } 405 441 $config_file = 'file://' . $config_file; 442 } 443 elsif ($mode eq "goto_scrubbed") { 444 my $config_file = $ipprc->filename("PPSTACK.CONFIG", $path_base, $skycell_id); 445 $config_file =~ s%^file://%%; 446 if ($config_file and -e $config_file) { 447 print STDERR "skipping scrubbed for stackRun $stage_id $skycell_id" . 448 " because config file is present\n"; 449 $status = 0; 450 } 406 451 } 407 452 if ($status) { … … 428 473 if ($mode eq "goto_purged") { 429 474 $command .= " -updaterun -state purged"; 430 } else { 475 } 476 elsif ($mode eq "goto_cleaned") { 431 477 $command .= " -updaterun -state cleaned"; 478 } 479 elsif ($mode eq "goto_scrubbed") { 480 $command .= " -updaterun -state scrubbed"; 432 481 } 433 482 $command .= " -dbname $dbname" if defined $dbname; … … 485 534 if ($mode eq "goto_cleaned") { 486 535 my $config_file = $ipprc->filename("PPSUB.CONFIG", $path_base, $skycell_id); 487 print STDERR "MY CONFIG FILE = $config_file\n"; 488 printf(STDERR "BOOLS: %d %d %d %s\n",!$config_file, ! -e $config_file, -e $config_file,$config_file); 536 489 537 $config_file =~ s%^file://%%; 490 538 if (!$config_file or ! -e $config_file) { … … 494 542 } 495 543 $config_file = 'file://' . $config_file; 544 } 545 elsif ($mode eq "goto_scrubbed") { 546 my $config_file = $ipprc->filename("PPSUB.CONFIG", $path_base, $skycell_id); 547 $config_file =~ s%^file://%%; 548 if ($config_file and -e $config_file) { 549 print STDERR "skipping scrubbed for diffRun $stage_id $skycell_id" . 550 " because config file ($config_file) is present\n"; 551 $status = 0; 552 } 496 553 } 497 554 if ($status) { … … 529 586 if ($status) { 530 587 my $command = "$difftool -diff_id $stage_id"; 531 # my $command = "$difftool -diff_id $stage_id -skycell_id $skycell_id"; 588 532 589 if ($mode eq "goto_purged") { 533 590 $command .= " -updaterun -state purged"; 534 } else { 591 } 592 elsif ($mode eq "goto_cleaned") { 535 593 $command .= " -updaterun -state cleaned"; 536 594 } 595 elsif ($mode eq "goto_scrubbed") { 596 $command .= " -updaterun -state scrubbed"; 597 } 598 537 599 $command .= " -dbname $dbname" if defined $dbname; 538 600 … … 545 607 } else { 546 608 my $command = "$difftool -updaterun -diff_id $stage_id -state $error_state"; 547 # my $command = "$difftool -updaterun -diff_id $stage_id -skycell_id $skycell_id -state $error_state"; 609 548 610 $command .= " -dbname $dbname" if defined $dbname; 549 611 … … 560 622 } 561 623 if ($stage eq 'fake') { 562 die "ipp_cleanup.pl -stage fake not yet implemented. Probably will just mark database cleaned.\n"; 624 print STDERR "This does not seem to work at present, as no files exist. Terminating quietly.\n"; 625 exit(0); 626 die "--stage_id required for stage fake\n" if !$stage_id; 627 ### select the imfiles for this entry 628 629 # this stage uses 'chiptool' 630 my $faketool = can_run('faketool') or die "Can't find faketool"; 631 632 # Get list of component imfiles 633 # XXX may need a different my_die for each stage 634 my $imfiles; # Array of component files 635 my $command = "$faketool -pendingcleanupimfile -fake_id $stage_id"; # Command to run 636 $command .= " -dbname $dbname" if defined $dbname; 637 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 638 unless ($success) { 639 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 640 &my_die("Unable to perform faketool: $error_code", "fake", $stage_id, $error_code); 641 } 642 643 # if there are no fakeProcessedImfiles (@$stdout_buf == 0), the reset the state to 'new' 644 if (@$stdout_buf == 0) { 645 my $command = "$faketool -fake_id $stage_id -updaterun -set_state new"; 646 $command .= " -dbname $dbname" if defined $dbname; 647 648 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 649 run(command => $command, verbose => $verbose); 650 unless ($success) { 651 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 652 &my_die("Unable to perform faketool: $error_code", "fake", $stage_id, $error_code); 653 } 654 exit 0; 655 } 656 657 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 658 &my_die("Unable to parse metadata config doc", "fake", $stage_id, $PS_EXIT_PROG_ERROR); 659 660 # extract the metadata for the files into a hash list 661 $imfiles = parse_md_list($metadata) or 662 &my_die("Unable to parse metadata list", "fake", $stage_id, $PS_EXIT_PROG_ERROR); 663 664 # loop over all of the imfiles, determine the path_base and class_id for each 665 foreach my $imfile (@$imfiles) { 666 my $class_id = $imfile->{class_id}; 667 my $path_base = $imfile->{path_base}; 668 my $status = 1; 669 670 # don't clean up unless the data needed to update is available 671 # modes goto_purged and goto_scrubbed will remove files even if the config is non-existent 672 # goto_scrubbed now requires the config file to not exist. 673 if ($mode eq "goto_cleaned") { 674 my $config_file = $ipprc->filename("PPSIM.CONFIG", $path_base, $class_id); 675 676 if (!$config_file or ! -e $config_file) { 677 print STDERR "skipping cleanup for fakeRun $stage_id $class_id " 678 . " because config file is missing\n"; 679 $status = 0; 680 } 681 } 682 elsif ($mode eq "goto_scrubbed") { 683 my $config_file = $ipprc->filename("PPSIM.CONFIG", $path_base, $class_id); 684 685 if ($config_file and -e $config_file) { 686 print STDERR "skipping scrubbed for fakeRun $stage_id $class_id " 687 . " because config file is present\n"; 688 $status = 0; 689 } 690 } 691 692 if ($status) { 693 # array of actual filenames to delete 694 my @files = (); 695 696 # delete the temporary image datafiles 697 addFilename (\@files, "PPSIM.OUTPUT.MEF", $path_base, $class_id); 698 addFilename (\@files, "PPSIM.OUTPUT.SPL", $path_base, $class_id); 699 addFilename (\@files, "PPSIM.FAKE.CHIP", $path_base, $class_id); 700 addFilename (\@files, "PPSIM.FORCE.CHIP", $path_base, $class_id); 701 if ($mode eq "goto_purged") { 702 # additional files to remove for 'purge' mode 703 addFilename (\@files, "PPSIM.SOURCES", $path_base, $class_id); 704 addFilename (\@files, "PPSIM.FAKE.SOURCES", $path_base, $class_id); 705 addFilename (\@files, "PPSIM.FORCE.SOURCES", $path_base, $class_id); 706 } 707 708 # actual command to delete the files 709 $status = &delete_files (\@files); 710 } 711 712 if ($status) { 713 my $command = "$faketool -fake_id $stage_id -class_id $class_id"; 714 if ($mode eq "goto_purged") { 715 $command .= " -topurgedimfile"; 716 } 717 elsif ($mode eq "goto_cleaned") { 718 $command .= " -tocleanedimfile"; 719 } 720 elsif ($mode eq "goto_scrubbed") { 721 $command .= " -toscrubbedimfile"; 722 } 723 724 $command .= " -dbname $dbname" if defined $dbname; 725 726 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 727 run(command => $command, verbose => $verbose); 728 unless ($success) { 729 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 730 &my_die("Unable to perform faketool: $error_code", "fake", $stage_id, $error_code); 731 } 732 } else { 733 734 # if an error happens for one chip, the chipRun will stay in goto_*, but the chips will go to error_* (matching the goto_*) 735 my $command = "$faketool -updateprocessedimfile -fake_id $stage_id -class_id $class_id -set_state $error_state"; 736 $command .= " -dbname $dbname" if defined $dbname; 737 738 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 739 run(command => $command, verbose => $verbose); 740 unless ($success) { 741 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 742 &my_die("Unable to perform faketool: $error_code", "fake", $stage_id, $error_code); 743 } 744 } 745 } 746 exit 0; 747 563 748 } 564 # fake : faketool : -pendingcleanupimfile (loop over imfiles) 749 # Detrend stages 750 if ($stage eq "detrend.process.imfile") { 751 752 die "--stage_id required for stage detrend.process.imfile\n" if !$stage_id; 753 ### select the imfiles for this entry 754 755 # this stage uses 'dettool' 756 my $dettool = can_run('dettool') or die "Can't find chiptool"; 757 758 # Get list of component imfiles 759 # XXX may need a different my_die for each stage 760 my $imfiles; # Array of component files 761 my $command = "$dettool -pendingcleanup_processedimfile -det_id $stage_id"; # Command to run 762 $command .= " -dbname $dbname" if defined $dbname; 763 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 764 unless ($success) { 765 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 766 &my_die("Unable to perform dettool: $error_code", "detrend.process.imfile", $stage_id, $error_code); 767 } 768 769 # if there are no detProcessedImfiles (@$stdout_buf == 0), the reset the state to 'new' 770 if (@$stdout_buf == 0) { 771 exit 0; # Silently exit if there's nothing to do. I don't know how we'd ever get here, but let's be safe. 772 } 773 774 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 775 &my_die("Unable to parse metadata config doc", "$stage", $stage_id, $PS_EXIT_PROG_ERROR); 776 777 # extract the metadata for the files into a hash list 778 $imfiles = parse_md_list($metadata) or 779 &my_die("Unable to parse metadata list", "$stage", $stage_id, $PS_EXIT_PROG_ERROR); 780 781 # loop over all of the imfiles, determine the path_base and class_id for each 782 foreach my $imfile (@$imfiles) { 783 my $exp_id = $imfile->{exp_id}; 784 my $class_id = $imfile->{class_id}; 785 my $path_base = $imfile->{path_base}; 786 my $status = 1; 787 788 # don't clean up unless the data needed to update is available 789 # modes goto_purged and goto_scrubbed will remove files even if the config is non-existent 790 # goto_scrubbed now requires the config file to not exist. 791 792 # Possibly not the correct config file, but simtest doesn't leave any around to check. 793 if ($mode eq "goto_cleaned") { 794 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base, $class_id); 795 796 if (!$config_file or ! -e $config_file) { 797 print STDERR "skipping cleanup for detrend.process.imfile $stage_id $class_id " 798 . " because config file is missing\n"; 799 $status = 0; 800 } 801 } 802 elsif ($mode eq "goto_scrubbed") { 803 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base, $class_id); 804 805 if ($config_file and -e $config_file) { 806 print STDERR "skipping scrubbed for detrend.process.imfile $stage_id $class_id " 807 . " because config file is present\n"; 808 $status = 0; 809 } 810 } 811 812 if ($status) { 813 # array of actual filenames to delete 814 my @files = (); 815 816 # delete the temporary image datafiles 817 addFilename (\@files, "PPIMAGE.OUTPUT", $path_base, $class_id); 818 addFilename (\@files, "PPIMAGE.OUTPUT.MASK", $path_base, $class_id); 819 addFilename (\@files, "PPIMAGE.OUTPUT.VARIANCE", $path_base, $class_id); 820 if ($mode eq "goto_purged") { 821 # additional files to remove for 'purge' mode 822 addFilename (\@files, "PPIMAGE.BIN1", $path_base, $class_id); 823 addFilename (\@files, "PPIMAGE.BIN2", $path_base, $class_id); 824 addFilename (\@files, "PPIMAGE.STATS", $path_base, $class_id); 825 } 826 827 # actual command to delete the files 828 $status = &delete_files (\@files); 829 } 830 831 if ($status) { 832 my $command = "$dettool -det_id $stage_id -exp_id $exp_id -class_id $class_id -updateprocessedimfile"; 833 if ($mode eq "goto_purged") { 834 $command .= " -data_state purged"; 835 } 836 elsif ($mode eq "goto_cleaned") { 837 $command .= " -data_state cleaned"; 838 } 839 elsif ($mode eq "goto_scrubbed") { 840 $command .= " -data_state scrubbed"; 841 } 842 843 $command .= " -dbname $dbname" if defined $dbname; 844 845 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 846 run(command => $command, verbose => $verbose); 847 unless ($success) { 848 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 849 &my_die("Unable to perform dettool: $error_code", "$stage", $stage_id, $error_code); 850 } 851 852 } else { 853 854 # if an error happens for one chip, the chipRun will stay in goto_*, but the chips will go to error_* (matching the goto_*) 855 my $command = "$dettool -updateprocessedimfile -det_id $stage_id -exp_id $exp_id -class_id $class_id -data_state $error_state"; 856 $command .= " -dbname $dbname" if defined $dbname; 857 858 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 859 run(command => $command, verbose => $verbose); 860 unless ($success) { 861 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 862 &my_die("Unable to perform dettool: $error_code", "$stage", $stage_id, $error_code); 863 } 864 } 865 } 866 867 # Check to see if we can mark the whole detRunSummary object as cleaned. 868 869 $command = "$dettool -pendingcleanup_detrunsummary -det_id $stage_id"; 870 $command .= " -dbname $dbname" if defined $dbname; 871 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 872 unless ($success) { 873 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 874 &my_die("Unable to perform dettool: $error_code", "$stage (detRunSummary)", $stage_id, $error_code); 875 } 876 if (@$stdout_buf != 0) { 877 $metadata = $mdcParser->parse(join "", @$stdout_buf) or 878 &my_die("Unable to parse metadata config doc", "$stage (detRunSummary)", $stage_id, $PS_EXIT_PROG_ERROR); 879 my $exps = parse_md_list($metadata) or 880 &my_die("Unable to parse metadata list", "$stage (detRunSummary)", $stage_id, $PS_EXIT_PROG_ERROR); 881 882 foreach my $exp (@$exps) { 883 my $iteration = $exp->{iteration}; 884 my $command; 885 if ($mode eq "goto_cleaned") { 886 $command = "$dettool -updatedetrunsummary -det_id $stage_id -iteration $iteration -data_state cleaned"; 887 } 888 if ($mode eq "goto_scrubbed") { 889 $command = "$dettool -updatedetrunsummary -det_id $stage_id -iteration $iteration -data_state scrubbed"; 890 } 891 if ($mode eq "goto_purged") { 892 $command = "$dettool -updatedetrunsummary -det_id $stage_id -iteration $iteration -data_state purged"; 893 } 894 $command .= " -dbname $dbname" if defined $dbname; 895 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 896 run(command => $command, verbose => $verbose); 897 unless ($success) { 898 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 899 &my_die("Unable to perform dettool: $error_code", "$stage (detRunSummary)", $stage_id, $error_code); 900 } 901 } 902 } 903 904 exit 0; 905 } 906 if ($stage eq "detrend.process.exp") { 907 die "--stage_id required for stage $stage\n" if !$stage_id; 908 # this stage uses 'dettool' 909 my $dettool = can_run('dettool') or die "Can't find dettool"; 910 911 # Get list of component imfiles 912 # XXX may need a different my_die for each stage 913 my $exps; # Array of component files 914 my $command = "$dettool -pendingcleanup_processedexp -det_id $stage_id"; # Command to run 915 $command .= " -dbname $dbname" if defined $dbname; 916 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 917 unless ($success) { 918 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 919 &my_die("Unable to perform dettool: $error_code", "$stage", $stage_id, $error_code); 920 } 921 922 if (@$stdout_buf == 0) { 923 exit 0; #silently abort. I need to fix this for propers 924 } 925 926 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 927 &my_die("Unable to parse metadata config doc", "$stage", $stage_id, $PS_EXIT_PROG_ERROR); 928 929 $exps = parse_md_list($metadata) or 930 &my_die("Unable to parse metadata list", "$stage", $stage_id, $PS_EXIT_PROG_ERROR); 931 932 933 foreach my $exp (@$exps) { 934 my $path_base = $exp->{path_base}; 935 my $exp_id = $exp->{exp_id}; 936 937 my $status = 1; 938 # don't clean up unless the data needed to update is available 939 # goto_scrubbed now requires the config file to not be present 940 if ($mode eq "goto_cleaned") { 941 my $config_file = $ipprc->filename("PSIMAGE.CONFIG", $path_base); 942 943 if (!$config_file or ! -e $config_file) { 944 print STDERR "skipping cleanup for $stage $stage_id because config file is missing\n"; 945 $status = 0; 946 } 947 } 948 elsif ($mode eq "goto_scrubbed") { 949 my $config_file = $ipprc->filename("PSIMAGE.CONFIG", $path_base); 950 951 if ($config_file and -e $config_file) { 952 print STDERR "skipping cleanup for $stage $stage_id because config file ($config_file) is present\n"; 953 $status = 0; 954 } 955 } 956 if ($status) { 957 my @files = (); 958 # delete the temporary image datafiles 959 # I can't find anything to put here 960 if ($mode eq "goto_purged") { 961 # additional files to remove for 'purge' mode 962 addFilename (\@files, "PPIMAGE.JPEG1", $path_base); 963 addFilename (\@files, "PPIMAGE.JPEG2", $path_base); 964 } 965 # actual command to delete the files 966 $status = &delete_files (\@files); 967 } 968 969 if ($status) { 970 my $command; 971 if ($mode eq "goto_cleaned") { 972 $command = "$dettool -updateprocessedexp -det_id $stage_id -exp_id $exp_id -data_state cleaned"; 973 } 974 if ($mode eq "goto_scrubbed") { 975 $command = "$dettool -updateprocessedexp -det_id $stage_id -exp_id $exp_id -data_state scrubbed"; 976 } 977 if ($mode eq "goto_purged") { 978 $command = "$dettool -updateprocessedexp -det_id $stage_id -exp_id $exp_id -data_state purged"; 979 } 980 $command .= " -dbname $dbname" if defined $dbname; 981 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 982 run(command => $command, verbose => $verbose); 983 unless ($success) { 984 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 985 &my_die("Unable to perform dettool: $error_code", "$stage", $stage_id, $error_code); 986 } 987 } else { 988 # since 'camera' has only a single imfile, we can just update the run 989 my $command = "$dettool -updateprocessedexp -det_id $stage_id -exp_id $exp_id -data_state $error_state"; 990 $command .= " -dbname $dbname" if defined $dbname; 991 992 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 993 run(command => $command, verbose => $verbose); 994 unless ($success) { 995 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 996 &my_die("Unable to perform dettool: $error_code", "$stage", $stage_id, $error_code); 997 } 998 exit $PS_EXIT_UNKNOWN_ERROR; 999 } 1000 } 1001 # Check to see if we can mark the whole detRunSummary object as cleaned. 1002 1003 $command = "$dettool -pendingcleanup_detrunsummary -det_id $stage_id"; 1004 $command .= " -dbname $dbname" if defined $dbname; 1005 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 1006 unless ($success) { 1007 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1008 &my_die("Unable to perform dettool: $error_code", "$stage (detRunSummary)", $stage_id, $error_code); 1009 } 1010 if (@$stdout_buf != 0) { 1011 $metadata = $mdcParser->parse(join "", @$stdout_buf) or 1012 &my_die("Unable to parse metadata config doc", "$stage (detRunSummary)", $stage_id, $PS_EXIT_PROG_ERROR); 1013 $exps = parse_md_list($metadata) or 1014 &my_die("Unable to parse metadata list", "$stage (detRunSummary)", $stage_id, $PS_EXIT_PROG_ERROR); 1015 1016 foreach my $exp (@$exps) { 1017 my $iteration = $exp->{iteration}; 1018 my $command; 1019 if ($mode eq "goto_cleaned") { 1020 $command = "$dettool -updatedetrunsummary -det_id $stage_id -iteration $iteration -data_state cleaned"; 1021 } 1022 if ($mode eq "goto_scrubbed") { 1023 $command = "$dettool -updatedetrunsummary -det_id $stage_id -iteration $iteration -data_state scrubbed"; 1024 } 1025 if ($mode eq "goto_purged") { 1026 $command = "$dettool -updatedetrunsummary -det_id $stage_id -iteration $iteration -data_state purged"; 1027 } 1028 $command .= " -dbname $dbname" if defined $dbname; 1029 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1030 run(command => $command, verbose => $verbose); 1031 unless ($success) { 1032 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1033 &my_die("Unable to perform dettool: $error_code", "$stage (detRunSummary)", $stage_id, $error_code); 1034 } 1035 } 1036 } 1037 1038 exit 0; 1039 } 1040 if ($stage eq "detrend.stack.imfile") { 1041 1042 die "--stage_id required for stage $stage\n" if !$stage_id; 1043 1044 # this stage uses 'dettool' 1045 my $dettool = can_run('dettool') or die "Can't find dettool"; 1046 1047 # Get list of component imfiles 1048 my $stacks; # Array reference of component files 1049 my $command = "$dettool -pendingcleanup_stacked -det_id $stage_id"; # Command to run 1050 $command .= " -dbname $dbname" if defined $dbname; 1051 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 1052 unless ($success) { 1053 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1054 &my_die("Unable to perform dettool: $error_code", "$stage", $stage_id, $error_code); 1055 } 1056 my $metadata = $mdcParser->parse(join "", @{ $stdout_buf }) or 1057 &my_die("Unable to parse metadata config doc", "$stage", $stage_id, $PS_EXIT_PROG_ERROR); 1058 1059 $stacks = parse_md_list($metadata) or 1060 &my_die("Unable to parse metadata list", "$stage", $stage_id, $PS_EXIT_PROG_ERROR); 1061 1062 my @files = (); 1063 foreach my $stack (@{ $stacks }) { 1064 # detStackedImfile does not have a path_base column. This is inconvenient, as it means we need to calculate it. 1065 my $path_base = $stack->{uri}; 1066 my $iteration = $stack->{iteration}; 1067 my $class_id = $stack->{class_id}; 1068 1069 $path_base =~ s/\.fits$//; # That should do it? 1070 1071 my $status = 1; 1072 1073 # if ($mode eq "goto_cleaned") { 1074 # my $config_file = $ipprc->filename("PPMERGE.CONFIG", $path_base, $stage_id); 1075 1076 # $config_file =~ s%^file://%%; 1077 # if (!$config_file or ! -e $config_file) { 1078 # print STDERR "skipping cleanup for $stage $stage_id $path_base" . 1079 # " because config file is missing\n"; 1080 # $status = 0; 1081 # } 1082 # $config_file = 'file://' . $config_file; 1083 # } 1084 # elsif ($mode eq "goto_scrubbed") { 1085 # my $config_file = $ipprc->filename("PPMERGE.CONFIG", $path_base, $stage_id); 1086 # $config_file =~ s%^file://%%; 1087 # if ($config_file and -e $config_file) { 1088 # print STDERR "skipping scrubbed for $stage $stage_id $path_base" . 1089 # " because config file is present\n"; 1090 # $status = 0; 1091 # } 1092 # } 1093 1094 if ($status) { 1095 # delete the temporary image datafiles 1096 # There's no convenient way to get the detrend type, so I'm queueing all of them for deletion. 1097 # I understand that they all point to the same filename right now, but that may not be true in 1098 # the future. 1099 addFilename(\@files, "PPMERGE.OUTPUT.MASK", $path_base, $stage_id); 1100 addFilename(\@files, "PPMERGE.OUTPUT.BIAS", $path_base, $stage_id); 1101 addFilename(\@files, "PPMERGE.OUTPUT.DARK", $path_base, $stage_id); 1102 addFilename(\@files, "PPMERGE.OUTPUT.SHUTTER", $path_base, $stage_id); 1103 addFilename(\@files, "PPMERGE.OUTPUT.FLAT", $path_base, $stage_id); 1104 addFilename(\@files, "PPMERGE.OUTPUT.FRINGE", $path_base, $stage_id); 1105 1106 1107 addFilename(\@files, "PPMERGE.OUTPUT.SIGMA", $path_base, $stage_id); 1108 addFilename(\@files, "PPMERGE.OUTPUT.COUNT", $path_base, $stage_id); 1109 1110 if ($mode eq "goto_purged") { 1111 # additional files to remove for 'purge' mode 1112 # addFilename(\@files, "PPMERGE.OUTPUT", $path_base, $stage_id); 1113 } 1114 1115 $status = &delete_files(\@files); 1116 } 1117 1118 if ($status) { 1119 my $command = "$dettool -det_id $stage_id -iteration $iteration -class_id $class_id"; 1120 if ($mode eq "goto_purged") { 1121 $command .= " -updatestacked -data_state purged"; 1122 } 1123 elsif ($mode eq "goto_cleaned") { 1124 $command .= " -updatestacked -data_state cleaned"; 1125 } 1126 elsif ($mode eq "goto_scrubbed") { 1127 $command .= " -updatestacked -data_state scrubbed"; 1128 } 1129 $command .= " -dbname $dbname" if defined $dbname; 1130 1131 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1132 run(command => $command, verbose => $verbose); 1133 unless ($success) { 1134 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1135 &my_die("Unable to perform dettool: $error_code", "$stage", $stage_id, $error_code); 1136 } 1137 } else { 1138 my $command = "$dettool -updatestacked -det_id $stage_id -iteration $iteration -class_id $class_id -data_state $error_state"; 1139 $command .= " -dbname $dbname" if defined $dbname; 1140 1141 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1142 run(command => $command, verbose => $verbose); 1143 unless ($success) { 1144 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1145 &my_die("Unable to perform dettool: $error_code", "$stage", $stage_id, $error_code); 1146 } 1147 exit $PS_EXIT_UNKNOWN_ERROR; 1148 } 1149 } 1150 # Check to see if we can mark the whole detRunSummary object as cleaned. 1151 1152 $command = "$dettool -pendingcleanup_detrunsummary -det_id $stage_id"; 1153 $command .= " -dbname $dbname" if defined $dbname; 1154 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 1155 unless ($success) { 1156 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1157 &my_die("Unable to perform dettool: $error_code", "$stage (detRunSummary)", $stage_id, $error_code); 1158 } 1159 if (@$stdout_buf != 0) { 1160 $metadata = $mdcParser->parse(join "", @$stdout_buf) or 1161 &my_die("Unable to parse metadata config doc", "$stage (detRunSummary)", $stage_id, $PS_EXIT_PROG_ERROR); 1162 my $exps = parse_md_list($metadata) or 1163 &my_die("Unable to parse metadata list", "$stage (detRunSummary)", $stage_id, $PS_EXIT_PROG_ERROR); 1164 1165 foreach my $exp (@$exps) { 1166 my $iteration = $exp->{iteration}; 1167 my $command; 1168 if ($mode eq "goto_cleaned") { 1169 $command = "$dettool -updatedetrunsummary -det_id $stage_id -iteration $iteration -data_state cleaned"; 1170 } 1171 if ($mode eq "goto_scrubbed") { 1172 $command = "$dettool -updatedetrunsummary -det_id $stage_id -iteration $iteration -data_state scrubbed"; 1173 } 1174 if ($mode eq "goto_purged") { 1175 $command = "$dettool -updatedetrunsummary -det_id $stage_id -iteration $iteration -data_state purged"; 1176 } 1177 $command .= " -dbname $dbname" if defined $dbname; 1178 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1179 run(command => $command, verbose => $verbose); 1180 unless ($success) { 1181 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1182 &my_die("Unable to perform dettool: $error_code", "$stage (detRunSummary)", $stage_id, $error_code); 1183 } 1184 } 1185 } 1186 exit 0; 1187 } 1188 if ($stage eq "detrend.normstat.imfile") { 1189 print STDERR "I'm not convinced there's anything to clean up from stage $stage\n"; 1190 die "--stage_id required for stage $stage\n" if !$stage_id; 1191 # this stage uses 'camtool' 1192 my $dettool = can_run('dettool') or die "Can't find dettool"; 1193 1194 my $command = "$dettool -pendingcleanup_normalizedstat -det_id $stage_id"; # Command to run 1195 $command .= " -dbname $dbname" if defined $dbname; 1196 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 1197 unless ($success) { 1198 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1199 &my_die("Unable to perform dettool: $error_code", "$stage", $stage_id, $error_code); 1200 } 1201 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 1202 &my_die("Unable to parse metadata config doc", "$stage", $stage_id, $PS_EXIT_PROG_ERROR); 1203 1204 my $exps = parse_md_list($metadata) or 1205 &my_die("Unable to parse metadata list", "$stage", $stage_id, $PS_EXIT_PROG_ERROR); 1206 1207 foreach my $exp (@$exps) { 1208 # my $path_base = $exp->{path_base}; 1209 my $iteration = $exp->{iteration}; 1210 my $class_id = $exp->{class_id}; 1211 1212 my $status = 1; 1213 if ($status) { 1214 my $command = "$dettool -updatenormalizedstat -det_id $stage_id -iteration $iteration -class_id $class_id"; 1215 if ($mode eq "goto_cleaned") { 1216 $command .= " -data_state cleaned"; 1217 } 1218 if ($mode eq "goto_scrubbed") { 1219 $command .= " -data_state scrubbed"; 1220 } 1221 if ($mode eq "goto_purged") { 1222 $command .= " -data_state purged"; 1223 } 1224 $command .= " -dbname $dbname" if defined $dbname; 1225 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1226 run(command => $command, verbose => $verbose); 1227 unless ($success) { 1228 print STDERR "WTF: $success TTT $error_code QQQ\n"; 1229 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1230 &my_die("Unable to perform dettool: $error_code", "$stage", $stage_id, $error_code); 1231 } 1232 } else { 1233 my $command = "$dettool -updatenormalizedstat -det_id $stage_id -iteration $iteration -class_id $class_id -data_state $error_state"; 1234 $command .= " -dbname $dbname" if defined $dbname; 1235 1236 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1237 run(command => $command, verbose => $verbose); 1238 unless ($success) { 1239 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1240 &my_die("Unable to perform dettool: $error_code", "$stage", $stage_id, $error_code); 1241 } 1242 exit $PS_EXIT_UNKNOWN_ERROR; 1243 } 1244 } 1245 # Check to see if we can mark the whole detRunSummary object as cleaned. 1246 1247 $command = "$dettool -pendingcleanup_detrunsummary -det_id $stage_id"; 1248 $command .= " -dbname $dbname" if defined $dbname; 1249 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 1250 unless ($success) { 1251 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1252 &my_die("Unable to perform dettool: $error_code", "$stage (detRunSummary)", $stage_id, $error_code); 1253 } 1254 if (@$stdout_buf != 0) { 1255 $metadata = $mdcParser->parse(join "", @$stdout_buf) or 1256 &my_die("Unable to parse metadata config doc", "$stage (detRunSummary)", $stage_id, $PS_EXIT_PROG_ERROR); 1257 $exps = parse_md_list($metadata) or 1258 &my_die("Unable to parse metadata list", "$stage (detRunSummary)", $stage_id, $PS_EXIT_PROG_ERROR); 1259 1260 foreach my $exp (@$exps) { 1261 my $iteration = $exp->{iteration}; 1262 my $command; 1263 if ($mode eq "goto_cleaned") { 1264 $command = "$dettool -updatedetrunsummary -det_id $stage_id -iteration $iteration -data_state cleaned"; 1265 } 1266 if ($mode eq "goto_scrubbed") { 1267 $command = "$dettool -updatedetrunsummary -det_id $stage_id -iteration $iteration -data_state scrubbed"; 1268 } 1269 if ($mode eq "goto_purged") { 1270 $command = "$dettool -updatedetrunsummary -det_id $stage_id -iteration $iteration -data_state purged"; 1271 } 1272 $command .= " -dbname $dbname" if defined $dbname; 1273 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1274 run(command => $command, verbose => $verbose); 1275 unless ($success) { 1276 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1277 &my_die("Unable to perform dettool: $error_code", "$stage (detRunSummary)", $stage_id, $error_code); 1278 } 1279 } 1280 } 1281 1282 exit 0; 1283 1284 } 1285 if ($stage eq "detrend.norm.imfile") { 1286 die "--stage_id required for stage $stage\n" if !$stage_id; 1287 # this stage uses 'dettool' 1288 my $dettool = can_run('dettool') or die "Can't find dettool"; 1289 1290 # Get list of component imfiles 1291 # XXX may need a different my_die for each stage 1292 my $exps; # Array of component files 1293 my $command = "$dettool -pendingcleanup_normalizedimfile -det_id $stage_id"; # Command to run 1294 $command .= " -dbname $dbname" if defined $dbname; 1295 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 1296 unless ($success) { 1297 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1298 &my_die("Unable to perform dettool: $error_code", "$stage", $stage_id, $error_code); 1299 } 1300 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 1301 &my_die("Unable to parse metadata config doc", "$stage", $stage_id, $PS_EXIT_PROG_ERROR); 1302 1303 $exps = parse_md_list($metadata) or 1304 &my_die("Unable to parse metadata list", "$stage", $stage_id, $PS_EXIT_PROG_ERROR); 1305 1306 foreach my $exp (@$exps) { 1307 my $path_base = $exp->{path_base}; 1308 my $iteration = $exp->{iteration}; 1309 my $class_id = $exp->{class_id}; 1310 1311 my $status = 1; 1312 # don't clean up unless the data needed to update is available 1313 # goto_scrubbed now requires the config file to not be present 1314 if ($mode eq "goto_cleaned") { 1315 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base); 1316 1317 if (!$config_file or ! -e $config_file) { 1318 print STDERR "skipping cleanup for $stage $stage_id because config file is missing\n"; 1319 $status = 0; 1320 } 1321 } 1322 elsif ($mode eq "goto_scrubbed") { 1323 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base); 1324 1325 if ($config_file and -e $config_file) { 1326 print STDERR "skipping cleanup for $stage $stage_id because config file ($config_file) is present\n"; 1327 $status = 0; 1328 } 1329 } 1330 if ($status) { 1331 my @files = (); 1332 1333 if ($mode eq "goto_purged") { 1334 # additional files to remove for 'purge' mode 1335 addFilename (\@files, "PPIMAGE.OUTPUT.FPA1", $path_base); 1336 addFilename (\@files, "PPIMAGE.OUTPUT.FPA2", $path_base); 1337 1338 addFilename (\@files, "PPIMAGE.OUTPUT", $path_base); 1339 addFilename (\@files, "PPIMAGE.STATS", $path_base); 1340 } 1341 # actual command to delete the files 1342 $status = &delete_files (\@files); 1343 } 1344 1345 if ($status) { 1346 my $command = "$dettool -updatenormalizedimfile -det_id $stage_id -iteration $iteration -class_id $class_id"; 1347 if ($mode eq "goto_cleaned") { 1348 $command .= " -data_state cleaned"; 1349 } 1350 if ($mode eq "goto_scrubbed") { 1351 $command .= " -data_state scrubbed"; 1352 } 1353 if ($mode eq "goto_purged") { 1354 $command .= " -data_state purged"; 1355 } 1356 $command .= " -dbname $dbname" if defined $dbname; 1357 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1358 run(command => $command, verbose => $verbose); 1359 unless ($success) { 1360 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1361 &my_die("Unable to perform dettool: $error_code", "$stage", $stage_id, $error_code); 1362 } 1363 } else { 1364 my $command = "$dettool -updatenormalizedimfile -det_id $stage_id -iteration $iteration -class_id $class_id -data_state $error_state"; 1365 $command .= " -dbname $dbname" if defined $dbname; 1366 1367 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1368 run(command => $command, verbose => $verbose); 1369 unless ($success) { 1370 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1371 &my_die("Unable to perform dettool: $error_code", "$stage", $stage_id, $error_code); 1372 } 1373 exit $PS_EXIT_UNKNOWN_ERROR; 1374 } 1375 } 1376 # Check to see if we can mark the whole detRunSummary object as cleaned. 1377 1378 $command = "$dettool -pendingcleanup_detrunsummary -det_id $stage_id"; 1379 $command .= " -dbname $dbname" if defined $dbname; 1380 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 1381 unless ($success) { 1382 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1383 &my_die("Unable to perform dettool: $error_code", "$stage (detRunSummary)", $stage_id, $error_code); 1384 } 1385 if (@$stdout_buf != 0) { 1386 $metadata = $mdcParser->parse(join "", @$stdout_buf) or 1387 &my_die("Unable to parse metadata config doc", "$stage (detRunSummary)", $stage_id, $PS_EXIT_PROG_ERROR); 1388 $exps = parse_md_list($metadata) or 1389 &my_die("Unable to parse metadata list", "$stage (detRunSummary)", $stage_id, $PS_EXIT_PROG_ERROR); 1390 1391 foreach my $exp (@$exps) { 1392 my $iteration = $exp->{iteration}; 1393 my $command; 1394 if ($mode eq "goto_cleaned") { 1395 $command = "$dettool -updatedetrunsummary -det_id $stage_id -iteration $iteration -data_state cleaned"; 1396 } 1397 if ($mode eq "goto_scrubbed") { 1398 $command = "$dettool -updatedetrunsummary -det_id $stage_id -iteration $iteration -data_state scrubbed"; 1399 } 1400 if ($mode eq "goto_purged") { 1401 $command = "$dettool -updatedetrunsummary -det_id $stage_id -iteration $iteration -data_state purged"; 1402 } 1403 $command .= " -dbname $dbname" if defined $dbname; 1404 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1405 run(command => $command, verbose => $verbose); 1406 unless ($success) { 1407 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1408 &my_die("Unable to perform dettool: $error_code", "$stage (detRunSummary)", $stage_id, $error_code); 1409 } 1410 } 1411 } 1412 1413 exit 0; 1414 } 1415 if ($stage eq "detrend.norm.exp") { 1416 die "--stage_id required for stage $stage\n" if !$stage_id; 1417 # this stage uses 'dettool' 1418 my $dettool = can_run('dettool') or die "Can't find dettool"; 1419 1420 # Get list of component imfiles 1421 # XXX may need a different my_die for each stage 1422 my $exps; # Array of component files 1423 my $command = "$dettool -pendingcleanup_normalizedexp -det_id $stage_id"; # Command to run 1424 $command .= " -dbname $dbname" if defined $dbname; 1425 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 1426 unless ($success) { 1427 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1428 &my_die("Unable to perform dettool: $error_code", "$stage", $stage_id, $error_code); 1429 } 1430 1431 if (@$stdout_buf == 0) { 1432 exit 0; 1433 } 1434 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 1435 &my_die("Unable to parse metadata config doc", "$stage", $stage_id, $PS_EXIT_PROG_ERROR); 1436 1437 $exps = parse_md_list($metadata) or 1438 &my_die("Unable to parse metadata list", "$stage", $stage_id, $PS_EXIT_PROG_ERROR); 1439 1440 foreach my $exp (@$exps) { 1441 my $exp_id = $exp->{exp_id}; 1442 my $iteration = $exp->{iteration}; 1443 my $path_base = $exp->{path_base}; 1444 1445 my $status = 1; 1446 # don't clean up unless the data needed to update is available 1447 # goto_scrubbed now requires the config file to not be present 1448 if ($mode eq "goto_cleaned") { 1449 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base); 1450 1451 if (!$config_file or ! -e $config_file) { 1452 print STDERR "skipping cleanup for $stage $stage_id because config file is missing\n"; 1453 $status = 0; 1454 } 1455 } 1456 elsif ($mode eq "goto_scrubbed") { 1457 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base); 1458 1459 if ($config_file and -e $config_file) { 1460 print STDERR "skipping cleanup for $stage $stage_id because config file ($config_file) is present\n"; 1461 $status = 0; 1462 } 1463 } 1464 if ($status) { 1465 my @files = (); 1466 # delete the temporary image datafiles 1467 if ($mode eq "goto_purged") { 1468 # additional files to remove for 'purge' mode 1469 addFilename (\@files, "PPIMAGE.JPEG1", $path_base); 1470 addFilename (\@files, "PPIMAGE.JPEG2", $path_base); 1471 } 1472 # actual command to delete the files 1473 $status = &delete_files (\@files); 1474 } 1475 1476 if ($status) { 1477 my $command = "$dettool -updatenormalizedexp -det_id $stage_id -iteration $iteration"; 1478 if ($mode eq "goto_cleaned") { 1479 $command .= " -data_state cleaned"; 1480 } 1481 if ($mode eq "goto_scrubbed") { 1482 $command .= " -data_state scrubbed"; 1483 } 1484 if ($mode eq "goto_purged") { 1485 $command .= " -data_state purged"; 1486 } 1487 $command .= " -dbname $dbname" if defined $dbname; 1488 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1489 run(command => $command, verbose => $verbose); 1490 unless ($success) { 1491 print STDERR " residexp had an issue setting the state:? $success $error_code\n"; 1492 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1493 &my_die("Unable to perform dettool: $error_code", "$stage", $stage_id, $error_code); 1494 } 1495 } else { 1496 my $command = "$dettool -updatenormalizedexp -det_id $stage_id -exp_id $exp_id -iteration $iteration -data_state $error_state"; 1497 $command .= " -dbname $dbname" if defined $dbname; 1498 1499 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1500 run(command => $command, verbose => $verbose); 1501 unless ($success) { 1502 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1503 &my_die("Unable to perform dettool: $error_code", "$stage", $stage_id, $error_code); 1504 } 1505 exit $PS_EXIT_UNKNOWN_ERROR; 1506 } 1507 } 1508 # Check to see if we can mark the whole detRunSummary object as cleaned. 1509 1510 $command = "$dettool -pendingcleanup_detrunsummary -det_id $stage_id"; 1511 $command .= " -dbname $dbname" if defined $dbname; 1512 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 1513 unless ($success) { 1514 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1515 &my_die("Unable to perform dettool: $error_code", "$stage (detRunSummary)", $stage_id, $error_code); 1516 } 1517 if (@$stdout_buf != 0) { 1518 $metadata = $mdcParser->parse(join "", @$stdout_buf) or 1519 &my_die("Unable to parse metadata config doc", "$stage (detRunSummary)", $stage_id, $PS_EXIT_PROG_ERROR); 1520 $exps = parse_md_list($metadata) or 1521 &my_die("Unable to parse metadata list", "$stage (detRunSummary)", $stage_id, $PS_EXIT_PROG_ERROR); 1522 1523 foreach my $exp (@$exps) { 1524 my $iteration = $exp->{iteration}; 1525 my $command; 1526 if ($mode eq "goto_cleaned") { 1527 $command = "$dettool -updatedetrunsummary -det_id $stage_id -iteration $iteration -data_state cleaned"; 1528 } 1529 if ($mode eq "goto_scrubbed") { 1530 $command = "$dettool -updatedetrunsummary -det_id $stage_id -iteration $iteration -data_state scrubbed"; 1531 } 1532 if ($mode eq "goto_purged") { 1533 $command = "$dettool -updatedetrunsummary -det_id $stage_id -iteration $iteration -data_state purged"; 1534 } 1535 $command .= " -dbname $dbname" if defined $dbname; 1536 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1537 run(command => $command, verbose => $verbose); 1538 unless ($success) { 1539 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1540 &my_die("Unable to perform dettool: $error_code", "$stage (detRunSummary)", $stage_id, $error_code); 1541 } 1542 } 1543 } 1544 exit 0; 1545 } 1546 if ($stage eq "detrend.resid.imfile") { 1547 1548 die "--stage_id required for stage $stage\n" if !$stage_id; 1549 ### select the imfiles for this entry 1550 1551 # this stage uses 'dettool' 1552 my $dettool = can_run('dettool') or die "Can't find dettool"; 1553 1554 # Get list of component imfiles 1555 # XXX may need a different my_die for each stage 1556 my $imfiles; # Array of component files 1557 my $command = "$dettool -pendingcleanup_residimfile -det_id $stage_id"; # Command to run 1558 $command .= " -dbname $dbname" if defined $dbname; 1559 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 1560 unless ($success) { 1561 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1562 &my_die("Unable to perform dettool: $error_code", "detrend.process.imfile", $stage_id, $error_code); 1563 } 1564 1565 if (@$stdout_buf == 0) { 1566 exit 0; 1567 } 1568 1569 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 1570 &my_die("Unable to parse metadata config doc", "$stage", $stage_id, $PS_EXIT_PROG_ERROR); 1571 1572 # extract the metadata for the files into a hash list 1573 $imfiles = parse_md_list($metadata) or 1574 &my_die("Unable to parse metadata list", "$stage", $stage_id, $PS_EXIT_PROG_ERROR); 1575 1576 # loop over all of the imfiles, determine the path_base and class_id for each 1577 foreach my $imfile (@$imfiles) { 1578 my $class_id = $imfile->{class_id}; 1579 my $iteration = $imfile->{iteration}; 1580 my $exp_id = $imfile->{exp_id}; 1581 my $path_base = $imfile->{path_base}; 1582 my $status = 1; 1583 1584 # don't clean up unless the data needed to update is available 1585 # modes goto_purged and goto_scrubbed will remove files even if the config is non-existent 1586 # goto_scrubbed now requires the config file to not exist. 1587 1588 # Possibly not the correct config file, but simtest doesn't leave any around to check. 1589 if ($mode eq "goto_cleaned") { 1590 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base, $class_id); 1591 1592 if (!$config_file or ! -e $config_file) { 1593 print STDERR "skipping cleanup for $stage $stage_id $class_id " 1594 . " because config file is missing\n"; 1595 $status = 0; 1596 } 1597 } 1598 elsif ($mode eq "goto_scrubbed") { 1599 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base, $class_id); 1600 1601 if ($config_file and -e $config_file) { 1602 print STDERR "skipping scrubbed for $stage $stage_id $class_id " 1603 . " because config file is present\n"; 1604 $status = 0; 1605 } 1606 } 1607 1608 if ($status) { 1609 # array of actual filenames to delete 1610 my @files = (); 1611 1612 # delete the temporary image datafiles 1613 addFilename (\@files, "PPIMAGE.OUTPUT", $path_base, $class_id); 1614 if ($mode eq "goto_purged") { 1615 # additional files to remove for 'purge' mode 1616 addFilename (\@files, "PPIMAGE.BIN1", $path_base, $class_id); 1617 addFilename (\@files, "PPIMAGE.BIN2", $path_base, $class_id); 1618 addFilename (\@files, "PPIMAGE.STATS", $path_base, $class_id); 1619 } 1620 1621 # actual command to delete the files 1622 $status = &delete_files (\@files); 1623 } 1624 1625 if ($status) { 1626 my $command = "$dettool -updateresidimfile -det_id $stage_id -exp_id $exp_id -iteration $iteration -class_id $class_id"; 1627 if ($mode eq "goto_purged") { 1628 $command .= " -data_state purged"; 1629 } 1630 elsif ($mode eq "goto_cleaned") { 1631 $command .= " -data_state cleaned"; 1632 } 1633 elsif ($mode eq "goto_scrubbed") { 1634 $command .= " -data_state scrubbed"; 1635 } 1636 1637 $command .= " -dbname $dbname" if defined $dbname; 1638 1639 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1640 run(command => $command, verbose => $verbose); 1641 unless ($success) { 1642 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1643 &my_die("Unable to perform dettool: $error_code", "$stage", $stage_id, $error_code); 1644 } 1645 } else { 1646 my $command = "$dettool -updateresidimfile -det_id $stage_id -exp_id $exp_id -iteration $iteration -class_id $class_id -data_state $error_state"; 1647 $command .= " -dbname $dbname" if defined $dbname; 1648 1649 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1650 run(command => $command, verbose => $verbose); 1651 unless ($success) { 1652 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1653 &my_die("Unable to perform dettool: $error_code", "$stage", $stage_id, $error_code); 1654 } 1655 } 1656 } 1657 # Check to see if we can mark the whole detRunSummary object as cleaned. 1658 1659 $command = "$dettool -pendingcleanup_detrunsummary -det_id $stage_id"; 1660 $command .= " -dbname $dbname" if defined $dbname; 1661 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 1662 unless ($success) { 1663 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1664 &my_die("Unable to perform dettool: $error_code", "$stage (detRunSummary)", $stage_id, $error_code); 1665 } 1666 if (@$stdout_buf != 0) { 1667 $metadata = $mdcParser->parse(join "", @$stdout_buf) or 1668 &my_die("Unable to parse metadata config doc", "$stage (detRunSummary)", $stage_id, $PS_EXIT_PROG_ERROR); 1669 my $exps = parse_md_list($metadata) or 1670 &my_die("Unable to parse metadata list", "$stage (detRunSummary)", $stage_id, $PS_EXIT_PROG_ERROR); 1671 1672 foreach my $exp (@$exps) { 1673 my $iteration = $exp->{iteration}; 1674 my $command; 1675 if ($mode eq "goto_cleaned") { 1676 $command = "$dettool -updatedetrunsummary -det_id $stage_id -iteration $iteration -data_state cleaned"; 1677 } 1678 if ($mode eq "goto_scrubbed") { 1679 $command = "$dettool -updatedetrunsummary -det_id $stage_id -iteration $iteration -data_state scrubbed"; 1680 } 1681 if ($mode eq "goto_purged") { 1682 $command = "$dettool -updatedetrunsummary -det_id $stage_id -iteration $iteration -data_state purged"; 1683 } 1684 $command .= " -dbname $dbname" if defined $dbname; 1685 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1686 run(command => $command, verbose => $verbose); 1687 unless ($success) { 1688 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1689 &my_die("Unable to perform dettool: $error_code", "$stage (detRunSummary)", $stage_id, $error_code); 1690 } 1691 } 1692 } 1693 1694 exit 0; 1695 } 1696 if ($stage eq "detrend.resid.exp") { 1697 die "--stage_id required for stage $stage\n" if !$stage_id; 1698 # this stage uses 'camtool' 1699 my $dettool = can_run('dettool') or die "Can't find dettool"; 1700 1701 # Get list of component imfiles 1702 # XXX may need a different my_die for each stage 1703 my $exps; # Array of component files 1704 my $command = "$dettool -pendingcleanup_residexp -det_id $stage_id"; # Command to run 1705 $command .= " -dbname $dbname" if defined $dbname; 1706 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 1707 unless ($success) { 1708 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1709 &my_die("Unable to perform dettool: $error_code", "$stage", $stage_id, $error_code); 1710 } 1711 # This is a hack to bomb out until I can diagnose why pantasks wants to keep running this 1712 if (@$stdout_buf == 0) { 1713 exit 0; 1714 } 1715 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or 1716 &my_die("Unable to parse metadata config doc", "$stage", $stage_id, $PS_EXIT_PROG_ERROR); 1717 1718 $exps = parse_md_list($metadata) or 1719 &my_die("Unable to parse metadata list", "$stage", $stage_id, $PS_EXIT_PROG_ERROR); 1720 1721 foreach my $exp (@$exps) { 1722 my $exp_id = $exp->{exp_id}; 1723 my $iteration = $exp->{iteration}; 1724 my $path_base = $exp->{path_base}; 1725 # my $class_id = $exp->{class_id} 1726 my $status = 1; 1727 # don't clean up unless the data needed to update is available 1728 # goto_scrubbed now requires the config file to not be present 1729 if ($mode eq "goto_cleaned") { 1730 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base); 1731 1732 if (!$config_file or ! -e $config_file) { 1733 print STDERR "skipping cleanup for $stage $stage_id because config file is missing\n"; 1734 $status = 0; 1735 } 1736 } 1737 elsif ($mode eq "goto_scrubbed") { 1738 my $config_file = $ipprc->filename("PPIMAGE.CONFIG", $path_base); 1739 1740 if ($config_file and -e $config_file) { 1741 print STDERR "skipping cleanup for $stage $stage_id because config file ($config_file) is present\n"; 1742 $status = 0; 1743 } 1744 } 1745 if ($status) { 1746 my @files = (); 1747 # delete the temporary image datafiles 1748 if ($mode eq "goto_purged") { 1749 # additional files to remove for 'purge' mode 1750 addFilename (\@files, "PPIMAGE.JPEG1", $path_base);#, $class_id); 1751 addFilename (\@files, "PPIMAGE.JPEG2", $path_base);#, $class_id); 1752 } 1753 # actual command to delete the files 1754 $status = &delete_files (\@files); 1755 } 1756 1757 if ($status) { 1758 my $command = "$dettool -updateresidexp -det_id $stage_id -exp_id $exp_id -iteration $iteration"; 1759 if ($mode eq "goto_cleaned") { 1760 $command .= " -data_state cleaned"; 1761 } 1762 if ($mode eq "goto_scrubbed") { 1763 $command .= " -data_state scrubbed"; 1764 } 1765 if ($mode eq "goto_purged") { 1766 $command .= " -data_state purged"; 1767 } 1768 $command .= " -dbname $dbname" if defined $dbname; 1769 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1770 run(command => $command, verbose => $verbose); 1771 unless ($success) { 1772 print STDERR " residexp had an issue setting the state:? $success $error_code\n"; 1773 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1774 &my_die("Unable to perform dettool: $error_code", "$stage", $stage_id, $error_code); 1775 } 1776 } else { 1777 my $command = "$dettool -updateresidexp -det_id $stage_id -exp_id $exp_id -iteration $iteration -data_state $error_state"; 1778 $command .= " -dbname $dbname" if defined $dbname; 1779 1780 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1781 run(command => $command, verbose => $verbose); 1782 unless ($success) { 1783 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1784 &my_die("Unable to perform dettool: $error_code", "$stage", $stage_id, $error_code); 1785 } 1786 exit $PS_EXIT_UNKNOWN_ERROR; 1787 } 1788 } 1789 # Check to see if we can mark the whole detRunSummary object as cleaned. 1790 1791 $command = "$dettool -pendingcleanup_detrunsummary -det_id $stage_id"; 1792 $command .= " -dbname $dbname" if defined $dbname; 1793 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 1794 unless ($success) { 1795 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1796 &my_die("Unable to perform dettool: $error_code", "$stage (detRunSummary)", $stage_id, $error_code); 1797 } 1798 if (@$stdout_buf != 0) { 1799 $metadata = $mdcParser->parse(join "", @$stdout_buf) or 1800 &my_die("Unable to parse metadata config doc", "$stage (detRunSummary)", $stage_id, $PS_EXIT_PROG_ERROR); 1801 $exps = parse_md_list($metadata) or 1802 &my_die("Unable to parse metadata list", "$stage (detRunSummary)", $stage_id, $PS_EXIT_PROG_ERROR); 1803 1804 foreach my $exp (@$exps) { 1805 my $iteration = $exp->{iteration}; 1806 my $command; 1807 if ($mode eq "goto_cleaned") { 1808 $command = "$dettool -updatedetrunsummary -det_id $stage_id -iteration $iteration -data_state cleaned"; 1809 } 1810 if ($mode eq "goto_scrubbed") { 1811 $command = "$dettool -updatedetrunsummary -det_id $stage_id -iteration $iteration -data_state scrubbed"; 1812 } 1813 if ($mode eq "goto_purged") { 1814 $command = "$dettool -updatedetrunsummary -det_id $stage_id -iteration $iteration -data_state purged"; 1815 } 1816 $command .= " -dbname $dbname" if defined $dbname; 1817 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 1818 run(command => $command, verbose => $verbose); 1819 unless ($success) { 1820 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 1821 &my_die("Unable to perform dettool: $error_code", "$stage (detRunSummary)", $stage_id, $error_code); 1822 } 1823 } 1824 } 1825 exit 0; 1826 } 1827 565 1828 566 1829 die "ipp_cleanup.pl -stage $stage not yet implemented\n"; … … 570 1833 my $files = shift; # reference to a list of files to unlink 571 1834 1835 # open(TMPLOG,">>/tmp/czw.cleanup.log"); 1836 # flock(TMPLOG,2); 1837 572 1838 # this script is, of course, very dangerous. 573 1839 foreach my $file (@$files) { 574 1840 print STDERR "unlinking $file\n"; 1841 # print TMPLOG "$stage $stage_id $file"; 1842 # my $ff = $file; 1843 # $ff =~ s%^file://%%; 1844 # unless (-e $ff) { 1845 # print TMPLOG "\t File not found\n"; 1846 # } 1847 # else { 1848 # print TMPLOG "\n"; 1849 # } 1850 575 1851 $ipprc->file_delete($file); 576 1852 } 1853 1854 # flock(TMPLOG,8); 1855 # close(TMPLOG); 1856 577 1857 return 1; 578 1858 } -
trunk/ippScripts/scripts/magic_destreak_revert.pl
- Property svn:mergeinfo changed
/branches/czw_branch/cleanup/ippScripts/scripts/magic_destreak_revert.pl (added) merged: 25051,25150,25158,25212
- Property svn:mergeinfo changed
-
trunk/ippScripts/scripts/stack_skycell.pl
r23745 r25299 65 65 66 66 my $ipprc = PS::IPP::Config->new() or my_die( "Unable to set up", $stack_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration 67 $| = 1; 68 print "I've set up: $stack_id\n"; 67 69 68 70 # XXX camera is not known here; cannot use filerules... … … 107 109 &my_die("Stack list contains less than two elements", $stack_id, $PS_EXIT_SYS_ERROR) unless 108 110 scalar @$files >= 2; 111 112 print "I've loaded my inputs: $stack_id\n"; 109 113 110 114 # Parse the list of input files to get the tesselation, skycell identifiers and camera … … 146 150 } 147 151 152 print "I've configured everything: $stack_id\n"; 153 148 154 # Generate MDC file with the inputs 149 155 my $tess_base = basename($tess_id); … … 180 186 print $listFile "END\n\n"; 181 187 } 188 189 print "I've checked everything: $stack_id\n"; 182 190 183 191 # Get the output filenames … … 200 208 201 209 my $cmdflags; 210 202 211 203 212 # Perform stacking … … 265 274 # &my_die("Couldn't find expected output file: $bin2Name", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($bin2Name); 266 275 } 267 276 277 print "I've stacked $listName: $stack_id\n"; 268 278 } 269 279 … … 298 308 } 299 309 310 print "I've updated teh database: $stack_id\n"; 311 300 312 301 313 my $my_die_called = 0; … … 372 384 } 373 385 386 print "I've reached the end of processing with a code of $?: $stack_id\n"; 374 387 375 388 END { -
trunk/ippTasks/Makefile.am
r24929 r25299 13 13 chip.pro \ 14 14 camera.pro \ 15 addstar.pro \ 15 16 fake.pro \ 16 17 warp.pro \ -
trunk/ippTasks/pantasks.pro
r24848 r25299 213 213 chip.on 214 214 camera.on 215 addstar.on 215 216 fake.on 216 217 warp.on … … 225 226 chip.off 226 227 camera.off 228 addstar.off 227 229 fake.off 228 230 warp.off … … 242 244 module chip.pro 243 245 module camera.pro 246 module addstar.pro 244 247 module fake.pro 245 248 module warp.pro -
trunk/ippTasks/summit.copy.pro
r24054 r25299 449 449 end 450 450 if (("$MD5SUM" != "NULL") && ("$MD5SUM" != "0") && (not($COMPRESS))) 451 # && (($YEAR > 2008) || (("$YEAR" = "2007") && ($MONTH > 8)))) 451 452 $run = $run --md5 $MD5SUM 452 453 end -
trunk/ippTools/share/Makefile.am
r25284 r25299 4 4 5 5 dist_pkgdata_DATA = \ 6 addtool_find_pendingexp.sql \ 7 addtool_queue_cam_id.sql \ 8 addtool_reset_faulted_runs.sql \ 9 addtool_revertprocessedexp.sql \ 6 10 camtool_donecleanup.sql \ 7 11 camtool_find_chip_id.sql \ -
trunk/ippTools/share/dettool_pendingcleanup_normalizedimfile.sql
r19092 r25299 1 SELECT 1 SELECT DISTINCT 2 2 detNormalizedImfile.*, 3 3 detRunSummary.data_state -
trunk/ippTools/share/dettool_pendingcleanup_stacked.sql
r19092 r25299 1 SELECT 1 SELECT DISTINCT 2 2 detStackedImfile.*, 3 3 detRunSummary.data_state -
trunk/ippTools/share/pxadmin_create_tables.sql
r25256 r25299 451 451 ) ENGINE=innodb DEFAULT CHARSET=latin1; 452 452 453 CREATE TABLE addRun ( 454 add_id BIGINT AUTO_INCREMENT, 455 cam_id BIGINT, 456 state VARCHAR(64), 457 workdir VARCHAR(255), 458 workdir_state VARCHAR(64), 459 label VARCHAR(64), 460 dvodb VARCHAR(255), 461 magicked BIGINT, 462 PRIMARY KEY(add_id), 463 KEY(add_id), 464 KEY(cam_id), 465 KEY(state), 466 KEY(workdir_state), 467 KEY(label), 468 INDEX(add_id, cam_id), 469 FOREIGN KEY(cam_id) REFERENCES camRun(cam_id) 470 ) ENGINE=innodb DEFAULT CHARSET=latin1; 471 472 CREATE TABLE addProcessedExp ( 473 add_id BIGINT AUTO_INCREMENT, 474 dtime_addstar FLOAT, 475 n_stars INT, 476 path_base VARCHAR(255), 477 fault SMALLINT NOT NULL, 478 PRIMARY KEY(add_id), 479 FOREIGN KEY(add_id) REFERENCES addRun(add_id) 480 ) ENGINE=innodb DEFAULT CHARSET=latin1; 481 482 CREATE TABLE addMask ( 483 label VARCHAR(64), 484 PRIMARY KEY(label) 485 ) ENGINE=innodb DEFAULT CHARSET=latin1; 486 453 487 CREATE TABLE fakeRun ( 454 488 fake_id BIGINT AUTO_INCREMENT, … … 1086 1120 KEY(magic_id), 1087 1121 KEY(label), 1088 FOREIGN KEY(magic_id) REFERENCES magicRun(magic_id) 1122 FOREIGN KEY(magic_id) REFERENCES magicRun(magic_id), 1123 FOREIGN KEY(inv_magic_id) REFERENCES magicRun(magic_id) 1089 1124 FOREIGN KEY(inv_magic_id) REFERENCES magicRun(magic_id) 1090 1125 ) ENGINE=innodb DEFAULT CHARSET=latin1; -
trunk/ippTools/share/pxadmin_drop_tables.sql
r24531 r25299 19 19 DROP TABLE IF EXISTS detRun; 20 20 DROP TABLE IF EXISTS detInputExp; 21 DROP TABLE IF EXISTS addRun; 22 DROP TABLE IF EXISTS addProcessedExp; 23 DROP TABLE IF EXISTS addMask; 21 24 DROP TABLE IF EXISTS fakeRun; 22 25 DROP TABLE IF EXISTS fakeProcessedImfile; -
trunk/ippTools/src/Makefile.am
r24512 r25299 1 1 bin_PROGRAMS = \ 2 addtool \ 2 3 caltool \ 3 4 camtool \ … … 28 29 29 30 pkginclude_HEADERS = \ 31 pxadd.h \ 30 32 pxadmin.h \ 31 33 pxcam.h \ … … 42 44 43 45 noinst_HEADERS = \ 46 addtool.h \ 44 47 caltool.h \ 45 48 camtool.h \ … … 68 71 libpxtools_la_LDFLAGS = -release $(PACKAGE_VERSION) 69 72 libpxtools_la_SOURCES = \ 73 pxadd.c \ 70 74 pxcam.c \ 71 75 pxchip.c \ … … 96 100 pstamptool.c \ 97 101 pstamptoolConfig.c 102 103 addtool_CFLAGS = $(PSLIB_CFLAGS) $(PSMODULES_CFLAGS) $(IPPDB_CFLAGS) 104 addtool_LDADD = $(PSLIB_LIBS) $(PSMODULES_LIBS) $(IPPDB_LIBS) libpxtools.la 105 addtool_SOURCES = \ 106 addtool.c \ 107 addtoolConfig.c 98 108 99 109 caltool_CFLAGS = $(PSLIB_CFLAGS) $(PSMODULES_CFLAGS) $(IPPDB_CFLAGS) -
trunk/ippTools/src/camtool.c
r24681 r25299 656 656 return false; 657 657 } 658 659 if (!pxaddQueueByCamID(config, 660 pendingRow->cam_id, 661 pendingRow->workdir, 662 pendingRow->label, 663 pendingRow->reduction, 664 pendingRow->dvodb 665 )) { 666 // rollback 667 if (!psDBRollback(config->dbh)) { 668 psError(PS_ERR_UNKNOWN, false, "database error"); 669 } 670 psError(PS_ERR_UNKNOWN, false, "failed to queue new addRun"); 671 psFree(pendingRow); 672 return false; 673 } 674 658 675 psFree(pendingRow); 659 676 -
trunk/ippTools/src/dettoolConfig.c
r24866 r25299 70 70 psMetadataAddF64(definebytagArgs, PS_LIST_TAIL, "-sun_angle_min", 0, "define min solar angle", NAN); 71 71 psMetadataAddF64(definebytagArgs, PS_LIST_TAIL, "-sun_angle_max", 0, "define max solar angle", NAN); 72 72 73 73 74 psMetadataAddTime(definebytagArgs, PS_LIST_TAIL, "-registered", 0, "time detrend run was registered", now); … … 138 139 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-comment", 0, "search by comment field (LIKE comparison)", NULL); 139 140 141 142 psMetadataAddF64(definebyqueryArgs, PS_LIST_TAIL, "-select_moon_angle_min", 0, "define min moon angle", NAN); 143 psMetadataAddF64(definebyqueryArgs, PS_LIST_TAIL, "-select_moon_angle_max", 0, "define max moon angle", NAN); 144 psMetadataAddF64(definebyqueryArgs, PS_LIST_TAIL, "-select_moon_alt_min", 0, "define min moon alt", NAN); 145 psMetadataAddF64(definebyqueryArgs, PS_LIST_TAIL, "-select_moon_alt_max", 0, "define max moon alt", NAN); 146 psMetadataAddF64(definebyqueryArgs, PS_LIST_TAIL, "-select_moon_phase_min", 0, "define min moon phase", NAN); 147 psMetadataAddF64(definebyqueryArgs, PS_LIST_TAIL, "-select_moon_phase_max", 0, "define max moon phase", NAN); 148 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-comment", 0, "search by comment field (LIKE comparison)", NULL); 149 140 150 psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-pretend", 0, "print the exposures that would be included in the detrend run and exit", false); 141 151 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-reduction", 0, "define reduction class for processing", NULL); -
trunk/ippTools/src/pxtools.h
r24733 r25299 37 37 #include "pxtoolsErrorCodes.h" 38 38 39 #include "pxadd.h" 39 40 #include "pxcam.h" 40 41 #include "pxchip.h" -
trunk/ippTools/src/regtool.c
r24866 r25299 331 331 PXOPT_LOOKUP_BOOL(faulted, config->args, "-faulted", false); 332 332 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 333 PXOPT_LOOKUP_BOOL(ordered_by_date, config->args, "-ordered_by_date", false); 333 334 334 335 psString query = pxDataGet("regtool_processedimfile.sql"); … … 352 353 // don't list faulted rows 353 354 psStringAppend(&query, " %s", "AND rawImfile.fault = 0"); 355 } 356 357 // add the ORDER BY statement if desired 358 if (ordered_by_date) { 359 psStringAppend(&query, " ORDER BY dateobs"); 354 360 } 355 361 … … 923 929 PXOPT_COPY_F64(config->args, where, "-posang_max", "posang", "<"); 924 930 PXOPT_COPY_STR(config->args, where, "-object", "object", "=="); 925 PXOPT_COPY_F32(config->args, where, "-s un_angle_min", "sun_angle", ">=");926 PXOPT_COPY_F32(config->args, where, "-s un_angle_max", "sun_angle", "<");931 PXOPT_COPY_F32(config->args, where, "-solang_min", "solang", ">="); 932 PXOPT_COPY_F32(config->args, where, "-solang_max", "solang", "<"); 927 933 928 934 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); -
trunk/ippTools/src/warptool.c
r24956 r25299 234 234 PXOPT_COPY_F64(config->args, where, "-posang_max", "rawExp.posang", "<"); 235 235 PXOPT_COPY_STR(config->args, where, "-object", "rawExp.object", "=="); 236 PXOPT_COPY_F32(config->args, where, "-s un_angle_min", "rawExp.sun_angle",">=");237 PXOPT_COPY_F32(config->args, where, "-s un_angle_max", "rawExp.sun_angle","<");236 PXOPT_COPY_F32(config->args, where, "-solang_min", "rawExp.solang", ">="); 237 PXOPT_COPY_F32(config->args, where, "-solang_max", "rawExp.solang", "<"); 238 238 PXOPT_COPY_STR(config->args, where, "-reduction", "fakeRun.reduction", "=="); 239 239 pxAddLabelSearchArgs (config, where, "-label", "fakeRun.label", "=="); -
trunk/ippconfig/gpc1/format_20090220.config
r24895 r25299 185 185 FPA.ALT STR ALT 186 186 FPA.AZ STR AZ 187 FPA.TEMP STR DETTEM187 # FPA.TEMP STR DETTEM 188 188 FPA.M1X STR M1X 189 189 FPA.M1Y STR M1Y … … 501 501 # How to translation PS concepts into database lookups 502 502 DATABASE METADATA 503 # this rule is fragile : does not match the camera 504 FPA.TEMP STR SELECT ccd_temp FROM rawExp WHERE dateobs >= '{FPA.DATE}' and abs(timediff(dateobs, cast('{FPA.TIME}' as datetime))) < 2 503 505 END 504 506 -
trunk/ippconfig/recipes/masks.16bit.config
r23498 r25299 20 20 21 21 # Mask values which represent non-astronomical structures 22 BURNTOOL U16 0x0080 # Pixel may contain uncorrected streak. 22 23 CR U16 0x0100 # Pixel contains a cosmic ray 23 24 SPIKE U16 0x0200 # Pixel contains a diffraction spike -
trunk/ippconfig/recipes/ppImage.config
r24904 r25299 16 16 MASK.SATURATED BOOL TRUE # Mask the saturated pixels 17 17 MASK.LOW BOOL TRUE # Mask pixels below valid range 18 MASK.BURNTOOL BOOL TRUE # Mask potential burntool trails 18 19 VARIANCE.BUILD BOOL FALSE # Build internal variance image 19 20 PATTERN BOOL FALSE # Fit and remove pattern noise? … … 54 55 ## if we use multithreaded detrending, detrend this number of rows per thread 55 56 SCAN.ROWS S32 100 57 58 BURNTOOL.TRAILS U16 0x01 56 59 57 60 # Non-linearity correction -
trunk/ippconfig/recipes/psastro.config
r24654 r25299 3 3 PSASTRO.ONLY.REFSTARS BOOL FALSE # skip all but refstar matches 4 4 PSASTRO.SAVE.REFMATCH BOOL FALSE # save refstar matches as table in output smf file 5 6 # select which WCS style to use on output images. 7 PSASTRO.WCS.USECDKEYS BOOL FALSE 5 8 6 9 # perform single-chip astrometry? -
trunk/ppImage/src/Makefile.am
r24229 r25299 54 54 ppImageDefineFile.c \ 55 55 ppImageSetMaskBits.c \ 56 ppImageBurntoolMask.c \ 56 57 ppImageParityFlip.c \ 57 58 ppImageCheckCTE.c \ -
trunk/ppImage/src/ppImage.h
r24903 r25299 26 26 bool doMaskBuild; // Build internal mask 27 27 bool doVarianceBuild; // Build internal variance map 28 bool doMaskBurntool; // mask potential burntool trails 28 29 bool doMaskSat; // mask saturated pixels 29 30 bool doMaskLow; // mask low pixels … … 74 75 psImageMaskType darkMask; // Mask value to give bad dark pixels 75 76 psImageMaskType blankMask; // Mask value to give blank pixels 76 77 psImageMaskType burntoolMask; // Suspect pixels that fall where a burntool trail is expected. 77 78 // non-linear correction parameters 78 79 psDataType nonLinearType; … … 82 83 // options for the analysis 83 84 pmOverscanOptions *overscan; // Overscan options 84 85 int burntoolTrails; 85 86 // binning parameters 86 87 int xBin1; // x-binning, scale 1 … … 156 157 bool ppImageCheckCTE(pmConfig *config, ppImageOptions *options, pmFPAview *view); 157 158 159 bool ppImageBurntoolMask(pmConfig *config, ppImageOptions *options, pmFPAview *view, pmReadout *mask); 160 158 161 // Record which detrend file was used for the detrending 159 162 bool ppImageDetrendRecord( -
trunk/ppImage/src/ppImageDetrendReadout.c
r24903 r25299 26 26 pmMaskBadPixels(input, mask, options->maskValue); 27 27 } 28 if (options->doMaskBurntool) { 29 ppImageBurntoolMask(config,options,view,input); 30 } 31 28 32 29 33 # if 0 -
trunk/ppImage/src/ppImageOptions.c
r24903 r25299 21 21 options->doMaskSat = false; // mask saturated pixels 22 22 options->doMaskLow = false; // mask low pixels 23 options->doMaskBurntool = false; // mask potential burntool trails 23 24 options->doVarianceBuild = false; // Build internal variance 24 25 options->doMask = false; // Mask bad pixels … … 64 65 options->blankMask = 0x00; // Blank (no data, cell gap) pixels (supplied to pmChipMosaic, pmFPAMosaic) 65 66 options->markValue = 0x00; // A safe bit for internal marking 66 67 options->burntoolMask = 0x00; // Suspect pixels that fall where a burntool trail is expected. 68 options->burntoolTrails = 0x00; // Which types of burntool areas to mask. 67 69 // crosstalk options 68 70 options->doCrosstalkMeasure = false; // measure crosstalk … … 219 221 options->doMaskSat = psMetadataLookupBool(NULL, recipe, "MASK.SATURATED"); 220 222 options->doMaskLow = psMetadataLookupBool(NULL, recipe, "MASK.LOW"); 223 options->doMaskBurntool = psMetadataLookupBool(NULL, recipe, "MASK.BURNTOOL"); 221 224 options->doVarianceBuild = psMetadataLookupBool(NULL, recipe, "VARIANCE.BUILD"); 222 225 … … 245 248 options->applyParity = psMetadataLookupBool(NULL, recipe, "APPLY.CELL.PARITY"); 246 249 250 options->burntoolTrails = psMetadataLookupU16(&status, recipe, "BURNTOOL.TRAILS"); 251 if (!status) { 252 psWarning("BURNTOOL.TRAILS not found in recipe: setting to default value.\n"); 253 } 254 247 255 // binned image options 248 256 options->xBin1 = psMetadataLookupS32(&status, recipe, "BIN1.XBIN"); 249 257 if (!status) { 250 258 psWarning("BIN1.XBIN not found in recipe: setting to default value.\n"); 259 options->xBin1 = 4; 251 260 } 252 261 options->yBin1 = psMetadataLookupS32(&status, recipe, "BIN1.YBIN"); 253 262 if (!status) { 254 263 psWarning("BIN1.YBIN not found in recipe: setting to default value.\n"); 255 options->yBin1 = 16;264 options->yBin1 = 4; 256 265 } 257 266 -
trunk/ppImage/src/ppImageSetMaskBits.c
r24079 r25299 38 38 psAssert (options->lowMask, "low mask not set"); 39 39 40 // mask for suspect regions due to burntool 41 options->burntoolMask = pmConfigMaskGet("BURNTOOL",config); 42 psAssert (options->burntoolMask, "burntool mask not set"); 43 40 44 // save MASK and MARK on the PSPHOT recipe 41 45 psMetadata *recipe = psMetadataLookupPtr (NULL, config->recipes, PSPHOT_RECIPE); -
trunk/psModules/src/astrom/pmAstrometryWCS.c
r24052 r25299 289 289 // test the CDELTi varient 290 290 if (pcKeys) { 291 wcs->wcsCDkeys = 0; 292 291 293 wcs->cdelt1 = psMetadataLookupF64 (&status, header, "CDELT1"); 292 294 wcs->cdelt2 = psMetadataLookupF64 (&status, header, "CDELT2"); … … 334 336 // test the CDi_j varient 335 337 if (cdKeys) { 338 wcs->wcsCDkeys = 1; 339 336 340 wcs->trans->x->coeff[1][0] = psMetadataLookupF64 (&status, header, "CD1_1"); // == PC1_1 337 341 wcs->trans->x->coeff[0][1] = psMetadataLookupF64 (&status, header, "CD1_2"); // == PC1_2 … … 375 379 // XXX make it optional to write out CDi_j terms, or other versions 376 380 // apply CDELT1,2 (degrees / pixel) to yield PCi,j terms of order unity 377 double cdelt1 = wcs->cdelt1; 378 double cdelt2 = wcs->cdelt2; 379 psMetadataAddF64 (header, PS_LIST_TAIL, "CDELT1", PS_META_REPLACE, "", cdelt1); 380 psMetadataAddF64 (header, PS_LIST_TAIL, "CDELT2", PS_META_REPLACE, "", cdelt2); 381 382 // test the PC00i00j varient: 383 psMetadataAddF64 (header, PS_LIST_TAIL, "PC001001", PS_META_REPLACE, "", wcs->trans->x->coeff[1][0] / cdelt1); // == PC1_1 384 psMetadataAddF64 (header, PS_LIST_TAIL, "PC001002", PS_META_REPLACE, "", wcs->trans->x->coeff[0][1] / cdelt2); // == PC1_2 385 psMetadataAddF64 (header, PS_LIST_TAIL, "PC002001", PS_META_REPLACE, "", wcs->trans->y->coeff[1][0] / cdelt1); // == PC2_1 386 psMetadataAddF64 (header, PS_LIST_TAIL, "PC002002", PS_META_REPLACE, "", wcs->trans->y->coeff[0][1] / cdelt2); // == PC2_2 387 388 // Elixir-style polynomial terms 389 // XXX currently, Elixir/DVO cannot accept mixed orders 390 // XXX need to respect the masks 391 // XXX is wcs->cdelt1,2 always consistent? 392 int fitOrder = wcs->trans->x->nX; 393 if (fitOrder > 1) { 381 382 if (!(wcs->wcsCDkeys)) { 383 384 double cdelt1 = wcs->cdelt1; 385 double cdelt2 = wcs->cdelt2; 386 psMetadataAddF64 (header, PS_LIST_TAIL, "CDELT1", PS_META_REPLACE, "", cdelt1); 387 psMetadataAddF64 (header, PS_LIST_TAIL, "CDELT2", PS_META_REPLACE, "", cdelt2); 388 389 // test the PC00i00j varient: 390 psMetadataAddF64 (header, PS_LIST_TAIL, "PC001001", PS_META_REPLACE, "", wcs->trans->x->coeff[1][0] / cdelt1); // == PC1_1 391 psMetadataAddF64 (header, PS_LIST_TAIL, "PC001002", PS_META_REPLACE, "", wcs->trans->x->coeff[0][1] / cdelt2); // == PC1_2 392 psMetadataAddF64 (header, PS_LIST_TAIL, "PC002001", PS_META_REPLACE, "", wcs->trans->y->coeff[1][0] / cdelt1); // == PC2_1 393 psMetadataAddF64 (header, PS_LIST_TAIL, "PC002002", PS_META_REPLACE, "", wcs->trans->y->coeff[0][1] / cdelt2); // == PC2_2 394 395 // Elixir-style polynomial terms 396 // XXX currently, Elixir/DVO cannot accept mixed orders 397 // XXX need to respect the masks 398 // XXX is wcs->cdelt1,2 always consistent? 399 int fitOrder = wcs->trans->x->nX; 400 if (fitOrder > 1) { 394 401 for (int i = 0; i <= fitOrder; i++) { 395 for (int j = 0; j <= fitOrder; j++) {396 if (i + j < 2)397 continue;398 if (i + j > fitOrder)399 continue;400 sprintf (name, "PCA1X%1dY%1d", i, j);401 psMetadataAddF64 (header, PS_LIST_TAIL, name, PS_META_REPLACE, "", wcs->trans->x->coeff[i][j] / pow(cdelt1, i) / pow(cdelt2, j));402 sprintf (name, "PCA2X%1dY%1d", i, j);403 psMetadataAddF64 (header, PS_LIST_TAIL, name, PS_META_REPLACE, "", wcs->trans->y->coeff[i][j] / pow(cdelt1, i) / pow(cdelt2, j));404 }402 for (int j = 0; j <= fitOrder; j++) { 403 if (i + j < 2) 404 continue; 405 if (i + j > fitOrder) 406 continue; 407 sprintf (name, "PCA1X%1dY%1d", i, j); 408 psMetadataAddF64 (header, PS_LIST_TAIL, name, PS_META_REPLACE, "", wcs->trans->x->coeff[i][j] / pow(cdelt1, i) / pow(cdelt2, j)); 409 sprintf (name, "PCA2X%1dY%1d", i, j); 410 psMetadataAddF64 (header, PS_LIST_TAIL, name, PS_META_REPLACE, "", wcs->trans->y->coeff[i][j] / pow(cdelt1, i) / pow(cdelt2, j)); 411 } 405 412 } 406 413 psMetadataAddS32 (header, PS_LIST_TAIL, "NPLYTERM", PS_META_REPLACE, "", fitOrder); 407 }408 409 // remove any existing 'CDi_j style' wcs keywords410 if (psMetadataLookup(header, "CD1_1")) {414 } 415 416 // remove any existing 'CDi_j style' wcs keywords 417 if (psMetadataLookup(header, "CD1_1")) { 411 418 psMetadataRemoveKey(header, "CD1_1"); 412 419 psMetadataRemoveKey(header, "CD1_2"); 413 420 psMetadataRemoveKey(header, "CD2_1"); 414 421 psMetadataRemoveKey(header, "CD2_2"); 422 } 423 } 424 if (wcs->wcsCDkeys) { 425 psMetadataAddF64 (header, PS_LIST_TAIL, "CD1_1", PS_META_REPLACE, "", wcs->trans->x->coeff[1][0]); 426 psMetadataAddF64 (header, PS_LIST_TAIL, "CD1_2", PS_META_REPLACE, "", wcs->trans->x->coeff[0][1]); 427 psMetadataAddF64 (header, PS_LIST_TAIL, "CD2_1", PS_META_REPLACE, "", wcs->trans->y->coeff[1][0]); 428 psMetadataAddF64 (header, PS_LIST_TAIL, "CD2_2", PS_META_REPLACE, "", wcs->trans->y->coeff[0][1]); 429 430 if (psMetadataLookup(header, "PC001001")) { 431 psMetadataRemoveKey(header, "PC001001"); 432 psMetadataRemoveKey(header, "PC001002"); 433 psMetadataRemoveKey(header, "PC002001"); 434 psMetadataRemoveKey(header, "PC002002"); 435 } 415 436 } 416 437 … … 535 556 fpa->toSky->R -= 2.0*M_PI; 536 557 558 fpa->wcsCDkeys = wcs->wcsCDkeys; 559 537 560 psTrace ("psastro", 5, "toFPA: %f %f (%f,%f),(%f,%f)\n", 538 561 chip->toFPA->x->coeff[0][0], chip->toFPA->y->coeff[0][0], … … 682 705 wcs->cdelt2 = hypot (wcs->trans->y->coeff[1][0], wcs->trans->y->coeff[0][1]); 683 706 707 wcs->wcsCDkeys = fpa->wcsCDkeys; 684 708 psFree (toTPA); 685 709 … … 922 946 wcs->trans = psPlaneTransformAlloc (nXorder, nYorder); 923 947 wcs->toSky = NULL; 948 wcs->wcsCDkeys = 0; 924 949 925 950 memset (wcs->ctype1, 0, PM_ASTROM_WCS_TYPE_SIZE); -
trunk/psModules/src/astrom/pmAstrometryWCS.h
r24766 r25299 23 23 double crpix1, crpix2; 24 24 double cdelt1, cdelt2; 25 bool wcsCDkeys; 25 26 psProjection *toSky; 26 27 psPlaneTransform *trans; -
trunk/psModules/src/camera/pmFPA.h
r21363 r25299 48 48 psPlaneTransform *toTPA; ///< Transformation from focal plane to tangent plane, or NULL 49 49 psProjection *toSky; ///< Projection from tangent plane to sky, or NULL 50 bool wcsCDkeys; 50 51 // Information 51 52 psMetadata *concepts; ///< FPA-level concepts -
trunk/psModules/src/camera/pmReadoutFake.c
- Property svn:mergeinfo changed (with no actual effect on merging)
-
trunk/psastro/src/psastroChipAstrom.c
r24036 r25299 97 97 // write the elapsed time here; this will be updated in psastroMosaicAstrometry, if called 98 98 psMetadataAddF32 (updates, PS_LIST_TAIL, "DT_ASTR", PS_META_REPLACE, "elapsed psastro time", psTimerMark ("psastroAnalysis")); 99 99 100 fpa->wcsCDkeys = psMetadataLookupBool(&status, recipe , "PSASTRO.WCS.USECDKEYS"); 100 101 pmAstromWriteWCS (updates, fpa, chip, NONLIN_TOL); 101 102 -
trunk/tools/ipp_apply_burntool.pl
r24859 r25299 172 172 173 173 if ($RAWTABLES) { 174 $status = vsystem ("$burntool $tmpImfileReal out=$artImfileReal $prevFileOpt ", $REALRUN);174 $status = vsystem ("$burntool $tmpImfileReal out=$artImfileReal $prevFileOpt persist=t", $REALRUN); 175 175 } else { 176 $status = vsystem ("$burntool $tmpImfileReal $prevFileOpt ", $REALRUN);176 $status = vsystem ("$burntool $tmpImfileReal $prevFileOpt persist=t", $REALRUN); 177 177 } 178 178 if ($status) {
Note:
See TracChangeset
for help on using the changeset viewer.
