Changeset 28334
- Timestamp:
- Jun 15, 2010, 11:22:56 AM (16 years ago)
- Location:
- branches/czw_branch/20100519
- Files:
-
- 8 added
- 1 deleted
- 42 edited
- 1 copied
-
. (modified) (1 prop)
-
Ohana (modified) (1 prop)
-
Ohana/src/photdbc/src/copy_images.c (modified) (1 diff)
-
Ohana/src/photdbc/src/join_stars.c (modified) (2 diffs)
-
Ohana/src/photdbc/src/make_subcatalog.c (modified) (2 diffs)
-
Ohana/src/photdbc/src/photdbc.c (modified) (1 diff)
-
dbconfig/changes.txt (modified) (2 diffs)
-
dbconfig/pstamp.md (modified) (1 diff)
-
ippScripts/scripts/addstar_run.pl (modified) (5 diffs)
-
ippScripts/scripts/minidvodb_createdb.pl (modified) (4 diffs)
-
ippScripts/scripts/skycell_jpeg.pl (modified) (2 diffs)
-
ippTasks/diff.pro (modified) (2 diffs)
-
ippTasks/minidvodb.pro (modified) (4 diffs)
-
ippTasks/stack.pro (modified) (6 diffs)
-
ippToPsps/src/ippToPspsBatchDetection.c (modified) (5 diffs)
-
ippTools/share/difftool_addsummary.sql (added)
-
ippTools/share/difftool_tosummary.sql (added)
-
ippTools/share/pxadmin_create_tables.sql (modified) (1 diff)
-
ippTools/share/stacktool_addsummary.sql (added)
-
ippTools/share/stacktool_associationdefine_select.sql (added)
-
ippTools/share/stacktool_sassskyfile.sql (added)
-
ippTools/share/stacktool_tosummary.sql (added)
-
ippTools/share/warptool_addsummary.sql (added)
-
ippTools/share/warptool_tosummary.sql (added)
-
ippTools/src/addtool.c (modified) (1 diff)
-
ippTools/src/pstamptool.c (modified) (6 diffs)
-
ippTools/src/pstamptoolConfig.c (modified) (1 diff)
-
ippTools/src/stacktool.c (modified) (2 diffs)
-
ippconfig/recipes/filerules-mef.mdc (modified) (2 diffs)
-
ippconfig/recipes/filerules-simple.mdc (modified) (2 diffs)
-
ippconfig/recipes/filerules-split.mdc (modified) (2 diffs)
-
ppBackground (modified) (1 prop)
-
ppBackground/configure.ac (modified) (1 diff)
-
ppBackground/src (modified) (1 prop)
-
ppBackground/src/Makefile.am (modified) (4 diffs)
-
ppBackground/src/ppBackground.c (modified) (3 diffs)
-
ppBackground/src/ppBackground.h (modified) (2 diffs)
-
ppBackground/src/ppBackgroundArguments.c (modified) (3 diffs)
-
ppBackground/src/ppBackgroundCamera.c (modified) (3 diffs)
-
ppBackground/src/ppBackgroundExit.c (modified) (1 diff)
-
ppBackground/src/ppBackgroundLoop.c (modified) (9 diffs)
-
ppBackground/src/ppBackgroundModel.c (deleted)
-
ppBackground/src/ppBackgroundRestore.c (copied) (copied from trunk/ppBackground/src/ppBackgroundRestore.c )
-
ppBackground/src/ppBackgroundVersionDefinitions.h.in (modified) (1 diff)
-
ppImage/src/ppImageLoop.c (modified) (6 diffs)
-
ppImage/src/ppImageMosaic.c (modified) (5 diffs)
-
ppStack/src/ppStackTarget.c (modified) (2 diffs)
-
psLib/src/sys/psAbort.c (modified) (3 diffs)
-
psLib/src/sys/psThread.c (modified) (1 diff)
-
psModules/src/config/pmConfig.c (modified) (3 diffs)
-
pstamp/src/pstamp.h (modified) (1 diff)
-
tools/chip_outputs.pl (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20100519
- Property svn:mergeinfo changed
/trunk merged: 28280-28298,28300-28302,28305-28307
- Property svn:mergeinfo changed
-
branches/czw_branch/20100519/Ohana
- Property svn:mergeinfo changed
/trunk/Ohana merged: 28306
- Property svn:mergeinfo changed
-
branches/czw_branch/20100519/Ohana/src/photdbc/src/copy_images.c
r17284 r28334 3 3 int copy_images (char *outdir) { 4 4 5 int status, Nimage; 5 int status; 6 off_t Nimage; 6 7 char *ImageOut; 7 8 FITS_DB in; -
branches/czw_branch/20100519/Ohana/src/photdbc/src/join_stars.c
r27435 r28334 7 7 off_t Naverage, Nmeasure, *index; 8 8 double *X, *Y, dX, dY, dR, RADIUS2; 9 double Sr, Sd,Rmid, Dmid;9 double Rmid, Dmid; 10 10 int basecode, baseNsec, Nsecfilt, *found; 11 11 … … 202 202 203 203 if (Nmeas != Nmeasure) { 204 fprintf (stderr, "failure to match %d measures (%d of %dmatched)\n", Nmeasure - Nmeas, Nmeas, Nmeasure);204 fprintf (stderr, "failure to match "OFF_T_FMT" measures ("OFF_T_FMT" of "OFF_T_FMT" matched)\n", Nmeasure - Nmeas, Nmeas, Nmeasure); 205 205 } 206 206 -
branches/czw_branch/20100519/Ohana/src/photdbc/src/make_subcatalog.c
r17284 r28334 5 5 int make_subcatalog (Catalog *subcatalog, Catalog *catalog) { 6 6 7 int i, j, offset;8 int NAVERAGE, NMEASURE, Naverage, Nmeasure, Nm, Nsecfilt;7 off_t i, j, offset; 8 off_t NAVERAGE, NMEASURE, Naverage, Nmeasure, Nm, Nsecfilt; 9 9 double mag, minMag; 10 10 … … 105 105 106 106 if (VERBOSE) { 107 fprintf (stderr, "%d: using %d stars (%dmeasures) for catalog\n", i,107 fprintf (stderr, OFF_T_FMT": using "OFF_T_FMT" stars ("OFF_T_FMT" measures) for catalog\n", i, 108 108 subcatalog[0].Naverage, subcatalog[0].Nmeasure); 109 109 } -
branches/czw_branch/20100519/Ohana/src/photdbc/src/photdbc.c
r25757 r28334 60 60 61 61 // XXX add other filters here: 62 join_stars (&outcatalog);62 // join_stars (&outcatalog); 63 63 // unique_measures (catalog); 64 64 // flag_measures (&db, catalog); -
branches/czw_branch/20100519/dbconfig/changes.txt
r28304 r28334 1756 1756 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1757 1757 1758 -- Version 1.1.69 1758 ALTER TABLE pstampRequest ADD COLUMN timestamp TIMESTAMP AFTER outdir; 1759 1760 -- Version 1.1.69 warp/stack/diff summary and stack associations. 1761 1759 1762 CREATE TABLE warpSummary ( 1760 1763 warp_id BIGINT, … … 1804 1807 ) ENGINE=innodb DEFAULT CHARSET=latin1; 1805 1808 1809 1810 1811 1812 -
branches/czw_branch/20100519/dbconfig/pstamp.md
r28304 r28334 31 31 uri STR 255 32 32 outdir STR 255 33 timestamp UTC 0001-01-01T00:00:00Z 33 34 fault S32 0 34 35 END -
branches/czw_branch/20100519/ippScripts/scripts/addstar_run.pl
r28304 r28334 36 36 exit($PS_EXIT_CONFIG_ERROR); 37 37 } 38 38 my $minidvodb_path; 39 39 my ( $exp_tag, $add_id, $camera, $outroot, $camroot, $dbname, $reduction, $dvodb, $minidvodb, $minidvodb_name, $minidvodb_group, $image_only, $verbose, $no_update, 40 40 $no_op, $redirect, $save_temps); … … 132 132 &my_die("Unable to parse metadata list", $add_id, $PS_EXIT_PROG_ERROR); 133 133 my $comp = $$components[0]; 134 $minidvodb_path = $comp->{minidvodb_path}; 134 135 $minidvodb_name = $comp->{minidvodb_name}; 135 136 137 if (!defined($minidvodb_path)) { 138 &my_die("Unable to parse minidvodb_path", $add_id, $PS_EXIT_PROG_ERROR); 139 } 136 140 if (!defined($minidvodb_name)) { 137 141 &my_die("Unable to parse minidvodb_name", $add_id, $PS_EXIT_PROG_ERROR); 138 } 139 142 } 140 143 } 141 144 # tack on the minidvodb part to the db. 142 $dvodbReal = $dvodbReal . '/' . $minidvodb_name . '/'; 145 # $dvodbReal = $dvodbReal . '/' . $minidvodb_name . '/'; 146 #we don't need this now that I fixed the paths 143 147 144 148 } … … 160 164 my $command = "$addstar -update"; # XXX optionally set -update? 161 165 $command .= " -D CAMERA $camdir"; 162 $command .= " -D CATDIR $ dvodbReal";166 $command .= " -D CATDIR $minidvodb_path"; 163 167 $command .= " $realFile"; 164 168 $command .= " -use-name $fpaObjects"; # DVO wants the neb-name as a file reference … … 182 186 $fpaCommand .= " -path_base $outroot"; 183 187 $fpaCommand .= " -dtime_addstar $dtime_addstar"; 184 $fpaCommand .= " -dvodb_path $ dvodbReal" if defined $dvodbReal;188 $fpaCommand .= " -dvodb_path $minidvodb_path" if defined $minidvodb_path; 185 189 $fpaCommand .= " -minidvodb_name $minidvodb_name" if defined $minidvodb_name; 186 190 $fpaCommand .= " -dbname $dbname" if defined $dbname; … … 213 217 $command .= " -addprocessedexp"; 214 218 $command .= " -fault $exit_code"; 215 $command .= " -dvodb_path $ dvodbReal" if defined $dvodbReal;219 $command .= " -dvodb_path $minidvodb_path" if defined $minidvodb_path; 216 220 $command .= " -path_base $outroot" if defined $outroot; 217 221 $command .= (" -dtime_addstar " . ((DateTime->now->mjd - $mjd_start) * 86400)); -
branches/czw_branch/20100519/ippScripts/scripts/minidvodb_createdb.pl
r28304 r28334 39 39 } 40 40 41 my ( $outroot, $dbname, $dvodb, $minidvodb_interval, $minidvodb_group, $camera, $verbose, $no_update,41 my ( $outroot, $dbname, $dvodb, $minidvodb,$minidvodb_interval, $minidvodb_group, $camera, $verbose, $no_update, 42 42 $no_op, $redirect, $save_temps); 43 43 GetOptions( … … 47 47 'outroot|w=s' => \$outroot, # output file base name 48 48 'dvodb|w=s' => \$dvodb, # output DVO database 49 'minidvodb|w=s' => \$minidvodb, # output miniDVODB 49 50 'interval|w=s' => \$minidvodb_interval, #interval between creation of minidvodbs (default = 1day) 50 51 'verbose' => \$verbose, # Print to stdout … … 97 98 exit(4); 98 99 } 100 my $minidvodbReal; 101 if (defined $minidvodb) { 102 $minidvodbReal = $ipprc->dvo_catdir( $minidvodb ); # catdir for DVO 103 $minidvodbReal = $ipprc->convert_filename_absolute( $minidvodbReal ); 104 } else { 105 warn("minidvodb undefined:\n"); 106 exit(4); 107 } 108 99 109 100 110 if (!defined $minidvodb_interval) { … … 215 225 my $fpaCommand = "$addtool -addminidvodbrun"; 216 226 $fpaCommand .= " -set_minidvodb_group $minidvodb_group"; 227 $fpaCommand .= " -set_minidvodb_path $minidvodbReal" if defined $minidvodbReal; 217 228 $fpaCommand .= " -set_mergedvodb_path $dvodbReal"; 218 229 $fpaCommand .= " -dbname $dbname" if defined $dbname; -
branches/czw_branch/20100519/ippScripts/scripts/skycell_jpeg.pl
r28304 r28334 273 273 my $path_base = $imfile->{path_base}; 274 274 my $quality = $imfile->{quality}; 275 my $state = $imfile->{ data_state};275 my $state = $imfile->{state}; 276 276 my $fault = $imfile->{fault}; 277 277 my $projection_cell = $skycell_id; 278 if ($quality == 8007 or $state ne 'full' or $fault != 0) {278 if ($quality == 8007 or $state ne 'full') { 279 279 next; 280 280 } … … 333 333 if (scalar (keys %tangents) == 0) { 334 334 my $projection_cell = 'NULL'; 335 $command = "$stacktool -addsummary -s tack_id $stage_id -projection_cell $projection_cell -path_base $outroot";336 if (defined($dbname)) { 337 $command .= " -dbname $dbname"; 338 } 339 340 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 341 unless ($success) { 342 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 343 &my_die("unable to update diffsummary: $error_code", $stage_id, $error_code);335 $command = "$stacktool -addsummary -sass_id $stage_id -projection_cell $projection_cell -path_base $outroot"; 336 if (defined($dbname)) { 337 $command .= " -dbname $dbname"; 338 } 339 # print "$command\n"; 340 ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 341 unless ($success) { 342 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 343 &my_die("unable to update stack summary: $error_code", $stage_id, $error_code); 344 344 } 345 345 } -
branches/czw_branch/20100519/ippTasks/diff.pro
r28304 r28334 574 574 book getword diffPendingSummary $pageName workdir -var WORKDIR_TEMPLATE 575 575 book getword diffPendingSummary $pageName dbname -var DBNAME 576 book getword warpPendingSummary $pageName tess_id -var TESS_DIR576 book getword diffPendingSummary $pageName tess_id -var TESS_DIR 577 577 book getword diffPendingSummary $pageName diff_mode -var DIFF_MODE 578 578 book getword diffPendingSummary $pageName state -var RUN_STATE … … 601 601 602 602 ## generate outroot specific to this exposure 603 sprintf outroot "%s/%s/%s /%s.%s.%sdif.%s.summary" $WORKDIR $TESS_ID $SKYCELL_ID $TESS_ID $SKYCELL_ID $DIFF_TAG $DIFF_ID603 sprintf outroot "%s/%s/%s.%sdif.%s.summary" $WORKDIR $TESS_ID $TESS_ID $DIFF_TAG $DIFF_ID 604 604 605 605 -
branches/czw_branch/20100519/ippTasks/minidvodb.pro
r28304 r28334 131 131 ## you get no choice - you add all of them in at the same time. you can always turn off the tasks you don't want to run. 132 132 macro add.minidvodb 133 if ($0 != 5)134 echo "USAGE: add.minidvodb (minidvodb_group) ( dvodb) (interval days) (camera)"133 if ($0 != 6) 134 echo "USAGE: add.minidvodb (minidvodb_group) (minidvodb) (dvodb) (interval days) (camera)" 135 135 break 136 136 end … … 139 139 book newpage MINIDVODB $1 140 140 book setword MINIDVODB $1 MINIDVODB_GROUP $1 141 book setword MINIDVODB $1 DVODB $ 2141 book setword MINIDVODB $1 DVODB $3 142 142 book setword MINIDVODB $1 STATE PENDING 143 143 #merge 144 144 book newpage MINIDVODB_MERGE $1 145 145 book setword MINIDVODB_MERGE $1 MINIDVODB_GROUP $1 146 book setword MINIDVODB_MERGE $1 DVODB $ 2146 book setword MINIDVODB_MERGE $1 DVODB $3 147 147 book setword MINIDVODB_MERGE $1 STATE PENDING 148 148 #active 149 149 book newpage MINIDVODB_ACTIVE $1 150 150 book setword MINIDVODB_ACTIVE $1 MINIDVODB_GROUP $1 151 book setword MINIDVODB_ACTIVE $1 DVODB $ 2151 book setword MINIDVODB_ACTIVE $1 DVODB $3 152 152 book setword MINIDVODB_ACTIVE $1 STATE PENDING 153 153 … … 155 155 book newpage MINIDVODB_CREATE $1 156 156 book setword MINIDVODB_CREATE $1 MINIDVODB_GROUP $1 157 book setword MINIDVODB_CREATE $1 DVODB $2 158 book setword MINIDVODB_CREATE $1 DVODB_DAYS $3 159 book setword MINIDVODB_CREATE $1 CAMERA $4 157 book setword MINIDVODB_CREATE $1 MINIDVODB $2 158 book setword MINIDVODB_CREATE $1 DVODB $3 159 book setword MINIDVODB_CREATE $1 DVODB_DAYS $4 160 book setword MINIDVODB_CREATE $1 CAMERA $5 160 161 book setword MINIDVODB_CREATE $1 STATE PENDING 161 162 end … … 542 543 543 544 book setword MINIDVODB_CREATE $minidvodb_group STATE DONE 545 book getword MINIDVODB_CREATE $minidvodb_group MINIDVODB -var minidvodb 544 546 book getword MINIDVODB_CREATE $minidvodb_group DVODB -var dvodb 545 547 book getword MINIDVODB_CREATE $minidvodb_group DVODB_DAYS -var dvodb_days 546 548 book getword MINIDVODB_CREATE $minidvodb_group CAMERA -var camera 547 $run = minidvodb_createdb.pl --camera $camera --outroot $dvodb --dvodb $dvodb --minidvodb _group $minidvodb_group --interval $dvodb_days549 $run = minidvodb_createdb.pl --camera $camera --outroot $dvodb --dvodb $dvodb --minidvodb $minidvodb --minidvodb_group $minidvodb_group --interval $dvodb_days 548 550 549 551 if ($DB:n == 0) -
branches/czw_branch/20100519/ippTasks/stack.pro
r28304 r28334 10 10 ### Initialise the books containing the tasks to do 11 11 book init stackSumSkyfile 12 book init stackPendingSummary 12 13 #book init stackCleanup 13 14 … … 16 17 $stack_revert_DB = 0 17 18 #$stackCleanup_DB = 0 19 $stackSummary_DB = 0 18 20 19 21 ### Check status of stacking tasks … … 26 28 macro stack.reset 27 29 book init stackSumSkyfile 30 book init stackPendingSummary 28 31 # book init stackCleanup 29 32 end … … 40 43 active false 41 44 end 45 task stack.summary.load 46 active true 47 end 48 task stack.summary.run 49 active true 50 end 42 51 end 43 52 … … 51 60 end 52 61 task stack.revert 62 active false 63 end 64 task stack.summary.load 65 active false 66 end 67 task stack.summary.run 53 68 active false 54 69 end … … 403 418 end 404 419 420 ### Load tasks for doing the stack summary 421 ### Tasks are loaded into stackPendingSummary 422 task stack.summary.load 423 host local 424 425 periods -poll $LOADPOLL 426 periods -exec $LOADEXEC 427 periods -timeout 1200 428 npending 1 429 430 stdout NULL 431 stderr $LOGDIR/stack.summary.load 432 433 task.exec 434 if ($LABEL:n == 0) break 435 $run = stacktool -tosummary 436 if ($DB:n == 0) 437 option DEFAULT 438 else 439 # save the DB name for the exit tasks 440 option $DB:$stackSummary_DB 441 $run = $run -dbname $DB:$stackSummary_DB 442 $stackSummary_DB ++ 443 if ($stackSummary_DB >= $DB:n) set stackSummary_DB = 0 444 end 445 add_poll_args run 446 add_poll_labels run 447 command $run 448 end 449 450 # success 451 task.exit 0 452 # convert 'stdout' to book format 453 ipptool2book stdout stackPendingSummary -key sass_id -uniq -setword dbname $options:0 -setword pantaskState INIT 454 if ($VERBOSE > 2) 455 book listbook stackPendingSummary 456 end 457 458 # delete existing entries in the appropriate pantaskStates 459 process_cleanup stackPendingSummary 460 end 461 462 # locked list 463 task.exit default 464 showcommand failure 465 end 466 467 task.exit crash 468 showcommand crash 469 end 470 471 # operation times out? 472 task.exit timeout 473 showcommand timeout 474 end 475 end 476 477 ### Run tasks for doing the stack summary 478 task stack.summary.run 479 periods -poll $RUNPOLL 480 periods -exec $RUNEXEC 481 periods -timeout 60 482 483 task.exec 484 # if we are unable to run the 'exec', use a long retry time 485 periods -exec $RUNEXEC 486 487 book npages stackPendingSummary -var N 488 if ($N == 0) break 489 if ($NETWORK == 0) break 490 491 # look for new images in stackPendingSummary (pantaskState == INIT) 492 book getpage stackPendingSummary 0 -var pageName -key pantaskState INIT 493 if ("$pageName" == "NULL") break 494 495 book setword stackPendingSummary $pageName pantaskState RUN 496 book getword stackPendingSummary $pageName sass_id -var SASS_ID 497 book getword stackPendingSummary $pageName camera -var CAMERA 498 book getword stackPendingSummary $pageName workdir -var WORKDIR_TEMPLATE 499 book getword stackPendingSummary $pageName dbname -var DBNAME 500 book getword stackPendingSummary $pageName tess_id -var TESS_DIR 501 book getword stackPendingSummary $pageName state -var RUN_STATE 502 book getword stackPendingSummary $pageName projection_cell -var projection_cell 503 504 # set the host and workdir 505 host anyhost 506 strsub $WORKDIR_TEMPLATE @HOST@.0 $default_host -var WORKDIR 507 508 basename $TESS_DIR -var TESS_ID 509 510 ## generate outroot specific to this association 511 sprintf outroot "%s/%s/%s.stk.%s.summary" $WORKDIR $TESS_ID $TESS_ID $SASS_ID 512 513 stdout $LOGDIR/stack.summary.log 514 stderr $LOGDIR/stack.summary.log 515 516 $run = skycell_jpeg.pl --stage stack --stage_id $SASS_ID --camera $CAMERA --outroot $outroot 517 add_standard_args run 518 519 # save the pageName for future reference below 520 options $pageName 521 522 # create the command line 523 if ($VERBOSE > 1) 524 echo command $run 525 end 526 periods -exec 0.05 527 command $run 528 end 529 530 # default exit status 531 task.exit default 532 process_exit stackPendingSummary $options:0 $JOB_STATUS 533 end 534 535 # locked list 536 task.exit crash 537 showcommand crash 538 echo "hostname: $JOB_HOSTNAME" 539 book setword stackPendingSummary $options:0 pantaskState CRASH 540 end 541 542 # operation timed out? 543 task.exit timeout 544 showcommand timeout 545 book setword stackPendingSummary $options:0 pantaskState TIMEOUT 546 end 547 end 548 -
branches/czw_branch/20100519/ippToPsps/src/ippToPspsBatchDetection.c
r28304 r28334 54 54 float zptObs, zeroPoint, exposureTime; 55 55 char filterType[20]; 56 double obsTime; 57 double expStart; 58 double expTime; 56 59 status=0; fits_read_key(fitsIn, TFLOAT, "ZPT_OBS", &zptObs, NULL, &status); 57 60 status=0; fits_read_key(fitsIn, TFLOAT, "ZPT_REF", &zeroPoint, NULL, &status); 58 61 status=0; fits_read_key(fitsIn, TFLOAT, "EXPREQ", &exposureTime, NULL, &status); 59 62 status=0; fits_read_key(fitsIn, TSTRING, "FILTERID", filterType, NULL, &status); 60 63 status=0; fits_read_key(fitsIn, TDOUBLE, "MJD-OBS", &expStart, NULL, &status); 64 status=0; fits_read_key(fitsIn, TDOUBLE, "EXPTIME", &expTime, NULL, &status); 65 obsTime = expStart + (expTime/172800); // exp start plus half exp time (converted from secs to days) 66 61 67 ippToPspsConfig_writeTable(this->config, fitsIn, this->fitsOut, 1, "FrameMeta", true); 62 68 … … 83 89 84 90 // stuff to keep from psf.hdr header 85 double obsTime = 0.0;86 91 int sourceId = -1; 87 92 int imageId = -1; … … 132 137 long ippDetectID[MAXDETECT]; 133 138 long imageID[MAXDETECT]; 134 floatobsTimes[MAXDETECT];139 double obsTimes[MAXDETECT]; 135 140 float instFlux[MAXDETECT]; 136 141 float instFluxErr[MAXDETECT]; … … 195 200 status=0; fits_read_key(fitsIn, TFLOAT, "IQ_FW2", &momentMin, NULL, &status); 196 201 status=0; fits_read_key(fitsIn, TLONG, "IMAGEID", &imageId, NULL, &status); 197 status=0; fits_read_key(fitsIn, TDOUBLE, "MJD-OBS", &obsTime, NULL, &status);198 202 status=0; fits_read_key(fitsIn, TLONG, "SOURCEID", &sourceId, NULL, &status); 199 203 … … 333 337 fits_write_col(this->fitsOut, TBYTE, DETECTION_SURVEYID, 1, 1, nDet, surveyIDs, &status); 334 338 fits_write_col(this->fitsOut, TLONGLONG, DETECTION_IMAGEID, 1, 1, nDet, imageID, &status); 335 fits_write_col(this->fitsOut, T FLOAT, DETECTION_OBSTIME, 1, 1, nDet, obsTimes, &status);339 fits_write_col(this->fitsOut, TDOUBLE, DETECTION_OBSTIME, 1, 1, nDet, obsTimes, &status); 336 340 fits_write_col(this->fitsOut, TFLOAT, DETECTION_INSTFLUX, 1, 1, nDet, instFlux, &status); 337 341 fits_write_col(this->fitsOut, TFLOAT, DETECTION_INSTFLUXERR, 1, 1, nDet, instFluxErr, &status); -
branches/czw_branch/20100519/ippTools/share/pxadmin_create_tables.sql
r28304 r28334 1411 1411 uri VARCHAR(255), 1412 1412 outdir VARCHAR(255), 1413 timestamp TIMESTAMP, 1413 1414 fault SMALLINT, 1414 1415 PRIMARY KEY(req_id), -
branches/czw_branch/20100519/ippTools/src/addtool.c
r28304 r28334 817 817 } 818 818 819 if (minidvodb_path) { 820 psStringAppend(&minidvodb_path,"/%s",minidvodb_name); 821 } 822 823 819 824 psString query = NULL; 820 825 -
branches/czw_branch/20100519/ippTools/src/pstamptool.c
r28304 r28334 271 271 uri, 272 272 NULL, // outdir 273 NULL, // timestamp 273 274 0 // fault 274 275 )) { … … 547 548 PXOPT_LOOKUP_BOOL(clearfault,config->args, "-clearfault", false); 548 549 550 if (!state && !label && !outProduct && !fault && !uri && !outdir && !name && !reqType && !clearfault) { 551 psError(PS_ERR_UNKNOWN, true, "at least one set option is required"); 552 return false; 553 } 554 549 555 psMetadata *where = psMetadataAlloc(); 550 556 PXOPT_COPY_S64(config->args, where, "-req_id", "req_id", "=="); … … 552 558 PXOPT_COPY_S32(config->args, where, "-fault", "fault", "=="); 553 559 PXOPT_COPY_STR(config->args, where, "-state", "state", "=="); 560 PXOPT_COPY_TIME(config->args, where, "-timestamp_begin", "timestamp", ">="); 561 PXOPT_COPY_TIME(config->args, where, "-timestamp_end", "timestamp", "<="); 554 562 pxAddLabelSearchArgs(config, where, "-label", "pstampRequest.label", "LIKE"); 555 563 if (!psListLength(where->list)) { … … 559 567 } 560 568 561 psString query = psStringCopy("UPDATE pstampRequest SET ");569 psString query = psStringCopy("UPDATE pstampRequest SET timestamp = UTC_TIMESTAMP()"); 562 570 563 571 psString stateCheck = NULL; 564 char c = ' ';565 572 if (state) { 566 psStringAppend(&query, "%c state = '%s'", c, state); 567 c = ','; 573 psStringAppend(&query, ", state = '%s'", state); 568 574 if (!strcmp(state, "goto_cleaned")) { 569 575 psStringAppend(&stateCheck, " AND state != 'cleaned'"); … … 571 577 } 572 578 if (label) { 573 psStringAppend(&query, "%c label = '%s'", c, label); 574 c = ','; 579 psStringAppend(&query, ", label = '%s'", label); 575 580 } 576 581 if (outProduct) { 577 psStringAppend(&query, "%c outProduct = '%s'", c, outProduct); 578 c = ','; 582 psStringAppend(&query, ", outProduct = '%s'", outProduct); 579 583 } 580 584 if (outdir) { 581 psStringAppend(&query, "%c outdir = '%s'", c, outdir); 582 c = ','; 585 psStringAppend(&query, ", outdir = '%s'", outdir); 583 586 } 584 587 if (clearfault) { … … 587 590 return false; 588 591 } 589 psStringAppend(&query, "%c fault = 0", c); 590 c = ','; 592 psStringAppend(&query, ", fault = 0"); 591 593 } else if (fault) { 592 psStringAppend(&query, "%c fault = %d", c, fault); 593 c = ','; 594 psStringAppend(&query, ", fault = %d", fault); 594 595 } 595 596 if (uri) { 596 psStringAppend(&query, "%c uri = '%s'", c, uri); 597 c = ','; 597 psStringAppend(&query, ", uri = '%s'", uri); 598 598 } 599 599 if (name) { 600 psStringAppend(&query, "%c name = '%s'", c, name); 601 c = ','; 600 psStringAppend(&query, ", name = '%s'", name); 602 601 } 603 602 if (reqType) { 604 psStringAppend(&query, "%c reqType = '%s'", c, reqType); 605 c = ','; 606 } 607 if (c != ',') { 608 psError(PS_ERR_UNKNOWN, true, "at least one set option is required"); 609 return false; 603 psStringAppend(&query, ", reqType = '%s'", reqType); 610 604 } 611 605 -
branches/czw_branch/20100519/ippTools/src/pstamptoolConfig.c
r28304 r28334 103 103 psMetadataAddStr(updatereqArgs, PS_LIST_TAIL, "-state", 0, "search by state", NULL); 104 104 psMetadataAddStr(updatereqArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by pstampJob label (LIKE comparision)", NULL); 105 psMetadataAddTime(updatereqArgs, PS_LIST_TAIL, "-timestamp_begin", 0, "search by timestamp (>=)", NULL); 106 psMetadataAddTime(updatereqArgs, PS_LIST_TAIL, "-timestamp_end", 0, "search by timestamp (<=)", NULL); 105 107 psMetadataAddStr(updatereqArgs, PS_LIST_TAIL, "-set_state", 0, "new state", NULL); 106 108 psMetadataAddStr(updatereqArgs, PS_LIST_TAIL, "-set_label", 0, "new label", NULL); -
branches/czw_branch/20100519/ippTools/src/stacktool.c
r28304 r28334 1372 1372 if (psListLength(where->list)) { 1373 1373 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 1374 psStringAppend(&query, " WHERE%s", whereClause);1374 psStringAppend(&query, " AND %s", whereClause); 1375 1375 psFree(whereClause); 1376 1376 } else if (!all) { … … 1387 1387 psFree(limitString); 1388 1388 } 1389 1389 1390 1390 if (!p_psDBRunQuery(config->dbh, query)) { 1391 1391 psError(PS_ERR_UNKNOWN, false, "database error"); -
branches/czw_branch/20100519/ippconfig/recipes/filerules-mef.mdc
r28164 r28334 153 153 PPBGRESTORE.INPUT INPUT @FILES CHIP IMAGE 154 154 PPBGRESTORE.BACKMDL INPUT @FILES CHIP IMAGE 155 156 PPBACKGROUND.IMAGE INPUT @FILES CHIP IMAGE 157 PPBACKGROUND.MASK INPUT @FILES CHIP MASK 158 PPBACKGROUND.PATTERN INPUT @FILES CHIP PATTERN 159 PPBACKGROUND.BACKGROUND INPUT @FILES CHIP IMAGE 155 160 156 161 ### output file definitions … … 330 335 331 336 PPBGRESTORE.OUTPUT OUTPUT {OUTPUT}.{CHIP.NAME}.fits IMAGE COMP_IMG CHIP TRUE NONE 337 338 PPBACKGROUND.OUTPUT OUTPUT {OUTPUT}.{CHIP.NAME}.fits IMAGE COMP_IMG CHIP TRUE NONE 339 PPBACKGROUND.OUTPUT.MASK OUTPUT {OUTPUT}.{CHIP.NAME}.mk.fits MASK COMP_MASK CHIP TRUE NONE -
branches/czw_branch/20100519/ippconfig/recipes/filerules-simple.mdc
r28164 r28334 128 128 129 129 PPVIZPATTERN.INPUT INPUT @FILES CHIP PATTERN 130 131 PPBACKGROUND.IMAGE INPUT @FILES CHIP IMAGE 132 PPBACKGROUND.MASK INPUT @FILES CHIP MASK 133 PPBACKGROUND.PATTERN INPUT @FILES CHIP PATTERN 134 PPBACKGROUND.BACKGROUND INPUT @FILES CHIP IMAGE 130 135 131 136 ### output file definitions … … 295 300 296 301 PPBGRESTORE.OUTPUT OUTPUT {OUTPUT}.fits IMAGE NONE FPA TRUE NONE 302 303 PPBACKGROUND.OUTPUT OUTPUT {OUTPUT}.{CHIP.NAME}.fits IMAGE NONE FPA TRUE NONE 304 PPBACKGROUND.OUTPUT.MASK OUTPUT {OUTPUT}.{CHIP.NAME}.mk.fits MASK NONE FPA TRUE NONE -
branches/czw_branch/20100519/ippconfig/recipes/filerules-split.mdc
r28164 r28334 139 139 140 140 PPVIZPATTERN.INPUT INPUT @FILES CHIP PATTERN 141 142 PPBACKGROUND.IMAGE INPUT @FILES CHIP IMAGE 143 PPBACKGROUND.MASK INPUT @FILES CHIP MASK 144 PPBACKGROUND.PATTERN INPUT @FILES CHIP PATTERN 145 PPBACKGROUND.BACKGROUND INPUT @FILES CHIP IMAGE 141 146 142 147 ### output file definitions … … 321 326 PPVIZPATTERN.CHIP OUTPUT {OUTPUT}.{CHIP.NAME}.ch.fits IMAGE NONE CHIP TRUE NONE 322 327 328 PPBACKGROUND.OUTPUT OUTPUT {OUTPUT}.{CHIP.NAME}.fits IMAGE COMP_IMG CHIP TRUE NONE 329 PPBACKGROUND.OUTPUT.MASK OUTPUT {OUTPUT}.{CHIP.NAME}.mk.fits MASK COMP_MASK CHIP TRUE NONE 323 330 324 331 # FILERULE naming operators: -
branches/czw_branch/20100519/ppBackground
-
Property svn:ignore
set to
configure
Makefile.in
ignore
config.log
depcomp
config.status
config.guess
ltmain.sh
config.sub
autom4te.cache
libtool
missing
Makefile
aclocal.m4
install-sh
-
Property svn:ignore
set to
-
branches/czw_branch/20100519/ppBackground/configure.ac
r28304 r28334 20 20 PKG_CHECK_MODULES([PSLIB], [pslib >= 1.0.0]) 21 21 PKG_CHECK_MODULES([PSMODULE], [psmodules >= 1.0.0]) 22 PKG_CHECK_MODULES([PSPHOT], [psphot >= 1.0.0]) 22 PKG_CHECK_MODULES([PPSTATS], [ppStats >= 1.0.0]) 23 PKG_CHECK_MODULES([PSPHOT], [psphot]) 24 25 AC_PATH_PROG([ERRORCODES], [psParseErrorCodes], [missing]) 26 if test "$ERRORCODES" = "missing" ; then 27 AC_MSG_ERROR([psParseErrorCodes is required]) 28 fi 23 29 24 30 dnl Set CFLAGS for build -
branches/czw_branch/20100519/ppBackground/src
-
Property svn:ignore
set to
ppBackground
Makefile.in
config.h
ppBackgroundVersionDefinitions.h
.deps
Makefile
ppBackgroundErrorCodes.c
ppBackgroundErrorCodes.h
stamp-h1
config.h.in
-
Property svn:ignore
set to
-
branches/czw_branch/20100519/ppBackground/src/Makefile.am
r28304 r28334 2 2 3 3 if HAVE_SVNVERSION 4 PP VIZPATTERN_VERSION=`$(SVNVERSION) ..`4 PPBACKGROUND_VERSION=`$(SVNVERSION) ..` 5 5 else 6 PP VIZPATTERN_VERSION="UNKNOWN"6 PPBACKGROUND_VERSION="UNKNOWN" 7 7 endif 8 8 9 9 if HAVE_SVN 10 PP VIZPATTERN_BRANCH=`$(SVN) info .. | $(SED) -n -e '/URL:/ h' -e '/Repository Root:/ { x; H; x; s|Repository Root: \(.*\)\nURL: \1\(.*\)|\2| ; s|^/|| ; s|/[a-zA-Z]*/src.*|| ; p }'`11 PP VIZPATTERN_SOURCE=`$(SVN) info | $(SED) -n -e 's/Repository UUID: // p'`10 PPBACKGROUND_BRANCH=`$(SVN) info .. | $(SED) -n -e '/URL:/ h' -e '/Repository Root:/ { x; H; x; s|Repository Root: \(.*\)\nURL: \1\(.*\)|\2| ; s|^/|| ; s|/[a-zA-Z]*/src.*|| ; p }'` 11 PPBACKGROUND_SOURCE=`$(SVN) info | $(SED) -n -e 's/Repository UUID: // p'` 12 12 else 13 PP VIZPATTERN_BRANCH="UNKNOWN"14 PP VIZPATTERN_SOURCE="UNKNOWN"13 PPBACKGROUND_BRANCH="UNKNOWN" 14 PPBACKGROUND_SOURCE="UNKNOWN" 15 15 endif 16 16 … … 19 19 ppBackgroundVersionDefinitions.h: ppBackgroundVersionDefinitions.h.in FORCE 20 20 -$(RM) ppBackgroundVersionDefinitions.h 21 $(SED) -e "s|@PP VIZPATTERN_VERSION@|\"$(PPVIZPATTERN_VERSION)\"|" -e "s|@PPVIZPATTERN_BRANCH@|\"$(PPVIZPATTERN_BRANCH)\"|" -e "s|@PPVIZPATTERN_SOURCE@|\"$(PPVIZPATTERN_SOURCE)\"|" ppBackgroundVersionDefinitions.h.in > ppBackgroundVersionDefinitions.h21 $(SED) -e "s|@PPBACKGROUND_VERSION@|\"$(PPBACKGROUND_VERSION)\"|" -e "s|@PPBACKGROUND_BRANCH@|\"$(PPBACKGROUND_BRANCH)\"|" -e "s|@PPBACKGROUND_SOURCE@|\"$(PPBACKGROUND_SOURCE)\"|" ppBackgroundVersionDefinitions.h.in > ppBackgroundVersionDefinitions.h 22 22 FORCE: ; 23 23 … … 25 25 26 26 27 ppBackground_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(P SPHOT_CFLAGS) $(PPBACKGROUND_CFLAGS)28 ppBackground_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) $(P SPHOT_LIBS) $(PPBACKGROUND_LIBS)27 ppBackground_CPPFLAGS = $(PSLIB_CFLAGS) $(PSMODULE_CFLAGS) $(PPSTATS_CFLAGS) $(PSPHOT_CFLAGS) $(PPBACKGROUND_CFLAGS) 28 ppBackground_LDFLAGS = $(PSLIB_LIBS) $(PSMODULE_LIBS) $(PPSTATS_LIBS) $(PSPHOT_LIBS) $(PPBACKGROUND_LIBS) 29 29 30 30 ppBackground_SOURCES = \ … … 35 35 ppBackgroundLoop.c \ 36 36 ppBackgroundVersion.c \ 37 ppBackgroundModel.c \ 38 ppBackgroundErrorCodes.c 37 ppBackgroundRestore.c \ 38 ppBackgroundErrorCodes.c \ 39 ppBackgroundExit.c 39 40 40 41 noinst_HEADERS = \ -
branches/czw_branch/20100519/ppBackground/src/ppBackground.c
r28304 r28334 6 6 #include <pslib.h> 7 7 #include <psmodules.h> 8 #include <psphot.h> 8 9 9 10 #include "ppBackground.h" … … 12 13 { 13 14 ppBackgroundVersionPrint(); 15 16 pmErrorRegister(); 17 psphotErrorRegister(); 18 ppBackgroundErrorRegister(); 14 19 15 20 ppBackgroundData *data = ppBackgroundDataInit(&argc, argv); … … 46 51 } 47 52 data->statsFile = NULL; 48 pmConfigRunFilenameAddWrite(data->config, "STATS", data->statsName);49 53 exitValue = ppBackgroundExitCode(exitValue); 50 54 } -
branches/czw_branch/20100519/ppBackground/src/ppBackground.h
r28304 r28334 5 5 #include <psmodules.h> 6 6 7 #include <ppBackgroundErrorCodes.h>7 #include "ppBackgroundErrorCodes.h" 8 8 9 9 #define PPBACKGROUND_RECIPE "PPBACKGROUND" // Recipe name … … 37 37 ); 38 38 39 /// Restore the background to an image 40 bool ppBackgroundRestore( 41 pmChip *chip, // Chip to correct 42 const pmChip *background, // Chip with background model 43 const pmChip *pattern, // Chip with pattern 44 const pmFPAview *view, // View to data 45 pmConfig *config // Configuration 46 ); 47 39 48 /// Determine exit code 40 49 psExit ppBackgroundExitCode( -
branches/czw_branch/20100519/ppBackground/src/ppBackgroundArguments.c
r28304 r28334 45 45 assert(data->config); 46 46 47 psMetadata *arguments = psMetadataAlloc(); // Command-line arguments47 psMetadata *arguments = data->config->arguments; 48 48 psMetadataAddStr(arguments, PS_LIST_TAIL, "-pattern", 0, "Filename of pattern correction", NULL); 49 49 psMetadataAddStr(arguments, PS_LIST_TAIL, "-background", 0, "Filename of background model", NULL); 50 psMetadataAddStr(arguments, PS_LIST_TAIL, "-image", 0, "Filename of image ", NULL);50 psMetadataAddStr(arguments, PS_LIST_TAIL, "-image", 0, "Filename of image (required)", NULL); 51 51 psMetadataAddStr(arguments, PS_LIST_TAIL, "-mask", 0, "Filename of mask", NULL); 52 psMetadataAddStr(arguments, PS_LIST_TAIL, "-stats", 0, "Output statistics file", NULL); 53 psMetadataAddStr(arguments, PS_LIST_TAIL, "-dumpconfig", 0, "Output configuration file", NULL); 52 54 if (argc == 1 || !psArgumentParse(arguments, &argc, argv) || argc != 2) { 53 55 usage(argv[0], arguments, data); … … 59 61 data->maskName = psMemIncrRefCounter(psMetadataLookupStr(NULL, arguments, "-mask")); 60 62 data->outRoot = psStringCopy(argv[1]); 61 psMetadataAddStr( data->config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "Output root name", data->outRoot);63 psMetadataAddStr(arguments, PS_LIST_TAIL, "OUTPUT", 0, "Output root name", data->outRoot); 62 64 63 65 psTrace("ppBackground", 1, "Done reading command-line arguments\n"); 64 psFree(arguments);65 66 66 67 if (!data->patternName && !data->backgroundName) { … … 68 69 return false; 69 70 } 71 if (!data->imageName) { 72 psError(PPBACKGROUND_ERR_CONFIG, true, "Must specify -image"); 73 return false; 74 } 70 75 71 76 PS_ASSERT_STRING_NON_EMPTY(data->outRoot, false); 77 78 const char *statsName = psMetadataLookupStr(NULL, arguments, "-stats"); 79 if (statsName) { 80 data->statsFile = fopen(statsName, "w"); 81 if (!data->statsFile) { 82 psError(PPBACKGROUND_ERR_IO, true, "Unable to open statistics file %s", statsName); 83 return false; 84 } 85 data->stats = psMetadataAlloc(); 86 pmConfigRunFilenameAddWrite(data->config, "STATS", statsName); 87 } 72 88 73 89 return true; -
branches/czw_branch/20100519/ppBackground/src/ppBackgroundCamera.c
r28304 r28334 32 32 bool status; // Status of file definition 33 33 34 fileArguments("PATTERN", data->patternName, "Input pattern", data->config); 35 pmFPAfile *pattern = pmFPAfileDefineFromArgs(&status, data->config, "PPBACKGROUND.PATTERN", 36 "PATTERN"); // File 37 if (!status) { 38 psError(psErrorCodeLast(), false, "Failed to build file from PPBACKGROUND.PATTERN"); 39 return false; 34 if (data->patternName) { 35 fileArguments("PATTERN", data->patternName, "Input pattern", data->config); 36 pmFPAfileDefineFromArgs(&status, data->config, "PPBACKGROUND.PATTERN", "PATTERN"); // File 37 if (!status) { 38 psError(psErrorCodeLast(), false, "Failed to build file from PPBACKGROUND.PATTERN"); 39 return false; 40 } 40 41 } 41 42 42 fileArguments("BACKGROUND", data->backgroundName, "Input background model", data->config); 43 pmFPAfile *background = pmFPAfileBindFromArgs(&status, data->config, "PPBACKGROUND.BACKGROUND", 44 "BACKGROUND"); // File 45 if (!status) { 46 psError(psErrorCodeLast(), false, "Failed to build file from PPBACKGROUND.BACKGROUND"); 47 return false; 43 if (data->backgroundName) { 44 fileArguments("BACKGROUND", data->backgroundName, "Input background model", data->config); 45 pmFPAfileDefineFromArgs(&status, data->config, "PPBACKGROUND.BACKGROUND", "BACKGROUND"); // File 46 if (!status) { 47 psError(psErrorCodeLast(), false, "Failed to build file from PPBACKGROUND.BACKGROUND"); 48 return false; 49 } 48 50 } 49 51 50 fileArguments("IMAGE", data-> backgroundName, "Input uncorrected image", data->config);51 pmFPAfile *image = pmFPAfile BindFromArgs(&status, background, data->config, "PPBACKGROUND.IMAGE",52 "IMAGE"); // File53 if (!status ) {52 fileArguments("IMAGE", data->imageName, "Input uncorrected image", data->config); 53 pmFPAfile *image = pmFPAfileDefineFromArgs(&status, data->config, "PPBACKGROUND.IMAGE", 54 "IMAGE"); // File 55 if (!status || !image) { 54 56 psError(psErrorCodeLast(), false, "Failed to build file from PPBACKGROUND.IMAGE"); 55 57 return false; 56 58 } 57 59 58 fileArguments("MASK", data->backgroundName, "Input uncorrected mask", data->config); 59 pmFPAfile *mask = pmFPAfileBindFromArgs(&status, image, data->config, "PPBACKGROUND.MASK", 60 "MASK"); // File 60 fileArguments("MASK", data->maskName, "Input uncorrected mask", data->config); 61 pmFPAfileBindFromArgs(&status, image, data->config, "PPBACKGROUND.MASK", "MASK"); // File 61 62 if (!status) { 62 63 psError(psErrorCodeLast(), false, "Failed to build file from PPBACKGROUND.MASK"); … … 64 65 } 65 66 66 pmFPAfile *output = pmFPAfileDefineOutput(data->config, file->fpa, "PPBACKGROUND.OUTPUT");67 pmFPAfile *output = pmFPAfileDefineOutput(data->config, image->fpa, "PPBACKGROUND.OUTPUT"); 67 68 if (!output) { 68 69 psError(psErrorCodeLast(), false, "Unable to define output."); … … 70 71 } 71 72 output->save = true; 73 74 pmFPAfile *outMask = pmFPAfileDefineOutput(data->config, output->fpa, "PPBACKGROUND.OUTPUT.MASK"); 75 if (!outMask) { 76 psError(psErrorCodeLast(), false, "Unable to define output."); 77 return false; 78 } 79 outMask->save = true; 72 80 73 81 #if 0 -
branches/czw_branch/20100519/ppBackground/src/ppBackgroundExit.c
r28304 r28334 13 13 if (errorCode != PS_ERR_NONE) { 14 14 pmFPAfileFreeSetStrict(false); 15 psErrorStackPrint(stderr, "Error in subtraction:");15 psErrorStackPrint(stderr, "Error in background restoration:"); 16 16 switch (errorCode) { 17 17 case PS_ERR_UNKNOWN: -
branches/czw_branch/20100519/ppBackground/src/ppBackgroundLoop.c
r28304 r28334 6 6 #include <pslib.h> 7 7 #include <psmodules.h> 8 #include <ppStats.h> 8 9 9 10 #include "ppBackground.h" … … 13 14 { 14 15 pmConfig *config = data->config; // Configuration data 15 pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPBACKGROUND. BACKGROUND", 0);16 pmFPAfile *file = pmFPAfileSelectSingle(config->files, "PPBACKGROUND.IMAGE", 0); 16 17 pmFPAfile *patternFile = pmFPAfileSelectSingle(config->files, "PPBACKGROUND.PATTERN", 0); // File with data 18 pmFPAfile *bgFile = pmFPAfileSelectSingle(config->files, "PPBACKGROUND.BACKGROUND", 0); // File with bg 17 19 pmFPA *patternMosaic = pmFPAConstruct(file->camera, file->cameraName); // Mosaicked FPA for pattern 18 20 19 psImageMaskType maskBad = pmConfigMaskGet(" BLANK", config); // Mask value to set21 psImageMaskType maskBad = pmConfigMaskGet("DETECTOR", config); // Mask value to set 20 22 21 23 pmFPAview *view = pmFPAviewAlloc(0); // Pointer into FPA hierarchy … … 34 36 } 35 37 36 if (chip->cell ->n > 1) {38 if (chip->cells->n > 1) { 37 39 psError(PPBACKGROUND_ERR_CONFIG, true, 38 40 "Input image and background model should be chip-mosaicked"); … … 44 46 pmFPAfileActivate(config->files, true, "PPBACKGROUND.PATTERN"); 45 47 46 pmCell * cell; // Cell with pattern data48 pmCell *patternCell; // Cell with pattern data 47 49 while ((patternCell = pmFPAviewNextCell(view, patternFile->fpa, 1))) { 48 if (! cell->process || !cell->file_exists) {50 if (!patternCell->process || !patternCell->file_exists) { 49 51 continue; 50 52 } … … 68 70 // Get size of image from concepts 69 71 if (numCols == 0 || numRows == 0) { 70 numCols = psMetadataLookupS32(NULL, cell->concepts, "CELL.XSIZE");71 numRows = psMetadataLookupS32(NULL, cell->concepts, "CELL.YSIZE");72 numCols = psMetadataLookupS32(NULL, patternCell->concepts, "CELL.XSIZE"); 73 numRows = psMetadataLookupS32(NULL, patternCell->concepts, "CELL.YSIZE"); 72 74 } 73 75 // Get size of image from TRIMSEC 74 76 if (numCols == 0 || numRows == 0) { 75 psRegion *trimsec = psMetadataLookupPtr(NULL, cell->concepts, "CELL.TRIMSEC");77 psRegion *trimsec = psMetadataLookupPtr(NULL, patternCell->concepts, "CELL.TRIMSEC"); 76 78 numCols = trimsec->x1 - trimsec->x0; 77 79 numRows = trimsec->y1 - trimsec->y0; … … 84 86 readout->image = psImageAlloc(numCols, numRows, PS_TYPE_F32); 85 87 psImageInit(readout->image, 0.0); 88 readout->mask = psImageAlloc(numCols, numRows, PS_TYPE_IMAGE_MASK); 89 psImageInit(readout->mask, 0); 86 90 87 91 if (!pmPatternRowApply(readout, maskBad) || !pmPatternCellApply(readout, maskBad)) { … … 91 95 92 96 // Remove bias sections to avoid warnings 93 psMetadataItem *biassec = psMetadataLookup(pattern RO->parent->concepts, "CELL.BIASSEC");97 psMetadataItem *biassec = psMetadataLookup(patternCell->concepts, "CELL.BIASSEC"); 94 98 if (psListLength(biassec->data.V)) { 95 99 psFree(biassec->data.V); … … 114 118 } 115 119 116 pmChip *mosaic = pmFPAviewThisChip(view, patternMosaic); // Chip for mosaicked pattern 117 if (!pmChipMosaic(mosaic, chip, true, maskBad)) { 118 psError(psErrorCodeLast(), false, "Unable to mosaic pattern correction"); 119 return false; 120 if (data->patternName) { 121 pmChip *patternChip = pmFPAviewThisChip(view, patternFile->fpa); // Chip for pattern 122 pmChip *mosaic = pmFPAviewThisChip(view, patternMosaic); // Chip for mosaicked pattern 123 if (!mosaic->hdu && !mosaic->parent->hdu) { 124 pmFPAAddSourceFromView(patternMosaic, view, file->format); 125 } 126 if (!pmChipMosaic(mosaic, patternChip, true, maskBad)) { 127 psError(psErrorCodeLast(), false, "Unable to mosaic pattern correction"); 128 return false; 129 } 130 pmFPAfileActivate(config->files, true, NULL); 131 // pmFPAfileActivate(config->files, false, "PPBACKGROUND.PATTERN"); 120 132 } 121 pmFPAfileActivate(config->files, true, NULL);122 pmFPAfileActivate(config->files, false, "PPBACKGROUND.PATTERN");123 133 } 124 134 135 pmChip *patternChip = patternFile ? pmFPAviewThisChip(view, patternMosaic) : NULL; // Chip with pattern 136 pmChip *bgChip = bgFile ? pmFPAviewThisChip(view, bgFile->fpa) : NULL; // Chip with background model 137 if (!ppBackgroundRestore(chip, bgChip, patternChip, view, config)) { 138 psError(psErrorCodeLast(), false, "Unable to replace background"); 139 return false; 140 } 141 pmChipFreeData(patternChip); 125 142 126 127 128 129 130 131 pmHDU *hdu = pmHDUGetLowest(file->fpa, chip, cell); // HDU for readout 132 if (!hdu) { 133 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find HDU for data."); 134 return false; 135 } 136 if (!hdu->header) { 137 hdu->header = psMetadataAlloc(); 138 } 139 ppBackgroundVersionHeader(hdu->header); 140 141 142 143 144 145 146 143 pmHDU *hdu = pmHDUGetLowest(file->fpa, chip, NULL); // HDU for chip 144 if (!hdu) { 145 psError(PS_ERR_UNEXPECTED_NULL, true, "Unable to find HDU for data."); 146 return false; 147 } 148 if (!hdu->header) { 149 hdu->header = psMetadataAlloc(); 150 } 151 ppBackgroundVersionHeader(hdu->header); 147 152 148 153 // Chip … … 158 163 } 159 164 165 psFree(patternMosaic); 166 167 if (data->stats) { 168 psImageMaskType maskVal = 0; // Bits to mask 169 if (!pmConfigMaskSetBits(&maskVal, NULL, config)) { 170 psError(psErrorCodeLast(), false, "Unable to find bits to mask"); 171 return false; 172 } 173 ppStatsFPA(data->stats, file->fpa, view, maskVal, config); 174 } 175 176 psFree(view); 177 160 178 return true; 161 179 } -
branches/czw_branch/20100519/ppBackground/src/ppBackgroundVersionDefinitions.h.in
r28304 r28334 1 #ifndef PP VIZPATTERN_VERSION_DEFINITIONS_H2 #define PP VIZPATTERN_VERSION_DEFINITIONS_H1 #ifndef PPBACKGROUND_VERSION_DEFINITIONS_H 2 #define PPBACKGROUND_VERSION_DEFINITIONS_H 3 3 4 #define PP VIZPATTERN_VERSION @PPVIZPATTERN_VERSION@ // SVN version5 #define PP VIZPATTERN_BRANCH @PPVIZPATTERN_BRANCH@ // SVN branch6 #define PP VIZPATTERN_SOURCE @PPVIZPATTERN_SOURCE@ // SVN source4 #define PPBACKGROUND_VERSION @PPBACKGROUND_VERSION@ // SVN version 5 #define PPBACKGROUND_BRANCH @PPBACKGROUND_BRANCH@ // SVN branch 6 #define PPBACKGROUND_SOURCE @PPBACKGROUND_SOURCE@ // SVN source 7 7 8 8 #endif -
branches/czw_branch/20100519/ppImage/src/ppImageLoop.c
r28304 r28334 51 51 ESCAPE("load failure for Chip"); 52 52 } 53 printf("PPI: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 53 54 54 // crosstalk measurement needs to be done on the entire chip at once, and before 55 55 // signal levels are modified by the detrending. If crosstalk measurement is … … 65 65 ESCAPE("Unable to perform crosstalk correction"); 66 66 } 67 printf("PPI: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 67 68 68 psTimerStart(TIMER_DETREND); 69 69 pmCell *cell; // Cell from chip … … 152 152 ESCAPE("Unable to free detrend images"); 153 153 } 154 printf("PPI: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 154 155 155 // Apply the fringe correction 156 156 if (options->doFringe) { … … 163 163 ESCAPE("Unable to free fringe images"); 164 164 } 165 printf("PPI: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 165 166 166 // Apply the pattern correction 167 167 if (options->doPatternRow || options->doPatternCell) { … … 170 170 } 171 171 } 172 printf("PPI: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 172 173 173 // measure various pixel-based statistics for this image 174 174 if (!ppImagePixelStats(config, stats, options, view)) { 175 175 ESCAPE("Unable to measures pixel stats for image"); 176 176 } 177 printf("PPI: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 177 178 178 if (!ppImageMosaicChip(config, options, view, "PPIMAGE.CHIP", "PPIMAGE.OUTPUT")) { 179 179 ESCAPE("Unable to mosaic chip"); … … 182 182 183 183 // we perform photometry on the readouts of this chip in the output 184 printf("PPI: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 184 185 185 psTimerStart(TIMER_PHOT); 186 186 if (options->doPhotom) { -
branches/czw_branch/20100519/ppImage/src/ppImageMosaic.c
r28304 r28334 9 9 { 10 10 bool status; // Status of MD lookup 11 printf("PPIM: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 11 12 12 pmFPAfile *in = psMetadataLookupPtr(&status, config->files, inFile); // Input file 13 13 if (!status) { … … 15 15 exit(EXIT_FAILURE); 16 16 } 17 printf("PPIM: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 17 18 18 pmFPAfile *out = psMetadataLookupPtr(&status, config->files, outFile); // Output file 19 19 if (!status) { … … 21 21 exit(EXIT_FAILURE); 22 22 } 23 printf("PPIM: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 23 24 24 pmChip *outChip = pmFPAviewThisChip(view, out->fpa); 25 25 pmChip *inChip = pmFPAviewThisChip(view, in->fpa); … … 27 27 pmFPAAddSourceFromView(out->fpa, view, out->format); 28 28 } 29 printf("PPIM: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 29 30 30 // If the input is a dark (normalising and mosaicking) then it looks like a video cell and will be ignored 31 31 // by pmChipMosaic. We therefore hack the structure so it doesn't look like a video cell. 32 32 psVector *darkNumbers = NULL; // Number of dark readouts for each cell 33 // psVectorInit(darkNumbers, 0);34 printf("PPIM: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast()));35 33 if (psMetadataLookupBool(&status, config->arguments, "INPUT_IS_DARK")) { 36 34 darkNumbers = psVectorAlloc(inChip->cells->n, PS_TYPE_S32); … … 45 43 } 46 44 } 47 printf("PPMI: %x %s\n",psErrorCodeLast(),psErrorCodeString(psErrorCodeLast())); 45 48 46 psTrace("pmChipMosaic", 5, "mosaic chip %s to %s (xbin,ybin: %d,%d to %d,%d)\n", 49 47 in->name, out->name, in->xBin, in->yBin, out->xBin, out->yBin); -
branches/czw_branch/20100519/ppStack/src/ppStackTarget.c
r28304 r28334 164 164 165 165 psStats *bg = psStatsAlloc(PS_STAT_ROBUST_MEDIAN); // Statistics for background 166 float mean = NAN; // Measured mean variance 166 167 if (!psImageBackground(bg, NULL, variance, mask, maskVal, rng)) { 167 psError(PPSTACK_ERR_DATA, false, "Can't measure background for image."); 168 psFree(rng); 169 return NULL; 168 psErrorClear(); 169 // Retry using all the available pixels 170 bg->nSubsample = variance->numCols * variance->numRows + 1; 171 if (!psImageStats(bg, variance, mask, maskVal)) { 172 psLogMsg("ppStack", PS_LOG_DETAIL, 173 "Couldn't measure mean variance for image %d; retrying.", i); 174 psErrorClear(); 175 // Retry with desperate statistic 176 bg->options = PS_STAT_SAMPLE_MEAN; 177 if (!psImageStats(bg, variance, mask, maskVal)) { 178 psWarning("Unable to measure mean variance for image %d --- rejecting.", i); 179 psErrorStackPrint(stderr, "Unable to measure mean variance for image %d", i); 180 options->inputMask->data.PS_TYPE_VECTOR_MASK_DATA[i] |= PPSTACK_MASK_PSF; 181 goto DONE; 182 } else { 183 // Desperate retry 184 mean = bg->sampleMean; 185 } 186 } else { 187 // Retry with all available pixels 188 mean = bg->robustMedian; 189 } 190 } else { 191 // First attempt 192 mean = bg->robustMedian; 170 193 } 171 194 … … 177 200 } 178 201 202 DONE: 203 psFree(bg); 179 204 if (!ppStackFilesIterateUp(config)) { 180 205 psFree(rng); -
branches/czw_branch/20100519/psLib/src/sys/psAbort.c
r28304 r28334 23 23 #include <stdarg.h> 24 24 #include <stdlib.h> 25 #include <string.h> 25 26 #include <unistd.h> 26 27 28 #if defined(HAVE_BACKTRACE) 29 #include <execinfo.h> 30 #define BACKTRACE_BUFFER_SIZE 256 // Maximum size of backtrace 31 #endif 32 27 33 #include "psAbort.h" 34 #include "psString.h" 35 #include "psMemory.h" 28 36 #include "psError.h" 29 37 #include "psLogMsg.h" 38 39 // Write backtrace to log 40 static inline void psBacktrace(void) 41 { 42 #ifdef HAVE_BACKTRACE 43 void **bt = psAlloc(BACKTRACE_BUFFER_SIZE * sizeof(void *)); // Backtrace information 44 if (!bt) { 45 psLogMsg("psLib.sys", PS_LOG_ABORT, "Unable to allocate memory for backtrace"); 46 return; 47 } 48 int size = backtrace(bt, BACKTRACE_BUFFER_SIZE); // Size of backtrace 49 char **strings = backtrace_symbols((void *const *)bt, size); 50 psLogMsg("psLib.sys", PS_LOG_ABORT, "Backtrace depth: %d", size); 51 for (int i = 0; i < size; i++) { 52 // if the caller was an anon function then strchr won't 53 // find a '(' in the string and will return NULL 54 char *caller = strchr(strings[i], '('); 55 if (caller) { 56 // skip over the '(' 57 caller++; 58 // find the end of the symbol name 59 size_t callerLength = abs(strchr(caller, '+') - caller); 60 psString name = psStringNCopy(caller, callerLength); 61 psLogMsg("psLib.sys", PS_LOG_ABORT, "Backtrace %d: %s", i, name); 62 psFree(name); 63 } else { 64 psLogMsg("psLib.sys", PS_LOG_ABORT, "Backtrace %d: (unknown)", i); 65 } 66 } 67 #endif // ifdef HAVE_BACKTRACE 68 } 30 69 31 70 void p_psAbort(const char *file, … … 46 85 // Clean up stack after variable arguement has been used 47 86 va_end(argPtr); 87 88 psBacktrace(); 48 89 49 90 // Call system abort function to terminate program execution … … 72 113 va_end(argPtr); 73 114 115 psBacktrace(); 116 74 117 // Call system abort function to terminate program execution 75 118 fsync(psLogGetDestination()); -
branches/czw_branch/20100519/psLib/src/sys/psThread.c
r28304 r28334 210 210 psThreadTask *task = psHashLookup(tasks, job->type); // Task to execute job 211 211 psAssert(task, "Couldn't find thread task %s", job->type); 212 psAssert(job->args->n == task->nArgs, "invalid number of arguments to %s (%ld supplied, expected %d)", task->type, job->args->n, task->nArgs); 212 psAssert(job->args->n == task->nArgs, 213 "invalid number of arguments to %s (%ld supplied, expected %d)", 214 task->type, job->args->n, task->nArgs); 213 215 bool status = task->function(job); // Status of executing task 214 216 -
branches/czw_branch/20100519/psModules/src/config/pmConfig.c
r27161 r28334 306 306 *config = psMetadataConfigRead(NULL, &numBadLines, realName, true); 307 307 if (numBadLines > 0) { 308 psError(PM_ERR_CONFIG, false, "%d bad lines in %s configuration file (%s)",308 psError(PM_ERR_CONFIG, true, "%d bad lines in %s configuration file (%s)", 309 309 numBadLines, description, realName); 310 310 psFree (realName); … … 1751 1751 psMetadataItem *item = psMetadataLookup(camera, "FILERULES"); // Item with the file rule of interest 1752 1752 if (!item) { 1753 psError(PM_ERR_CONFIG, false, "Unable to find FILERULES in the camera configuration.");1753 psError(PM_ERR_CONFIG, true, "Unable to find FILERULES in the camera configuration."); 1754 1754 return NULL; 1755 1755 } … … 1771 1771 } 1772 1772 1773 return psMetadataLookupMetadata( &mdok, filerules, realname);1773 return psMetadataLookupMetadata(NULL, filerules, realname); 1774 1774 } 1775 1775 -
branches/czw_branch/20100519/pstamp/src/pstamp.h
r28304 r28334 33 33 #define PSTAMP_SELECT_BACKMDL 32 34 34 #define PSTAMP_SELECT_INVERSE 1024 35 #define PSTAMP_SELECT_UNCONV 2048 36 #define PSTAMP_USE_IMFILE_ID 16384 35 37 36 #define PSTAMP_ WAIT_FOR_UPDATE 204838 #define PSTAMP_NO_WAIT_FOR_UPDATE 32768 37 39 38 40 #define PSTAMP_CENTER_IN_PIXELS 1 -
branches/czw_branch/20100519/tools/chip_outputs.pl
r27690 r28334 23 23 'PSF' => '.psf', # Point-spread function 24 24 'LOG' => '.log', # Processing log 25 'PATTERN' => '.ptn', # Pattern subtraction 26 'MODEL' => '.mdl.fits', # Background model 25 27 }; 26 28
Note:
See TracChangeset
for help on using the changeset viewer.
