Changeset 35412
- Timestamp:
- Apr 19, 2013, 3:39:39 PM (13 years ago)
- Location:
- branches/eam_branches/ipp-20130307
- Files:
-
- 46 edited
- 4 copied
-
Ohana (modified) (1 prop)
-
Ohana/src/libohana/src (modified) (1 prop)
-
Ohana/src/opihi (modified) (1 prop)
-
Ohana/src/opihi/cmd.astro (modified) (1 prop)
-
Ohana/src/opihi/cmd.data (modified) (1 prop)
-
Ohana/src/relastro/src (modified) (1 prop)
-
ippScripts/scripts/camera_exp.pl (modified) (1 diff)
-
ippScripts/scripts/chip_imfile.pl (modified) (1 prop)
-
ippScripts/scripts/destreak_restore_camera.pl (modified) (1 prop)
-
ippScripts/scripts/ipp_apply_burntool_single.pl (modified) (1 prop)
-
ippScripts/scripts/magic_destreak.pl (modified) (1 prop)
-
ippScripts/scripts/publish_file.pl (modified) (1 prop)
-
ippScripts/scripts/relgroup_exp_list.pl (modified) (6 diffs)
-
ippScripts/scripts/warp_skycell.pl (modified) (1 prop)
-
ippTools/share (modified) (1 prop)
-
ippTools/share/Makefile.am (modified) (1 diff)
-
ippTools/share/camtool_find_pendingimfile.sql (modified) (1 prop)
-
ippTools/share/chiptool_setimfiletoupdate.sql (modified) (1 prop)
-
ippTools/share/pstamptool_completedreq.sql (modified) (1 diff)
-
ippTools/share/pstamptool_getdependent.sql (modified) (1 diff)
-
ippTools/share/pxadmin_create_tables.sql (modified) (1 prop)
-
ippTools/share/releasetool_listrelexp.sql (modified) (1 diff)
-
ippTools/share/releasetool_listrelstack.sql (copied) (copied from trunk/ippTools/share/releasetool_listrelstack.sql )
-
ippTools/share/releasetool_pendingrelgroup.sql (modified) (1 diff)
-
ippTools/share/warptool_towarped.sql (modified) (1 prop)
-
ippTools/src (modified) (1 prop)
-
ippTools/src/camtool.c (modified) (1 prop)
-
ippTools/src/camtoolConfig.c (modified) (1 prop)
-
ippTools/src/magictool.c (modified) (1 prop)
-
ippTools/src/pstamptool.c (modified) (12 diffs)
-
ippTools/src/pstamptoolConfig.c (modified) (1 diff)
-
ippTools/src/releasetool.c (modified) (9 diffs)
-
ippTools/src/releasetoolConfig.c (modified) (3 diffs)
-
psLib/src/math/Makefile.am (modified) (2 diffs)
-
psLib/src/math/psMixtureModels.c (copied) (copied from trunk/psLib/src/math/psMixtureModels.c )
-
psLib/src/math/psMixtureModels.h (copied) (copied from trunk/psLib/src/math/psMixtureModels.h )
-
psLib/src/pslib_strict.h (modified) (1 diff)
-
pstamp/scripts (modified) (1 prop)
-
pstamp/scripts/psmkreq (modified) (13 diffs)
-
pstamp/scripts/psstatus (modified) (6 diffs)
-
pstamp/scripts/pstamp_cleanup.pl (modified) (1 diff)
-
pstamp/scripts/pstamp_finish.pl (modified) (4 diffs)
-
pstamp/scripts/pstamp_job_run.pl (modified) (4 diffs)
-
pstamp/scripts/pstamp_parser_run.pl (modified) (3 diffs)
-
pstamp/scripts/pstamp_request_file (modified) (4 diffs)
-
pstamp/scripts/pstamp_webrequest.pl (modified) (6 diffs)
-
pstamp/scripts/pstampparse.pl (modified) (34 diffs)
-
pstamp/src/ppstampParseCamera.c (modified) (3 diffs)
-
tools/heathers_plots/deploy.sh (copied) (copied from trunk/tools/heathers_plots/deploy.sh )
-
tools/heathers_plots/heathers_plots.py (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/eam_branches/ipp-20130307/Ohana
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20130307/Ohana/src/libohana/src
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20130307/Ohana/src/opihi
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20130307/Ohana/src/opihi/cmd.astro
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20130307/Ohana/src/opihi/cmd.data
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20130307/Ohana/src/relastro/src
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20130307/ippScripts/scripts/camera_exp.pl
r35159 r35412 363 363 } 364 364 # Construct FPA continuity corrected background images 365 { 365 if ($camera =~ /ISP/) { 366 print "Skipping FPA continuity corrected background images for ISP\n"; 367 } else { 366 368 my $command; 367 369 $command = "$ppImage"; -
branches/eam_branches/ipp-20130307/ippScripts/scripts/chip_imfile.pl
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20130307/ippScripts/scripts/destreak_restore_camera.pl
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20130307/ippScripts/scripts/ipp_apply_burntool_single.pl
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20130307/ippScripts/scripts/magic_destreak.pl
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20130307/ippScripts/scripts/publish_file.pl
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20130307/ippScripts/scripts/relgroup_exp_list.pl
r35247 r35412 16 16 17 17 18 my ($group_id, $group_type, $lap_id, $ release_name, $rebuild, $dbname, $no_update, $verbose);18 my ($group_id, $group_type, $lap_id, $group_name, $release_name, $rebuild, $dbname, $no_update, $verbose); 19 19 20 20 GetOptions( 21 21 'group_id=s' => \$group_id, 22 'group_type=s' => \$group_type, 22 23 'lap_id=s' => \$lap_id, 23 'group_ type=s' => \$group_type,24 'group_name=s' => \$group_name, 24 25 'release_name=s' => \$release_name, 25 26 'rebuild' => \$rebuild, # rebuild directory if it exists … … 36 37 -exitval => 3) 37 38 unless $lap_id; 39 $group_name = "lap_$lap_id"; 40 } else { 41 pod2usage( -msg => "--group_name is required with --group_type $group_type", 42 -exitval => 3) 43 unless $group_name; 38 44 } 39 45 … … 48 54 49 55 # XXX: get this from site.config 50 my $outputBase = "/data/ippc17.0/www/ipp-misc/ps1-data/single-frame/$release_name"; 51 52 my $outdir; 53 if ($group_type eq 'lap') { 54 $outdir = "$outputBase/lap_$lap_id"; 55 if (-e $outdir) { 56 if ($rebuild) { 57 my $rc = system "rm -rf $outdir"; 58 if ($rc) { 59 my $status = $rc >> 8; 60 my_die("failed to remove existing directory $outdir: $rc $status", $group_id, $PS_EXIT_UNKNOWN_ERROR); 61 } 62 } else { 63 my_die("directory $outdir already exists and --rebuild not supplied", $group_id, $PS_EXIT_UNKNOWN_ERROR); 64 } 65 } 66 } else { 67 my_die("Not ready to do group_type $group_type\n", $group_id, $PS_EXIT_UNKNOWN_ERROR); 56 my $exposureListRoot = "/data/ippc17.0/www/ipp-misc/ps1-data/single-frame"; 57 58 my $outputBase = "$exposureListRoot/$release_name"; 59 60 if (!-e $outputBase) { 61 mkdir $outputBase or &my_die("Failed to create $outputBase", $group_id, $PS_EXIT_SYS_ERROR); 62 } 63 64 my $outdir = "$outputBase/$group_name"; 65 if (-e $outdir) { 66 if ($rebuild) { 67 my $rc = system "rm -rf $outdir"; 68 if ($rc) { 69 my $status = $rc >> 8; 70 my_die("failed to remove existing directory $outdir: $rc $status", $group_id, $PS_EXIT_UNKNOWN_ERROR); 71 } 72 } else { 73 my_die("directory $outdir already exists and --rebuild not supplied", $group_id, $PS_EXIT_UNKNOWN_ERROR); 74 } 68 75 } 69 76 70 77 mkdir $outdir or my_die ("failed to create $outdir", $group_id, $PS_EXIT_UNKNOWN_ERROR); 71 72 if (0) {73 # XXX: old code from prototype for nightly lists74 my $outroot;75 my $oh;76 my ($year, $month, $day);77 if ($outroot) {78 die "usage: $0 <year> <month> <day>\n" unless $year and $month and $day;79 my $monthdir = sprintf "$outroot/%4d/%02d", $year, $month;80 if (! -e $monthdir) {81 die "can't find directory for $year-$month\n";82 }83 my $daydir = sprintf "$monthdir/%02d", $day;84 if (! -e $daydir) {85 mkdir $daydir or die "failed to create $daydir\n";86 }87 my $outfile = sprintf "$daydir/index.html", $day;88 open $oh, ">$outfile" or die "failed to open $outfile";89 } else {90 $oh = *STDOUT;91 }92 93 my $ticks = timegm(0, 0, 0, $day, $month - 1, $year - 1900);94 95 my $mjd = 40587 + ($ticks / 86400.);96 my $date = sprintf "%04d-%02d-%02d", $year, $month, $day;97 }98 78 99 79 my $oh; … … 105 85 open $oh2, ">$outfile2" or my_die("failed to open $outfile2", $group_id, $PS_EXIT_UNKNOWN_ERROR); 106 86 107 my $title = "PS1 Exposure List for $release_name LAP run $lap_id"; 87 my $title = "PS1 Exposure List for"; 88 if ($group_type eq 'lap') { 89 $title .= " $release_name LAP run $lap_id"; 90 } else { 91 $title .= " $group_name"; 92 } 108 93 109 94 my $head = " … … 125 110 126 111 127 # find all exposures on given day that have a chip run112 # find all exposures in this relGroup 128 113 my $query = " 129 114 SELECT … … 149 134 $stmt->execute() or my_die("failed to execute query: $stmt->errstr\n", $group_id, $PS_EXIT_UNKNOWN_ERROR); 150 135 151 printf STDERR "%4d exposures in group for LAP run $lap_id\n", $stmt->rows;136 printf STDERR "%4d exposures in group for $group_name\n", $stmt->rows; 152 137 153 138 # $stmt->dump_results(1000); -
branches/eam_branches/ipp-20130307/ippScripts/scripts/warp_skycell.pl
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20130307/ippTools/share
- Property svn:mergeinfo changed
/trunk/ippTools/share merged: 35358,35365,35397,35410
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20130307/ippTools/share/Makefile.am
r35350 r35412 473 473 releasetool_definerelstack.sql \ 474 474 releasetool_definerelstack_with_skycal.sql \ 475 releasetool_listrelstack.sql \ 475 476 releasetool_definerelgroup_select_lap.sql \ 476 477 releasetool_definerelgroup_select_data_group.sql \ -
branches/eam_branches/ipp-20130307/ippTools/share/camtool_find_pendingimfile.sql
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20130307/ippTools/share/chiptool_setimfiletoupdate.sql
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20130307/ippTools/share/pstamptool_completedreq.sql
r29563 r35412 8 8 SELECT count(*) FROM pstampJob 9 9 WHERE pstampJob.req_id = pstampRequest.req_id 10 AND pstampJob.state != 'stop' 10 AND pstampJob.state != 'stop' 11 AND pstampJob.state != 'cancel' 11 12 ) = 0 -
branches/eam_branches/ipp-20130307/ippTools/share/pstamptool_getdependent.sql
r28145 r35412 1 1 SELECT DISTINCT pstampDependent.* 2 2 FROM pstampDependent 3 WHERE pstampDependent.state = 'new'3 WHERE (pstampDependent.state = 'new' OR pstampDependent.state = 'hold') -
branches/eam_branches/ipp-20130307/ippTools/share/pxadmin_create_tables.sql
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20130307/ippTools/share/releasetool_listrelexp.sql
r35213 r35412 25 25 warpRun.warp_id, 26 26 warpRun.state as warp_state, 27 warpRun.tess_id, 27 28 rawExp.filter, 28 29 rawExp.dateobs, -
branches/eam_branches/ipp-20130307/ippTools/share/releasetool_pendingrelgroup.sql
r35350 r35412 5 5 JOIN ippRelease USING(rel_id) 6 6 WHERE relGroup.state = 'new' 7 AND relGroup.fault = 0 -
branches/eam_branches/ipp-20130307/ippTools/share/warptool_towarped.sql
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20130307/ippTools/src
- Property svn:mergeinfo changed
/trunk/ippTools/src merged: 35357-35358,35365,35397
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20130307/ippTools/src/camtool.c
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20130307/ippTools/src/camtoolConfig.c
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20130307/ippTools/src/magictool.c
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/eam_branches/ipp-20130307/ippTools/src/pstamptool.c
r35350 r35412 49 49 static bool revertjobMode(pxConfig *config); 50 50 51 # if (1)52 // these are unused functions -- since they are 'static', this raises an warning53 // XXX: They actually are used54 51 static bool addprojectMode(pxConfig *config); 55 52 static bool projectMode(pxConfig *config); … … 63 60 static bool listfileMode(pxConfig *config); 64 61 static bool deletefileMode(pxConfig *config); 65 # endif66 62 67 63 # define MODECASE(caseName, func) \ … … 103 99 MODECASE(PSTAMPTOOL_MODE_STOPDEPENDENTJOB, stopdependentjobMode); 104 100 MODECASE(PSTAMPTOOL_MODE_REVERTJOB, revertjobMode); 105 # if (1)106 101 MODECASE(PSTAMPTOOL_MODE_ADDPROJECT, addprojectMode); 107 102 MODECASE(PSTAMPTOOL_MODE_MODPROJECT, modprojectMode); … … 115 110 MODECASE(PSTAMPTOOL_MODE_LISTFILE, listfileMode); 116 111 MODECASE(PSTAMPTOOL_MODE_DELETEFILE, deletefileMode); 117 # endif 112 118 113 default: 119 114 psAbort("invalid option (this should not happen)"); … … 624 619 if (outdir) { 625 620 psStringAppend(&query, ", outdir = '%s'", outdir); 621 } 622 if (username) { 623 psStringAppend(&query, ", username = '%s'", username); 626 624 } 627 625 if (clearfault) { … … 1236 1234 PXOPT_LOOKUP_BOOL(need_magic, config->args, "-need_magic", false); 1237 1235 PXOPT_LOOKUP_BOOL(no_create, config->args, "-no_create", false); 1236 PXOPT_LOOKUP_BOOL(hold, config->args, "-hold", false); 1238 1237 1239 1238 psMetadata *where = psMetadataAlloc(); … … 1243 1242 PXOPT_COPY_STR(config->args, where, "-component", "component", "=="); 1244 1243 1245 // start a transaction e raly so it will contain any row level locks1244 // start a transaction early so it will contain any row level locks 1246 1245 if (!psDBTransaction(config->dbh)) { 1247 1246 psError(PS_ERR_UNKNOWN, false, "database error"); … … 1267 1266 psError(PS_ERR_UNKNOWN, false, "database error"); 1268 1267 psFree(query); 1268 if (!psDBRollback(config->dbh)) { 1269 psError(PS_ERR_UNKNOWN, false, "database error"); 1270 } 1269 1271 return false; 1270 1272 } … … 1274 1276 if (!output) { 1275 1277 psError(PS_ERR_UNKNOWN, false, "database error"); 1278 if (!psDBRollback(config->dbh)) { 1279 psError(PS_ERR_UNKNOWN, false, "database error"); 1280 } 1276 1281 return false; 1277 1282 } … … 1282 1287 psError(PS_ERR_UNKNOWN, false, "database error"); 1283 1288 psFree(output); 1289 if (!psDBRollback(config->dbh)) { 1290 psError(PS_ERR_UNKNOWN, false, "database error"); 1291 } 1284 1292 return false; 1285 1293 } … … 1287 1295 if (fault > 0) { 1288 1296 fprintf(stderr, "existing dependent has fault %d\n", fault); 1297 if (!psDBRollback(config->dbh)) { 1298 psError(PS_ERR_UNKNOWN, false, "database error"); 1299 } 1300 // return the fault to the client. This is used by the postage stamp parser 1289 1301 exit (fault); 1290 1302 } 1303 bool commit = false; 1304 // Check the state of the exisiting dependent. By query it is either 1305 // new or hold 1306 psString state = psMetadataLookupStr(NULL, dep, "state"); 1307 if (!hold && !strcmp(state, "hold")) { 1308 // There is a dependent for this component but it's state is hold. 1309 // This client needs one that will run. 1310 // Update the state 1311 psString updateQuery = NULL; 1312 psStringAppend(&updateQuery, "UPDATE pstampDependent SET state = 'new' " 1313 "\nWHERE stage = '%s' AND imagedb = '%s' AND stage_id = %"PRId64 " AND component = '%s'", 1314 stage, imagedb, stage_id, component); 1315 1316 if (!p_psDBRunQuery(config->dbh, updateQuery)) { 1317 psError(PS_ERR_UNKNOWN, false, "database error"); 1318 psFree(updateQuery); 1319 if (!psDBRollback(config->dbh)) { 1320 psError(PS_ERR_UNKNOWN, false, "database error"); 1321 } 1322 return false; 1323 } 1324 // set flag to commit this change 1325 commit = true; 1326 psFree(updateQuery); 1327 } 1328 // print the dep_id for the user 1291 1329 printf("%" PRId64 "\n", dep_id); 1292 1330 psFree(output); 1293 if (!psDBRollback(config->dbh)) { 1331 // now either commit the change or rollback the transaction which releases the lock 1332 if (commit) { 1333 if (!psDBCommit(config->dbh)) { 1334 // rollback 1335 if (!psDBRollback(config->dbh)) { 1336 psError(PS_ERR_UNKNOWN, false, "database error"); 1337 } 1294 1338 psError(PS_ERR_UNKNOWN, false, "database error"); 1339 return false; 1340 } 1341 } else if (!psDBRollback(config->dbh)) { 1342 psError(PS_ERR_UNKNOWN, false, "database error"); 1343 return false; 1295 1344 } 1296 1345 return true; … … 1310 1359 config->dbh, 1311 1360 0, // dep_id 1312 "new", // state1361 hold ? "hold" : "new", // state 1313 1362 stage, 1314 1363 stage_id, -
branches/eam_branches/ipp-20130307/ippTools/src/pstamptoolConfig.c
r35350 r35412 223 223 psMetadataAddBool(getdependentArgs,PS_LIST_TAIL, "-need_magic", 0, "define need_magic", false); 224 224 psMetadataAddStr(getdependentArgs, PS_LIST_TAIL, "-outdir", 0, "define output directory for dependent (required)", NULL); 225 psMetadataAddBool(getdependentArgs,PS_LIST_TAIL, "-hold", 0, "if creating new dependent set it's state to hold", false); 225 226 psMetadataAddBool(getdependentArgs,PS_LIST_TAIL, "-no_create", 0, "if no matching dependent do not create one", false); 226 227 -
branches/eam_branches/ipp-20130307/ippTools/src/releasetool.c
r35350 r35412 832 832 PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false); 833 833 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 834 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); 834 835 835 836 // find the parameters of all the exposures that we want to add to the release … … 852 853 853 854 psFree(where); 855 856 if (limit) { 857 psString limitString = psDBGenerateLimitSQL(limit); 858 psStringAppend(&query, " %s", limitString); 859 psFree(limitString); 860 } 854 861 855 862 if (!p_psDBRunQuery(config->dbh, query)) { … … 968 975 psMetadata *where = psMetadataAlloc(); 969 976 977 PXOPT_COPY_S64(config->args, where, "-relstack_id", "relStack.relstack_id", "=="); 978 PXOPT_COPY_S64(config->args, where, "-stack_id", "relStack.stack_id", "=="); 979 PXOPT_COPY_S64(config->args, where, "-skycal_id", "relStack.skycal_id", "=="); 980 PXOPT_COPY_S64(config->args, where, "-relstack_id", "relStack.relstack_id", "=="); 970 981 PXOPT_COPY_STR(config->args, where, "-release_name", "ippRelease.release_name", "LIKE"); 971 982 pxAddLabelSearchArgs(config, where, "-release_state","ippRelease.state", "=="); 972 PXOPT_COPY_STR(config->args, where, "-state", "rel Exp.state", "==");973 PXOPT_COPY_STR(config->args, where, "-filter", "r awExp.filter", "LIKE");974 PXOPT_COPY_ TIME(config->args, where, "-dateobs_begin","rawExp.dateobs", ">=");975 PXOPT_COPY_ TIME(config->args, where, "-dateobs_end", "rawExp.dateobs", "<=");976 PXOPT_COPY_F32(config->args, where, "-fwhm_min", "skycalResult.fwhm_m ajor", ">=");983 PXOPT_COPY_STR(config->args, where, "-state", "relStack.state", "=="); 984 PXOPT_COPY_STR(config->args, where, "-filter", "relStack.filter", "LIKE"); 985 PXOPT_COPY_F32(config->args, where, "-mjd_min", "stackSumSkyfile.mjd_obs", ">="); 986 PXOPT_COPY_F32(config->args, where, "-mjd_max", "stackSumSkyfile.mjd_obs", "<="); 987 PXOPT_COPY_F32(config->args, where, "-fwhm_min", "skycalResult.fwhm_minor", ">="); 977 988 PXOPT_COPY_F32(config->args, where, "-fwhm_max", "skycalresult.fwhm_major", "<="); 978 PXOPT_COPY_STR(config->args, where, "-exp_name", "rawExp.exp_ame", "=="); 979 PXOPT_COPY_S64(config->args, where, "-exp_id", "relExp.exp_id", "=="); 980 PXOPT_COPY_S64(config->args, where, "-chip_id", "relExp.chip_id", "=="); 981 PXOPT_COPY_S64(config->args, where, "-cam_id", "relExp.cam_id", "=="); 982 PXOPT_COPY_S64(config->args, where, "-warp_id", "warpRun.warp_id", "=="); 983 PXOPT_COPY_STR(config->args, where, "-chip_data_group", "chipRun.data_group", "LIKE"); 984 PXOPT_COPY_STR(config->args, where, "-cam_data_group", "camRun.data_group", "LIKE"); 985 PXOPT_COPY_STR(config->args, where, "-warp_data_group", "warpRun.data_group", "LIKE"); 989 PXOPT_COPY_STR(config->args, where, "-tess_id", "relStack.tess_id", "=="); 990 PXOPT_COPY_STR(config->args, where, "-skycell_id", "relStack.skycell_id", "LIKE"); 991 PXOPT_COPY_STR(config->args, where, "-stack_data_group", "stackRun.data_group", "LIKE"); 992 PXOPT_COPY_STR(config->args, where, "-skycal_data_group", "skycalRun.data_group", "LIKE"); 986 993 987 994 PXOPT_COPY_STR(config->args, where, "-surveyName", "survey.surveyName", "LIKE"); 988 995 PXOPT_COPY_S32(config->args, where, "-rel_id", "relExp.rel_id", "=="); 996 pxskycellAddWhere(config, where); 989 997 990 998 PXOPT_LOOKUP_BOOL(priority_order, config->args, "-priority_order", false); … … 993 1001 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 994 1002 995 psString query = pxDataGet("releasetool_listrel exp.sql");1003 psString query = pxDataGet("releasetool_listrelstack.sql"); 996 1004 if (!query) { 997 1005 psError(PXTOOLS_ERR_SYS, false, "failed to retreive SQL statement"); 998 return false;999 }1000 1001 psString where2 = NULL;1002 if (!pxspaceAddWhere(config, &where2, "rawExp")) {1003 psError(psErrorCodeLast(), false, "pxspaceAddWhere failed");1004 1006 return false; 1005 1007 } … … 1009 1011 psStringAppend(&query, "\nWHERE %s", whereClause); 1010 1012 psFree(whereClause); 1011 } else if (where2) {1012 psStringAppend(&query, "\nWHERE ");1013 1013 } else { 1014 1014 psError(PXTOOLS_ERR_CONFIG, false, "search parameters are required\n"); … … 1017 1017 } 1018 1018 1019 if (where2) {1020 psStringAppend(&query, "\n%s", where2);1021 psFree(where2);1022 }1023 1024 1019 if (priority_order) { 1025 psStringAppend(&query, "\nAND priority > 0 order by exp_id, priority");1020 psStringAppend(&query, "\nAND priority > 0 order by stack_id, priority"); 1026 1021 } 1027 1022 … … 1051 1046 } 1052 1047 1053 if (!ippdbPrintMetadatas(stdout, output, "rel Exp", !simple)) {1048 if (!ippdbPrintMetadatas(stdout, output, "relStack", !simple)) { 1054 1049 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 1055 1050 psFree(output); … … 1331 1326 PS_ASSERT_PTR_NON_NULL(config, false); 1332 1327 1333 PXOPT_LOOKUP_S32(group_id, config->args, "-group_id", true, false); 1328 PXOPT_LOOKUP_S32(group_id, config->args, "-group_id", false, false); 1329 PXOPT_LOOKUP_STR(group_name, config->args, "-group_name", false, false); 1330 if (!group_id && !group_name) { 1331 psError(PXTOOLS_ERR_CONFIG, true, "either group_id or group_name is required\n"); 1332 return false; 1333 } 1334 1334 1335 1335 PXOPT_LOOKUP_STR(state, config->args, "-set_state", false, false); … … 1352 1352 1353 1353 PXOPT_COPY_S64(config->args, where, "-group_id", "relGroup.group_id", "=="); 1354 PXOPT_COPY_STR(config->args, where, "-group_name", "relGroup.group_name", "=="); 1354 1355 // XXX TODO if label is enabled (for changing label or state for a block) we should 1355 1356 // disallow setting some parameters such as exp_list_path -
branches/eam_branches/ipp-20130307/ippTools/src/releasetoolConfig.c
r35350 r35412 195 195 psMetadataAddF32(definerelstackArgs, PS_LIST_TAIL, "-set_zpt_stdev", 0, "define zero point stdev", NAN); 196 196 psMetadataAddF32(definerelstackArgs, PS_LIST_TAIL, "-set_fwhm_major", 0, "define fwhm_major", NAN); 197 psMetadataAddStr(definerelstackArgs, PS_LIST_TAIL, "-set_path_base", 0, "define state (required)", NULL);197 psMetadataAddStr(definerelstackArgs, PS_LIST_TAIL, "-set_path_base", 0, "define state", NULL); 198 198 psMetadataAddS16(definerelstackArgs, PS_LIST_TAIL, "-set_fault", 0, "define fault", 0); 199 199 200 psMetadataAddBool(definerelstackArgs, PS_LIST_TAIL, "-pretend", 0, "do not actually modify the database", false);200 psMetadataAddBool(definerelstackArgs, PS_LIST_TAIL, "-pretend", 0, "do not actually modify the database", false); 201 201 psMetadataAddBool(definerelstackArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 202 psMetadataAddU64(definerelstackArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 203 204 // -listrelstack 205 psMetadata *listrelstackArgs = psMetadataAlloc(); 206 psMetadataAddS64(listrelstackArgs, PS_LIST_TAIL, "-relstack_id", 0, "select by released exposure ID", 0); 207 psMetadataAddS64(listrelstackArgs, PS_LIST_TAIL, "-stack_id", 0, "select by stack ID", 0); 208 psMetadataAddS64(listrelstackArgs, PS_LIST_TAIL, "-skycal_id", 0, "select by skycal ID", 0); 209 psMetadataAddStr(listrelstackArgs, PS_LIST_TAIL, "-release_name", 0, "select by release name (LIKE comparision)", NULL); 210 psMetadataAddStr(listrelstackArgs, PS_LIST_TAIL, "-release_state", PS_META_DUPLICATE_OK, "select by release state", NULL); 211 psMetadataAddStr(listrelstackArgs, PS_LIST_TAIL, "-state", 0, "select by released stack state", NULL); 212 213 psMetadataAddStr(listrelstackArgs, PS_LIST_TAIL, "-filter", 0, "select by filter name (LIKE comparison)", NULL); 214 // psMetadataAddTime(listrelstackArgs, PS_LIST_TAIL, "-dateobs_begin", 0,"search for exposures by time (>=)", NULL); 215 // psMetadataAddTime(listrelstackArgs, PS_LIST_TAIL, "-dateobs_end", 0, "search for exposures by time (<=)", NULL); 216 217 pxskycellAddArguments(listrelstackArgs); 218 219 psMetadataAddF32(listrelstackArgs, PS_LIST_TAIL, "-fwhm_min", 0, "search by measured seeing (>=)", NAN); 220 psMetadataAddF32(listrelstackArgs, PS_LIST_TAIL, "-fwhm_max", 0, "search by seeing (<=)", NAN); 221 222 psMetadataAddStr(listrelstackArgs, PS_LIST_TAIL, "-tess_id", 0, "select by tess_id", NULL); 223 psMetadataAddStr(listrelstackArgs, PS_LIST_TAIL, "-skycell_id", 0, "select by skycell_id (LIKE comparision)", NULL); 224 225 psMetadataAddStr(listrelstackArgs, PS_LIST_TAIL, "-stack_data_group", 0, "select by stackRun.data_group (LIKE comparison)", NULL); 226 psMetadataAddStr(listrelstackArgs, PS_LIST_TAIL, "-skycal_data_group", 0, "select by skycalRun.data_group (LIKE comparison)", NULL); 227 228 psMetadataAddStr(listrelstackArgs, PS_LIST_TAIL, "-surveyName", 0, "select by survey name (LIKE comparision)", NULL); 229 psMetadataAddS64(listrelstackArgs, PS_LIST_TAIL, "-rel_id", 0, "select by release ID", 0); 230 231 psMetadataAddBool(listrelstackArgs, PS_LIST_TAIL, "-priority_order", 0, "order by release priority", false); 232 233 psMetadataAddU64(listrelstackArgs, PS_LIST_TAIL, "-limit", 0, "limit result set to N items", 0); 234 psMetadataAddBool(listrelstackArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 235 202 236 203 237 // -definerelgroup … … 240 274 psMetadata *updaterelgroupArgs = psMetadataAlloc(); 241 275 242 psMetadataAddS32(updaterelgroupArgs, PS_LIST_TAIL, "-group_id", 0, "select by group ID (required)", 0); 276 psMetadataAddS32(updaterelgroupArgs, PS_LIST_TAIL, "-group_id", 0, "select by group ID", 0); 277 psMetadataAddStr(updaterelgroupArgs, PS_LIST_TAIL, "-group_name", 0, "select by group name", 0); 243 278 244 279 // parameters of the relGroup … … 272 307 273 308 PXOPT_ADD_MODE("-definerelstack", "define a released stack", RELEASETOOL_MODE_DEFINERELSTACK, definerelstackArgs); 309 PXOPT_ADD_MODE("-listrelstack", "list released stacks", RELEASETOOL_MODE_LISTRELSTACK, listrelstackArgs); 274 310 275 311 PXOPT_ADD_MODE("-definerelgroup", "define a group of exposures", RELEASETOOL_MODE_DEFINERELGROUP, definerelgroupArgs); -
branches/eam_branches/ipp-20130307/psLib/src/math/Makefile.am
r16793 r35412 16 16 psMinimizePowell.c \ 17 17 psMinimizePolyFit.c \ 18 psMixtureModels.c \ 18 19 psPolynomial.c \ 19 20 psPolynomialMetadata.c \ … … 45 46 psMinimizePowell.h \ 46 47 psMinimizePolyFit.h \ 48 psMixtureModels.h \ 47 49 psPolynomial.h \ 48 50 psPolynomialMetadata.h \ -
branches/eam_branches/ipp-20130307/psLib/src/pslib_strict.h
r32251 r35412 76 76 #include "psMinimizePowell.h" 77 77 #include "psMinimizePolyFit.h" 78 #include "psMixtureModels.h" 78 79 #include "psMutex.h" 79 80 #include "psRandom.h" -
branches/eam_branches/ipp-20130307/pstamp/scripts
- Property svn:mergeinfo changed
/trunk/pstamp/scripts merged: 35353-35354,35356,35362-35364,35366,35380,35384,35388,35396,35398,35409
- Property svn:mergeinfo changed
-
branches/eam_branches/ipp-20130307/pstamp/scripts/psmkreq
r34611 r35412 28 28 my ($ra, $dec, $x, $y, $list, $output, $req_name, $req_name_base); 29 29 30 my ($image, $mask, $variance, $cmf, $psf, $backmdl, $inverse); 31 my ($unconvolved, $use_imfile_id, $no_wait); 30 my ($image, $mask, $variance, $jpeg, $cmf, $psf, $backmdl, $inverse); 31 my ($convolved, $unconvolved, $uncompressed, $use_imfile_id, $no_wait); 32 33 # new header keywords for version 2 34 my $action = 'PROCESS'; 35 my $email = 'null'; 32 36 33 37 my $default_size = 100; … … 52 56 my $comment; 53 57 58 # new request specification columns for version 2 59 my $survey_name ='null'; 60 my $release_name = 'null'; 61 my $run_type ='null'; 62 my $fwhm_min = 0; 63 my $fwhm_max = 0; 64 65 54 66 my $missing_tools; 55 67 my $pstamp_request_file = can_run('pstamp_request_file') or (warn "Can't find required program pstamp_request_file" and $missing_tools = 1); … … 62 74 GetOptions( 63 75 'list=s' => \$list, # list of coordinates if undef ra and dec or x and y are required 64 'ra=s' => \$ra, #76 'ra=s' => \$ra, 65 77 'dec=s' => \$dec, 66 78 'x=s' => \$x, … … 87 99 'comment=s' => \$comment, 88 100 101 'survey=s' => \$survey_name, 102 'release=s' => \$release_name, 103 'run_type=s' => \$run_type, 104 'fwhm_min=s' => \$fwhm_min, 105 'fwhm_max=s' => \$fwhm_max, 106 89 107 'option_mask=i' => \$option_mask, 90 108 'image' => \$image, 91 109 'mask' => \$mask, 110 'jpeg' => \$jpeg, 92 111 'variance' => \$variance, 93 112 'cmf' => \$cmf, … … 96 115 'inverse' => \$inverse, 97 116 'unconvolved' => \$unconvolved, 117 'convolved' => \$convolved, 118 'uncompressed' => \$uncompressed, 98 119 'use_imfile_id' => \$use_imfile_id, 99 120 'do_not_wait' => \$no_wait, 121 122 'action=s' => \$action, 123 'email=s' => \$email, 100 124 101 125 'verbose' => \$verbose, … … 156 180 } 157 181 182 if ($stage eq 'stack') { 183 # default is to do convolved stack 184 unless (defined $option_mask || $convolved) { 185 $unconvolved = 1; 186 } 187 } 188 158 189 checkFilter($filter, 'null', $filter) if $filter; 159 190 checkMJD($mjd_min, 0, "") if $mjd_min; … … 167 198 $option_mask |= $PSTAMP_SELECT_MASK if $mask; 168 199 $option_mask |= $PSTAMP_SELECT_VARIANCE if $variance; 200 $option_mask |= $PSTAMP_SELECT_JPEG if $jpeg; 201 202 # if no image was requested make a stamp of the image 169 203 $option_mask = $PSTAMP_SELECT_IMAGE if $option_mask == 0; 170 204 171 # if no image was requested make a stamp of the image172 205 173 206 $option_mask |= $PSTAMP_SELECT_CMF if $cmf; … … 207 240 } else { 208 241 $rows = []; 209 push @$rows, buildRow("", $comment, $x, $y, $filter, $mjd_min, $mjd_max);242 push @$rows, buildRow("", $comment, 1, $x, $y, $filter, $mjd_min, $mjd_max); 210 243 } 211 244 212 245 my ($tdf, $table_def_name) = tempfile ("/tmp/tabledef.XXXX", UNLINK => !$save_temps); 213 print $tdf "$req_name 1\n"; 246 my $line = "$req_name 2 $action $email"; 247 print "$line\n" if $verbose; 248 print $tdf "$line\n"; 214 249 my $rownum = 0; 215 250 foreach my $row (@$rows) { 216 251 $rownum++; 217 252 my $line = "$rownum $row->{ra}\t$row->{dec}\t$width $height" 218 . " $coord_mask $job_type $option_mask $project $ req_type"253 . " $coord_mask $job_type $option_mask $project $survey_name $release_name $req_type" 219 254 . " $stage $id $tess_id $component $data_group" 220 . " $row->{filter} $row->{mjd_min} $row->{mjd_max} ";255 . " $row->{filter} $row->{mjd_min} $row->{mjd_max} $run_type $fwhm_min $fwhm_max"; 221 256 222 257 if ($row->{comment} and $row->{comment} ne '') { … … 235 270 $command .= " --output $output" if $output; 236 271 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 237 run(command => $command, verbose => 0);272 run(command => $command, verbose => $verbose); 238 273 unless ($success) { 239 274 print STDERR @$stderr_buf; … … 274 309 275 310 my $row = {}; 276 $row->{ra} = checkRA($vals[0], $linenumber); 277 $row->{dec} = checkDEC($vals[1], $linenumber); 278 $row->{filter} = checkFilter($vals[2], $filter, $linenumber); 279 $row->{mjd_min} = checkMJD($vals[3], $mjd_min, $linenumber);; 280 $row->{mjd_max} = checkMJD($vals[4], $mjd_max, $linenumber);; 311 $row->{rownum} = checkRownum($vals[0], $linenumber); 312 $row->{ra} = checkRA($vals[1], $linenumber); 313 $row->{dec} = checkDEC($vals[2], $linenumber); 314 $row->{filter} = checkFilter($vals[3], $filter, $linenumber); 315 $row->{mjd_min} = checkMJD($vals[4], $mjd_min, $linenumber);; 316 $row->{mjd_max} = checkMJD($vals[5], $mjd_max, $linenumber);; 281 317 $row->{comment} = $comment; 282 318 … … 305 341 my $linenumber = shift; 306 342 307 my $result;343 my $result; 308 344 if ($c =~ /\:/) { 309 345 # sexagesmial format not valid for pixel coordinates … … 329 365 } 330 366 367 sub checkRownum { 368 my $rownum = shift; 369 my $linenumber = shift; 370 die "rownum can not be null at $linenumber\n" unless defined $rownum; 371 372 # XXX: For now just check that rownum is defined and a single word 373 # extend this. Should we require a number? 374 my @words = split " ", $rownum; 375 die "$rownum is not a vaild rownum at $linenumber\n" unless (scalar @words) == 1; 376 } 377 331 378 sub checkRA { 332 379 my $ra = shift; … … 335 382 336 383 if ($ra =~ /\:/) { 384 # assume RA is in hours:minutes:seconds 337 385 return $checked * 360. / 24.; 338 386 } else { -
branches/eam_branches/ipp-20130307/pstamp/scripts/psstatus
r30692 r35412 68 68 IFNULL(depcount, 0) AS 'Image updates' 69 69 , timestamp AS 'last state change (UTC)' 70 , registered AS 'Submit time (UTC)' 70 71 FROM ( 71 72 SELECT … … 77 78 pstampRequest.fault, 78 79 timestamp, 80 registered, 79 81 IFNULL(priority,10000) AS priority 80 82 FROM pstampRequest 81 83 LEFT JOIN Label USING(label) 82 84 WHERE pstampRequest.state = 'run' or pstampRequest.state ='new' 85 OR pstampRequest.state = 'parsed' 83 86 -- OR pstampRequest.state = 'run.wait' 84 87 ) as unfinishedReq … … 89 92 FROM pstampRequest JOIN pstampJob USING(req_id) 90 93 WHERE (pstampRequest.state = 'run' or pstampRequest.state = 'new' 91 OR pstampRequest.state = 'run.wait') 94 OR pstampRequest.state = 'run.wait' 95 OR pstampRequest.state = 'parsed') 92 96 GROUP BY req_id 93 97 ) as rowCounts … … 101 105 JOIN pstampDependent USING(dep_id) 102 106 WHERE (pstampRequest.state = 'run' or pstampRequest.state = 'new' 107 OR pstampRequest.state = 'parsed' 103 108 OR pstampRequest.state = 'run.wait') 104 109 AND dep_id > 0 … … 178 183 IFNULL(faulted,0) AS 'Faulted Jobs', 179 184 IFNULL(depcount, 0) AS 'Image updates completed', 180 timestamp AS 'Completion Time (UTC)' 185 timestamp AS 'Completion Time (UTC)', 186 registered AS 'Submit Time (UTC)' 181 187 FROM ( 182 188 SELECT … … 187 193 -- pstampRequest.state, 188 194 -- pstampRequest.fault, 189 timestamp 195 timestamp, 196 registered 190 197 FROM pstampRequest 191 198 WHERE pstampRequest.state = 'stop' -
branches/eam_branches/ipp-20130307/pstamp/scripts/pstamp_cleanup.pl
r34231 r35412 183 183 } 184 184 185 my $command = "rm -r $dir"; 185 # do an ls of the directory before starting 186 # print "directory listing for $dir\n"; 187 # system "ls $dir"; 188 189 my $command = "rm -rf $dir"; 186 190 unless ($no_update) { 187 191 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 188 192 run(command => $command, verbose => $verbose); 189 193 unless ($success) { 190 my $rc = $error_code >> 8; 191 my_die("Unable to perform $command return status: $rc", $req_id, $rc); 194 if (-e $dir) { 195 my $rc = $error_code >> 8; 196 my_die("Unable to perform $command return status: $rc", $req_id, $rc); 197 } else { 198 print STDERR "rm claimed to fail but directory no longer exists\n"; 199 } 192 200 } 193 201 } else { -
branches/eam_branches/ipp-20130307/pstamp/scripts/pstamp_finish.pl
r34447 r35412 107 107 my ($header, $rows) = read_request_file($req_file); 108 108 109 my $action = $header->{ACTION}; 110 111 if (!$header or (($action eq 'PROCESS') and !$rows)) { 109 if (!$header or !$rows) { 112 110 # Since a request got queued, the request file must have been readable at some point 113 111 my_die("failed to read request file $req_file", $req_id, $PS_EXIT_CONFIG_ERROR); … … 128 126 129 127 my $request_fault = 0; 130 if ($action eq 'PROCESS'){128 { 131 129 # The results table definition file 132 130 my ($tdf, $table_def_name) = tempfile ("$outdir/tabledef.XXXX", UNLINK => !$save_temps); … … 238 236 } else { 239 237 my_die("No reglist for successful job: $job_id", $req_id, $PS_EXIT_PROG_ERROR) 240 if $ fault eq $PSTAMP_SUCCESS;238 if $job->{state} eq 'stop' and $fault eq $PSTAMP_SUCCESS; 241 239 print STDERR "no reglist file for job $job_id\n" if $verbose; 242 240 print $tdf "$rownum|$fault|$error_string|0|$job_id|"; … … 273 271 } 274 272 } 275 } elsif ($action ne 'LIST') {276 my_die("Unexpected action $action found", $req_id, $PS_EXIT_PROG_ERROR);277 } else {278 # pstampparse did all of the work279 273 } 280 274 -
branches/eam_branches/ipp-20130307/pstamp/scripts/pstamp_job_run.pl
r33512 r35412 113 113 114 114 if ($stage eq "raw") { 115 # zap options that don't apply to raw stage 115 116 $options &= ~($PSTAMP_SELECT_MASK | $PSTAMP_SELECT_VARIANCE); 116 117 } … … 136 137 $argString .= " -astrom $params->{astrom}"; 137 138 push @file_list, $params->{astrom}; 139 } 140 141 if ($options & $PSTAMP_SELECT_SOURCES) { 142 # Extract sources from astrometry file if provided. This will be the smf for chip stage 143 # or the skycal cmf for stacks 144 if ($params->{astrom}) { 145 $argString .= " -write_cmf"; 146 if ($stage eq 'stack') { 147 # Set psphot recipe to STACKPHOT so that the extended source paramters will 148 # be copied from the cmf file. 149 $argString .= " -recipe PSPHOT STACKPHOT" 150 } 151 } elsif ($params->{cmf}) { 152 $argString .= " -write_cmf"; 153 push @file_list, $params->{cmf}; 154 } else { 155 print "Could not find suitable sources file will not write cmf\n"; 156 } 138 157 } 139 158 … … 254 273 $PSTAMP_SELECT_MASK => "mk.fits", 255 274 $PSTAMP_SELECT_VARIANCE => "wt.fits", 275 $PSTAMP_SELECT_SOURCES => "cmf", 256 276 $PSTAMP_SELECT_JPEG => "jpg"); 257 277 258 my $output_mask = $options & ($PSTAMP_SELECT_IMAGE | $PSTAMP_SELECT_MASK | $PSTAMP_SELECT_VARIANCE | $PSTAMP_SELECT_JPEG );278 my $output_mask = $options & ($PSTAMP_SELECT_IMAGE | $PSTAMP_SELECT_MASK | $PSTAMP_SELECT_VARIANCE | $PSTAMP_SELECT_JPEG | $PSTAMP_SELECT_SOURCES); 259 279 260 280 foreach my $key (keys (%extensions)) { … … 400 420 my $pattern_file = $params->{pattern} if ($options & $PSTAMP_SELECT_BACKMDL); 401 421 my $cmf_file; 402 if ($stage ne 'chip') {403 # we don't ship chip stage cmf files because they may not be censored404 $cmf_file = $params->{cmf} if ($options & $PSTAMP_SELECT_CMF);405 }422 # if ($stage ne 'chip') { 423 # # we don't ship chip stage cmf files because they may not be censored 424 # $cmf_file = $params->{cmf} if ($options & $PSTAMP_SELECT_CMF); 425 # } 406 426 407 427 my $outdir = dirname($output_base); -
branches/eam_branches/ipp-20130307/pstamp/scripts/pstamp_parser_run.pl
r34232 r35412 158 158 my $request_fault = $PSTAMP_INVALID_REQUEST; 159 159 160 # default action is to process the request after parsing. This can be overridden by 161 # PREVIEW mode for pstamp requests 162 my $action = 'PROCESS'; 163 160 164 if (-r $uri) { 161 165 # run the appropriate parse command to parse the queue the jobs for this request 162 166 # first check the extension header to find the EXTNAME 163 $request_type = find_request_type($uri );167 $request_type = find_request_type($uri, \$action); 164 168 165 169 if ($request_type) { … … 240 244 241 245 if ($success) { 242 $newState = 'run'; 246 # XXX: This bit of the postage stamp request API has slipped in here because we need to control 247 # the new state of the request 248 if ($action eq 'PROCESS') { 249 $newState = 'run'; 250 } elsif ($action eq 'PREVIEW') { 251 $newState = 'parsed'; 252 } else { 253 print STDERR "WARNING Ignoring unexpected value for ACTION found in request header: $action\n"; 254 } 243 255 } else { 244 256 $fault = $error_code >> 8; … … 275 287 # find the EXTNAME in the input fits table 276 288 my $file_name = shift; 277 my $out = `echo $file_name | fields -x 0 EXTNAME`; 289 my $r_action = shift; 290 291 my $out = `echo $file_name | fields -x 0 EXTNAME ACTION`; 278 292 279 293 if ($out) { 280 294 # output from fields is filename value 281 my ($dummy, $extname) = split " ", $out; 295 my ($dummy, $extname, $action) = split " ", $out; 296 297 # Set the action if it is defined in the request header 298 # XXX:consider doing this only if extname is PS1_PS_REQUSET 299 $$r_action = $action if ($action); 282 300 283 301 return $extname; -
branches/eam_branches/ipp-20130307/pstamp/scripts/pstamp_request_file
r34447 r35412 54 54 value => undef 55 55 }, 56 { name => 'USERNAME',57 writetype => TSTRING,58 comment => 'username for request (optional)',59 value => undef60 },56 # { name => 'USERNAME', 57 # writetype => TSTRING, 58 # comment => 'username for request (optional)', 59 # value => undef 60 # }, 61 61 { name => 'EMAIL', 62 62 writetype => TSTRING, … … 97 97 { name => 'MJD_MIN', type => 'D', writetype => TDOUBLE }, 98 98 { name => 'MJD_MAX', type => 'D', writetype => TDOUBLE }, 99 # new in version 2 99 100 { name => 'RUN_TYPE', type => '16A', writetype => TSTRING }, 101 { name => 'FWHM_MIN', type => 'D', writetype => TDOUBLE }, 102 { name => 'FWHM_MAX', type => 'D', writetype => TDOUBLE }, 100 103 101 104 { name => 'COMMENT ', type => '64A', writetype => TSTRING }, … … 326 329 pop @colData; 327 330 pop @colData; 331 pop @colData; 332 pop @colData; 328 333 } 329 334 … … 346 351 } 347 352 # trim leading whitespace from comment 348 $comment =~ s/^\s+// ;353 $comment =~ s/^\s+// if $comment; 349 354 if ($comment) { 350 355 if ($comment =~ /#/) { -
branches/eam_branches/ipp-20130307/pstamp/scripts/pstamp_webrequest.pl
r29383 r35412 5 5 # 6 6 # The arguments are the command line parameters for the program psmkreq 7 #8 # Unless the argument -list is provided the output is the request id for the resulting request9 #10 # If -list is the first argument, the request file is built and parsed and the11 # the selected "input" uris are listed on stdout.12 7 # 13 8 # Note: Despite the name there nothing particularly web specific about this program. … … 23 18 24 19 my $host = hostname(); 25 my $verbose = 1;20 my $verbose = 0; 26 21 my $dbname; 27 22 my $dbserver; 23 my $pretend; 24 my $label = 'WEB'; 25 my $req_name_prefix = 'web'; 26 my $username; 28 27 29 28 GetOptions( 30 29 'dbname=s' => \$dbname, 31 30 'dbserver=s' => \$dbserver, 32 'verbose' => \$verbose, 31 'label=s' => \$label, 32 'username=s' => \$username, 33 'prefix=s' => \$req_name_prefix, 34 'pretend' => \$pretend, 35 'verbose' => \$verbose, 33 36 ); 34 37 … … 36 39 37 40 if ($verbose) { 38 print "\n\n";39 print "Starting script $0 on $host\n\n";41 print STDERR "\n\n"; 42 print STDERR "Starting script $0 on $host\n\n"; 40 43 } 41 44 … … 70 73 # make a request file 71 74 my $cur_dir = getcwd(); 75 72 76 #print STDERR "cur_dir is $cur_dir\n"; 73 77 74 my $datestr = strftime "%Y %m%d", gmtime;78 my $datestr = strftime "%Y/%m/%d", gmtime; 75 79 my $datedir = "$cur_dir/webreq/$datestr"; 76 80 if (! -e $datedir ) { 77 if (! mkdir $datedir ) { 78 print STDERR "failed to create working directory $datedir"; 81 my $rc = system "mkdir -p $datedir"; 82 if ($rc) { 83 my $status = $rc >> 8; 84 print STDERR "failed to create working directory $datedir: $rc $status"; 79 85 exit $PS_EXIT_CONFIG_ERROR; 80 86 } 81 87 } 82 88 83 my $request_name = "web_". get_webreq_num();89 my $request_name = $req_name_prefix . '_' . get_webreq_num(); 84 90 my $request_file = "$datedir/$request_name.fits"; 85 91 { … … 96 102 # Queue the request 97 103 my $req_id = 0; 98 {104 unless ($pretend) { 99 105 100 106 my $command = "$pstamptool -addreq -uri $request_file -ds_id 0"; 101 $command .= " -label WEB"; 107 $command .= " -label $label"; 108 $command .= " -username $username" if $username; 102 109 $command .= " -dbname $dbname" if $dbname; 103 110 $command .= " -dbserver $dbserver" if $dbserver; … … 109 116 } 110 117 $req_id = ${$stdout_buf}[0]; 118 chomp $req_id; 111 119 } 112 120 -
branches/eam_branches/ipp-20130307/pstamp/scripts/pstampparse.pl
r34447 r35412 27 27 my $outdir; 28 28 my $product; 29 my $label ;29 my $label = ""; 30 30 my $save_temps; 31 31 my $no_update; … … 57 57 die "outdir is required" if !$outdir; 58 58 die "product is required" if !$product; 59 } else { 60 $req_id = 0; 61 $outdir = "nowhere"; 62 $product = "dummy"; 59 63 } 60 64 … … 83 87 $pstamptool .= " -dbserver $dbserver" if $dbserver; 84 88 85 # list_job is a deugging mode 86 $no_update = 1 if $mode eq "list_job"; 89 # If $mode is not queue_job we are using a debugging mode 90 # do not update the database 91 $no_update = 1 if $mode ne "queue_job"; 87 92 88 93 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 89 94 90 95 # 91 # get the datafrom the extension header96 # Read the keywords from the extension header 92 97 # 93 98 my $fields_output; 94 99 { 95 my $command = "echo $request_file_name | $fields -x 0 EXTNAME EXTVER REQ_NAME ACTION USEREMAIL";100 my $command = "echo $request_file_name | $fields -x 0 EXTNAME EXTVER REQ_NAME ACTION EMAIL"; 96 101 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 97 102 run(command => $command, verbose => $verbose); 98 # fields doesn't return zero when it succeeds 99 #unless ($success) { 100 # print STDERR @$stderr_buf; 101 #} 103 104 # note fields doesn't return zero when it succeeds. 102 105 $fields_output = join "", @$stdout_buf; 103 106 } 104 my (undef, $extname, $extver, $req_name, $action, $ username, $email) = split " ", $fields_output;107 my (undef, $extname, $extver, $req_name, $action, $email) = split " ", $fields_output; 105 108 106 109 # make sure the file contains what we are expecting 107 # This program shouldn't have been run if the request file is bogus. 108 # No need to notify the client 109 my_die("$request_file_name is not a PS1_PS_REQEST", $PS_EXIT_PROG_ERROR) if $extname ne "PS1_PS_REQUEST"; 110 my_die("REQ_NAME not found in $request_file_name", $PS_EXIT_PROG_ERROR) if (!$req_name); 111 my_die("wrong EXTVER $extver found in $request_file_name", $PS_EXIT_PROG_ERROR) if ($extver ne "1" and $extver ne "2"); 112 110 # pstamp_parser_run.pl would not have run this program unless the request file was ok 111 my_die("$request_file_name does not contain EXTNAME\n", $PS_EXIT_PROG_ERROR) if !$extname; 112 my_die("$request_file_name is not a PS1_PS_REQUEST\n", $PS_EXIT_PROG_ERROR) if $extname ne "PS1_PS_REQUEST"; 113 my_die("REQ_NAME not found in $request_file_name\n", $PS_EXIT_PROG_ERROR) if (!$req_name); 114 my_die("wrong EXTVER $extver found in $request_file_name\n", $PS_EXIT_PROG_ERROR) if ($extver ne "1" and $extver ne "2"); 115 116 if ($extver >= 2) { 117 # We have a version 2 file. Require that the new keywords be supplied. 118 my_die("action not supplied in version $extver request file $request_file_name\n", $PSTAMP_INVALID_REQUEST) unless defined $action; 119 120 my_die("invalid action: $action supplied in version $extver request file $request_file_name\n", $PSTAMP_INVALID_REQUEST) unless (uc($action) eq 'PROCESS' or uc($action) eq 'PREVIEW'); 121 122 my_die("email not supplied in version $extver request file $request_file_name\n", $PSTAMP_INVALID_REQUEST) unless $email; 123 # XXX check for "valid" $email 124 } else { 125 # for version 1 file the action is process and email is not used 126 $action = 'PROCESS'; 127 $email = 'null'; 128 } 129 130 print "Request Header Keywords EXTVER: $extver REQ_NAME: $req_name ACTION: $action EMAIL: $email\n"; 113 131 114 132 # check for duplicate request name … … 161 179 # the output data store's product name 162 180 my $command = "$pstamptool -updatereq -req_id $req_id -set_name $req_name"; 181 $command .= " -set_username $email" if $email ne 'null'; 163 182 $command .= " -set_outProduct $product"; 164 183 $command .= " -set_label $label" if $label_changed; … … 174 193 175 194 # 176 # now convert the request table to an array of metadata config docs195 # now convert the request table to an array of metadatas 177 196 # 178 197 … … 191 210 my $dtime_request_file = gettimeofday() - $start_request_file; 192 211 print "Time to read and parse request file: $dtime_request_file\n"; 193 194 } 195 196 # 197 # Loop over rows in the request file collecting consecutive rows that have the "same images of interest" 198 # in the sense that their selection parameters will yield the same "Runs". 199 # Process the groups of rows together to reduce lookup time and to potentially make multiple 200 # stamps from the same ppstamp process. 201 # 202 my @rowList; 212 } 213 214 my $nRows = scalar @$rows; 215 print "\n$nRows rows read from request file\n"; 216 217 203 218 my $num_jobs = 0; 204 219 my $imageList; 205 220 my $stage; 206 my $need_magic;207 221 foreach my $row (@$rows) { 208 # santiy check the paramaters 222 223 if ($label eq 'WEB.UP' and ($nRows > 500 or $num_jobs > 500) and $req_id and !$no_update) { 224 # this is a big request and it came from the upload page and doesn't have a specific label assigned 225 # change it to the generic one that has lower with lower priority 226 $label = 'WEB.BIG'; 227 print "\nChanging label for big WEB.UP request to $label\n"; 228 229 my $command = "$pstamptool -updatereq -req_id $req_id -set_label $label"; 230 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 231 run(command => $command, verbose => $verbose); 232 unless ($success) { 233 my_die("$command failed", $PS_EXIT_UNKNOWN_ERROR); 234 } 235 } 236 237 # validate the paramaters 209 238 if (!checkRow($row)) { 210 239 # when it enconters an error checkRow adds a fake job with an appropriate error code to the database … … 216 245 $row->{error_code} = 0; 217 246 218 if (scalar @rowList == 0) { 219 push @rowList, $row; 220 next; 221 } 222 223 my $firstRow = $rowList[0]; 224 if (same_images_of_interest($firstRow, $row)) { 225 # add this row to the list and move on 226 push @rowList, $row; 227 next; 228 } 229 230 # the images of interest for this new row doesn't match the list. 231 # process the list ... 232 $num_jobs += processRows($action, \@rowList); 233 234 # and reset the list to contain just the new row 235 @rowList = ($row); 236 } 237 238 # out of rows process the list 239 if (scalar @rowList > 0) { 240 $num_jobs += processRows($action, \@rowList); 247 $num_jobs += processRow($action, $row); 241 248 } 242 249 … … 252 259 my $row = shift; 253 260 261 # check validity of the paramters in a request specification 254 262 # If we encounter an error for a particular row add a job with the proper fault code. 263 # also adjust some paramterers like filter and set defaults for some others 255 264 256 265 my $stage = $row->{IMG_TYPE}; … … 284 293 } 285 294 286 287 295 my $component = $row->{COMPONENT}; 288 296 if (!defined $component or (lc($component) eq "null") or (lc($component) eq "all")) { … … 314 322 return 0; 315 323 } 324 325 my $fwhm_min = $row->{FWHM_MIN}; 326 if (!defined $fwhm_min) { 327 $row->{FWHM_MIN} = 0; 328 } elsif (!validNumber($fwhm_min)) { 329 print STDERR "$fwhm_min is not a valid FWHM_MIN\n"; 330 insertFakeJobForRow($row, 1, $PSTAMP_INVALID_REQUEST); 331 return 0; 332 } 333 my $fwhm_max = $row->{FWHM_MAX}; 334 if (!defined $fwhm_max) { 335 $row->{FWHM_MAX} = 0; 336 } elsif (!validNumber($fwhm_max)) { 337 print STDERR "$fwhm_max is not a valid FWHM_MAX\n"; 338 insertFakeJobForRow($row, 1, $PSTAMP_INVALID_REQUEST); 339 return 0; 340 } 341 316 342 my $data_group = $row->{DATA_GROUP}; 317 343 if (!defined $data_group) { … … 363 389 } 364 390 365 # $mode list_uri is a debugging mode (it may used by the http interface)366 # if this happens just croak367 # my_die("job_type is list_uri but mode is $mode", $PS_EXIT_PROG_ERROR) if ($job_type eq "list_uri") and ($mode ne "list_uri");368 369 370 391 if ($req_type eq "bycoord") { 371 392 if (!$skycenter) { … … 384 405 } 385 406 407 386 408 return 1; 387 409 } … … 392 414 393 415 $num_jobs = 1; 416 return $num_jobs; 417 } 418 419 sub processRow { 420 my $action = shift; 421 my $row = shift; 422 423 my $num_jobs = 0; 424 425 my $project = $row->{PROJECT}; 426 427 # note: resolve_project avoids running pstamptool every time by remembering the 428 # last project resolved 429 my $proj_hash = resolve_project($ipprc, $project, $dbname, $dbserver); 430 if (!$proj_hash) { 431 insertFakeJobForRow($row, 1, $PSTAMP_UNKNOWN_PROJECT); 432 $num_jobs++; 433 return $num_jobs; 434 } 435 my $image_db = $proj_hash->{dbname}; 436 my $camera = $proj_hash->{camera}; 437 438 my $req_type = $row->{REQ_TYPE}; 439 my $rownum = $row->{ROWNUM}; 440 441 # Since user can get unmagicked data "by coordinate" requests can go back in time 442 # to dredge unusable data from the "dark days"... 443 if ($req_type eq 'bycoord' and $row->{IMG_TYPE} ne 'stack' and $row->{MJD_MIN} == 0) { 444 # ... so unless the user sets mjd_min clamp it to 2009-04-01 445 # XXX: This value should live in the pstampProject table not be hardcoded here 446 $row->{MJD_MIN} = 54922; 447 } 448 449 if (($req_type eq 'byskycell') or ($req_type eq 'bycoord')) { 450 # avoid error from print below if $id isn't needed 451 $row->{ID} = "" if !$row->{ID}; 452 } 453 454 # Call PS::IPP::PStamp::Job locate_images subroutine to get the images for this 455 # request specification. An array reference is returned. 456 my $start_locate = gettimeofday(); 457 458 print "\nCalling new_locate_images for row: $rownum\n"; 459 460 $imageList = locate_images_for_row($ipprc, $image_db, $camera, $row, $verbose); 461 462 my $dtime_locate = gettimeofday() - $start_locate; 463 print "Time to locate_images for row $rownum $dtime_locate\n"; 464 465 my @rowList = ($row); 466 $num_jobs += queueJobs($action, \@rowList, $imageList); 467 468 # if this row slipped through without a job being added add one. 469 if ($row->{job_num} == 0) { 470 print "row $row->{ROWNUM} produced no jobs\n"; 471 print STDERR "row $row->{ROWNUM} produced no jobs\n"; 472 my $error_code = $row->{error_code}; 473 $error_code = $PSTAMP_NO_IMAGE_MATCH if !$error_code; 474 insertFakeJobForRow($row, ++$row->{job_num}, $error_code); 475 } 476 394 477 return $num_jobs; 395 478 } … … 401 484 402 485 if ($action eq 'LIST') { 486 # LIST is not allowed by caller. Can't get here. 403 487 return list_targets($rowList); 404 488 } … … 420 504 } 421 505 my $req_type = $row->{REQ_TYPE}; 422 $stage= $row->{IMG_TYPE};506 my $stage = $row->{IMG_TYPE}; 423 507 my $id = $row->{ID}; 424 508 my $component = $row->{COMPONENT}; … … 436 520 my $image_db = $proj_hash->{dbname}; 437 521 my $camera = $proj_hash->{camera}; 438 $need_magic = $proj_hash->{need_magic};522 my $need_magic = $proj_hash->{need_magic}; 439 523 # Since user can get unmagicked data "by coordinate" requests can go back in time 440 524 # to dredge unusable data from the "dark days"... … … 496 580 # information required is contained there 497 581 498 $imageList = locate_images($ipprc, $image_db, \@rowList, $req_type, $stage, $id, $tess_id, $component,582 $imageList = locate_images($ipprc, $image_db, $rowList, $req_type, $stage, $id, $tess_id, $component, 499 583 $option_mask, $need_magic, $mjd_min, $mjd_max, $filter, $data_group, $verbose); 500 584 … … 506 590 $row->{need_magic} = $need_magic; 507 591 508 $num_jobs += queueJobs($ mode, \@rowList, $imageList);592 $num_jobs += queueJobs($action, $rowList, $imageList); 509 593 510 594 # if a row slipped through with no jobs add a faulted one 511 foreach my $row (@ rowList) {595 foreach my $row (@$rowList) { 512 596 if ($row->{job_num} == 0) { 513 597 print "row $row->{ROWNUM} produced no jobs\n"; … … 528 612 my $image = shift; 529 613 my $need_magic = shift; 530 my $ mode= shift;614 my $action = shift; 531 615 532 616 my $rownum = $row->{ROWNUM}; … … 611 695 write_params($output_base, $image); 612 696 613 my $newState = "run";697 my $newState = $action eq 'PROCESS' ? "run" : "parsed"; 614 698 my $fault = 0; 615 699 my $dep_id; 616 700 617 queueUpdatesIfNeeded($ stage, $image, $option_mask, \$newState, \$fault, \$dep_id);701 queueUpdatesIfNeeded($action, $stage, $image, $option_mask, \$newState, \$fault, \$dep_id); 618 702 619 703 my $command = "$pstamptool -addjob -req_id $req_id -job_type $row->{JOB_TYPE}" … … 644 728 sub queueJobs 645 729 { 646 my $ mode= shift;730 my $action = shift; 647 731 my $rowList = shift; 648 732 my $imageList = shift; 649 733 650 my $firstRow = $rowList [0];734 my $firstRow = $rowList->[0]; 651 735 my $stage = $firstRow->{IMG_TYPE}; 652 736 my $job_type = $firstRow->{JOB_TYPE}; … … 656 740 657 741 if ($mode eq "list_uri") { 742 $num_jobs = $imageList ? scalar @$imageList : 0; 743 print "List of $num_jobs Images selected for row: $firstRow->{ROWNUM}\n"; 658 744 foreach my $image (@$imageList) { 659 745 print "$image->{image}\n"; 746 ++$firstRow->{job_num}; 660 747 } 661 748 } elsif ($job_type eq "get_image") { … … 664 751 my_die( "error: unexpected number of rows for get_image request: $n", $PS_EXIT_PROG_ERROR) if $n != 1; 665 752 666 $num_jobs = queueGetImageJobs($firstRow, $imageList, $stage, $need_magic, $ mode);753 $num_jobs = queueGetImageJobs($firstRow, $imageList, $stage, $need_magic, $action); 667 754 668 755 } else { … … 692 779 my $row = $rowList->[$i]; 693 780 694 $num_jobs += queueJobForImage($row, $stage, $image, $need_magic, $ mode);781 $num_jobs += queueJobForImage($row, $stage, $image, $need_magic, $action); 695 782 } 696 783 } … … 706 793 my $stage = shift; 707 794 my $need_magic = shift; 708 my $ mode= shift;795 my $action = shift; 709 796 710 797 my $num_jobs = 0; … … 753 840 write_params($output_base, $image); 754 841 755 my $newState = "run";842 my $newState = $action eq 'PROCESS' ? "run" : "parsed"; 756 843 my $fault = 0; 757 844 my $dep_id; 758 845 759 queueUpdatesIfNeeded($ stage, $image, $option_mask, \$newState, \$fault, \$dep_id);846 queueUpdatesIfNeeded($action, $stage, $image, $option_mask, \$newState, \$fault, \$dep_id); 760 847 761 848 $num_jobs++; … … 899 986 sub get_dependent 900 987 { 901 my ($ r_jobState, $r_fault, $r_dep_id, $imagedb, $state, $stage, $stage_id, $component, $need_magic) = @_;988 my ($action, $r_jobState, $r_fault, $r_dep_id, $imagedb, $state, $stage, $stage_id, $component, $need_magic) = @_; 902 989 903 990 # chipRun's can be in full state if destreaking is necessary … … 918 1005 my $command = "$pstamptool -getdependent -stage $stage -stage_id $stage_id -imagedb $imagedb -component $component -outdir $outdir"; 919 1006 $command .= " -need_magic" if $need_magic; 920 921 # compute rlabel for the run. 922 # XXX: This bit of policy shouldn't be buried so deeply in the code 923 # For now use one that implies 'postage stamp server' 'update' 'request_label" 924 my $rlabel = "ps_ud_" . $label if $label; 925 $command .= " -rlabel $rlabel" if $rlabel; 1007 $command .= ' -hold' if $action eq 'PREVIEW'; 1008 1009 if ($label) { 1010 # compute rlabel for the run. 1011 # XXX: This bit of policy shouldn't be buried so deeply in the code 1012 # For now use one that implies 'postage stamp server' 'update' 'request_label" 1013 my $rlabel = "ps_ud_" . $label; 1014 $command .= " -rlabel $rlabel"; 1015 } 926 1016 927 1017 if (!$no_update) { … … 931 1021 my $fault = $error_code >> 8; 932 1022 print STDERR "$command failed with fault $fault\n"; 933 if ($fault < 10) {1023 if ($fault < $PSTAMP_FIRST_ERROR_CODE) { 934 1024 # pstamptool returns an error if an existing depenent is faulted 935 # Set the object to not available even if the fault < 101025 # Set the object to not available even if the fault < $PSTAMP_FIRST_ERROR_CODE 936 1026 # which is nominally a recoverable error in order to keep 937 1027 # the request from faulting (which can be very expensive if … … 939 1029 $fault = $PSTAMP_NOT_AVAILABLE 940 1030 } 941 if ($fault >= 10) {1031 if ($fault >= $PSTAMP_FIRST_ERROR_CODE) { 942 1032 $$r_dep_id = 0; 943 1033 $$r_fault = $fault; … … 967 1057 968 1058 sub queueUpdatesIfNeeded { 1059 my $action = shift; 969 1060 my $stage = shift; 970 1061 my $image = shift; … … 973 1064 my $r_fault = shift; 974 1065 my $r_dep_id = shift; 1066 1067 my $need_magic = 0; 975 1068 976 1069 if ($stage ne 'raw') { … … 1016 1109 # set up to queue an update run 1017 1110 my $require_magic = ($need_magic or $image->{magicked}); 1018 get_dependent( \$$r_newState, \$$r_fault, $r_dep_id, $image->{imagedb},1111 get_dependent($action, \$$r_newState, \$$r_fault, $r_dep_id, $image->{imagedb}, 1019 1112 $run_state, $stage, $image->{stage_id}, $image->{component}, $require_magic ); 1020 1113 } … … 1070 1163 my $fault = shift; 1071 1164 1072 carp$msg;1165 print STDERR $msg; 1073 1166 1074 1167 # we don't fault the request here pstamp_parser_run.pl handles that if necessary -
branches/eam_branches/ipp-20130307/pstamp/src/ppstampParseCamera.c
r34596 r35412 95 95 } 96 96 97 98 // XXX: create a filerule for PPSTAMP.ASTROM99 97 pmFPAfile *astrom = pmFPAfileDefineFromArgs(&status, config, "PSWARP.ASTROM", "ASTROM"); 100 98 if (!status) { … … 103 101 } 104 102 if (astrom) { 105 psLogMsg ("ppstamp", 3, " using supplied astrometry\n");103 psLogMsg ("ppstamp", 3, "Using supplied astrometry\n"); 106 104 } else { 107 psLogMsg ("ppstamp", 3, " using header astrometry\n");105 psLogMsg ("ppstamp", 3, "Using header astrometry\n"); 108 106 } 109 110 #ifdef notyet111 // add recipe options supplied on command line112 psMetadata *recipe = psMetadataLookupPtr (&status, config->recipes, RECIPE_NAME);113 #endif114 107 115 108 // Set up the output target … … 138 131 } 139 132 } else { 140 psLogMsg ("ppstamp", PS_LOG_INFO, "output sources file requested but no input supplied. Will try the supplied astrometry file.\n"); 133 psLogMsg ("ppstamp", PS_LOG_INFO, "Output sources file requested but no -sources supplied.\n"); 134 psLogMsg ("ppstamp", PS_LOG_INFO, "Will use the sources in the supplied astrometry file.\n"); 141 135 } 142 136 -
branches/eam_branches/ipp-20130307/tools/heathers_plots/heathers_plots.py
r35198 r35412 1 #!/usr/ bin env python1 #!/usr/local/bin/python2.7 2 2 3 3 """ … … 10 10 import numpy as np 11 11 import matplotlib as mpl 12 mpl.use('Agg') 12 13 import matplotlib.pyplot as plt 13 14 import pylab … … 24 25 IMAGES_DIRECTORY = "/data/ipp009.0/czartool_plots/heathers_plots" 25 26 CAM_WEB_FILENAME = "/data/ipp009.0/czartool_plots/heathers_plots/cam.png" 27 CAM_MERGED_WEB_FILENAME = "/data/ipp009.0/czartool_plots/heathers_plots/cam_merged.png" 26 28 SKYCAL_WEB_FILENAME = "/data/ipp009.0/czartool_plots/heathers_plots/skycal.png" 29 SKYCAL_MERGED_WEB_FILENAME = "/data/ipp009.0/czartool_plots/heathers_plots/skycal_merged.png" 27 30 28 31 def __init__(self): … … 37 40 WHERE stage = 'cam' and addRun.dvodb = 'LAP.20120706' 38 41 """ 42 43 CAM_MERGED_STATEMENT = """SELECT ra, decl, mergedvodbRun.state, mergedvodbProcessed.fault 44 FROM mergedvodbRun 45 LEFT JOIN mergedvodbProcessed USING(merge_id) 46 LEFT JOIN minidvodbRun USING(minidvodb_id) 47 LEFT JOIN addRun USING(minidvodb_name) 48 LEFT JOIN addProcessedExp USING(add_id) 49 JOIN camRun ON stage_id = cam_id 50 JOIN chipRun USING(chip_id) 51 JOIN rawExp USING(exp_id) 52 WHERE stage = 'cam' AND mergedvodbRun.mergedvodb = 'LAP.20120706' 53 """ 54 39 55 SKYCAL_STATEMENT = """SELECT radeg*3.1415927/180., decdeg*3.1415927/180., addRun.state, addProcessedExp.fault 40 56 FROM addRun … … 48 64 WHERE stage = 'skycal' AND addRun.dvodb = 'LAP.20120706' 49 65 """ 66 67 SKYCAL_MERGED_STATEMENT = """SELECT radeg*3.1415927/180., decdeg*3.1415927/180., mergedvodbRun.state, mergedvodbProcessed.fault 68 FROM mergedvodbRun 69 LEFT JOIN mergedvodbProcessed USING(merge_id) 70 LEFT JOIN minidvodbRun USING(minidvodb_id) 71 LEFT JOIN addRun USING(minidvodb_name) 72 LEFT JOIN addProcessedExp USING(add_id) 73 JOIN skycalRun ON skycal_id = stage_id 74 JOIN skycalResult USING(skycal_id) 75 JOIN staticskyInput USING(sky_id, stack_id) 76 JOIN staticskyRun USING (sky_id) 77 JOIN stackRun using (stack_id) 78 JOIN skycell using (tess_id, skycell_id) 79 WHERE stage = 'skycal' AND addRun.dvodb = 'LAP.20120706'""" 50 80 51 81 def fetch_data(self, statement): … … 95 125 try: 96 126 os.unlink(web_filename) 97 except OSError : # No such file or directory98 p ass127 except OSError, e: # No such file or directory 128 print e 99 129 os.symlink(new_filename, web_filename) 100 130 … … 115 145 self.relink_webfiles(HeathersPlot.CAM_WEB_FILENAME, new_filename) 116 146 147 def update_cam_merged_plot(self): 148 HeathersPlot.mkdir(HeathersPlot.IMAGES_DIRECTORY) 149 (ras, decs, states) = self.fetch_data(HeathersPlot.CAM_MERGED_STATEMENT) 150 new_filename = self.plot(ras, decs, states, 'Camera_Merged') 151 self.relink_webfiles(HeathersPlot.CAM_MERGED_WEB_FILENAME, new_filename) 152 117 153 def update_skycal_plot(self): 118 154 HeathersPlot.mkdir(HeathersPlot.IMAGES_DIRECTORY) … … 121 157 self.relink_webfiles(HeathersPlot.SKYCAL_WEB_FILENAME, new_filename) 122 158 159 def update_skycal_merged_plot(self): 160 HeathersPlot.mkdir(HeathersPlot.IMAGES_DIRECTORY) 161 (ras, decs, states) = self.fetch_data(HeathersPlot.SKYCAL_MERGED_STATEMENT) 162 new_filename = self.plot(ras, decs, states, 'SkyCal_Merged') 163 self.relink_webfiles(HeathersPlot.SKYCAL_MERGED_WEB_FILENAME, new_filename) 164 123 165 if __name__ == "__main__": 124 166 hp = HeathersPlot() 125 167 hp.update_cam_plot() 126 168 hp.update_skycal_plot() 169 hp.update_cam_merged_plot() 170 hp.update_skycal_merged_plot()
Note:
See TracChangeset
for help on using the changeset viewer.
