Changeset 29124
- Timestamp:
- Sep 7, 2010, 9:16:10 AM (16 years ago)
- Location:
- branches/eam_branches/ipp-20100823
- Files:
-
- 2 deleted
- 54 edited
- 17 copied
-
. (modified) (1 prop)
-
Nebulous-Server/bin/neb-countcheck (copied) (copied from trunk/Nebulous-Server/bin/neb-countcheck )
-
Ohana/src/opihi/dvo/ImageSelection.c (modified) (1 diff)
-
Ohana/src/opihi/dvo/find_matches.c (modified) (4 diffs)
-
PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm (modified) (1 diff)
-
extperl/Pod-Escapes-1.04.tar.gz (copied) (copied from trunk/extperl/Pod-Escapes-1.04.tar.gz )
-
extperl/Pod-Simple-3.14.tar.gz (copied) (copied from trunk/extperl/Pod-Simple-3.14.tar.gz )
-
ippMonitor/Makefile.in (modified) (1 diff)
-
ippMonitor/raw/czartool_labels.php (modified) (9 diffs)
-
ippMonitor/raw/diskUsage.php (copied) (copied from trunk/ippMonitor/raw/diskUsage.php )
-
ippMonitor/raw/ipp.imfiles.dat (modified) (1 diff)
-
ippScripts/scripts/automate_stacks.pl (modified) (2 diffs)
-
ippScripts/scripts/dist_bundle.pl (modified) (1 diff)
-
ippScripts/scripts/dist_defineruns.pl (modified) (1 diff)
-
ippScripts/scripts/magic_destreak_cleanup.pl (modified) (7 diffs)
-
ippScripts/scripts/staticsky.pl (modified) (2 diffs)
-
ippTasks/destreak.pro (modified) (2 diffs)
-
ippTasks/dist.pro (modified) (1 diff)
-
ippToPsps/perl/checkOdmStatus.pl (modified) (11 diffs)
-
ippToPsps/perl/getSmfForThisBatch.pl (copied) (copied from trunk/ippToPsps/perl/getSmfForThisBatch.pl )
-
ippToPsps/perl/ippToPsps/BatchManager.pm (copied) (copied from trunk/ippToPsps/perl/ippToPsps/BatchManager.pm )
-
ippToPsps/perl/ippToPsps/IppToPspsDb.pm (modified) (5 diffs)
-
ippToPsps/perl/ippToPsps_run.pl (modified) (4 diffs)
-
ippToPsps/src/ippToPspsBatchDetection.c (modified) (1 diff)
-
ippToPsps/xmlschema (copied) (copied from trunk/ippToPsps/xmlschema )
-
ippToPsps/xmlschema/BatchManifest.xsd (copied) (copied from trunk/ippToPsps/xmlschema/BatchManifest.xsd )
-
ippTools/configure.ac (modified) (1 diff)
-
ippTools/share/magicdstool_tocleanup.sql (modified) (2 diffs)
-
ippTools/src/disttool.c (modified) (1 diff)
-
ippTools/src/disttoolConfig.c (modified) (1 diff)
-
ippTools/src/staticskytool.c (modified) (1 diff)
-
ippconfig/recipes/fitstypes.mdc (modified) (1 diff)
-
ippconfig/recipes/nightly_science.config (modified) (1 diff)
-
ippconfig/recipes/ppSub.config (modified) (1 diff)
-
ippconfig/recipes/psphot.config (modified) (3 diffs)
-
psLib/src/math/psUnaryOp.c (modified) (1 diff)
-
psModules/src/imcombine/pmSubtractionStamps.c (modified) (1 diff)
-
psModules/src/objects/models/pmModel_SERSIC.c (modified) (2 diffs)
-
psModules/src/objects/pmSourceIO_CMF_PS1_DV2.c (modified) (2 diffs)
-
psModules/src/objects/pmSourceIO_CMF_PS1_SV1.c (modified) (1 diff)
-
psModules/src/objects/pmSourceIO_CMF_PS1_V3.c (modified) (3 diffs)
-
psModules/src/objects/pmSourceMoments.c (modified) (1 diff)
-
psModules/src/objects/pmSourcePhotometry.c (modified) (2 diffs)
-
psconfig/tagsets/ipp-2.9.perl (modified) (1 diff)
-
psphot/doc/notes.20100715.txt (modified) (1 diff)
-
psphot/src/psphotBlendFit.c (modified) (1 diff)
-
psphot/src/psphotExtendedSourceAnalysis.c (modified) (2 diffs)
-
psphot/src/psphotExtendedSourceFits.c (modified) (6 diffs)
-
psphot/src/psphotSourceFits.c (modified) (4 diffs)
-
psphot/src/psphotSourceSize.c (modified) (1 diff)
-
psphot/src/psphotStackMatchPSFs.c (modified) (1 diff)
-
psphot/src/psphotStackMatchPSFsUtils.c (modified) (2 diffs)
-
pstamp/scripts/Makefile.am (modified) (1 diff)
-
pstamp/scripts/detectability_respond.pl (modified) (10 diffs)
-
pstamp/scripts/psmkreq (copied) (copied from trunk/pstamp/scripts/psmkreq )
-
pstamp/scripts/pstamp_checkdependent.pl (modified) (2 diffs)
-
pstamp/scripts/pstamp_webrequest.pl (modified) (4 diffs)
-
pstamp/scripts/pstamprequest (deleted)
-
pstamp/web/request.php (modified) (24 diffs)
-
tools/czarclean.pl (copied) (copied from trunk/tools/czarclean.pl ) (1 diff)
-
tools/czarplot.pl (modified) (6 diffs)
-
tools/czartool/Burntool.pm (copied) (copied from trunk/tools/czartool/Burntool.pm )
-
tools/czartool/CzarDb.pm (modified) (10 diffs)
-
tools/czartool/Czarplot.pm (deleted)
-
tools/czartool/MySQLDb.pm (modified) (1 diff)
-
tools/czartool/Pantasks.pm (modified) (1 diff)
-
tools/czartool/Plotter.pm (copied) (copied from trunk/tools/czartool/Plotter.pm )
-
tools/neb-grep (copied) (copied from trunk/tools/neb-grep )
-
tools/roboczar.pl (modified) (7 diffs)
-
tools/who_uses_the_cluster (copied) (copied from trunk/tools/who_uses_the_cluster )
-
tools/who_uses_the_cluster/_who_uses_the_cluster.sh (copied) (copied from trunk/tools/who_uses_the_cluster/_who_uses_the_cluster.sh )
-
tools/who_uses_the_cluster/_who_uses_the_cluster_analyze.pl (copied) (copied from trunk/tools/who_uses_the_cluster/_who_uses_the_cluster_analyze.pl )
-
tools/who_uses_the_cluster/who_uses_the_cluster_analyze.sh (copied) (copied from trunk/tools/who_uses_the_cluster/who_uses_the_cluster_analyze.sh )
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20100823
-
branches/eam_branches/ipp-20100823/Ohana/src/opihi/dvo/ImageSelection.c
r28958 r29124 47 47 Image *MatchImage (unsigned int time, short int source, unsigned int imageID) { 48 48 49 int m ;49 int m = -1; 50 50 51 51 if ((imageID != 0) && (imageID < Nimage)) { 52 m = (int) imageID - 1; 53 } else { 52 // imageID is in range for the array of images. If the table is still in order and 53 // no images have been deleted the index of the image we are looking for will be imageID - 1 54 // If this is the case, we have it. Otherwise we'll have to go search for it below 55 int guess = (int) imageID - 1; 56 if (image[guess].imageID == imageID) { 57 m = guess; 58 } 59 } 60 if (m == -1) { 54 61 m = match_image_subset (image, subset, Nsubset, time, source); 55 62 } -
branches/eam_branches/ipp-20100823/Ohana/src/opihi/dvo/find_matches.c
r27610 r29124 10 10 off_t *N1, *N2; 11 11 double *X1, *Y1, *X2, *Y2; 12 double dX, dY, dR ;12 double dX, dY, dR, Doff, Dmin, Dmax, Rmin, Rmax; 13 13 int status; 14 double RADIUS2, R min;14 double RADIUS2, RadMin; 15 15 off_t Nave; 16 16 Coords tcoords; … … 52 52 strcpy (tcoords.ctype, "RA---ARC"); 53 53 54 // this region includes a boundary layer of size RADIUS 55 if (fabs(region[0].Dmin) < fabs(region[0].Dmax)) { 56 Doff = RAD_DEG*region[0].Dmax; 57 } else { 58 Doff = RAD_DEG*region[0].Dmin; 59 } 60 if (Doff < 80) { 61 Rmin = region[0].Rmin - RADIUS / 3600.0 / cos(Doff); 62 Rmax = region[0].Rmax + RADIUS / 3600.0 / cos(Doff); 63 } else { 64 Rmin = 0.0; 65 Rmax = 360.0; 66 } 67 Dmin = region[0].Dmin - RADIUS / 3600.0; 68 Dmax = region[0].Dmax + RADIUS / 3600.0; 69 54 70 // identify the entries contained by this catalog & init index 55 71 for (i = 0; i < Npoints; i++) { 56 72 index[i] = -1; 57 if (RAvec->elements.Flt[i] < region[0].Rmin) continue;58 if (RAvec->elements.Flt[i] > region[0].Rmax) continue;59 if (DECvec->elements.Flt[i] < region[0].Dmin) continue;60 if (DECvec->elements.Flt[i] > region[0].Dmax) continue;73 if (RAvec->elements.Flt[i] < Rmin) continue; 74 if (RAvec->elements.Flt[i] > Rmax) continue; 75 if (DECvec->elements.Flt[i] < Dmin) continue; 76 if (DECvec->elements.Flt[i] > Dmax) continue; 61 77 index[i] = -2; 62 78 } … … 100 116 /* within match range; look for matches */ 101 117 Jmin = -1; 102 R min = RADIUS2;118 RadMin = RADIUS2; 103 119 for (J = j; (dX > -1.02*RADIUS) && (J < Nave); J++) { 104 120 /* find closest match for this detection */ … … 107 123 dR = dX*dX + dY*dY; 108 124 if (dR > RADIUS2) continue; 109 if (dR < R min) {110 R min = dR;125 if (dR < RadMin) { 126 RadMin = dR; 111 127 Jmin = J; 112 128 } -
branches/eam_branches/ipp-20100823/PS-IPP-PStamp/lib/PS/IPP/PStamp/Job.pm
r28562 r29124 1130 1130 } 1131 1131 $cam_path_base = $run->{cam_path_base}; 1132 $astrom_file = $run->{astrom _file};1132 $astrom_file = $run->{astrom}; 1133 1133 } 1134 1134 my $astrom_file_resolved = $ipprc->file_resolve($astrom_file); -
branches/eam_branches/ipp-20100823/ippMonitor/Makefile.in
r28969 r29124 61 61 $(DESTWWW)/cleanTmpDirectory.php \ 62 62 $(DESTWWW)/warpProcessedExp_Images.php \ 63 $(DESTWWW)/warpProcessedExp.php 63 $(DESTWWW)/warpProcessedExp.php \ 64 $(DESTWWW)/diskUsage.php 64 65 65 66 DEFSRC = \ -
branches/eam_branches/ipp-20100823/ippMonitor/raw/czartool_labels.php
r28969 r29124 39 39 if ($selectedStage == "") { $selectedStage = "all_stages"; } 40 40 41 echo 'Some documentation can be found <a href="http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Processing">here</a><br>'; 41 $nsStatus = getNightlyScienceStatus($czardb); 42 echo "<p align=\"center\"> Current status of the IPP as of $lastUpdateTime (faults are shown in parentheses). <br>Documentation can be found <a href=\"http://svn.pan-starrs.ifa.hawaii.edu/trac/ipp/wiki/Processing\">here</a> and cluster load monitored <a href=\"http://ganglia.pan-starrs.ifa.hawaii.edu/?r=hour&s=descending&c=IPP%2520Production\">here</a><br>Current nightly science status: $nsStatus</p>"; 43 42 44 43 45 // deal with reverts: turn on or off if requested and pass current revert state for this stage onto labels table later … … 66 68 67 69 $states=array("full","new","drop","wait"); 68 $stages=array(" chip","cam","fake","warp","stack","diff","magic","magicDS","dist");70 $stages=array("burntool", "chip","cam","fake","warp","stack","diff","magic","magicDS","dist"); 69 71 $servers=array( 70 72 "addstar", … … 87 89 echo "<input type=\"hidden\" name=\"menu\" value=\"$menu\">\n"; 88 90 echo "</form>\n"; 89 echo "<p align=\"center\"> Current status of IPP (any faults are shown in parentheses). NOTE: This data is good as of: $lastUpdateTime </p>";90 91 91 92 echo "<table>\n"; … … 231 232 echo "<tr><td></td>\n"; 232 233 233 echo "<p align=\"center\"> Current labels for $server server </p>";234 echo "<p align=\"center\"> Current labels for $server server (D=distributing, P=publishing)</p>"; 234 235 235 236 write_header_cell($class, ""); … … 238 239 foreach ($stages as &$stage) { 239 240 241 if ($stage == "burntool") continue; 240 242 $reverting = getRevertStatus($db, $stage); 241 243 $link = "czartool_labels.php?pass=" . $pass . "&proj=" . $proj . "&label=" . $selectedLabel . "&stage=" . $selectedStage . "&revertstage=" . $stage . "&revertmode="; … … 249 251 echo "</tr>\n"; 250 252 echo "<tr><td></td>\n"; 253 write_header_cell($class, " "); 251 254 write_header_cell($class, "Label (in order of priority)"); 252 write_header_cell($class, "Distributing?");253 write_header_cell($class, "Publishing?");254 255 foreach ($stages as &$stage) { 255 256 … … 287 288 288 289 echo "<tr><td></td>\n"; 290 $distPub = " "; 291 if ($distributing) $distPub = "D"; 292 if ($publishing) $distPub = $distPub . "P"; 293 write_table_cell($class, '%s', "", $distPub); 294 289 295 write_table_cell($class, '%s', $link, $thisLabel); 290 write_table_cell($class, '%s', "", $distributing ? "yes" : "NO");291 write_table_cell($class, '%s', "", $publishing ? "yes" : "NO");292 296 293 297 $str = ""; 294 298 $anyFaults = false; 299 300 $link = $defaultlink; 301 getStateAndFaults($db, $thisLabel, $selectedState, "burntool", $str, $anyFaults); 302 write_table_cell($class, '%s', $anyFaults ? $link : "", $str); 295 303 296 304 $link = "failedChipProcessedImfile.php?pass=" . $pass . "&proj=" . $proj . "&chipRun.label=" . $thisLabel . "&chipRun.state=new"; … … 337 345 338 346 echo "<tr><td></td>\n"; 347 write_table_cell($class, '%s', "", " "); 339 348 write_table_cell($class, '%s', $link, "All $server labels"); 340 349 … … 355 364 $qry = $db->query($sql); 356 365 if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";} 366 } 367 368 ########################################################################### 369 # 370 # Returns current nightly science status 371 # 372 ########################################################################### 373 function getNightlyScienceStatus($db) { 374 375 $sql = "SELECT status FROM nightlyscience"; 376 if ($debug) {echo "$sql<br>";} 377 378 $qry = $db->query($sql); 379 if (dberror($qry)) {echo "<b>error with $sql </b><br>\n";} 380 $qry->fetchInto($row); 381 382 return $row[0]; 357 383 } 358 384 -
branches/eam_branches/ipp-20100823/ippMonitor/raw/ipp.imfiles.dat
r28969 r29124 38 38 menulink | menuselect | link | Tables columns | columns_in_db.php 39 39 menulink | menuselect | link | Clean /tmp directory | cleanTmpDirectory.php 40 menutop | menutop | link | disk usage | diskUsage.php -
branches/eam_branches/ipp-20100823/ippScripts/scripts/automate_stacks.pl
r28982 r29124 123 123 defined $queue_chips or defined $queue_stacks or $queue_sweetspot or $queue_detrends or $queue_dqstats or 124 124 defined $check_chips or defined $check_stacks or $check_sweetspot or $check_detrends or $check_dqstats or 125 defined $test_mode or defined $clean_old or defined $check_mode; 125 defined $test_mode or defined $clean_old or defined $check_mode or 126 defined $confirm_stacks; 126 127 127 128 # Configurable parameters from our config file. … … 1271 1272 print STDERR "confirm_stacks: Target $target on $date is not done stacking. $Nstacks $Nattempted\n" 1272 1273 } 1274 if ($metadata_out{nsState} eq 'CONFIRM_STACKING') { 1275 $metadata_out{nsState} = 'STACKING'; 1276 } 1277 1273 1278 next; 1274 1279 } 1275 if (defined($pretend)) { 1276 add_to_macro_list('check_confirm_stacks',$stackable_list{$target},$date,$target); 1277 } 1278 else { 1279 add_to_macro_list('confirm_stacks',$stackable_list{$target},$date,$target); 1280 if ($metadata_out{nsState} eq 'CONFIRM_STACKING') { 1281 if (defined($pretend)) { 1282 add_to_macro_list('check_confirm_stacks',$stackable_list{$target},$date,$target); 1283 } 1284 else { 1285 add_to_macro_list('confirm_stacks',$stackable_list{$target},$date,$target); 1286 } 1280 1287 } 1281 1288 } -
branches/eam_branches/ipp-20100823/ippScripts/scripts/dist_bundle.pl
r28963 r29124 154 154 # 2. magic is not required for this distRun 155 155 # 3. the processing for the component produced no images (warp or diff with bad quality for example) 156 my $nan_masked_pixels = ! ($clean || (($stage eq "camera") || ($stage eq 'fake') || ($stage eq 'stack') ) || $no_magic || $poor_quality);156 my $nan_masked_pixels = ! ($clean || (($stage eq "camera") || ($stage eq 'fake') || ($stage eq 'stack') || ($stage eq 'sky')) || $no_magic || $poor_quality); 157 157 158 158 my ($image, $mask, $variance); -
branches/eam_branches/ipp-20100823/ippScripts/scripts/dist_defineruns.pl
r28536 r29124 83 83 push @stages, $stage; 84 84 } else { 85 @stages = qw( raw chip chip_bg camera fake warp warp_bg diff stack SSdiff );85 @stages = qw( raw chip chip_bg camera fake warp warp_bg diff stack SSdiff sky); 86 86 } 87 87 -
branches/eam_branches/ipp-20100823/ippScripts/scripts/magic_destreak_cleanup.pl
r27785 r29124 38 38 39 39 # Parse the command-line arguments 40 my ($magic_ds_id, $camera );40 my ($magic_ds_id, $camera, $stage); 41 41 my ($dbname, $save_temps, $verbose, $no_update, $no_op, $logfile); 42 42 … … 44 44 'magic_ds_id=s' => \$magic_ds_id,# Magic destreak run identifier 45 45 'camera=s' => \$camera, # camera for evaluating file rules 46 'stage=s' => \$stage, # camera for evaluating file rules 46 47 'save-temps' => \$save_temps, # Save temporary files? 47 48 'dbname=s' => \$dbname, # Database name … … 56 57 -exitval => 3) unless 57 58 defined $magic_ds_id and 58 defined $camera; 59 # defined $stage and 60 # defined $stage_id; 59 defined $camera and 60 defined $stage; 61 61 62 62 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $magic_ds_id, $PS_EXIT_CONFIG_ERROR ); # IPP configuration … … 79 79 my $dbh = DBI->connect($dsn, $dbuser, $dbpassword) or die "Cannot connect to mysql server\n"; 80 80 81 my $q1 = "SELECT magicDSRun.*, camera, camProcessedExp.path_base AS cam_path_base, camRun.reduction AS cam_reduction, magicRun.inverse" 82 . " FROM magicDSRun JOIN magicRun USING(magic_id) JOIN rawExp USING(exp_id) LEFT JOIN camProcessedExp USING(cam_id) LEFT JOIN camRun USING(cam_id)" 83 . " WHERE magic_ds_id = $magic_ds_id"; 81 my $q1; 82 83 if ($stage ne 'diff') { 84 $q1 = "SELECT magicDSRun.*, camera, camProcessedExp.path_base AS cam_path_base, camRun.reduction AS cam_reduction" 85 . " FROM magicDSRun JOIN magicRun USING(magic_id) JOIN rawExp USING(exp_id) LEFT JOIN camProcessedExp USING(cam_id) LEFT JOIN camRun USING(cam_id)"; 86 } else { 87 $q1 = "SELECT magicDSRun.*, diffRun.diff_mode FROM magicDSRun JOIN diffRun ON stage_id = diffRun.diff_id AND stage = 'diff'"; 88 } 89 $q1 .= " WHERE magic_ds_id = $magic_ds_id"; 90 84 91 my $q2 = "SELECT * from magicDSFile where magic_ds_id = $magic_ds_id"; 85 92 … … 89 96 &my_die ("Unable to find magicDSRun $magic_ds_id", $magic_ds_id, $PS_EXIT_CONFIG_ERROR) if !$nrows; 90 97 my $run = $stmt1->fetchrow_hashref(); 98 $stmt1->finish(); 91 99 92 100 my $state = $run->{state}; 93 my $stage = $run->{stage};94 101 my $stage_id = $run->{stage_id}; 95 102 my $cam_path_base = $run->{cam_path_base}; 96 103 my $cam_reduction = $run->{cam_reduction}; 97 104 $cam_reduction = 'DEFAULT' if !$cam_reduction or ($cam_reduction eq 'NULL'); 98 my $inverse = $run->{inverse}; 105 106 my $warp_warp = ($stage eq 'diff' and $run->{diff_mode} eq 1); 99 107 100 108 … … 105 113 &my_die("clean not allowed for raw stage, use goto_restore", $magic_ds_id, $PS_EXIT_CONFIG_ERROR) if $stage eq "raw"; 106 114 107 my $recipe_psastro = $ipprc->reduction($cam_reduction, 'PSASTRO'); # Recipe to use 108 &my_die("Unrecognised PSASTRO recipe", $magic_ds_id, $PS_EXIT_CONFIG_ERROR) unless defined $recipe_psastro; 115 my $recipe_psastro; 116 if ($stage eq 'chip') { 117 $recipe_psastro = $ipprc->reduction($cam_reduction, 'PSASTRO'); # Recipe to use 118 &my_die("Unrecognised PSASTRO recipe", $magic_ds_id, $PS_EXIT_CONFIG_ERROR) unless defined $recipe_psastro; 119 } 109 120 110 121 … … 217 228 delete_files($rimage, $rmask, $rweight, $rsources, $rastrom, $bimage, $bmask, $bweight, $bsources, $bastrom, $bch_mask, $rch_mask); 218 229 219 if ($stage eq "diff" and $ inverse) {230 if ($stage eq "diff" and $warp_warp) { 220 231 my $name = "PPSUB.INVERSE"; 221 232 if ($backup_path_base) { -
branches/eam_branches/ipp-20100823/ippScripts/scripts/staticsky.pl
r28962 r29124 71 71 $ipprc->redirect_output($logDest) or my_die( "Unable to redirect output", $sky_id, $PS_EXIT_SYS_ERROR ) if $redirect; 72 72 73 my $traceDest = $ipprc->filename("TRACE.EXP", $outroot); 73 74 # my $source_id = $ipprc->source_id($dbname, $PS_TABLE_ID_STATICSKY); 74 75 … … 164 165 $command .= " -recipe PSPHOT $recipe_psphot"; 165 166 $command .= " -dumpconfig $configuration"; 166 #$command .= " -tracedest $traceDest -log $logDest";167 $command .= " -tracedest $traceDest -log $logDest"; 167 168 # $command .= " -dbname $dbname" if defined $dbname; 168 169 # $command .= " -image_id $diff_skyfile_id" if defined $diff_skyfile_id; -
branches/eam_branches/ipp-20100823/ippTasks/destreak.pro
r27946 r29124 600 600 book getword magicDSToCleanup $pageName magic_ds_id -var MAGIC_DS_ID 601 601 book getword magicDSToCleanup $pageName camera -var CAMERA 602 book getword magicDSToCleanup $pageName stage -var STAGE 602 603 book getword magicDSToCleanup $pageName outroot -var OUTROOT 603 604 book getword magicDSToCleanup $pageName dbname -var DBNAME … … 607 608 host anyhost 608 609 609 $run = magic_destreak_cleanup.pl --magic_ds_id $MAGIC_DS_ID -- camera $CAMERA --logfile $logfile610 $run = magic_destreak_cleanup.pl --magic_ds_id $MAGIC_DS_ID --stage $STAGE --camera $CAMERA --logfile $logfile 610 611 611 612 add_standard_args run -
branches/eam_branches/ipp-20100823/ippTasks/dist.pro
r28778 r29124 30 30 list DIST_STAGE -add "chip_bg" 31 31 list DIST_STAGE -add "warp_bg" 32 list DIST_STAGE -add "sky" 32 33 33 34 $currentStage = 0 -
branches/eam_branches/ipp-20100823/ippToPsps/perl/checkOdmStatus.pl
r28954 r29124 10 10 use ippToPsps::IppToPspsDb; 11 11 use ippToPsps::Datastore; 12 use ippToPsps::BatchManager; 12 13 13 14 my $singleBatch = undef; … … 17 18 my $toTime = undef; 18 19 my $product = undef; 20 my $filePath = undef; 19 21 20 22 … … 24 26 'to|t=s' => \$toTime, 25 27 'product|p=s' => \$product, 28 'location|l=s' => \$filePath, 26 29 'verbose|v' => \$verbose, 27 30 'save_temps|s' => \$save_temps … … 32 35 } 33 36 if (!defined $singleBatch) { 34 print "* OPTIONAL: a single batch -b (default = none)\n";37 print "* OPTIONAL: a single batch -b <batchNum> (default = none)\n"; 35 38 } 36 39 if (!defined $fromTime) { 37 40 $fromTime = "2010-01-01"; 38 print "* OPTIONAL: from time -f (default = $fromTime)\n";41 print "* OPTIONAL: from time -f <dateTime> (default = $fromTime)\n"; 39 42 } 40 43 if (!defined $toTime) { 41 44 $toTime = "2099-12-31"; 42 print "* OPTIONAL: to time -t (default = $toTime)\n"; 45 print "* OPTIONAL: to time -t <dateTime> (default = $toTime)\n"; 46 } 47 if (!defined $filePath) { 48 print "* OPTIONAL: location for files to be deleted -l <path>\n"; 43 49 } 44 50 if (!defined $verbose) { … … 54 60 my $datastore = new ippToPsps::Datastore($product, 0, 0); 55 61 my $ippToPspsDb = new ippToPsps::IppToPspsDb("ippToPsps", "ippdb01", "ipp", "ipp", $verbose, $save_temps); 62 my $batchManager = new ippToPsps::BatchManager($ippToPspsDb, $filePath, $verbose, $save_temps); 56 63 my $odmUrl = "http://web01.psps.ifa.hawaii.edu/a01/OdmWebService/OdmWebService.asmx/GetBatchStatus"; 57 64 my $ua = LWP::UserAgent->new; … … 72 79 my $numOfBatches; 73 80 74 if (defined $singleBatch ) { $numOfBatches = $ippToPspsDb->get SingleBatch($singleBatch, \$batches);}75 else { $numOfBatches = $ippToPspsDb->getBatch List(\$batches, $fromTime, $toTime);}81 if (defined $singleBatch ) { $numOfBatches = $ippToPspsDb->getBatch($singleBatch, \$batches);} 82 else { $numOfBatches = $ippToPspsDb->getBatches(\$batches, $fromTime, $toTime);} 76 83 77 84 if ($numOfBatches < 1) {return 0;} … … 84 91 # loop round batches 85 92 my $batch; 93 my $numBatchesToCheck = 0; 86 94 my $numChecked = 0; 95 my $numRemovedFromDatastore = 0; 96 my $numDeleted = 0; 87 97 foreach $batch ( @{$batches} ) { 88 my ($timestamp, $expId, $batchId, $surveyType, $deleted) = @{$batch}; 89 90 if (checkBatch($timestamp, $expId, $batchId, $surveyType, $deleted)) {$numChecked++;} 91 98 my ($timestamp, $expId, $batchId, $surveyType, $deleted, $dvoDb, $processed, $onDatastore, $loadedToOdm, $mergeWorthy, $merged) = @{$batch}; 99 100 if (!$processed) {next;} 101 102 $numBatchesToCheck++; 103 104 my $batchName = $batchManager->getBatchName($batchId); 105 106 # if not merged then update by polling ODM for status 107 if (!$merged) { 108 109 if (checkODM($batchName, \$loadedToOdm, \$mergeWorthy, \$merged)) {$numChecked++;} 110 } 111 112 # delete from datastore 113 if (defined $product && !$deleted && $loadedToOdm && $mergeWorthy) { 114 115 $deleted = $datastore->remove($batchName); 116 if ($deleted) { 117 $ippToPspsDb->setBatchAsDeleted($batchId, $expId); 118 $numRemovedFromDatastore++; 119 } 120 } 121 # if merged and already removed from datastore then delete files 122 if (defined $filePath && $merged && $deleted) { 123 124 if($batchManager->deleteBatch($batchId)) {$numDeleted++;} 125 } 126 127 # update database 128 $ippToPspsDb->updateODMStatus($batchId, $expId, $loadedToOdm, $mergeWorthy, $merged, $deleted); 129 printf( "| %18s | %11s | %10d | %6s | %6s | %6s | %5s |\n", 130 $timestamp, 131 $batchName, 132 $expId, 133 $loadedToOdm ? "yes" : "no", 134 $mergeWorthy ? "yes" : "no", 135 $merged ? "yes" : "no", 136 $deleted ? "yes" : "no"); 92 137 } 138 93 139 printf("+----------------------+--------------+--------------+----------------+---------------+---------+----------+\n"); 94 140 95 printf( "* Successfully checked %d batch%s out of %d\n", $numChecked, ($numChecked==1) ? "" : "es", $numOfBatches); 96 97 } 98 99 ######################################################################################y 141 printf( "* Successfully checked %d batch%s out of %d\n", $numChecked, ($numChecked==1) ? "" : "es", $numBatchesToCheck); 142 printf( "* Successfully removed %d batch%s from the datastore\n", $numRemovedFromDatastore, ($numRemovedFromDatastore==1) ? "" : "es"); 143 printf( "* Successfully deleted %d batch%s from local file system\n", $numDeleted, ($numDeleted==1) ? "" : "es"); 144 145 } 146 147 ######################################################################################## 100 148 # 101 149 # Check a single batch 102 150 # 103 151 ######################################################################################## 104 sub checkBatch { 105 my ($timestamp, $expId, $batchId, $surveyType, $deleted) = @_; 106 107 108 my $batchFilter = sprintf("B%08d", $batchId); 152 sub checkODM { 153 my ($batchName, $loadedToOdm, $mergeWorthy, $merged) = @_; 154 109 155 my $statusFilter = "*"; 110 156 111 157 my $response = $ua->post($odmUrl, 112 [batchNameFilter => $batchFilter,158 [batchNameFilter => "%".$batchName, 113 159 statusFilter => $statusFilter, 114 160 fromFilter => "2010-01-01", … … 119 165 if ($response->code != 200) { 120 166 121 print "Problem connecting to web service for '$batch Filter', HTTP response status: ".$response->status_line."\n";122 return ;167 print "Problem connecting to web service for '$batchName', HTTP response status: ".$response->status_line."\n"; 168 return 0; 123 169 } 124 170 # print( "HTTP response status: ".$response->content."\n" ); … … 128 174 close($tempFile); 129 175 130 my $loadedToOdm = 0; 131 my $mergeWorthy = 0; 132 my $mergeCompleted = 0; 133 134 parseXml($tempName, \$loadedToOdm, \$mergeWorthy, \$mergeCompleted); 135 136 # delete from datastore 137 if(defined $product) { 138 139 if (!$deleted && $loadedToOdm && $mergeWorthy) { 140 141 $deleted = $datastore->remove($batchFilter); 142 if ($deleted) { 143 $ippToPspsDb->setBatchAsDeleted($batchId, $expId); 144 } 145 } 146 } 147 148 printf( "| %18s | %11s | %10d | %6s | %6s | %6s | %5s |\n", 149 $timestamp, 150 $batchFilter, 151 $expId, 152 $loadedToOdm ? "yes" : "no", 153 $mergeWorthy ? "yes" : "no", 154 $mergeCompleted ? "yes" : "no", 155 $deleted ? "yes" : "no"); 156 157 $ippToPspsDb->updateODMStatus($batchId, $expId, $loadedToOdm, $mergeWorthy, $mergeCompleted, $deleted); 158 176 ${$loadedToOdm} = 0; 177 ${$mergeWorthy} = 0; 178 ${$merged} = 0; 179 180 parseXml($tempName, $loadedToOdm, $mergeWorthy, $merged); 181 182 return 1; 159 183 } 160 184 … … 165 189 ######################################################################################## 166 190 sub parseXml { 167 my ($xmlFile, $loadedToOdm, $mergeWorthy, $merge Completed) = @_;191 my ($xmlFile, $loadedToOdm, $mergeWorthy, $merged) = @_; 168 192 169 193 my $parser = XML::LibXML->new; … … 174 198 ${$loadedToOdm} = 0; 175 199 ${$mergeWorthy} = 0; 176 ${$merge Completed} = 0;200 ${$merged} = 0; 177 201 178 202 if ($result =~ m/LoadStarted/) { ${$loadedToOdm} = 1;} 179 203 if ($result =~ m/MergeWorthy/) { ${$loadedToOdm} = 1; ${$mergeWorthy} = 1;} 180 if ($result =~ m/Merge[1-9]Completed/) { ${$loadedToOdm} = 1; ${$mergeWorthy} = 1; ${$merge Completed} = 1;}181 } 182 204 if ($result =~ m/Merge[1-9]Completed/) { ${$loadedToOdm} = 1; ${$mergeWorthy} = 1; ${$merged} = 1;} 205 } 206 -
branches/eam_branches/ipp-20100823/ippToPsps/perl/ippToPsps/IppToPspsDb.pm
r28952 r29124 15 15 # 16 16 ########################################################################### 17 sub getBatch List{18 my ($self, $ exposures, $fromTime, $toTime) = @_;19 20 my $query = $self->{_db}->prepare(<<SQL); 21 SELECT created, exp_id, batch_id, survey_id, deleted 17 sub getBatches { 18 my ($self, $batches, $fromTime, $toTime) = @_; 19 20 my $query = $self->{_db}->prepare(<<SQL); 21 SELECT created, exp_id, batch_id, survey_id, deleted, dvo_db, processed, on_datastore, loaded_to_ODM, merge_worthy, merged 22 22 FROM batches 23 WHERE processed = 1 24 AND on_datastore = 1 25 AND created >= '$fromTime' 23 WHERE created >= '$fromTime' 26 24 AND created <= '$toTime'; 27 25 SQL … … 29 27 # TODO remove date restriction 30 28 $query->execute; 31 ${$ exposures} = $query->fetchall_arrayref();32 my $count = scalar @{${$ exposures}};29 ${$batches} = $query->fetchall_arrayref(); 30 my $count = scalar @{${$batches}}; 33 31 34 32 printf( "* Found %d batch%s\n", $count, ($count==1) ? "" : "es"); … … 41 39 # 42 40 ########################################################################### 43 sub get SingleBatch{44 my ($self, $batch_id, $ exposures) = @_;45 46 my $query = $self->{_db}->prepare(<<SQL); 47 SELECT created, exp_id, batch_id, survey_id, deleted 41 sub getBatch{ 42 my ($self, $batch_id, $batches) = @_; 43 44 my $query = $self->{_db}->prepare(<<SQL); 45 SELECT created, exp_id, batch_id, survey_id, deleted, dvo_db, processed, on_datastore, loaded_to_ODM, merge_worthy, merged 48 46 FROM batches 49 47 WHERE batch_id = $batch_id 50 AND processed = 151 AND on_datastore = 1;52 48 SQL 53 49 54 50 $query->execute; 55 ${$ exposures} = $query->fetchall_arrayref();56 my $count = scalar @{${$ exposures}};51 ${$batches} = $query->fetchall_arrayref(); 52 my $count = scalar @{${$batches}}; 57 53 58 54 printf( "* Found %d batch%s\n", $count, ($count==1) ? "" : "es"); … … 149 145 150 146 my $processed = $query->fetchrow_array(); 151 152 if ($processed) {print "* Exposure ID '$expId' has already been processed\n";}153 147 154 148 return $processed; … … 424 418 return $row[0]; 425 419 } 420 421 sub insetDetection { 422 my ($self, $expId, $imageID, $objID,$ippObjID, $ippDetectID) = @_; 423 424 my $query = $self->{_db}->prepare(<<SQL); 425 INSERT INTO detections 426 (expId, imageID, objID, ippObjID, ippDetectID) 427 VALUES 428 ($expId, $imageID, $objID,$ippObjID, $ippDetectID); 429 SQL 430 431 $query->execute; 432 433 } 434 426 435 1 -
branches/eam_branches/ipp-20100823/ippToPsps/perl/ippToPsps_run.pl
r28907 r29124 17 17 18 18 # globals 19 my $camera = 'GPC1';19 my $camera = undef; 20 20 my $batchType = undef; 21 21 my $dvoLocation = undef; … … 33 33 # get user args 34 34 GetOptions( 35 'camera|c' => \$camera, 35 36 'output|o=s' => \$output, 36 37 'batch|b=s' => \$batchType, … … 63 64 print "* REQUIRED: need to provide a DVO Db -d <pathToDVO>\n"; 64 65 } 66 if (!defined $camera) { 67 $camera = "GPC1"; 68 print "* OPTIONAL: select a camera -c (default = $camera)\n"; 69 } 65 70 if (!defined $singleExpId) { 66 71 … … 175 180 if (!$initBatch && $ippToPspsDb->isExposureAlreadyProcessed($expId)) { 176 181 177 if ($force) {print "* Forcing....\n";} 178 else {next}; 182 if ($force) {print "* Already processed '$expId', but forcing....\n";} 183 else { 184 185 print "* Exposure ID '$expId' has already been processed\n"; 186 next 187 }; 179 188 } 180 189 -
branches/eam_branches/ipp-20100823/ippToPsps/src/ippToPspsBatchDetection.c
r28992 r29124 305 305 numInvalidFlux++; 306 306 } 307 308 // store max/min objID 309 if (objID[s] > maxObjID) maxObjID = objID[s]; 310 if (objID[s] < minObjID) minObjID = objID[s]; 311 307 else { 308 309 // store max/min objID 310 if (objID[s] > maxObjID) maxObjID = objID[s]; 311 if (objID[s] < minObjID) minObjID = objID[s]; 312 } 312 313 totalDetections++; 313 314 } -
branches/eam_branches/ipp-20100823/ippTools/configure.ac
r28486 r29124 19 19 PKG_CHECK_MODULES([PSMODULES], [psmodules >= 1.1.0]) 20 20 PKG_CHECK_MODULES([IPPDB], [ippdb >= 1.1.63]) 21 PKG_CHECK_MODULES([PPSTAMP], [ ippdb >= 1.1.63])21 PKG_CHECK_MODULES([PPSTAMP], [ppstamp >= 0.1.1]) 22 22 23 23 PXTOOLS_CFLAGS="${PSLIB_CFLAGS=} ${PSMODULES_CFLAGS=} ${PPSTAMP_CFLAGS=} ${IPPDB_CFLAGS=}" -
branches/eam_branches/ipp-20100823/ippTools/share/magicdstool_tocleanup.sql
r25837 r29124 1 1 SELECT 2 2 magic_ds_id, 3 stage, 3 4 magicDSRun.state, 4 5 magicDSRun.outroot, … … 9 10 WHERE magicDSRun.state = 'goto_cleaned' 10 11 -- XXX: need to add fault to magicDSRun 12 -- XXX: the database has been updated, but fault isn't yet used 11 13 -- AND magicDSRun.fault = 0 12 14 -
branches/eam_branches/ipp-20100823/ippTools/src/disttool.c
r28959 r29124 519 519 PXOPT_COPY_STR(config->args, where, "-stage", "stage", "==");; 520 520 PXOPT_COPY_STR(config->args, where, "-state", "distRun.state", "=="); 521 PXOPT_COPY_STR(config->args, where, "-label", "label", " ==");521 PXOPT_COPY_STR(config->args, where, "-label", "label", "LIKE"); 522 522 PXOPT_COPY_STR(config->args, where, "-data_group", "distRun.data_group", "LIKE"); 523 523 PXOPT_COPY_STR(config->args, where, "-dist_group", "distTarget.dist_group", "=="); -
branches/eam_branches/ipp-20100823/ippTools/src/disttoolConfig.c
r28938 r29124 76 76 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-stage", 0, "value for stage", NULL); 77 77 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-state", 0, "value for state", NULL); 78 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-label", 0, "limit updates to label ", NULL);79 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-data_group", 0, "limit updates to data_group ", NULL);78 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-label", 0, "limit updates to label (LIKE comparison)", NULL); 79 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-data_group", 0, "limit updates to data_group (LIKE comparison)", NULL); 80 80 psMetadataAddStr(updaterunArgs, PS_LIST_TAIL, "-dist_group", 0, "limit updates to data_group", NULL); 81 81 psMetadataAddTime(updaterunArgs, PS_LIST_TAIL, "-time_stamp_begin", 0, "limit updates by time_stamp (>=)", NULL); -
branches/eam_branches/ipp-20100823/ippTools/src/staticskytool.c
r28959 r29124 290 290 workdir, 291 291 label, 292 data_group ,292 data_group ? data_group : label, 293 293 dist_group, 294 294 reduction, -
branches/eam_branches/ipp-20100823/ippconfig/recipes/fitstypes.mdc
r27417 r29124 107 107 BSCALE F32 0.1 # Disk is stored as 1/10th sec 108 108 BZERO F32 3276.8 # Store unsigned zero as zero 109 # switch to NONE to work around ticket 1411 110 #COMPRESSION STR NONE 109 111 COMPRESSION STR GZIP 110 112 TILE.X S32 0 -
branches/eam_branches/ipp-20100823/ippconfig/recipes/nightly_science.config
r28982 r29124 39 39 40 40 UNRECOVERABLE_QUALITY MULTI 41 UNRECOVERABLE_QUALITY S16 042 41 UNRECOVERABLE_QUALITY S16 4007 43 42 -
branches/eam_branches/ipp-20100823/ippconfig/recipes/ppSub.config
r29005 r29124 59 59 INNER S32 5 # Inner half-size for SPAM and FRIES kernels 60 60 RINGS.ORDER S32 2 # Polynomial order for RINGS kernels 61 PENALTY F32 1 .0 # Penalty for wideness61 PENALTY F32 16.0 # Penalty for wideness 62 62 BIN1 S32 4 # Binning factor for first level 63 63 BIN2 S32 4 # Binning factor for second level -
branches/eam_branches/ipp-20100823/ippconfig/recipes/psphot.config
r29005 r29124 188 188 #PGAUSS_PSF EXTENDED_SOURCE_MODEL PS_MODEL_PGAUSS 20.0 TRUE 189 189 #QGAUSS_PSF EXTENDED_SOURCE_MODEL PS_MODEL_QGAUSS 20.0 TRUE 190 SERSIC_PSF EXTENDED_SOURCE_MODEL PS_MODEL_SERSIC 20.0 TRUE 190 EXP_PCM EXTENDED_SOURCE_MODEL PS_MODEL_EXP 20.0 TRUE 191 DEV_PCM EXTENDED_SOURCE_MODEL PS_MODEL_DEV 20.0 TRUE 192 SER_PCM EXTENDED_SOURCE_MODEL PS_MODEL_SERSIC 20.0 TRUE 191 193 END 192 194 … … 325 327 # Extended source fit parameters 326 328 STACKPHOT METADATA 329 EXTENDED_SOURCE_FITS BOOL TRUE # perform any of the aperture-like measurements? 327 330 EXTENDED_SOURCE_ANALYSIS BOOL TRUE # perform any of the aperture-like measurements? 328 331 EXTENDED_SOURCE_SN_LIM F32 20.0 329 332 EXTENDED_SOURCE_PETROSIAN BOOL TRUE 330 EXTENDED_SOURCE_ISOPHOTAL BOOL FALSE331 333 EXTENDED_SOURCE_ANNULI BOOL TRUE 332 EXTENDED_SOURCE_KRON BOOL FALSE333 334 PSPHOT.STACK.MATCH.PSF.SOURCE STR AUTO # which inputs to convolve? (RAW, CNV, AUTO) 334 335 PSPHOT.STACK.TARGET.PSF.AUTO BOOL F # automatically determine target PSF size? … … 337 338 RADIAL_APERTURES_SN_LIM F32 0.0 # S/N limit for radial aperture calculation 338 339 OUTPUT.FORMAT STR PS1_SV1 340 341 EXT_FIT_MAX_RADIUS F32 50.0 342 PSF_MODEL STR PS_MODEL_GAUSS 343 EXT_MODEL STR PS_MODEL_SERSIC 339 344 END 340 345 -
branches/eam_branches/ipp-20100823/psLib/src/math/psUnaryOp.c
r26892 r29124 63 63 64 64 // Conversion for degrees to radians 65 #define D2R 0.01745329252111111 /* PI/180 */66 65 // #define D2R 0.01745329252111111 /* PI/180 */ 66 #define D2R 0.01745329251994329 /* PI/180 Corrected. Truncated digits: 576924 */ 67 67 // Conversion for radians to degrees 68 #define R2D 57.29577950924861 /* 180.0/PI */69 68 // #define R2D 57.29577950924861 /* 180.0/PI */ 69 #define R2D 57.29577951308232 /* 180.0/PI Correcte. Truncated digits: 087679 */ 70 70 71 71 // Unary SCALAR operations -
branches/eam_branches/ipp-20100823/psModules/src/imcombine/pmSubtractionStamps.c
r29004 r29124 830 830 } 831 831 832 #if 1832 #if 0 833 833 { 834 834 psFits *fits = NULL; -
branches/eam_branches/ipp-20100823/psModules/src/objects/models/pmModel_SERSIC.c
r29004 r29124 252 252 float Rminor = Rmajor * (axes.minor / axes.major); 253 253 254 fprintf (stderr, "guess index: %f : %f, %f -> %f, %f\n", index, axes.major, axes.minor, Rmajor, Rminor);254 // fprintf (stderr, "guess index: %f : %f, %f -> %f, %f\n", index, axes.major, axes.minor, Rmajor, Rminor); 255 255 256 256 axes.major = Rmajor; … … 346 346 psF64 radius = axes.major * sqrt (2.0) * pow(zn, 0.5 / PAR[PM_PAR_7]); 347 347 348 fprintf (stderr, "sersic model %f %f, n %f, radius: %f, zn: %f, f/Io: %f, major: %f\n", PAR[PM_PAR_XPOS], PAR[PM_PAR_YPOS], PAR[PM_PAR_7], radius, zn, flux/PAR[PM_PAR_I0], axes.major);348 // fprintf (stderr, "sersic model %f %f, n %f, radius: %f, zn: %f, f/Io: %f, major: %f\n", PAR[PM_PAR_XPOS], PAR[PM_PAR_YPOS], PAR[PM_PAR_7], radius, zn, flux/PAR[PM_PAR_I0], axes.major); 349 349 350 350 psAssert (isfinite(radius), "fix this code: z should not be nan for %f", PAR[PM_PAR_7]); -
branches/eam_branches/ipp-20100823/psModules/src/objects/pmSourceIO_CMF_PS1_DV2.c
r29004 r29124 186 186 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_FLUX_SIG",PS_DATA_F32, "Sigma of PSF instrumental magnitude", source->psfFluxErr); 187 187 psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG", PS_DATA_F32, "magnitude in standard aperture", source->apMag); 188 // XXX replace with AP_FLUX (& ERR)? psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG", PS_DATA_F32, "magnitude in standard aperture", source->apMag); 189 188 190 psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG_RADIUS", PS_DATA_F32, "radius used for aperture mags", apRadius); 189 191 psMetadataAdd (row, PS_LIST_TAIL, "PEAK_FLUX_AS_MAG", PS_DATA_F32, "Peak flux expressed as magnitude", peakMag); … … 214 216 psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_XY", PS_DATA_F32, "second moments (X*Y)", mxy); 215 217 psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_YY", PS_DATA_F32, "second moments (Y*Y)", myy); 218 219 float Mrf = source->moments ? source->moments->Mrf : NAN; 220 float Mrh = source->moments ? source->moments->Mrh : NAN; 221 float Krf = source->moments ? source->moments->KronFlux : NAN; 222 float dKrf = source->moments ? source->moments->KronFluxErr : NAN; 223 224 float Kinner = source->moments ? source->moments->KronFinner : NAN; 225 float Kouter = source->moments ? source->moments->KronFouter : NAN; 226 227 psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_R1", PS_DATA_F32, "first radial moment", Mrf); 228 psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_RH", PS_DATA_F32, "half radial moment", Mrh); 229 psMetadataAdd (row, PS_LIST_TAIL, "KRON_FLUX", PS_DATA_F32, "Kron Flux (in 2.5 R1)", Krf); 230 psMetadataAdd (row, PS_LIST_TAIL, "KRON_FLUX_ERR", PS_DATA_F32, "Kron Flux Error", dKrf); 231 232 psMetadataAdd (row, PS_LIST_TAIL, "KRON_FLUX_INNER", PS_DATA_F32, "Kron Flux (in 1.0 R1)", Kinner); 233 psMetadataAdd (row, PS_LIST_TAIL, "KRON_FLUX_OUTER", PS_DATA_F32, "Kron Flux (in 4.0 R1)", Kouter); 216 234 217 235 psMetadataAdd (row, PS_LIST_TAIL, "DIFF_NPOS", PS_DATA_S32, "nPos (n pix > 3 sigma)", diffStats.nGood); -
branches/eam_branches/ipp-20100823/psModules/src/objects/pmSourceIO_CMF_PS1_SV1.c
r29004 r29124 198 198 psMetadataAdd (row, PS_LIST_TAIL, "PSF_INST_FLUX_SIG",PS_DATA_F32, "Sigma of PSF instrumental flux", source->psfFluxErr); 199 199 psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG", PS_DATA_F32, "magnitude in standard aperture", source->apMag); 200 psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG_RAW", PS_DATA_F32, "magnitude in reported aperture", source->apMagRaw); 200 201 psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG_RADIUS", PS_DATA_F32, "radius used for aperture mags", apRadius); 201 202 psMetadataAdd (row, PS_LIST_TAIL, "PEAK_FLUX_AS_MAG", PS_DATA_F32, "Peak flux expressed as magnitude", peakMag); -
branches/eam_branches/ipp-20100823/psModules/src/objects/pmSourceIO_CMF_PS1_V3.c
r29012 r29124 179 179 psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG_RAW", PS_DATA_F32, "magnitude in reported aperture", source->apMagRaw); 180 180 psMetadataAdd (row, PS_LIST_TAIL, "AP_MAG_RADIUS", PS_DATA_F32, "radius used for aperture mags", apRadius); 181 // XXX need ap_mag error 181 182 psMetadataAdd (row, PS_LIST_TAIL, "PEAK_FLUX_AS_MAG", PS_DATA_F32, "Peak flux expressed as magnitude", peakMag); 182 183 psMetadataAdd (row, PS_LIST_TAIL, "CAL_PSF_MAG", PS_DATA_F32, "PSF Magnitude using supplied calibration", calMag); … … 204 205 float Myy = source->moments ? source->moments->Myy : NAN; 205 206 207 psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_XX", PS_DATA_F32, "second moments (X^2)", Mxx); 208 psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_XY", PS_DATA_F32, "second moments (X*Y)", Mxy); 209 psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_YY", PS_DATA_F32, "second moments (Y*Y)", Myy); 210 211 float M_c3 = source->moments ? 1.0*source->moments->Mxxx - 3.0*source->moments->Mxyy : NAN; 212 float M_s3 = source->moments ? 3.0*source->moments->Mxxy - 1.0*source->moments->Myyy : NAN; 213 float M_c4 = source->moments ? 1.0*source->moments->Mxxxx - 6.0*source->moments->Mxxyy + 1.0*source->moments->Myyyy : NAN; 214 float M_s4 = source->moments ? 4.0*source->moments->Mxxxy - 4.0*source->moments->Mxyyy : NAN; 215 216 psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_M3C", PS_DATA_F32, "third momemt cos theta", M_c3); 217 psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_M3S", PS_DATA_F32, "third momemt sin theta", M_s3); 218 psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_M4C", PS_DATA_F32, "fourth momemt cos theta", M_c4); 219 psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_M4S", PS_DATA_F32, "fourth momemt sin theta", M_s4); 220 206 221 float Mrf = source->moments ? source->moments->Mrf : NAN; 207 222 float Mrh = source->moments ? source->moments->Mrh : NAN; … … 211 226 float Kinner = source->moments ? source->moments->KronFinner : NAN; 212 227 float Kouter = source->moments ? source->moments->KronFouter : NAN; 213 214 float M_c3 = source->moments ? 1.0*source->moments->Mxxx - 3.0*source->moments->Mxyy : NAN;215 float M_s3 = source->moments ? 3.0*source->moments->Mxxy - 1.0*source->moments->Myyy : NAN;216 float M_c4 = source->moments ? 1.0*source->moments->Mxxxx - 6.0*source->moments->Mxxyy + 1.0*source->moments->Myyyy : NAN;217 float M_s4 = source->moments ? 4.0*source->moments->Mxxxy - 4.0*source->moments->Mxyyy : NAN;218 219 psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_XX", PS_DATA_F32, "second moments (X^2)", Mxx);220 psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_XY", PS_DATA_F32, "second moments (X*Y)", Mxy);221 psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_YY", PS_DATA_F32, "second moments (Y*Y)", Myy);222 223 psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_M3C", PS_DATA_F32, "third momemt cos theta", M_c3);224 psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_M3S", PS_DATA_F32, "third momemt sin theta", M_s3);225 psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_M4C", PS_DATA_F32, "fourth momemt cos theta", M_c4);226 psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_M4S", PS_DATA_F32, "fourth momemt sin theta", M_s4);227 228 228 229 psMetadataAdd (row, PS_LIST_TAIL, "MOMENTS_R1", PS_DATA_F32, "first radial moment", Mrf); -
branches/eam_branches/ipp-20100823/psModules/src/objects/pmSourceMoments.c
r29004 r29124 77 77 // well: 78 78 psF32 sky = 0.0; 79 if (source->moments == NULL) { 80 source->moments = pmMomentsAlloc(); 81 } 79 82 // XXX if (source->moments == NULL) { 80 83 // XXX source->moments = pmMomentsAlloc(); -
branches/eam_branches/ipp-20100823/psModules/src/objects/pmSourcePhotometry.c
r29004 r29124 148 148 149 149 // for PSFs, correct both apMag and psfMag to same system, consistent with infinite flux star in aperture RADIUS 150 // XXX add a flag for "ap_mag is corrected?" 150 151 if ((mode & PM_SOURCE_PHOT_APCORR) && isPSF && psf && psf->ApTrend) { 151 152 // the source peak pixel is guaranteed to be on the image, and only minimally different from the source center … … 292 293 293 294 // measure apMag 295 // XXX save the apFlux and apFluxErr 296 // XXX note that these fluxes/mags are uncorrected for masked pixels 297 // XXX raise a bit if the aperture has a masked pixel (not marked)? 294 298 for (int iy = 0; iy < image->numRows; iy++) { 295 299 for (int ix = 0; ix < image->numCols; ix++) { -
branches/eam_branches/ipp-20100823/psconfig/tagsets/ipp-2.9.perl
r27951 r29124 92 92 80 Abstract::Meta::Class Abstract-Meta-Class-0.13.tar.gz 0 NONE NONE 93 93 81 DBIx::Connection DBIx-Connection-0.13.tar.gz 0 NONE NONE 94 82a Test::Pod Test-Pod-1.40.tar.gz 0 NONE NONE 95 82c XML::NamespaceSupport XML-NamespaceSupport-1.10.tar.gz 0 --skip NONE 96 82b XML::SAX XML-SAX-0.96.tar.gz 0 NONE Y 97 82d Simple::SAX::Serializer Simple-SAX-Serializer-0.05.tar.gz 0 NONE NONE 94 82a Pod::Escapes Pod-Escapes-1.04.tar.gz 0 NONE NONE 95 82b Pod::Simple Pod-Simple-3.14.tar.gz 0 NONE NONE 96 82c Test::Pod Test-Pod-1.40.tar.gz 0 NONE NONE 97 82d XML::NamespaceSupport XML-NamespaceSupport-1.10.tar.gz 0 --skip NONE 98 82e XML::SAX XML-SAX-0.96.tar.gz 0 NONE Y 99 82f Simple::SAX::Serializer Simple-SAX-Serializer-0.05.tar.gz 0 NONE NONE 98 100 83 Test::Distribution Test-Distribution-2.00.tar.gz 0 NONE NONE 99 101 84 Test::DBUnit Test-DBUnit-0.20.tar.gz 0.20 NONE NONE -
branches/eam_branches/ipp-20100823/psphot/doc/notes.20100715.txt
r29004 r29124 1 2 2010.08.24 3 4 Remaining work to be done: 5 6 * test and turn on CR masking 7 * double-check source size analysis: 8 * are we doing the right thing with sources flagged as bad in 'rough'? 9 * are we doing the right thing for SAT, CR, EXT, PSF after SourceSize? 10 * convert CR_SIGMA and EXT_SIGMA to probabilities 11 * example results of model fits vs fake inputs 12 * what is the right solution for the stack PSF photometry? 13 * Nigel sees 4-6% 14 * we see 1.9% at the worst 15 * non-poisson errors are clearly better -- check on the chisq values 16 * why is QGAUSS so good for the one example (better for poisson, if trendy) 1 17 2 18 2010.08.12 -
branches/eam_branches/ipp-20100823/psphot/src/psphotBlendFit.c
r29004 r29124 66 66 67 67 float fitMinTol = psMetadataLookupF32 (&status, recipe, "EXT_FIT_MIN_TOL"); // Fit tolerance 68 assert (status && isfinite(fitMinTol) && fitMinTol > 0); 68 if (!status || !isfinite(fitMinTol) || fitMinTol <= 0) { 69 fitMinTol = psMetadataLookupF32 (&status, recipe, "PSF_FIT_TOL"); // Fit tolerance 70 if (!status || !isfinite(fitMinTol) || fitMinTol <= 0) { 71 psAbort("PSF_FIT_MIN_TOL (and PSF_FIT_TOL) not defined or positive"); 72 } 73 } 69 74 70 75 float fitMaxTol = psMetadataLookupF32 (&status, recipe, "EXT_FIT_MAX_TOL"); // Fit tolerance 71 assert (status && isfinite(fitMaxTol) && fitMaxTol > 0); 76 if (!status || !isfinite(fitMaxTol) || fitMaxTol <= 0) { 77 fitMaxTol = 1.0; 78 } 72 79 73 80 bool poisson = psMetadataLookupBool(&status, recipe, "POISSON.ERRORS.PHOT.LMM"); // Poisson errors? -
branches/eam_branches/ipp-20100823/psphot/src/psphotExtendedSourceAnalysis.c
r29004 r29124 121 121 if (source->peak->y > AnalysisRegion.y1) continue; 122 122 123 // fprintf (stderr, "xsrc: %f, %f : %f\n", source->peak->xf, source->peak->yf, source->peak->SN); 124 123 125 // replace object in image 124 126 if (source->tmpFlags & PM_SOURCE_TMPF_SUBTRACTED) { … … 178 180 } 179 181 182 // fprintf (stderr, "xsrc : tried %ld objects\n", sources->n); 183 180 184 return true; 181 185 } -
branches/eam_branches/ipp-20100823/psphot/src/psphotExtendedSourceFits.c
r29015 r29124 200 200 } 201 201 psFree(job); 202 }202 } 203 203 } 204 204 psFree (cellGroups); … … 270 270 // set the radius based on the footprint (also sets the mask pixels) 271 271 if (!psphotSetRadiusFootprint(&radius, readout, source, markVal, 1.0)) { 272 fprintf (stderr, "skipping (1) %f, %f\n", source->peak->xf, source->peak->yf); 272 273 psFree (fitOptions) 273 274 return false; … … 280 281 // XXX save the psf-based moments for output 281 282 if (!pmSourceMoments (source, radius, 0.0, 0.0, maskVal)) { 283 fprintf (stderr, "skipping (2) %f, %f\n", source->peak->xf, source->peak->yf); 282 284 // subtract the best fit from the object, leave local sky 283 285 pmSourceSub (source, PM_MODEL_OP_FULL, maskVal); … … 289 291 psImage *modelFluxStart = psMemIncrRefCounter (source->modelFlux); 290 292 if (!modelFluxStart) { 291 // XXX raise an error of some kind? 292 continue; 293 pmSourceCacheModel (source, maskVal); 294 modelFluxStart = psMemIncrRefCounter (source->modelFlux); 295 if (!modelFluxStart) { 296 fprintf (stderr, "skipping (3) %f, %f\n", source->peak->xf, source->peak->yf); 297 // XXX raise an error of some kind? 298 continue; 299 } 293 300 } 294 301 295 302 if (savePics) { 296 303 psphotSaveImage (NULL, readout->image, "image.xp.fits"); … … 317 324 float SNlim = psMetadataLookupF32 (&status, model, "SNLIM_VALUE"); 318 325 assert (status); 326 327 // fprintf (stderr, "xfit: %f, %f : %f\n", source->peak->xf, source->peak->yf, source->peak->SN); 319 328 320 329 // limit selection to some SN limit … … 449 458 psFree (fitOptions); 450 459 460 // fprintf (stderr, "xfit : tried %ld objects\n", sources->n); 461 451 462 // change the value of a scalar on the array (wrap this and put it in psArray.h) 452 463 scalar = job->args->data[7]; -
branches/eam_branches/ipp-20100823/psphot/src/psphotSourceFits.c
r29015 r29124 506 506 // psTraceSetLevel("psLib.math.psMinimizeLMChi2", 5); 507 507 pmSourceFitModel (source, model, &options, maskVal); 508 fprintf (stderr, "chisq: %f, nIter: %d, radius: %f, npix: %d\n\n", model->chisqNorm, model->nIter, model->fitRadius, model->nPix);508 // fprintf (stderr, "chisq: %f, nIter: %d, radius: %f, npix: %d\n\n", model->chisqNorm, model->nIter, model->fitRadius, model->nPix); 509 509 510 510 // psTraceSetLevel("psLib.math.psMinimizeLMChi2", 0); … … 570 570 // psTraceSetLevel("psLib.math.psMinimizeLMChi2", 5); 571 571 pmSourceFitPCM (pcm, source, &options, maskVal, markVal, psfSize); 572 fprintf (stderr, "chisq: %f, nIter: %d, radius: %f, npix: %d\n\n", model->chisqNorm, model->nIter, model->fitRadius, model->nPix);572 // fprintf (stderr, "chisq: %f, nIter: %d, radius: %f, npix: %d\n\n", model->chisqNorm, model->nIter, model->fitRadius, model->nPix); 573 573 574 574 // psTraceSetLevel("psLib.math.psMinimizeLMChi2", 0); … … 613 613 614 614 pmSourceFitModel (source, model, &options, maskVal); 615 fprintf (stderr, "chisq: %f, nIter: %d, radius: %f, npix: %d\n", model->chisqNorm, model->nIter, model->fitRadius, model->nPix);615 // fprintf (stderr, "chisq: %f, nIter: %d, radius: %f, npix: %d\n", model->chisqNorm, model->nIter, model->fitRadius, model->nPix); 616 616 617 617 chiSquare[i] = model->chisqNorm; … … 681 681 pmSourceFitPCM (pcm, source, &options, maskVal, markVal, psfSize); 682 682 # endif 683 fprintf (stderr, "chisq: %f, nIter: %d, radius: %f, npix: %d\n", model->chisqNorm, model->nIter, model->fitRadius, model->nPix);683 // fprintf (stderr, "chisq: %f, nIter: %d, radius: %f, npix: %d\n", model->chisqNorm, model->nIter, model->fitRadius, model->nPix); 684 684 685 685 chiSquare[i] = model->chisq; -
branches/eam_branches/ipp-20100823/psphot/src/psphotSourceSize.c
r29004 r29124 366 366 float nSigmaMYY = (Myy - psfClump->Y) / hypot(psfClump->dY, psfClump->Y*psfClump->Y*source->errMag); 367 367 368 fprintf (stderr, "%f %f : Mxx: %f, Myy: %f, dx: %f, dy: %f, psfMag: %f, apMag: %f, dMag: %f, errMag: %f, nSigmaMag: %f, nSigmaMxx: %f, nSigmaMyy: %f\n",369 source->peak->xf, source->peak->yf, Mxx, Myy, source->peak->xf - source->moments->Mx, source->peak->yf - source->moments->My,370 source->psfMag, apMag, dMag, source->errMag, nSigmaMAG, nSigmaMXX, nSigmaMYY);368 // fprintf (stderr, "%f %f : Mxx: %f, Myy: %f, dx: %f, dy: %f, psfMag: %f, apMag: %f, dMag: %f, errMag: %f, nSigmaMag: %f, nSigmaMxx: %f, nSigmaMyy: %f\n", 369 // source->peak->xf, source->peak->yf, Mxx, Myy, source->peak->xf - source->moments->Mx, source->peak->yf - source->moments->My, 370 // source->psfMag, apMag, dMag, source->errMag, nSigmaMAG, nSigmaMXX, nSigmaMYY); 371 371 372 372 // XXX double check on ths stuff!! partially-masked sources are more likely to be mis-measured PSFs -
branches/eam_branches/ipp-20100823/psphot/src/psphotStackMatchPSFs.c
r28013 r29124 106 106 rescaleData(readoutOut, config, options, index); 107 107 108 dumpImage(readoutOut, readoutSrc, index, "convolved");108 // dumpImage(readoutOut, readoutSrc, index, "convolved"); 109 109 110 110 return true; -
branches/eam_branches/ipp-20100823/psphot/src/psphotStackMatchPSFsUtils.c
r28013 r29124 346 346 if (!fake) goto escape; 347 347 348 dumpImage(fake, readoutSrc, index, "fake");349 dumpImage(readoutSrc, readoutSrc, index, "real");348 // dumpImage(fake, readoutSrc, index, "fake"); 349 // dumpImage(readoutSrc, readoutSrc, index, "real"); 350 350 351 351 if (threads) pmSubtractionThreadsInit(); … … 380 380 } 381 381 382 dumpImage(readoutOut, readoutSrc, index, "conv");383 dumpImageDiff(readoutOut, fake, readoutSrc, index, "diff");382 // dumpImage(readoutOut, readoutSrc, index, "conv"); 383 // dumpImageDiff(readoutOut, fake, readoutSrc, index, "diff"); 384 384 385 385 psFree(fake); -
branches/eam_branches/ipp-20100823/pstamp/scripts/Makefile.am
r28038 r29124 19 19 pstamp_webrequest.pl \ 20 20 pstamp_get_image_job.pl \ 21 psmkreq \ 21 22 pstamp_checkdependent.pl \ 22 23 request_finish.pl \ -
branches/eam_branches/ipp-20100823/pstamp/scripts/detectability_respond.pl
r28902 r29124 98 98 my $key = shift(@key_values); 99 99 my $val = shift(@key_values); 100 # if we have wisdom, then we should have updated already. If not, we'll bomb out later in the code. 101 if ($key eq 'FAULT') { 102 $val = 0; 103 } 100 104 $query{$fpa_id}{$key}[$i] = $val; 101 105 } … … 148 152 # Determine the query style for this fpa_id 149 153 if ($fpa_id =~ /o.*g.*o/) { 150 $query_style = 'byexp';151 }154 $query_style = 'byexp'; 155 } 152 156 elsif ($fpa_id =~ /\d+/) { 153 $query_style = 'byid';154 }157 $query_style = 'byid'; 158 } 155 159 else { 156 exit_with_failure(21,"Parse error in request file");157 }160 exit_with_failure(21,"Parse error in request file"); 161 } 158 162 # Confirm that we only have one stage/filter/mjd 159 163 for (my $i = 0; $i <= $#{ $query{$fpa_id}{STAGE} }; $i++) { 160 $temp_hash{STAGE}{$query{$fpa_id}{STAGE}[$i]} = 1;161 $temp_hash{FILTER}{$query{$fpa_id}{FILTER}[$i]} = 1;162 $temp_hash{'MJD-OBS'}{$query{$fpa_id}{'MJD-OBS'}[$i]} = 1;163 }164 $temp_hash{STAGE}{$query{$fpa_id}{STAGE}[$i]} = 1; 165 $temp_hash{FILTER}{$query{$fpa_id}{FILTER}[$i]} = 1; 166 $temp_hash{'MJD-OBS'}{$query{$fpa_id}{'MJD-OBS'}[$i]} = 1; 167 } 164 168 if (scalar(keys(%{ $temp_hash{STAGE} })) == 1) { 165 169 $stage = (keys(%{ $temp_hash{STAGE} }))[0]; 166 170 } 167 171 else { 168 exit_with_failure(21,"Too many STAGEs specified");169 }172 exit_with_failure(21,"Too many STAGEs specified"); 173 } 170 174 if (scalar(keys(%{ $temp_hash{FILTER} })) == 1) { 171 $filter = (keys(%{ $temp_hash{FILTER} }))[0];172 }175 $filter = (keys(%{ $temp_hash{FILTER} }))[0]; 176 } 173 177 else { 174 exit_with_failure(21,"Too many FILTERs specified");175 }178 exit_with_failure(21,"Too many FILTERs specified"); 179 } 176 180 if (scalar(keys(%{ $temp_hash{'MJD-OBS'} })) == 1) { 177 $mjd = (keys(%{ $temp_hash{'MJD-OBS'} }))[0];178 }181 $mjd = (keys(%{ $temp_hash{'MJD-OBS'} }))[0]; 182 } 179 183 else { 180 exit_with_failure(21,"Too many MJD-OBS specified");181 }184 exit_with_failure(21,"Too many MJD-OBS specified"); 185 } 182 186 # Set common request components 183 187 my $option_mask |= 1; … … 200 204 $rowList[$i]->{ID} = $query{$fpa_id}{ROWNUM}[$i]; 201 205 $rowList[$i]->{COORD_MASK} = 0; 206 # Set default values 207 $query{$fpa_id}{BAD_COMPONENT}[$i] = 1; 208 $query{$fpa_id}{IMAGE}[$i] = 'no_image'; 209 $query{$fpa_id}{MASK}[$i] = 'no_mask'; 210 $query{$fpa_id}{WEIGHT}[$i] = 'no_weight'; 211 $query{$fpa_id}{PSF}[$i] = 'no_psf'; 212 213 $query{$fpa_id}{STAGE_ID}[$i] = 'no_id'; 214 $query{$fpa_id}{IMAGE_DB}[$i] = 'no_imdb'; 215 $query{$fpa_id}{NEED_MAGIC}[$i] = 'no_magic'; 216 $query{$fpa_id}{MAGICKED}[$i] = 'no_magic'; 217 $query{$fpa_id}{CATALOG}[$i] = 'no_catalog'; 218 $query{$fpa_id}{COMPONENT_ID}[$i] = 'no_component'; 219 $query{$fpa_id}{CLASS_ID}[$i] = 'no_class'; 220 221 $query{$fpa_id}{STATE}[$i] = 'no_state'; 222 $query{$fpa_id}{DATA_STATE}[$i] = 'no_dstate'; 223 $query{$fpa_id}{FAULT}[$i] = 'no_fault'; 224 $query{$fpa_id}{BURNTOOL_STATE}[$i] = 'no_btstate'; 225 202 226 } 203 227 … … 217 241 $value = join ' ', @{ $this_image_ref->{$key} }; 218 242 } 243 219 244 # print "$this_image_ref $key $value\n"; 220 245 foreach my $valid_index (@{ $this_image_ref->{row_index} }) { … … 226 251 $query{$fpa_id}{IMAGE_DB}[$valid_index] = $this_image_ref->{imagedb}; 227 252 $query{$fpa_id}{NEED_MAGIC}[$valid_index] = $need_magic; 253 $query{$fpa_id}{BAD_COMPONENT}[$valid_index] = 0; 228 254 229 255 if (exists($this_image_ref->{astrom})) { … … 231 257 } 232 258 else { 233 $query{$fpa_id}{CATALOG}[$valid_index] = $this_image_ref->{cmf};234 }259 $query{$fpa_id}{CATALOG}[$valid_index] = $this_image_ref->{cmf}; 260 } 235 261 if (exists($this_image_ref->{class_id})) { 236 262 $query{$fpa_id}{COMPONENT_ID}[$valid_index] = $this_image_ref->{class_id}; … … 301 327 } 302 328 print WISDOM "\n"; 303 @{ $update_request{$query{$fpa_id}{IMAGE}[$i]}{$query{$fpa_id}{FAULT}[$i]} } = 304 ($query{$fpa_id}{STATE}[$i],$query{$fpa_id}{STAGE}[$i],$query{$fpa_id}{STAGE_ID}[$i], 305 $query{$fpa_id}{COMPONENT_ID}[$i],$query{$fpa_id}{NEED_MAGIC}[$i],$query{$fpa_id}{IMAGE_DB}[$i]); 306 push @{ $processing_request{$fpa_id}{$query{$fpa_id}{IMAGE}[$i]} }, $i; 329 if ($query{$fpa_id}{BAD_COMPONENT}[$i] == 0) { 330 @{ $update_request{$query{$fpa_id}{IMAGE}[$i]}{$query{$fpa_id}{FAULT}[$i]} } = 331 ($query{$fpa_id}{STATE}[$i],$query{$fpa_id}{STAGE}[$i],$query{$fpa_id}{STAGE_ID}[$i], 332 $query{$fpa_id}{COMPONENT_ID}[$i],$query{$fpa_id}{NEED_MAGIC}[$i],$query{$fpa_id}{IMAGE_DB}[$i]); 333 push @{ $processing_request{$fpa_id}{$query{$fpa_id}{IMAGE}[$i]} }, $i; 334 } 307 335 } 308 336 } … … 356 384 my $stage = $query{$fpa_id}{STAGE}[$index]; 357 385 # if there's a fault, then we can't process this image. 358 if ($fault != 0) { 386 if (($fault != 0)||($query{$fpa_id}{BAD_COMPONENT}[$index] == 1)) { 387 $query{$fpa_id}{PROC_ERROR}[$index] = 23; 388 389 $query{$fpa_id}{NPIX}[$index] = 0; 390 $query{$fpa_id}{QFACTOR}[$index] = 0.0; 391 $query{$fpa_id}{FLUX}[$index] = 0.0; 392 $query{$fpa_id}{FLUX_SIG}[$index] = 0.0; 393 359 394 next; 360 395 } … … 384 419 my ($r_ra,$r_dec,$trash,$r_x,$r_y,$r_chip) = split /\s+/, $line; 385 420 print $targetfile "$r_x $r_y\n"; 386 if (( $r_ra == $query{$fpa_id}{RA1_DEG}[$processing_request{$fpa_id}{$image}[$i]])&&387 ( $r_dec == $query{$fpa_id}{DEC1_DEG}[$processing_request{$fpa_id}{$image}[$i]])) {421 if ((abs($r_ra - $query{$fpa_id}{RA1_DEG}[$processing_request{$fpa_id}{$image}[$i]]) < 1e-8)&& 422 (abs($r_dec - $query{$fpa_id}{DEC1_DEG}[$processing_request{$fpa_id}{$image}[$i]]) < 1e-8)) { 388 423 $query{$fpa_id}{X_PXL}[$processing_request{$fpa_id}{$image}[$i]] = $r_x; 389 424 $query{$fpa_id}{Y_PXL}[$processing_request{$fpa_id}{$image}[$i]] = $r_y; … … 392 427 else { 393 428 $error_code = $PS_EXIT_PROG_ERROR; 394 my_die("Unable to match input RA/DEC with output RA/DEC: ($query{$fpa_id}{RA1_DEG}[$i],$query{$fpa_id}{DEC1_DEG}[$i]) -> ($r_ra,$r_dec) i.$error_code",429 my_die("Unable to match input RA/DEC with output RA/DEC: ($query{$fpa_id}{RA1_DEG}[$i],$query{$fpa_id}{DEC1_DEG}[$i]) -> ($r_ra,$r_dec) $error_code", 395 430 $query{$fpa_id}{QUERY_ID}[$index],$fpa_id,$query{$fpa_id}{'MJD-OBS'}[$index], 396 431 $query{$fpa_id}{FILTER}[$index],$query{$fpa_id}{OBSCODE}[$index],$query{$fpa_id}{STAGE}[$index], -
branches/eam_branches/ipp-20100823/pstamp/scripts/pstamp_checkdependent.pl
r28929 r29124 644 644 # if the input file is already magicked no need to queue destreaking for this chipRun 645 645 if ($need_magic and !$input_magicked) { 646 if ($dsRun_state eq 'cleaned') { 646 if (!defined($dsRun_state) or ($dsRun_state eq 'NULL')) { 647 print "No magicDSRun for chipRun $stage_id and magic is required\n"; 648 faultJobs('stop', undef, undef, $PSTAMP_NOT_DESTREAKED); 649 } elsif ($dsRun_state eq 'cleaned') { 647 650 my $command = "$magicdstool -updaterun -set_state new -stage $stage -stage_id $stage_id"; 648 651 $command .= " -set_label $rlabel" if $rlabel; … … 658 661 } 659 662 } elsif ($dsRun_state eq 'failed_revert') { 660 print "magicDSRun.state = $dsRun_state for chipRun $stage_id is in state failed_revert cannot update ";663 print "magicDSRun.state = $dsRun_state for chipRun $stage_id is in state failed_revert cannot update\n"; 661 664 faultJobs('stop', undef, undef, $PSTAMP_NOT_AVAILABLE); 662 665 } else { -
branches/eam_branches/ipp-20100823/pstamp/scripts/pstamp_webrequest.pl
r28106 r29124 4 4 # pstampwebrequest.pl: take a postage stamp request command line and process it 5 5 # 6 # The arguments are the command line parameters for the program ps tamprequest6 # The arguments are the command line parameters for the program psmkreq 7 7 # 8 8 # Unless the argument -list is provided the output is the request id for the resulting request … … 70 70 my $missing_tools; 71 71 72 my $ps tamprequest = can_run('pstamprequest') or (warn "Can't find pstamprequest" and $missing_tools = 1);72 my $psmkreq = can_run('psmkreq') or (warn "Can't find psmkreq" and $missing_tools = 1); 73 73 my $pstamptool = can_run('pstamptool') or (warn "Can't find pstamptool" and $missing_tools = 1); 74 74 my $pstampparse = can_run('pstampparse.pl') or (warn "Can't find pstampparse.pl" and $missing_tools = 1); 75 my $pstampparser_run = can_run('pstamp_parser_run.pl') or (warn "Can't find pstamp_parser_run.pl" and $missing_tools = 1);76 75 77 76 if ($missing_tools) { … … 96 95 my $request_file = "$datedir/$request_name.fits"; 97 96 { 98 my $command = "$pstamprequest -req_name $request_name -project $project $request_file @ARGV"; 99 $command .= " -$job_type" if $job_type; # default job_type is pstamp 97 my $command = "$psmkreq --req_name $request_name --output $request_file @ARGV"; 100 98 101 99 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = … … 103 101 unless ($success) { 104 102 print STDERR @$stderr_buf; 105 die("Unable to perform ps tamprequest: $error_code");103 die("Unable to perform psmkreq: $error_code"); 106 104 } 107 105 } -
branches/eam_branches/ipp-20100823/pstamp/web/request.php
r25322 r29124 16 16 // XXX This is just a prototype for testing purposes. 17 17 18 19 // XXX: change to include pstampconfig.php 20 21 // BEGIN Local configuration 22 23 $WORKDIR = "/data/ipp049.0/pstamp/work"; 24 $dsroot = "/data/ipp049.0/datastore/dsroot"; 25 $dbname = "ippRequestServer"; 26 $dbserver = "ipp049"; 27 28 $PSCONFDIR = "/data/ipp053.0/home/bills/psconfig"; 29 $PSCONFIG = "debug"; 30 $PSBINDIR = "$PSCONFDIR/$PSCONFIG.lin64/bin"; 31 32 // END Local configuration 18 require "pstamp.php"; 19 require "submitted.php"; 33 20 34 21 # this script sets up the environment to run IPP commands with current directory … … 55 42 $diff_checked = ""; 56 43 $list_checked = ""; 44 $getstatus_checked = ""; 57 45 $pstamp_checked = ""; 58 46 $get_checked = ""; … … 102 90 if ($rvar_project == "gpc1") { 103 91 $gpc1_selected = "selected"; 104 $require_class_id = 1;92 // $require_class_id = 1; 105 93 } else if ($rvar_project == "megacam-mops") { 106 94 $mops_selected = "selected"; … … 122 110 $diff_checked = "CHECKED"; 123 111 } else { 124 // nothing checked default to By Exposure125 $ exp_checked = "CHECKED";112 // nothing checked default to By ID 113 $file_checked = "CHECKED"; 126 114 } 127 115 … … 140 128 141 129 // is the center is specified in Pixels or sky coordinates 142 if ($rvar_center_type == "Sky") { 130 if ($rvar_center_type == "Pixels") { 131 $sky_checked=""; 132 $pix_checked="checked"; 133 } else { 143 134 $sky_checked="checked"; 144 135 $pix_checked=""; 145 } else {146 $sky_checked="";147 $pix_checked="checked";148 136 } 149 137 … … 168 156 } 169 157 158 $getstatus_checked = ""; 159 $pstamp_checked = ""; 160 $list_checked = ""; 161 $get_checked = ""; 170 162 if ($rvar_cmd_mode == "Make Stamps") { 171 163 $pstamp_checked = "checked"; 172 $list_checked = "";173 $get_checked = "";174 164 } else if ($rvar_cmd_mode == "Get Images") { 175 165 $get_checked = "checked"; 176 $list_checked = ""; 177 $ pstamp_checked = "";166 } else if ($rvar_cmd_mode == "Get Status") { 167 $getstatus_checked = "checked"; 178 168 } else { 179 $list_checked = "checked"; 180 $get_checked = ""; 181 $pstamp_checked = ""; 169 // default 170 $pstamp_checked = "checked"; 182 171 } 183 172 … … 188 177 189 178 // How do we know whether or not this is the intial page load or not? 190 // Well, in that case rvar_img_type is not set so key off of that179 // Well, the first time rvar_img_type is not set. So we key off of that. 191 180 // TODO: find a better way to decide whether or not to run commands 192 181 193 182 if ($rvar_img_type) { 194 195 183 $jobFinished = 0; 196 if ( $request_id == 0) {184 if (! $getstatus_checked) { 197 185 try { 198 186 $command_line = build_request_cmd(); … … 201 189 if (! $list_checked) { 202 190 // The only output from a successful run is the request_id 191 $request_name = trim(Array_pop($output_array)); 203 192 $request_id = Array_pop($output_array); 204 193 $last_request_id = $request_id; 205 setcookie("our_request_id", $request_id); 206 // echo "The request id is $request_id\n"; 207 if (count($output_array) != 0) { 208 throw new Exception("unexpected output returned by pstampwebrequest."); 194 if ($request_id && $request_name) { 195 addRequest($request_id, $request_name); 196 // setcookie("our_request_id", $request_id); 197 // echo "The request id is $request_id\n"; 198 $getstatus_checked = "checked"; 199 $pstamp_checked = ""; 200 } else { 201 // XXX: TODO print out the error 202 if (count($output_array) != 0) { 203 throw new Exception("unexpected output returned by pstampwebrequest."); 204 } 209 205 } 210 211 $jobRunning = getRequestStatus();212 if (!$jobRunning) {213 // echo "1 getRequestStatus reuturned 0\n";214 $jobFinished = 1;215 $request_id = 0;216 }217 218 206 } else { 219 207 $last_request_id = 0; … … 222 210 $error_line = $e->getMessage(); 223 211 } 224 } else { 225 try { 226 // get the list of jobs for the request 227 // echo "calling getRequestStatus\n"; 228 $jobRunning = getRequestStatus(); 229 230 if (!$jobRunning) { 231 // echo "2 getRequestStatus reuturned 0\n"; 232 $jobFinished = 1; 233 $request_id = 0; 234 } 235 236 } catch (Exception $e) { 237 echo "Got Exception $request_id $e\n"; 238 $error_line = $e->getMessage(); 239 } 240 } 241 if ($last_request_id) { 242 // This doesn't work for get_image 243 listJobs($last_request_id, $jobFinished); 244 } 245 } 212 } 213 } 214 215 // This is the end of the Logic 246 216 247 217 function build_request_cmd() … … 296 266 throw new Exception('RA and DEC must be specified.'); 297 267 } 298 $cmd .= " - skycenter $rvar_RA$rvar_DEC";268 $cmd .= " --ra $rvar_RA --dec $rvar_DEC"; 299 269 } else { 300 270 if (! $rvar_X || ! $rvar_Y) { 301 271 throw new Exception('X and Y must be specified.'); 302 272 } 303 $cmd .= " -pixcenter $rvar_X$rvar_Y";273 $cmd .= " -pixcenter --x $rvar_X --y $rvar_Y"; 304 274 } 305 275 … … 308 278 throw new Exception('dRA and dDEC must be specified.'); 309 279 } 310 $cmd .= " - arcrange $rvar_dRA$rvar_dDEC";280 $cmd .= " --arcseconds --width $rvar_dRA --height $rvar_dDEC"; 311 281 } else { 312 282 if (! $rvar_W || ! $rvar_H) { 313 283 throw new Exception('width and height must be specified.'); 314 284 } 315 $cmd .= " - pixrange $rvar_W$rvar_H";285 $cmd .= " --width $rvar_W --height $rvar_H"; 316 286 } 317 287 } … … 324 294 325 295 if ($exp_checked) { 296 if ($rvar_img_type == "stack") { 297 throw new Exception('Lookup by exposure name not supported for stack images.'); 298 } 326 299 if (! $rvar_id ) { 327 300 throw new Exception('Must set ID to the Exposure ID.'); 328 301 } 329 $cmd .= " - byexp $rvar_img_type$rvar_id";302 $cmd .= " --req_type byexp --stage $rvar_img_type --id $rvar_id"; 330 303 } else if ($file_checked) { 331 304 if (! $rvar_id ) { 332 305 throw new Exception('Must set ID to the exposure name.'); 333 306 } 334 $cmd .= " - byid $rvar_img_type$rvar_id";307 $cmd .= " --req_type byid --stage $rvar_img_type --id $rvar_id"; 335 308 } else if ($coord_checked) { 336 // $cmd .= " -bycoord $rvar_img_type"; 337 $coord_checked = ""; 338 $exp_checked = "checked"; 339 throw new Exception("Image selection by coordinate not implemented yet."); 309 $cmd .= " --req_type bycoord --stage $rvar_img_type"; 310 $coord_checked = "checked"; 311 // throw new Exception("Image selection by coordinate not implemented yet."); 340 312 } else if ($diff_checked) { 341 313 if (! $rvar_id ) { 342 314 throw new Exception('Must set ID to Diff Image ID.'); 343 315 } 344 $cmd .= " - bydiff $rvar_img_type$rvar_id";345 } 346 347 if (($rvar_img_type == "raw") || ($rvar_img_type == "chip")) { 348 if ($require_class_id && ! $rvar_class_id) {349 throw new Exception("must specify Class ID with Image Type $rvar_img_type."); 350 } 351 if ((!$rvar_class_id) || ($rvar_class_id == "all")) { 352 $cmd .= " null";353 } else{354 $cmd .= " $rvar_class_id";355 } 356 }316 $cmd .= " --req_type bydiff --stage $rvar_img_type --id $rvar_id"; 317 } 318 319 // XXX: don't need to require class_id anymore 320 // if (($rvar_img_type == "raw") || ($rvar_img_type == "chip")) { 321 // if (!$sky_checked && ($require_class_id && ! $rvar_class_id )) { 322 // throw new Exception("must specify Class ID with Image Type $rvar_img_type."); 323 // } 324 // leave off compoennt if we're looking up by coordinates. It breaks it 325 if (!$coord_checked && (($rvar_class_id) && ($rvar_class_id != "all"))) { 326 $cmd .= " --component $rvar_class_id"; 327 } 328 // } 357 329 358 330 return escapeshellcmd($cmd); … … 390 362 } 391 363 364 // This is no longer used 392 365 function printURL($line) 393 366 { … … 442 415 echo "</td></tr>"; 443 416 } 444 445 function countRunningJobs()446 {447 global $output_array;448 449 $runningJobs = 0;450 $size = sizeof($output_array);451 for ($i = 0; $i < $size; $i++) {452 $elements = explode(" ", $output_array[$i]);453 if (count($elements) == 3) {454 $state = $elements[1];455 if ($state != "stop") {456 $runningJobs++;457 }458 } else {459 throw new Exception ("incorrect data in job status: $output_array[$i]");460 }461 }462 return $runningJobs;463 }464 465 function listJobs($request_id, $jobFinished)466 {467 global $WORKDIR;468 global $SCRIPT;469 470 $command_line = "$SCRIPT pstamp_listjobs.pl $request_id";471 global $dbname;472 global $dbserver;473 if ($dbname) {474 $command_line .= " --dbname $dbname --dbserver $dbserver";475 }476 477 run_command($command_line);478 if ($jobFinished) {479 global $outFileset;480 global $dsroot;481 $parse_error = "$WORKDIR/$request_id/parse_error.txt";482 #echo "reading $parse_error\n";483 // readfile( $parse_error );484 if (file_exists($parse_error)) {485 $fhandle = fopen($parse_error, "r");486 if ($fhandle) {487 $contents = fread($fhandle, 1024);488 if ($contents) {489 global $last_request_id;490 global $error_line;491 $error_line = "Request $last_request_id: $contents\n";492 }493 }494 }495 }496 }497 498 function getRequestStatus()499 {500 global $request_id;501 global $command_status;502 global $output_array;503 global $outFileset;504 global $dbname;505 global $dbserver;506 global $SCRIPT;507 508 $command_line = "$SCRIPT pstamptool -listreq -req_id $request_id -simple";509 if ($dbname) {510 $command_line .= " -dbname $dbname -dbserver $dbserver";511 }512 // echo "Running $command_line\n";513 514 run_command($command_line);515 if ($command_status == 0) {516 $size = sizeof($output_array);517 $runningReq = 0;518 for ($i = 0; $i < $size; $i++) {519 $elements = explode(" ", $output_array[$i]);520 if (count($elements) >= 4) {521 $state = $elements[2];522 $outFileset = $elements[4];523 if ($state != "stop") {524 $runningReq++;525 }526 } else {527 throw new Exception ("incorrect data in job status: $output_array[$i]");528 }529 }530 return $runningReq;531 } else {532 return 0;533 }534 }535 536 417 ?> 537 418 538 <!-- Beginning of the HTML --------------------------------------------- --> 419 <!----------------------Beginning of the HTML --------------------------------------------- --> 420 539 421 <html> 540 <head> 541 <title>Postage Stamp Request Form</title> 542 <?php 543 if ($request_id != 0) { 544 // This doesn't do what I want. It does a get not a post 545 546 // echo '<META HTTP-EQUIV="refresh" CONTENT="5">'; 547 548 } 549 ?> 550 </head> 422 <head> 423 <title> 424 Postage Stamp Request Form (prototype) 425 </title> 426 </head> 427 <body> 428 429 <H1 align=center> 430 Postage Stamp Request Form 431 </h1> 432 433 <?php 434 welcomeHeader($auth_user, "pstamp_links.php", "Postage Stamp Home"); 435 ?> 436 551 437 <form method="post"> 552 553 <body>554 555 <H1 align=center>556 Postage Stamp Request557 </h1>558 559 438 <!-- Whole page is a single column table --> 560 439 … … 586 465 <td> 587 466 <b>Select Images By:</b> 467 <input type=radio name="select_by" value="db_id" <?php echo $file_checked; ?> >Database ID 468 588 469 <input type=radio name="select_by" value="exposure_id" <?php echo $exp_checked; ?> >Exposure Name 589 470 590 <input type=radio name="select_by" value="db_id" <?php echo $file_checked; ?> >Database ID 591 471 592 472 <input type=radio name="select_by" value="coord" <?php echo $coord_checked; ?> >Coordinates 593 473 … … 625 505 echo "Chip ID:"; 626 506 } else { 627 echo "C lass ID:";507 echo "Component:"; 628 508 } 629 509 ?> … … 685 565 686 566 <input type="text" name="dRA" size=10 value= <?php echo $rvar_dRA; ?> > 567 " 687 568 </td> 688 569 <td> … … 691 572 692 573 <input type="text" name="dDEC" size=10 value="<?php echo $rvar_dDEC;?>" > 574 " 693 575 </td> 694 576 </tr> … … 742 624 <tr> 743 625 744 <?php745 if ($request_id == 0): ?>746 626 <td><input type=submit value="Submit"></td> 747 627 <td><b>Mode:</b> 628 <input type=radio name="cmd_mode" value="Get Status"<?php echo $getstatus_checked; ?> >Get Status 748 629 <input type=radio name="cmd_mode" value="Make Stamps"<?php echo $pstamp_checked; ?> >Make Stamps 749 <input type=radio name="cmd_mode" value="Get Images" <?php echo $get_checked; ?> >Get Images 630 <input type=radio name="cmd_mode" value="Get Images" <?php echo $get_checked; ?> >Get Bundles 631 <!-- 750 632 <input type=radio name="cmd_mode" value="List Images" <?php echo $list_checked; ?> >List Images 633 --> 751 634 </td> 752 <?php753 else: ?>754 <td><input type=submit value="Check Status"></td>755 <!--- <td><input type=submit value="Cancel"></td> --->756 635 <?php 757 echo "<td><b>Request Id: $request_id";758 endif;?>636 // echo "<td><b>Request Id: $request_id"; 637 ?> 759 638 760 639 </tr> … … 766 645 767 646 <tr> 647 <!--- Don't show the command 768 648 <td> 769 649 <b>Command:</b> <?php echo "$command_line\n";?> 650 </td> 651 ---> 652 653 </tr> 654 <tr> 655 <td> 656 <b>Last Command</b> 770 657 </td> 771 658 </tr> … … 794 681 <td> 795 682 <table align=center width=100% rules=none> 796 <caption height=10 valign=center><b>Results</b></caption> 797 683 <caption height=10 valign=center><b>Request Results</b></caption> 798 684 799 685 <?php 686 if (0) { 687 // This is the old way of listing the status of the current request. 688 // now we save the submitted requests in the session see listRequests() below 689 800 690 $size = sizeof($output_array); 801 691 // echo "<pre>size of output array is $size\n</pre>"; … … 818 708 } 819 709 } 710 } // end if if(0) 820 711 ?> 821 712 </table> … … 845 736 </table> 846 737 738 <?php 739 listRequests("http://datastore.ipp.ifa.hawaii.edu/pstampresults", "pstamp_results_fileset"); 740 ?> 741 847 742 <!-- The end --> 848 743 … … 861 756 ?> 862 757 758 </form> 863 759 </body> 864 </form>865 866 760 </html> -
branches/eam_branches/ipp-20100823/tools/czarclean.pl
r29033 r29124 59 59 60 60 61 $czarDb->cleanupDateRange($begin, $end, "1 HOUR");61 $czarDb->cleanupDateRange($begin, $end, $interval); 62 62 -
branches/eam_branches/ipp-20100823/tools/czarplot.pl
r28922 r29124 8 8 9 9 use czartool::CzarDb; 10 use czartool:: Czarplot;10 use czartool::Plotter; 11 11 12 12 my $czarDbName = "czardb"; … … 23 23 my $nebulous = undef; 24 24 my $savingToFile = undef; 25 my $log = undef; 25 26 26 27 GetOptions ( … … 36 37 "timeseries|t" => \$timeSeries, 37 38 "verbose|v" => \$verbose, 39 "log|g" => \$log, 38 40 ); 39 41 40 print "\n"; 42 print "\n*******************************************************************************\n"; 43 print "* \n"; 44 my $quit = 0; 45 if (@ARGV) { 46 $quit=1; 47 print "* UNKNKOWN: option @ARGV\n"; 48 } 41 49 if (!$histogram) { 42 50 print "* OPTIONAL: plot histogram -h (default=off)\n";} 43 51 if (!$timeSeries) { 44 52 print "* OPTIONAL: plot timeseries -t (default=on)\n";} 53 if (!$log) { 54 $log = 0; 55 print "* OPTIONAL: use log plots -g (default=$log\n";} 45 56 if (!$nebulous) { 46 57 print "* OPTIONAL: plot nebulous disk space -n (default=off)\n";} 47 58 if (!$label) { 48 print "* OPTIONAL: choose a label -l <labellName> (default='all_stdscience_labels')\n";} 59 $label = "all_stdscience_labels"; 60 print "* OPTIONAL: choose a label -l <labellName> (default=$label)\n";} 49 61 if (!$stage) { 50 62 print "* OPTIONAL: choose a stage -s <chip|cam|warp|etc> (default=none)\n";} 51 63 if (!$interval) { 52 print "* OPTIONAL: choose time interval in past -i <'1 hour'|'1 day'|etc> (default= interval since 7am this morning)\n";}64 print "* OPTIONAL: choose time interval in past -i <'1 hour'|'1 day'|etc> (default=none\n";} 53 65 if (!$begin) { 54 66 print "* OPTIONAL: choose a begin time -b <datetime> (default=7am this morning)\n";} … … 56 68 print "* OPTIONAL: choose an end time -e <datetime> (default=now)\n";} 57 69 if (!$path) { 58 print "* OPTIONAL: choose an output location -o <path> (default=none)\n";} 70 print "* OPTIONAL: choose an output location -o <path> (default=none)\n"; 71 } 72 print "*\n*******************************************************************************\n"; 59 73 60 print "\n"; 74 if ($quit) { exit; } 61 75 62 76 # default values 63 if (!$label) {$label = "all_stdscience_labels";}64 77 if (!$nebulous && !$histogram && !$timeSeries) {$timeSeries = 1; $histogram = 0;} 65 78 if (!$verbose) {$verbose = 0;} … … 71 84 $czarDb->setDateFormat("%Y%m%d-%H%i%s"); 72 85 73 my $czarplot = new czartool::Czarplot($czarDb, "%Y%m%d-%H%M%S", $savingToFile ? "png font \"/usr/share/fonts/corefonts/arial.ttf\" 8" : "X11", $path, $save_temps);74 86 75 my @allStages = ("chip", "cam", "fake", "warp", "stack", "diff", "magic", "magicDS", "dist"); 87 # GENE PLOTS my $plotter = new czartool::Plotter($czarDb, "%Y%m%d-%H%M%S", $savingToFile ? "png size 1280,960 font \"/usr/share/fonts/corefonts/arial.ttf\" 12" : "X11", $path, $save_temps); 88 my $plotter = new czartool::Plotter($czarDb, "%Y%m%d-%H%M%S", $savingToFile ? "png font \"/usr/share/fonts/corefonts/arial.ttf\" 8" : "X11", $path, $save_temps); 76 89 77 90 # sort out times … … 79 92 if (!$begin) { 80 93 if ($interval) {$begin = $czarDb->subtractInterval($end, $interval);} 81 else {$begin = strftime('%Y-%m-%d 0 7:00',localtime);}94 else {$begin = strftime('%Y-%m-%d 06:35',localtime);} 82 95 } 83 96 84 97 my $diskUsage = 1; # TODO 85 98 86 if (!$nebulous && $timeSeries) {$ czarplot->createTimeSeries($label, $stage, $begin, $end);}87 if ($histogram) {$ czarplot->createHistogram($label, $begin, $end);}88 if ($nebulous && $timeSeries) {$ czarplot->plotStorageTimeSeries($begin, $end);}89 elsif ($nebulous) {$ czarplot->plotDiskUsageHistogram();}99 if (!$nebulous && $timeSeries) {$plotter->createTimeSeries($label, $stage, $begin, $end, $log);} 100 if ($histogram) {$plotter->createHistogram($label, $begin, $end);} 101 if ($nebulous && $timeSeries) {$plotter->plotStorageTimeSeries($begin, $end);} 102 elsif ($nebulous) {$plotter->plotDiskUsageHistogram();} 90 103 -
branches/eam_branches/ipp-20100823/tools/czartool/CzarDb.pm
r28921 r29124 1 #!/usr/bin/perl i-w1 #!/usr/bin/perl -w 2 2 3 3 package czartool::CzarDb; … … 6 6 use strict; 7 7 8 my @stages = (" chip", "cam", "fake", "warp", "stack", "diff", "magic", "magicDS", "dist"); # TODO put elsewhere8 my @stages = ("burntool", "chip", "cam", "fake", "warp", "stack", "diff", "magic", "magicDS", "dist"); # TODO put elsewhere 9 9 10 10 use base 'czartool::MySQLDb'; … … 119 119 120 120 $query->execute; 121 } 122 123 ########################################################################### 124 # 125 # Updates nightlyscience table 126 # 127 ########################################################################### 128 sub updateNightlyScience { 129 my ($self, $status) = @_; 130 131 my $query = $self->{_db}->prepare(<<SQL); 132 DELETE FROM nightlyscience; 133 SQL 134 135 $query->execute; 136 137 $query = $self->{_db}->prepare(<<SQL); 138 INSERT INTO nightlyscience 139 (status) 140 VALUES 141 ('$status'); 142 SQL 143 144 $query->execute; 121 145 } 122 146 … … 218 242 ########################################################################### 219 243 sub createTimeSeriesData { 220 my ($self, $label, $stage, $fromTime, $toTime, $minX, $maxX, $minY, $maxY, $timeDiff) = @_; 221 222 my $dataFile = "/tmp/czarplot_gnuplot_".$label."_".$stage."_t.dat"; 223 open (GNUDAT, ">$dataFile"); 244 my ($self, $label, $stage, $fromTime, $toTime, $minX, $maxX, $minY, $maxY, $timeDiff, $dataFile, $isLog) = @_; 245 246 ${$dataFile} = "/tmp/czarplot_gnuplot_".$label."_".$stage."_t.dat"; 247 248 open (GNUDAT, ">${$dataFile}") or print "* Problem opening gnuplot data file for plot for '$label' '$stage'\n"; 224 249 225 250 my $query = $self->{_db}->prepare(<<SQL); … … 235 260 SQL 236 261 237 if (!$query->execute) {return undef;}262 if (!$query->execute) {return 0;} 238 263 239 264 my $minProcessed = undef; 240 241 ($minProcessed, ${$maxY}, ${$minY}, ${$maxX}, ${$minX}, ${$timeDiff}) = $query->fetchrow_array(); 242 243 if (!defined $minProcessed) {return undef;} 265 my ($_maxY, $_minY, $_timeDiff); 266 ($minProcessed, $_maxY, $_minY, ${$maxX}, ${$minX}, $_timeDiff) = $query->fetchrow_array(); 267 268 if ($_maxY > ${$maxY}) {${$maxY} = $_maxY;} 269 if ($_minY < ${$minY}) {${$minY} = $_minY;} 270 if ($_timeDiff > ${$timeDiff}) {${$timeDiff} = $_timeDiff;} 271 272 if (!defined $minProcessed) {return 0;} 244 273 245 274 $query = $self->{_db}->prepare(<<SQL); … … 256 285 # loop round results 257 286 while (my @row = $query->fetchrow_array()) { 258 259 287 my ($timestamp, $pending, $faults, $processed) = @row; 260 # print "'$timestamp' '$pending' '$faults' '$processed'\n"; 288 289 if ($isLog) { 290 291 $processed = log($processed + 1); 292 $pending = log($pending + 1); 293 $faults = log($faults + 1); 294 } 295 261 296 print GNUDAT "$timestamp $pending $faults $processed\n"; 262 297 } 263 close(GNUDAT); 264 265 return $dataFile; 298 299 close(GNUDAT) or print "* Problem closing gnuplot data file for plot for '$label' '$stage'\n"; 300 301 return 1; 266 302 } 267 303 … … 491 527 } 492 528 529 530 ########################################################################### 531 # 532 # Deletes all but one row per interval from all stage tables for all labels between the two dates 533 # 534 ########################################################################### 535 sub cleanupDateRange { 536 my ($self, $startDay, $endDay, $interval) = @_; 537 538 my $thisDay = $startDay; 539 my $quit = 0; 540 while(!$quit) { 541 542 if (!$self->isBefore($thisDay, $endDay)) { 543 544 $quit = 1; 545 } 546 547 print "* Running cleanup for $thisDay with an interval of $interval\n"; 548 $self->cleanupADay($thisDay, $interval); 549 $thisDay = $self->addInterval($thisDay, "1 DAY"); 550 551 } 552 } 553 ########################################################################### 554 # 555 # Deletes all but one row per interval from all stage tables for all labels between the provided day 556 # 557 ########################################################################### 558 sub cleanupADay { 559 my ($self, $startDay, $interval) = @_; 560 561 my $endDay = $self->addInterval($startDay, "1 DAY"); 562 563 my $labels = undef; 564 my $fromTime = $startDay; 565 my $toTime = undef; 566 my $totalDeleted = undef; 567 my $quit = 0; 568 while(!$quit) { 569 570 $toTime = $self->addInterval($fromTime, $interval); 571 if (!$self->isBefore($toTime, $endDay)) { 572 573 $toTime = $endDay; 574 $quit = 1; 575 } 576 577 my $stage = undef; 578 $totalDeleted = 0; 579 foreach $stage (@stages) { 580 581 if (!$self->getLabelsInThisTimePeriod($stage, $fromTime, $toTime, \$labels)) {next;} 582 583 my $label = undef; 584 my $row = undef; 585 foreach $row ( @{$labels} ) { 586 my ($label) = @{$row}; 587 588 my $query = $self->{_db}->prepare(<<SQL); 589 SELECT COUNT(*) 590 FROM $stage 591 WHERE timestamp > '$fromTime' 592 AND timestamp <= '$toTime' 593 AND label = '$label' 594 SQL 595 596 $query->execute; 597 598 my $toDelete = scalar $query->fetchrow_array() - 1; 599 if ($toDelete < 1) {next;} 600 601 $query = $self->{_db}->prepare(<<SQL); 602 DELETE FROM $stage 603 WHERE timestamp > '$fromTime' 604 AND timestamp <= '$toTime' 605 AND label = '$label' ORDER BY timestamp DESC LIMIT $toDelete 606 SQL 607 $query->execute; 608 609 $totalDeleted += $toDelete; 610 } 611 } 612 print " * Deleted $totalDeleted between $fromTime and $toTime\n"; 613 $fromTime = $toTime; 614 } 615 } 616 617 ########################################################################### 618 # 619 # Returns an array of labels present during the provided time frame 620 # 621 ########################################################################### 622 sub getLabelsInThisTimePeriod { 623 my ($self, $stage, $fromTime, $toTime, $labels) = @_; 624 625 my $query = $self->{_db}->prepare(<<SQL); 626 SELECT DISTINCT label 627 FROM $stage 628 WHERE timestamp > '$fromTime' 629 AND timestamp <= '$toTime'; 630 SQL 631 632 if (!$query->execute) { 633 634 return 0; 635 } 636 637 ${$labels} = $query->fetchall_arrayref(); 638 639 return 1; 640 } 641 493 642 ########################################################################### 494 643 # … … 500 649 501 650 my $currentRevision = -1; 502 my $latestRevision = 10; 503 504 while ($currentRevision != $latestRevision) { 651 652 while (1) { 505 653 506 654 $currentRevision = $self->getRevision(); … … 517 665 elsif ($currentRevision == 8) {$self->createRevision_9();} 518 666 elsif ($currentRevision == 9) {$self->createRevision_10();} 667 elsif ($currentRevision == 10) {$self->createRevision_11();} 668 elsif ($currentRevision == 11) {$self->createRevision_12();} 669 else {last;} 519 670 } 520 671 } … … 841 992 } 842 993 994 ####################################################################################### 995 # 996 # Create revision 11 of the database 997 # 998 ####################################################################################### 999 sub createRevision_11 { 1000 my ($self) = @_; 1001 1002 print "* Creating revision 11 of '$self->{_dbName}'\n"; 1003 1004 # same shape as other stage tables to enable easy update 1005 my $query = $self->{_db}->prepare(<<SQL); 1006 CREATE TABLE burntool ( 1007 timestamp TIMESTAMP DEFAULT NOW(), 1008 label VARCHAR(128) DEFAULT "NONE", 1009 pending BIGINT NOT NULL, 1010 processed BIGINT NOT NULL, 1011 faults BIGINT NOT NULL); 1012 SQL 1013 1014 $query->execute; 1015 $query = $self->{_db}->prepare(<<SQL); 1016 CREATE INDEX burntoolIndex ON burntool (timestamp, label); 1017 SQL 1018 1019 $query->execute; 1020 1021 $self->setRevision(11); 1022 } 1023 1024 ####################################################################################### 1025 # 1026 # Create revision 12 of the database 1027 # 1028 ####################################################################################### 1029 sub createRevision_12 { 1030 my ($self) = @_; 1031 1032 print "* Creating revision 12 of '$self->{_dbName}'\n"; 1033 1034 # same shape as other stage tables to enable easy update 1035 my $query = $self->{_db}->prepare(<<SQL); 1036 CREATE TABLE nightlyscience ( 1037 timestamp TIMESTAMP DEFAULT NOW(), 1038 status VARCHAR(128) DEFAULT "NONE"); 1039 SQL 1040 1041 $query->execute; 1042 1043 $self->setRevision(12); 1044 } 1045 843 1046 1; 844 1047 -
branches/eam_branches/ipp-20100823/tools/czartool/MySQLDb.pm
r28771 r29124 64 64 return $self->{_dbHost}; 65 65 } 66 67 ########################################################################### 68 # 69 # Adds the provided interval to the provided time 70 # 71 ########################################################################### 72 sub addInterval { 73 my ($self, $time, $interval) = @_; 74 75 my $query = $self->{_db}->prepare(<<SQL); 76 SELECT '$time' + INTERVAL $interval; 77 SQL 78 $query->execute; 79 80 return scalar $query->fetchrow_array(); 81 } 66 82 67 83 ########################################################################### -
branches/eam_branches/ipp-20100823/tools/czartool/Pantasks.pm
r28920 r29124 73 73 } 74 74 return 1; 75 } 76 77 ########################################################################### 78 # 79 # Gets nightlyscience status for today 80 # 81 ########################################################################### 82 sub getNightlyScienceStatus { 83 my ($self, $status) = @_; 84 85 my @labels; 86 87 my ($day, $month, $year) = (localtime)[3,4,5]; 88 my $today = sprintf("%04d-%02d-%02d", $year+1900, $month+1, $day); 89 90 my @cmdOut = `echo "ns.show.dates;quit" | pantasks_client -c ~ipp/stdscience/ptolemy.rc 2>&1`; 91 my $line; 92 foreach $line (@cmdOut) { 93 94 chomp($line); 95 if (!$self->outputOk($line)) {return 0;} 96 if ($line =~ m/$today\s+(.+)/) { 97 ${$status} = $1; 98 return 1; 99 } 100 } 101 102 return 0; 75 103 } 76 104 -
branches/eam_branches/ipp-20100823/tools/roboczar.pl
r28926 r29124 11 11 use czartool::Pantasks; 12 12 use czartool::Nebulous; 13 use czartool::Czarplot; 13 use czartool::Plotter; 14 use czartool::Burntool; 14 15 15 16 my $period = 60; … … 26 27 my $nebulous = new czartool::Nebulous($czarDb); 27 28 my $pantasks = new czartool::Pantasks(); 28 my $czarplot = new czartool::Czarplot($czarDb, "%Y%m%d-%H%M%S", "png font \"/usr/share/fonts/corefonts/arial.ttf\" 8", "/tmp", $save_temps); # TODO hardcoded font path 29 my $plotter = new czartool::Plotter($czarDb, "%Y%m%d-%H%M%S", "png font \"/usr/share/fonts/corefonts/arial.ttf\" 8", "/tmp", $save_temps); # TODO hardcoded font path 30 my $burntool = new czartool::Burntool(); 31 29 32 $czarDb->setDateFormat("%Y%m%d-%H%i%s"); 30 33 31 my @stages = (" chip", "cam", "fake", "warp", "stack", "diff", "magic", "magicDS", "dist");34 my @stages = ("burntool", "chip", "cam", "fake", "warp", "stack", "diff", "magic", "magicDS", "dist"); 32 35 33 36 … … 101 104 my $priority = undef; 102 105 my $newState = undef; 106 my $nsStatus = undef; 103 107 104 108 while (1) { 105 109 106 110 # sort out times 107 $begin = strftime('%Y-%m-%d 0 7:00',localtime);111 $begin = strftime('%Y-%m-%d 06:35',localtime); 108 112 $end = $czarDb->getNowTimestamp(); 109 113 … … 112 116 $begin = $czarDb->subtractInterval($begin, "1 DAY"); 113 117 } 118 119 # check nightly science status 120 print "* Checking nightly science status\n"; 121 if (!$pantasks->getNightlyScienceStatus(\$nsStatus)) {$nsStatus = "Unknown";} 122 $czarDb->updateNightlyScience($nsStatus); 114 123 115 124 # check nebulous 116 125 print "* Checking Nebulous\n"; 117 126 $nebulous->updateClusterSpaceInfo(); 118 $ czarplot->plotDiskUsageHistogram();127 $plotter->plotDiskUsageHistogram(); 119 128 updateServerStatus(); 120 129 … … 177 186 178 187 chomp($label); 179 $ czarplot->createTimeSeries($label, $stage, $begin, $end);188 $plotter->createLogAndLinearTimeSeries($label, $stage, $begin, $end); 180 189 } 181 190 } … … 185 194 my ($label) = @{$row}; 186 195 187 $ czarplot->createTimeSeries($label, undef, $begin, $end);188 $ czarplot->createHistogram($label, $begin, $end);196 $plotter->createLogAndLinearTimeSeries($label, undef, $begin, $end); 197 $plotter->createHistogram($label, $begin, $end); 189 198 190 199 #routineChecks($label, "1 HOUR"); 191 200 } 192 $ czarplot->createTimeSeries("all_".$server."_labels", undef, $begin, $end);193 $ czarplot->createHistogram("all_".$server."_labels", $begin, $end);201 $plotter->createLogAndLinearTimeSeries("all_".$server."_labels", undef, $begin, $end); 202 $plotter->createHistogram("all_".$server."_labels", $begin, $end); 194 203 foreach $stage (@stages) { 195 204 196 $ czarplot->createTimeSeries("all_".$server."_labels", $stage, $begin, $end); # TODO must be a neater way...205 $plotter->createLogAndLinearTimeSeries("all_".$server."_labels", $stage, $begin, $end); # TODO must be a neater way... 197 206 } 198 207 } … … 233 242 chomp($label); 234 243 235 $new = $gpc1Db->countExposures($label, $stage, $newState); 236 $full = $gpc1Db->countExposures($label, $stage, "full"); 237 $faults = $gpc1Db->countFaults($label, $stage, $newState); 238 244 if ($stage eq "burntool") { 245 246 if ($labelServer eq "stdscience") { 247 248 $burntool->getPendingAndProcessed($label, \$new, \$full); 249 $faults = 0; 250 } 251 else { $new = $full = $faults = 0;} 252 } 253 else { 254 255 $new = $gpc1Db->countExposures($label, $stage, $newState); 256 $full = $gpc1Db->countExposures($label, $stage, "full"); 257 $faults = $gpc1Db->countFaults($label, $stage, $newState); 258 } 239 259 #printf("%s %s, %s, %d, %d\n", $labelServer, $label, $stage, $new, $faults); 240 260 $totalNew += $new;
Note:
See TracChangeset
for help on using the changeset viewer.
