Changeset 31253
- Timestamp:
- Apr 8, 2011, 6:31:08 PM (15 years ago)
- Location:
- branches/czw_branch/20110406
- Files:
-
- 48 edited
- 4 copied
-
. (modified) (1 prop)
-
Ohana/src/addstar/include/skycells.h (modified) (1 diff)
-
Ohana/src/addstar/src/args_skycells.c (modified) (2 diffs)
-
Ohana/src/addstar/src/sky_tessalation.c (modified) (5 diffs)
-
Ohana/src/getstar/include/dvoImagesAtCoords.h (modified) (2 diffs)
-
Ohana/src/getstar/src/MatchCoords.c (modified) (1 diff)
-
Ohana/src/getstar/src/args_coords.c (modified) (1 diff)
-
Ohana/src/getstar/src/dvoImagesAtCoords.c (modified) (4 diffs)
-
ippScripts/scripts/ipp_apply_burntool_single.pl (modified) (1 prop)
-
ippScripts/scripts/stack_skycell.pl (modified) (2 diffs)
-
ippScripts/scripts/staticsky.pl (modified) (3 diffs)
-
ippToPsps/jython/batch.py (modified) (24 diffs)
-
ippToPsps/jython/config.xml (modified) (1 diff)
-
ippToPsps/jython/datastore.py (copied) (copied from trunk/ippToPsps/jython/datastore.py )
-
ippToPsps/jython/gpc1db.py (modified) (5 diffs)
-
ippToPsps/jython/initbatch.py (modified) (2 diffs)
-
ippToPsps/jython/ipptopspsdb.py (modified) (6 diffs)
-
ippToPsps/jython/logging.conf (copied) (copied from trunk/ippToPsps/jython/logging.conf )
-
ippToPsps/jython/stackbatch.py (modified) (14 diffs)
-
ippTools/share/Makefile.am (modified) (1 diff)
-
ippTools/share/difftool_listrun.sql (modified) (3 diffs)
-
ippTools/share/difftool_skyfile.sql (modified) (2 diffs)
-
ippTools/share/disttool_definebyquery_raw_no_magic.sql (copied) (copied from trunk/ippTools/share/disttool_definebyquery_raw_no_magic.sql )
-
ippTools/share/disttool_pending_SSdiff.sql (modified) (1 diff)
-
ippTools/share/disttool_pending_camera.sql (modified) (1 diff)
-
ippTools/share/disttool_pending_chip.sql (modified) (1 diff)
-
ippTools/share/disttool_pending_chip_bg.sql (modified) (1 diff)
-
ippTools/share/disttool_pending_diff.sql (modified) (1 diff)
-
ippTools/share/disttool_pending_fake.sql (modified) (1 diff)
-
ippTools/share/disttool_pending_raw.sql (modified) (6 diffs)
-
ippTools/share/disttool_pending_sky.sql (modified) (1 diff)
-
ippTools/share/disttool_pending_stack.sql (modified) (1 diff)
-
ippTools/share/disttool_pending_warp.sql (modified) (1 diff)
-
ippTools/share/disttool_pending_warp_bg.sql (modified) (1 diff)
-
ippTools/src/difftool.c (modified) (1 diff)
-
ippTools/src/difftoolConfig.c (modified) (1 diff)
-
ippTools/src/stacktool.c (modified) (1 diff)
-
ippTools/src/staticskytool.c (modified) (1 diff)
-
ippTools/src/staticskytoolConfig.c (modified) (1 diff)
-
ippconfig/recipes/nightly_science.config (modified) (1 diff)
-
ippconfig/recipes/ppStack.config (modified) (1 diff)
-
ippconfig/recipes/psphot.config (modified) (1 diff)
-
ippconfig/recipes/reductionClasses.mdc (modified) (2 diffs, 1 prop)
-
ppSub/src/ppSub.c (modified) (1 diff)
-
psModules/src/camera/pmFPAWrite.c (modified) (4 diffs)
-
tools/mysql-dump (modified) (1 prop)
-
tools/mysql-dump/gpc1_dump.sh (modified) (2 diffs)
-
tools/mysql-dump/gpc1_install.sh (modified) (4 diffs)
-
tools/mysql-dump/msg (copied) (copied from trunk/tools/mysql-dump/msg )
-
tools/mysql-dump/neb_dump.sh (modified) (2 diffs)
-
tools/mysql-dump/ops_dump.csh (modified) (5 diffs)
-
tools/runcameraexp.pl (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/czw_branch/20110406
- Property svn:mergeinfo changed
/trunk (added) merged: 31218,31220-31231,31234-31240,31242-31244,31246-31251
- Property svn:mergeinfo changed
-
branches/czw_branch/20110406/Ohana/src/addstar/include/skycells.h
r31027 r31253 65 65 int NMAX; 66 66 int NX_SUB, NY_SUB; 67 int X_PARITY; 67 68 double SCALE; 68 69 double PADDING; -
branches/czw_branch/20110406/Ohana/src/addstar/src/args_skycells.c
r31177 r31253 188 188 remove_argument (N, &argc, argv); 189 189 OVERLAP_DEC = atof (argv[N]); 190 remove_argument (N, &argc, argv); 191 } 192 X_PARITY = 1; 193 if ((N = get_argument (argc, argv, "-skyparity"))) { 194 X_PARITY = -1; 190 195 remove_argument (N, &argc, argv); 191 196 } … … 224 229 fprintf (stderr, " -nx Nx : subdivide skycell projection in x by Nx\n"); 225 230 fprintf (stderr, " -ny Ny : subdivide skycell projection in y by Ny\n"); 231 fprintf (stderr, " -overlap Or Od : overlap between skycells (arcseconds)\n"); 226 232 fprintf (stderr, " -projection-number Np : set projection-number (local mode only)\n"); 233 fprintf (stderr, " -skyparity : set wcs for skycells so that east is to the left\n"); 227 234 fprintf (stderr, " -help : this list\n"); 228 235 fprintf (stderr, " -h : this list\n\n"); -
branches/czw_branch/20110406/Ohana/src/addstar/src/sky_tessalation.c
r31027 r31253 318 318 memset (image, 0, sizeof(Image)); 319 319 image[0].coords = *refcoords; 320 image[0].coords.pc1_1 = image[0].coords.pc2_2 = 1.0; 320 image[0].coords.pc1_1 = 1.0 * X_PARITY; 321 image[0].coords.pc2_2 = 1.0; 321 322 image[0].coords.pc1_2 = image[0].coords.pc2_1 = 0.0; 322 323 … … 468 469 469 470 if (FIX_NS) { 470 rectangle[0].coords.pc1_1 = +1.0 ;471 rectangle[0].coords.pc1_1 = +1.0 * X_PARITY; 471 472 rectangle[0].coords.pc1_2 = +0.0; 472 473 rectangle[0].coords.pc2_1 = -0.0; … … 475 476 ycr = yc*cos(angle) + xc*sin(angle); 476 477 } else { 477 rectangle[0].coords.pc1_1 = +cos(angle) ;478 rectangle[0].coords.pc1_1 = +cos(angle) * X_PARITY; 478 479 rectangle[0].coords.pc1_2 = +sin(angle); 479 rectangle[0].coords.pc2_1 = -sin(angle) ;480 rectangle[0].coords.pc2_1 = -sin(angle) * X_PARITY; 480 481 rectangle[0].coords.pc2_2 = +cos(angle); 481 482 xcr = xc; … … 514 515 angle = 0.0; 515 516 if (FIX_NS) { 516 rectangle[0].coords.pc1_1 = +1.0 ;517 rectangle[0].coords.pc1_1 = +1.0 * X_PARITY; 517 518 rectangle[0].coords.pc1_2 = +0.0; 518 519 rectangle[0].coords.pc2_1 = -0.0; 519 520 rectangle[0].coords.pc2_2 = +1.0; 520 521 } else { 521 rectangle[0].coords.pc1_1 = +cos(angle) ;522 rectangle[0].coords.pc1_1 = +cos(angle) * X_PARITY; 522 523 rectangle[0].coords.pc1_2 = +sin(angle); 523 rectangle[0].coords.pc2_1 = -sin(angle) ;524 rectangle[0].coords.pc2_1 = -sin(angle) * X_PARITY; 524 525 rectangle[0].coords.pc2_2 = +cos(angle); 525 526 } … … 626 627 ring[i].coords.crval2 = dec; 627 628 628 ring[i].coords.pc1_1 = +1.0 ;629 ring[i].coords.pc1_1 = +1.0 * X_PARITY; 629 630 ring[i].coords.pc1_2 = +0.0; 630 631 ring[i].coords.pc2_1 = -0.0; -
branches/czw_branch/20110406/Ohana/src/getstar/include/dvoImagesAtCoords.h
r27435 r31253 7 7 8 8 int VERBOSE; 9 int LISTCHIPCOORDS; 9 10 10 11 char OUTPUT[256]; … … 19 20 20 21 typedef struct { 22 int n; 23 double x; 24 double y; 25 } Match; 26 27 typedef struct { 21 28 int id; 22 29 double ra; 23 30 double dec; 24 31 int Nmatches; 25 int*matches;32 Match *matches; 26 33 int arrayLength; 27 34 } Point; -
branches/czw_branch/20110406/Ohana/src/getstar/src/MatchCoords.c
r30791 r31253 93 93 totalMatches++; 94 94 95 pt->matches[pt->Nmatches] = i; 95 pt->matches[pt->Nmatches].n = i; 96 pt->matches[pt->Nmatches].x = x; 97 pt->matches[pt->Nmatches].y = y; 96 98 pt->Nmatches ++; 97 99 98 100 if (pt->Nmatches == pt->arrayLength) { 99 101 pt->arrayLength += 20; 100 REALLOCATE (pt->matches, int, pt->arrayLength);102 REALLOCATE (pt->matches, Match, pt->arrayLength); 101 103 } 102 104 } -
branches/czw_branch/20110406/Ohana/src/getstar/src/args_coords.c
r26288 r31253 41 41 42 42 /* check for command line options */ 43 LISTCHIPCOORDS = FALSE; 44 if ((N = get_argument (argc, argv, "-listchipcoords"))) { 45 LISTCHIPCOORDS = TRUE; 46 remove_argument (N, &argc, argv); 47 } 43 48 WITH_PHU = FALSE; 44 49 if ((N = get_argument (argc, argv, "+phu"))) { -
branches/czw_branch/20110406/Ohana/src/getstar/src/dvoImagesAtCoords.c
r29001 r31253 91 91 while ((Nread = fscanf(f, "%d %lf %lf\n", &pts[Npoints].id, &pts[Npoints].ra, &pts[Npoints].dec)) == 3) { 92 92 pts[Npoints].Nmatches = 0; 93 ALLOCATE(pts[Npoints].matches, int, 20);93 ALLOCATE(pts[Npoints].matches, Match, 20); 94 94 pts[Npoints].arrayLength = 20; 95 95 … … 118 118 pts[0].dec = dec; 119 119 pts[0].Nmatches = 0; 120 ALLOCATE(pts[0].matches, int, 20);120 ALLOCATE(pts[0].matches, Match, 20); 121 121 pts[0].arrayLength = 20; 122 122 … … 133 133 Point *pt = points + j; 134 134 for (i = 0; i < pt->Nmatches; i++) { 135 int N = pt->matches[i]; 135 int N = pt->matches[i].n; 136 double x = pt->matches[i].x; 137 double y = pt->matches[i].y; 136 138 137 139 char *name; … … 150 152 name = dbImages[N].name; 151 153 } 152 fprintf (stdout, "%d %lf %lf %s\n", pt->id, pt->ra, pt->dec, name); 154 if (LISTCHIPCOORDS) { 155 fprintf (stdout, "%d %lf %lf %s %8.2lf %8.2lf\n", pt->id, pt->ra, pt->dec, name, x, y); 156 } else { 157 fprintf (stdout, "%d %lf %lf %s\n", pt->id, pt->ra, pt->dec, name); 158 } 153 159 if (copy) { 154 160 free(copy); -
branches/czw_branch/20110406/ippScripts/scripts/ipp_apply_burntool_single.pl
- Property svn:mergeinfo changed (with no actual effect on merging)
-
branches/czw_branch/20110406/ippScripts/scripts/stack_skycell.pl
r30842 r31253 73 73 PPSTACK.OUTPUT.EXPNUM 74 74 PPSTACK.OUTPUT.EXPWT 75 PPSTACK.TARGET.PSF76 75 PPSTACK.OUTPUT.JPEG1 77 76 PPSTACK.OUTPUT.JPEG2 … … 84 83 # extra outputs when convolving 85 84 my @outputListUnconv = qw( 85 PPSTACK.TARGET.PSF 86 86 PPSTACK.UNCONV 87 87 PPSTACK.UNCONV.MASK -
branches/czw_branch/20110406/ippScripts/scripts/staticsky.pl
r31164 r31253 32 32 my $staticskytool = can_run('staticskytool') or (warn "Can't find staticskytool" and $missing_tools = 1); 33 33 my $psphotStack = can_run('psphotStack') or (warn "Can't find psphotStack" and $missing_tools = 1); 34 my $psphot = can_run('psphot') or (warn "Can't find psphot" and $missing_tools = 1); 34 35 my $ppStatsFromMetadata = can_run('ppStatsFromMetadata') or (warn "Can't find ppStatsFromMetadata" and $missing_tools = 1); 36 my $ppConfigDump = can_run('ppConfigDump') or (warn "Can't find ppConfigDump" and $missing_tools = 1); 35 37 if ($missing_tools) { 36 38 warn("Can't find required tools."); … … 96 98 } 97 99 98 # generate the input99 print $listFile "INPUT MULTI\n";100 my $nInputs = @$files;101 102 my $configuration = $ipprc->filename("PSPHOT.STACK.CONFIG", $outroot);103 104 foreach my $file (@$files) {105 print $listFile "INPUT METADATA\n";106 107 # XXX if we take the input from 'warp', we will need to make different selections here108 my $path_base = $file->{path_base};109 print "input: $path_base\n";110 111 my $imageCnv = $ipprc->filename("PPSTACK.OUTPUT", $path_base ); # Image name112 my $maskCnv = $ipprc->filename("PPSTACK.OUTPUT.MASK", $path_base ); # Mask name113 my $weightCnv = $ipprc->filename("PPSTACK.OUTPUT.VARIANCE", $path_base ); # Weight name114 115 my $imageRaw = $ipprc->filename("PPSTACK.UNCONV", $path_base ); # Image name116 my $maskRaw = $ipprc->filename("PPSTACK.UNCONV.MASK", $path_base ); # Mask name117 my $weightRaw = $ipprc->filename("PPSTACK.UNCONV.VARIANCE", $path_base ); # Weight name118 119 my $sources = $ipprc->filename("PSPHOT.OUT.CMF.MEF", $path_base ); # Sources name120 121 # XXX is this the correct PSF file?122 my $psfCnv = $ipprc->filename("PPSTACK.TARGET.PSF", $path_base ); # PSF name123 124 # XXX we could make some different choices if some inputs do not exist...125 &my_die("Couldn't find input: $imageRaw", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$imageRaw");126 &my_die("Couldn't find input: $maskRaw", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$maskRaw");127 &my_die("Couldn't find input: $weightRaw", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$weightRaw");128 &my_die("Couldn't find input: $imageCnv", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$imageCnv");129 &my_die("Couldn't find input: $maskCnv", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$maskCnv");130 &my_die("Couldn't find input: $weightCnv", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$weightCnv");131 &my_die("Couldn't find input: $psfCnv", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$psfCnv");132 &my_die("Couldn't find input: $sources", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$sources");133 134 print $listFile " RAW:IMAGE STR " . $imageRaw . "\n";135 print $listFile " RAW:MASK STR " . $maskRaw . "\n";136 print $listFile " RAW:VARIANCE STR " . $weightRaw . "\n";137 138 print $listFile " CNV:IMAGE STR " . $imageCnv . "\n";139 print $listFile " CNV:MASK STR " . $maskCnv . "\n";140 print $listFile " CNV:VARIANCE STR " . $weightCnv . "\n";141 print $listFile " CNV:PSF STR " . $psfCnv . "\n";142 143 print $listFile " SOURCES STR " . $sources . "\n";144 145 print $listFile "END\n\n";146 }147 148 100 # Recipes to use based on reduction class 149 101 $reduction = 'DEFAULT' unless defined $reduction; … … 160 112 print "recipe_ppstack: $recipe_ppstack\n"; 161 113 162 # my $cmdflags; 163 164 # Perform stack photometry analysis 165 { 166 my $command = "$psphotStack $outroot"; 167 $command .= " -input $listName"; 168 $command .= " -threads $threads" if defined $threads; 169 $command .= " -recipe PSPHOT $recipe_psphot"; 170 $command .= " -recipe PPSUB $recipe_ppsub"; 171 $command .= " -recipe PPSTACK $recipe_ppstack"; 172 $command .= " -dumpconfig $configuration"; 173 $command .= " -tracedest $traceDest -log $logDest"; 174 # $command .= " -dbname $dbname" if defined $dbname; 175 # $command .= " -image_id $diff_skyfile_id" if defined $diff_skyfile_id; 176 # $command .= " -source_id $source_id" if defined $source_id; 177 178 unless ($no_op) { 179 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 180 unless ($success) { 181 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 182 &my_die("Unable to perform psphotStack: $error_code", $sky_id, $error_code); 183 } 184 185 # my $outputStatsReal = $ipprc->file_resolve($outputStats); 186 # &my_die("Couldn't find expected output file: $outputStats", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStatsReal); 187 188 # measure chip stats 189 # $command = "$ppStatsFromMetadata $outputStatsReal - DIFF_SKYCELL"; 190 # ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 191 # run(command => $command, verbose => $verbose); 192 # unless ($success) { 193 # $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 194 # &my_die("Unable to perform ppStatsFromMetadata: $error_code", $sky_id, $error_code); 195 # } 196 # foreach my $line (@$stdout_buf) { 197 # $cmdflags .= " $line"; 198 # } 199 # chomp $cmdflags; 200 201 # my ($quality) = $cmdflags =~ /-quality (\d+)/; # Quality flag 202 203 my $quality = 0; 204 if (!$quality) { 205 206 # Get the output filenames 207 # we have one set of output files per input file set 208 for (my $i = 0; $i < @$files; $i++) { 209 my $outputName = $ipprc->filename("PSPHOT.STACK.OUTPUT.IMAGE", $outroot, $i); 210 my $outputMask = $ipprc->filename("PSPHOT.STACK.OUTPUT.MASK", $outroot, $i); 211 my $outputVariance = $ipprc->filename("PSPHOT.STACK.OUTPUT.VARIANCE", $outroot, $i); 212 my $outputSources = $ipprc->filename("PSPHOT.STACK.OUTPUT", $outroot, $i); 213 214 # XXX these are optional and not generated by default 215 # &my_die("Couldn't find expected output file: $outputName", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputName); 216 # &my_die("Couldn't find expected output file: $outputMask", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask); 217 # &my_die("Couldn't find expected output file: $outputVariance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputVariance); 218 &my_die("Couldn't find expected output file: $outputSources", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources); 219 } 220 221 #my $configuration = $ipprc->filename("PPSUB.CONFIG", $outroot); 222 #my $outputStats = $ipprc->filename("SKYCELL.STATS", $outroot); 223 #my $traceDest = $ipprc->filename("TRACE.EXP", $outroot); 224 225 my $chisqName = $ipprc->filename("PSPHOT.CHISQ.IMAGE", $outroot); 226 my $chisqMask = $ipprc->filename("PSPHOT.CHISQ.MASK", $outroot); 227 my $chisqVariance = $ipprc->filename("PSPHOT.CHISQ.VARIANCE", $outroot); 228 229 # XXX check the recipe -- should we expect these to exist? 230 # &my_die("Couldn't find expected output file: $chisqName", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqName); 231 # &my_die("Couldn't find expected output file: $chisqMask", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqMask); 232 # &my_die("Couldn't find expected output file: $chisqVariance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqVariance); 233 } 234 } else { 235 print "Not executing: $command\n"; 236 } 114 115 # generate the input 116 print $listFile "INPUT MULTI\n"; 117 my $nInputs = @$files; 118 119 if ($nInputs > 1) { 120 my $configuration = $ipprc->filename("PSPHOT.STACK.CONFIG", $outroot); 121 122 foreach my $file (@$files) { 123 print $listFile "INPUT METADATA\n"; 124 125 # XXX if we take the input from 'warp', we will need to make different selections here 126 my $path_base = $file->{path_base}; 127 print "input: $path_base\n"; 128 129 my $imageCnv = $ipprc->filename("PPSTACK.OUTPUT", $path_base ); # Image name 130 my $maskCnv = $ipprc->filename("PPSTACK.OUTPUT.MASK", $path_base ); # Mask name 131 my $weightCnv = $ipprc->filename("PPSTACK.OUTPUT.VARIANCE", $path_base ); # Weight name 132 133 my $imageRaw = $ipprc->filename("PPSTACK.UNCONV", $path_base ); # Image name 134 my $maskRaw = $ipprc->filename("PPSTACK.UNCONV.MASK", $path_base ); # Mask name 135 my $weightRaw = $ipprc->filename("PPSTACK.UNCONV.VARIANCE", $path_base ); # Weight name 136 137 my $sources = $ipprc->filename("PSPHOT.OUT.CMF.MEF", $path_base ); # Sources name 138 139 # XXX is this the correct PSF file? 140 my $psfCnv = $ipprc->filename("PPSTACK.TARGET.PSF", $path_base ); # PSF name 141 142 # XXX we could make some different choices if some inputs do not exist... 143 &my_die("Couldn't find input: $imageRaw", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$imageRaw"); 144 &my_die("Couldn't find input: $maskRaw", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$maskRaw"); 145 &my_die("Couldn't find input: $weightRaw", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$weightRaw"); 146 &my_die("Couldn't find input: $imageCnv", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$imageCnv"); 147 &my_die("Couldn't find input: $maskCnv", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$maskCnv"); 148 &my_die("Couldn't find input: $weightCnv", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$weightCnv"); 149 &my_die("Couldn't find input: $psfCnv", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$psfCnv"); 150 &my_die("Couldn't find input: $sources", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$sources"); 151 152 print $listFile " RAW:IMAGE STR " . $imageRaw . "\n"; 153 print $listFile " RAW:MASK STR " . $maskRaw . "\n"; 154 print $listFile " RAW:VARIANCE STR " . $weightRaw . "\n"; 155 156 print $listFile " CNV:IMAGE STR " . $imageCnv . "\n"; 157 print $listFile " CNV:MASK STR " . $maskCnv . "\n"; 158 print $listFile " CNV:VARIANCE STR " . $weightCnv . "\n"; 159 print $listFile " CNV:PSF STR " . $psfCnv . "\n"; 160 161 print $listFile " SOURCES STR " . $sources . "\n"; 162 163 print $listFile "END\n\n"; 164 } 165 166 # my $cmdflags; 167 168 # Perform stack photometry analysis 169 { 170 my $command = "$psphotStack $outroot"; 171 $command .= " -input $listName"; 172 $command .= " -threads $threads" if defined $threads; 173 $command .= " -recipe PSPHOT $recipe_psphot"; 174 $command .= " -recipe PPSUB $recipe_ppsub"; 175 $command .= " -recipe PPSTACK $recipe_ppstack"; 176 $command .= " -dumpconfig $configuration"; 177 $command .= " -tracedest $traceDest -log $logDest"; 178 # $command .= " -dbname $dbname" if defined $dbname; 179 # $command .= " -image_id $diff_skyfile_id" if defined $diff_skyfile_id; 180 # $command .= " -source_id $source_id" if defined $source_id; 181 182 unless ($no_op) { 183 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 184 unless ($success) { 185 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 186 &my_die("Unable to perform psphotStack: $error_code", $sky_id, $error_code); 187 } 188 189 # my $outputStatsReal = $ipprc->file_resolve($outputStats); 190 # &my_die("Couldn't find expected output file: $outputStats", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStatsReal); 191 192 # measure chip stats 193 # $command = "$ppStatsFromMetadata $outputStatsReal - DIFF_SKYCELL"; 194 # ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 195 # run(command => $command, verbose => $verbose); 196 # unless ($success) { 197 # $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 198 # &my_die("Unable to perform ppStatsFromMetadata: $error_code", $sky_id, $error_code); 199 # } 200 # foreach my $line (@$stdout_buf) { 201 # $cmdflags .= " $line"; 202 # } 203 # chomp $cmdflags; 204 205 # my ($quality) = $cmdflags =~ /-quality (\d+)/; # Quality flag 206 207 my $quality = 0; 208 if (!$quality) { 209 210 # Get the output filenames 211 # we have one set of output files per input file set 212 for (my $i = 0; $i < @$files; $i++) { 213 my $outputName = $ipprc->filename("PSPHOT.STACK.OUTPUT.IMAGE", $outroot, $i); 214 my $outputMask = $ipprc->filename("PSPHOT.STACK.OUTPUT.MASK", $outroot, $i); 215 my $outputVariance = $ipprc->filename("PSPHOT.STACK.OUTPUT.VARIANCE", $outroot, $i); 216 my $outputSources = $ipprc->filename("PSPHOT.STACK.OUTPUT", $outroot, $i); 217 218 # XXX these are optional and not generated by default 219 # &my_die("Couldn't find expected output file: $outputName", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputName); 220 # &my_die("Couldn't find expected output file: $outputMask", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask); 221 # &my_die("Couldn't find expected output file: $outputVariance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputVariance); 222 &my_die("Couldn't find expected output file: $outputSources", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources); 223 } 224 225 #my $configuration = $ipprc->filename("PPSUB.CONFIG", $outroot); 226 #my $outputStats = $ipprc->filename("SKYCELL.STATS", $outroot); 227 #my $traceDest = $ipprc->filename("TRACE.EXP", $outroot); 228 229 my $chisqName = $ipprc->filename("PSPHOT.CHISQ.IMAGE", $outroot); 230 my $chisqMask = $ipprc->filename("PSPHOT.CHISQ.MASK", $outroot); 231 my $chisqVariance = $ipprc->filename("PSPHOT.CHISQ.VARIANCE", $outroot); 232 233 # XXX check the recipe -- should we expect these to exist? 234 # &my_die("Couldn't find expected output file: $chisqName", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqName); 235 # &my_die("Couldn't find expected output file: $chisqMask", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqMask); 236 # &my_die("Couldn't find expected output file: $chisqVariance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqVariance); 237 } 238 } else { 239 print "Not executing: $command\n"; 240 } 241 } 242 } else { 243 # single input. Run psphot 244 my $configuration = $ipprc->filename("PSPHOT.STACK.CONFIG", $outroot); 245 246 my $file = $files->[0]; 247 248 # XXX if we take the input from 'warp', we will need to make different selections here 249 my $path_base = $file->{path_base}; 250 print "input: $path_base\n"; 251 252 # examine the recipe to determine whether to analyze the "raw" or convolved images 253 my $command = "$ppConfigDump -camera $camera -dump-recipe PSPHOT -recipe PSPHOT $recipe_psphot -"; 254 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 255 run(command => $command, verbose => 0); 256 unless ($success) { 257 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 258 &my_die("Unable to perform ppConfigDump: $error_code", $sky_id, $PS_EXIT_SYS_ERROR); 259 } 260 my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or 261 &my_die("Unable to parse metadata config doc", $sky_id, $PS_EXIT_SYS_ERROR); 262 263 my $use_raw = metadataLookupBool($recipeData, 'PSPHOT.STACK.USE.RAW'); 264 265 my ($image, $mask, $variance); 266 if ($use_raw) { 267 $image = $ipprc->filename("PPSTACK.UNCONV", $path_base ); # Image name 268 $mask = $ipprc->filename("PPSTACK.UNCONV.MASK", $path_base ); # Mask name 269 $variance = $ipprc->filename("PPSTACK.UNCONV.VARIANCE", $path_base ); # Weight name 270 } else { 271 $image = $ipprc->filename("PPSTACK.OUTPUT", $path_base ); # Image name 272 $mask = $ipprc->filename("PPSTACK.OUTPUT.MASK", $path_base ); # Mask name 273 $variance = $ipprc->filename("PPSTACK.OUTPUT.VARIANCE", $path_base ); # Weight name 274 } 275 276 my $sources = $ipprc->filename("PSPHOT.OUT.CMF.MEF", $path_base ); # Sources name 277 278 # XXX is this the correct PSF file? 279 my $psfCnv = $ipprc->filename("PPSTACK.TARGET.PSF", $path_base ); # PSF name 280 281 # XXX we could make some different choices if some inputs do not exist... 282 &my_die("Couldn't find input: $image", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$image"); 283 &my_die("Couldn't find input: $mask", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$mask"); 284 &my_die("Couldn't find input: $variance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$variance"); 285 &my_die("Couldn't find input: $psfCnv", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$psfCnv"); 286 &my_die("Couldn't find input: $sources", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists("$sources"); 287 288 # my $cmdflags; 289 290 # Perform stack photometry analysis 291 { 292 my $command = "$psphot $outroot"; 293 $command .= " -file $image"; 294 $command .= " -mask $mask"; 295 $command .= " -variance $variance"; 296 $command .= " -threads $threads" if defined $threads; 297 $command .= " -recipe PSPHOT $recipe_psphot"; 298 $command .= " -dumpconfig $configuration" if $configuration; 299 $command .= " -tracedest $traceDest -log $logDest"; 300 301 unless ($no_op) { 302 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = run(command => $command, verbose => $verbose); 303 unless ($success) { 304 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 305 &my_die("Unable to perform psphotStack: $error_code", $sky_id, $error_code); 306 } 307 308 # my $outputStatsReal = $ipprc->file_resolve($outputStats); 309 # &my_die("Couldn't find expected output file: $outputStats", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStatsReal); 310 311 # measure chip stats 312 # $command = "$ppStatsFromMetadata $outputStatsReal - DIFF_SKYCELL"; 313 # ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) = 314 # run(command => $command, verbose => $verbose); 315 # unless ($success) { 316 # $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR); 317 # &my_die("Unable to perform ppStatsFromMetadata: $error_code", $sky_id, $error_code); 318 # } 319 # foreach my $line (@$stdout_buf) { 320 # $cmdflags .= " $line"; 321 # } 322 # chomp $cmdflags; 323 324 # my ($quality) = $cmdflags =~ /-quality (\d+)/; # Quality flag 325 326 my $quality = 0; 327 if (0 and !$quality) { 328 329 # Get the output filenames 330 # we have one set of output files per input file set 331 for (my $i = 0; $i < @$files; $i++) { 332 my $outputName = $ipprc->filename("PSPHOT.STACK.OUTPUT.IMAGE", $outroot, $i); 333 my $outputMask = $ipprc->filename("PSPHOT.STACK.OUTPUT.MASK", $outroot, $i); 334 my $outputVariance = $ipprc->filename("PSPHOT.STACK.OUTPUT.VARIANCE", $outroot, $i); 335 my $outputSources = $ipprc->filename("PSPHOT.STACK.OUTPUT", $outroot, $i); 336 337 # XXX these are optional and not generated by default 338 # &my_die("Couldn't find expected output file: $outputName", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputName); 339 # &my_die("Couldn't find expected output file: $outputMask", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask); 340 # &my_die("Couldn't find expected output file: $outputVariance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputVariance); 341 &my_die("Couldn't find expected output file: $outputSources", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputSources); 342 } 343 344 #my $configuration = $ipprc->filename("PPSUB.CONFIG", $outroot); 345 #my $outputStats = $ipprc->filename("SKYCELL.STATS", $outroot); 346 #my $traceDest = $ipprc->filename("TRACE.EXP", $outroot); 347 348 my $chisqName = $ipprc->filename("PSPHOT.CHISQ.IMAGE", $outroot); 349 my $chisqMask = $ipprc->filename("PSPHOT.CHISQ.MASK", $outroot); 350 my $chisqVariance = $ipprc->filename("PSPHOT.CHISQ.VARIANCE", $outroot); 351 352 # XXX check the recipe -- should we expect these to exist? 353 # &my_die("Couldn't find expected output file: $chisqName", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqName); 354 # &my_die("Couldn't find expected output file: $chisqMask", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqMask); 355 # &my_die("Couldn't find expected output file: $chisqVariance", $sky_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($chisqVariance); 356 } 357 } else { 358 print "Not executing: $command\n"; 359 } 360 } 237 361 } 238 362 -
branches/czw_branch/20110406/ippToPsps/jython/batch.py
r31201 r31253 7 7 import os 8 8 import md5 9 9 import shutil 10 import logging 11 from subprocess import call, PIPE, Popen 12 13 from datastore import Datastore 10 14 from gpc1db import Gpc1Db 11 15 from ipptopspsdb import IppToPspsDb … … 14 18 from java.sql import * 15 19 from xml.etree.ElementTree import ElementTree, Element, tostring 16 from xml.dom import minidom17 20 18 21 ''' … … 30 33 "../config/2/tables.vot" 31 34 ''' 32 def __init__(self, batchType, inputFitsPath="", survey=""): 35 def __init__(self, logger, batchType, inputFitsPath="", survey=""): 36 37 # set up logging 38 self.logger = logger 39 self.logger.debug("Batch class constructor") 33 40 34 41 # set up class variables … … 51 58 52 59 # create Gpc1Db object 53 self.gpc1Db = Gpc1Db( )60 self.gpc1Db = Gpc1Db(self.logger) 54 61 55 62 # get survey ID from init table … … 60 67 self.surveyID = rs.getInt(1) 61 68 except: 62 self.log ("No survey ID found for this survey: '" + survey + "'")69 self.logger.exception("No survey ID found for this survey: '" + survey + "'") 63 70 self.surveyID = -1; 64 71 65 72 # get dvo info from config 66 dvoName = doc.find(survey+"dvo/name").text 67 dvoLocation = doc.find(survey+"dvo/location").text 73 if survey != "": 74 dvoName = doc.find(survey+"dvo/name").text 75 dvoLocation = doc.find(survey+"dvo/location").text 76 else: 77 dvoName = "" 78 dvoLocation = "" 68 79 69 80 # get datastore info from config 70 datastoreProduct = doc.find("datastore/product").text81 self.datastore = Datastore(self.logger) 71 82 72 83 # create IppToPspsDb object and create a new batch 73 self.ippToPspsDb = IppToPspsDb() 74 self.batchID = self.ippToPspsDb.createNewBatch(66, survey, self.getPspsBatchType(), dvoName, datastoreProduct) 84 self.ippToPspsDb = IppToPspsDb(logger) 85 self.batchID = self.ippToPspsDb.createNewBatch(66, 86 survey, 87 self.getPspsBatchType(), 88 dvoName, 89 self.datastore.product) 75 90 76 91 # get local storage location from config 77 92 self.batchName = "B%08d" % self.batchID 78 self.localOutPath = doc.find("localOutPath").text + "/" + self.getPspsBatchType() + "/" + dvoName + "/%s" % self.batchName 93 self.subDir = doc.find("localOutPath").text + "/" + self.getPspsBatchType() + "/" + dvoName 94 self.localOutPath = self.subDir + "/" + self.batchName 79 95 if not os.path.exists(self.localOutPath): os.makedirs(self.localOutPath) 80 96 … … 94 110 def __del__(self): 95 111 96 self.log ("Batch destructor")112 self.logger.debug("Batch destructor") 97 113 self.localStmt.close() 98 114 self.localCon.close() … … 105 121 outPath = self.localOutPath + "/BatchManifest.xml" 106 122 tmpPath = "./tmp.xml" 107 self.log ("Creating batch manifest file here: " + outPath)123 self.logger.info("Creating batch manifest file here: " + outPath) 108 124 root = Element('manifest') 109 125 … … 117 133 118 134 # get md5sum 119 fits=os.popen("md5sum " + self.outputFitsPath) 120 for f in fits.readlines(): md5sum = f[0:f.rfind(" ")] 135 p = Popen("md5sum " + self.outputFitsPath, shell=True, stdout=PIPE) 136 p.wait() 137 out = p.stdout.read() 138 md5sum = out[0:out.rfind(" ")] 121 139 122 140 # get file size … … 136 154 137 155 # clunky way to prettify XML 138 os.popen("xmllint --format " + tmpPath + " > " + outPath) 139 # os.remove(tmpPath) 140 156 p = Popen("xmllint --format " + tmpPath + " > " + outPath, shell=True, stdout=PIPE) 157 p.wait() 158 os.remove(tmpPath) 159 160 161 ''' 162 tar and zips batch directory 163 ''' 164 def createTarball(self): 165 166 # set up filenams and paths 167 tarFile = self.batchName + ".tar" 168 tarPath = self.subDir + "/" + tarFile 169 170 self.tarballFile = tarFile + ".gz" 171 tarballPath = self.subDir + "/" + self.tarballFile 172 173 # tar directory 174 p = Popen("tar -cvf " + tarPath + "\ 175 -C " + self.subDir + " \ 176 " + self.batchName, shell=True, stdout=PIPE) 177 p.wait() 178 179 # zip tar archive 180 p = Popen("gzip -c " + tarPath + " > " + tarballPath, shell=True, stdout=PIPE) 181 p.wait() 182 183 # delete tar file and original directory 184 os.remove(tarPath) 185 shutil.rmtree(self.localOutPath) 186 187 ''' 188 Publishes this batch to the datastore 189 ''' 190 def publishToDatastore(self): 191 192 self.datastore.publish(self.batchName, self.subDir, self.tarballFile, "tgz") 193 # TODO update ippToPsps Db here 141 194 142 195 ''' … … 147 200 if self.survey == "ThreePi": return "3PI" 148 201 elif self.survey == "MD04": return "MD04" 149 else: self.log ("ERROR:Don't know this survey: " + self.survey)202 else: self.logger.error("Don't know this survey: " + self.survey) 150 203 151 204 ''' … … 157 210 elif self.batchType == "detection": return "P2" 158 211 elif self.batchType == "stack": return "ST" 159 else: self.log ("ERROR:Don't know this batch type: " + self.survey)212 else: self.logger.error("Don't know this batch type: " + self.survey) 160 213 161 214 … … 244 297 self.pspsTables = stilts.treads(self.pspsVoTableFilePath) 245 298 for table in self.pspsTables: 246 self.log ("Creating PSPS table: " + table.name)299 self.logger.info("Creating PSPS table: " + table.name) 247 300 table.write(self.localUrl + '#' + table.name) 248 301 … … 253 306 ''' 254 307 def indexIppTables(self): 255 self.log ("indexIppTables not implemented")308 self.logger.warn("indexIppTables not implemented") 256 309 257 310 … … 261 314 def createIndex(self, table, column): 262 315 263 self.log ("Creating index on column '"+column+"' for table '"+table+"'")316 self.logger.info("Creating index on column '"+column+"' for table '"+table+"'") 264 317 265 318 sql = "CREATE INDEX "+table+"_index ON "+table+" ("+column+")" … … 267 320 self.localStmt.execute(sql) 268 321 except: 269 self.log ("Index already in place on '" + column + "' for table '" + table + "'")322 self.logger.warn("Index already in place on '" + column + "' for table '" + table + "'") 270 323 271 324 … … 274 327 ''' 275 328 def indexPspsTables(self): 276 self.log ("indexPspsTables not implemented")329 self.logger.warn("indexPspsTables not implemented") 277 330 278 331 ''' … … 290 343 match = re.match(filter, table.name) 291 344 if not match: continue 292 self.log ("Creating IPP table " + table.name)345 self.logger.info("Creating IPP table " + table.name) 293 346 table = stilts.tpipe(table, cmd='explodeall') 294 347 try: 295 348 table.write(self.localUrl + '#' + table.name) 296 349 except: 297 self.log ("ERROR problem writing table '" + table.name + "' to the database")350 self.logger.exception("Problem writing table '" + table.name + "' to the database") 298 351 299 352 count = count + 1 300 353 301 self.log ("Imported %d tables from '%s' " % (count, self.inputFitsPath))354 self.logger.info("Imported %d tables from '%s' " % (count, self.inputFitsPath)) 302 355 303 356 self.indexIppTables() … … 308 361 def exportPspsTablesToFits(self): 309 362 310 self.log ("Exporting all PSPS tables to FITS")363 self.logger.info("Exporting all PSPS tables to FITS") 311 364 _tables = [] 312 365 313 self.log (" Selecting database tables")366 self.logger.info(" Selecting database tables") 314 367 for table in self.pspsTables: 315 368 _table = stilts.tread(self.localUrl + '#SELECT * FROM ' + table.name) … … 317 370 _tables.append(_table) 318 371 319 self.log (" Writing to FITS file '" + self.outputFitsPath + "'...")372 self.logger.info(" Writing to FITS file '" + self.outputFitsPath + "'...") 320 373 stilts.twrites(_tables, self.outputFitsPath, fmt='fits') 321 self.log (" ...done")374 self.logger.info(" ...done") 322 375 323 376 ''' … … 394 447 def replaceAllPspsNulls(self, sub): 395 448 396 self.log ("Replacing all NULL values in PSPS tables with '" + sub + "'...")449 self.logger.info("Replacing all NULL values in PSPS tables with '" + sub + "'...") 397 450 for table in self.pspsTables: 398 451 self.replaceNulls(table.name, sub) 399 self.log ("...done")452 self.logger.info("...done") 400 453 401 454 ''' … … 403 456 ''' 404 457 def populatePspsTables(self): 405 self.log ("Not implemented yet")458 self.logger.warn("Not implemented yet") 406 459 407 460 ''' … … 410 463 def updateDvoIDs(self, table): 411 464 412 self.log ("Updating table '" + table + "' with DVO IDs...")465 self.logger.info("Updating table '" + table + "' with DVO IDs...") 413 466 sql = "UPDATE " + table + " AS a, dvo AS b SET \ 414 467 a.ippObjID = b.ippObjID, \ … … 416 469 WHERE a.ippDetectID = b.ippDetectID" 417 470 self.localStmt.execute(sql) 418 self.log ("...done")471 self.logger.info("...done") 419 472 420 473 … … 424 477 def createDvoTable(self): 425 478 426 self.log ("Creating DVO table for ID matching")479 self.logger.info("Creating DVO table for ID matching") 427 480 sql = "DROP TABLE dvo" 428 481 self.localStmt.execute(sql) -
branches/czw_branch/20110406/ippToPsps/jython/config.xml
r31199 r31253 32 32 <datastore> 33 33 <product>PSPS_JHU</product> 34 <type>IPP_PSPS</type> 34 35 </datastore> 35 36 -
branches/czw_branch/20110406/ippToPsps/jython/gpc1db.py
r31200 r31253 5 5 import glob 6 6 import os 7 import logging 7 8 8 9 from java.sql import * … … 21 22 22 23 ''' 23 def __init__(self): 24 def __init__(self, logger): 25 26 # setup logging 27 self.logger = logger 28 self.logger.debug("Gpc1Db constructor") 24 29 25 30 # open config … … 40 45 def __del__(self): 41 46 42 print "Gpc1Db destructor"47 self.logger.debug("Gpc1Db destructor") 43 48 self.stmt.close() 44 49 self.con.close() … … 49 54 ''' 50 55 def getStackStageCmfs(self, skyID): 56 57 self.logger.debug("Querying for stack cmf files") 58 51 59 sql = "SELECT path_base, num_inputs \ 52 60 FROM staticskyResult \ … … 56 64 rs.first() 57 65 except: 58 print "No worky"66 self.logger.exception("Can't query for stack cmfs") 59 67 60 68 # get path to base dir of cmf files -
branches/czw_branch/20110406/ippToPsps/jython/initbatch.py
r31180 r31253 2 2 3 3 import stilts 4 import logging 5 import logging.config 4 6 from java.lang import * 5 7 from java.sql import * … … 14 16 Constructor 15 17 ''' 16 def __init__(self ):17 super(InitBatch, self).__init__( "init")18 def __init__(self, logger): 19 super(InitBatch, self).__init__(logger, "init") 18 20 19 self.outputFitsPath = "00000000.FITS"; 21 self.outputFitsFile = "00000000.FITS"; 22 self.outputFitsPath = self.localOutPath + "/" + self.outputFitsFile 20 23 21 22 initBatch = InitBatch() 24 logging.config.fileConfig("logging.conf") 25 logger = logging.getLogger("initbatch") 26 initBatch = InitBatch(logger) 23 27 initBatch.createEmptyPspsTables() 24 28 initBatch.exportPspsTablesToFits() -
branches/czw_branch/20110406/ippToPsps/jython/ipptopspsdb.py
r31198 r31253 4 4 import sys 5 5 import os 6 import logging 6 7 7 8 from java.sql import * … … 19 20 20 21 ''' 21 def __init__(self ):22 def __init__(self, logger): 22 23 24 # setup logging 25 self.logger = logger 26 self.logger.debug("IppToPspsDb Constructor") 23 27 # open config 24 28 doc = ElementTree(file="config.xml") … … 38 42 def createNewBatch(self, expID, surveyType, batchType, dvoDb, datastoreProduct): 39 43 40 print "Creating nw batch in ippToPsps database"41 44 sql = "SELECT batch_id FROM batches ORDER BY batch_id DESC LIMIT 1" 42 45 … … 48 51 batchID = rs.getInt(1) 49 52 except: 50 print "Unable to get batch ID"53 self.logger.exception("Unable to get batch ID") 51 54 52 55 if batchID > 0: … … 70 73 self.stmt.execute(sql) 71 74 75 self.logger.info("Creating new batch in ippToPsps database with batchID = %d" % batchID) 76 72 77 return batchID; 73 78 … … 77 82 def __del__(self): 78 83 79 print "IppToPspsDb destructor"84 self.logger.debug("IppToPspsDb Desstructor") 80 85 self.stmt.close() 81 86 self.con.close() -
branches/czw_branch/20110406/ippToPsps/jython/stackbatch.py
r31202 r31253 7 7 from gpc1db import Gpc1Db 8 8 from batch import Batch 9 import logging.config 9 10 10 11 class StackBatch(Batch): … … 13 14 Constructor 14 15 ''' 15 def __init__(self, skyID, inputFile):16 def __init__(self, logger, skyID, inputFile): 16 17 super(StackBatch, self).__init__( 18 logger, 17 19 "stack", 18 20 inputFile, 19 21 "MD04") # TODO 20 22 21 self.log ("StackBatch constructor. Creating batch from input file here: ''" + inputFile + "'")23 self.logger.info("StackBatch constructor. Creating batch from: ''" + inputFile + "'") 22 24 23 25 # obs time makes no sense except for nightly stacks … … 185 187 ''' 186 188 def populateStackMeta(self): 187 self.log ("Procesing StackMeta table")189 self.logger.info("Procesing StackMeta table") 188 190 189 191 sql = "INSERT INTO StackMeta (\ … … 233 235 ''' 234 236 def populateStackDetection(self): 235 self.log ("Procesing StackDetection table")237 self.logger.info("Procesing StackDetection table") 236 238 237 239 # insert all the detections … … 297 299 ''' 298 300 def populateStackApFlx(self): 299 self.log ("Procesing StackApFlx table")301 self.logger.info("Procesing StackApFlx table") 300 302 301 303 sql = "INSERT INTO StackApFlx \ … … 307 309 308 310 # TODO temporarily loading 1st convolved fluxes into unconvolved fields 309 self.log (" Adding un-convolved fluxes")311 self.logger.info(" Adding un-convolved fluxes") 310 312 self.updateApFlxs("", "< 7.0") 311 self.log (" Adding 1st convolved fluxes")313 self.logger.info(" Adding 1st convolved fluxes") 312 314 self.updateApFlxs("c1", "< 7.0") 313 self.log (" Adding 2nd convolved fluxes")315 self.logger.info(" Adding 2nd convolved fluxes") 314 316 self.updateApFlxs("c2", "> 7.0") 315 317 316 self.log (" Adding petrosians for extended sources")318 self.logger.info(" Adding petrosians for extended sources") 317 319 sql = "UPDATE StackApFlx AS a, SkyChip_xsrc AS b SET \ 318 320 petRadius=b.PETRO_RADIUS \ … … 337 339 ''' 338 340 def populateStackModelFit(self): 339 self.log ("Procesing StackModelFit table")341 self.logger.info("Procesing StackModelFit table") 340 342 341 343 # insert all the detections … … 344 346 345 347 # populate model parameters 346 self.log (" Adding deVaucouleurs fit")348 self.logger.info(" Adding deVaucouleurs fit") 347 349 self.updateModelFit("deV", "PS_MODEL_DEV") 348 self.log (" Adding exponential fit")350 self.logger.info(" Adding exponential fit") 349 351 self.updateModelFit("exp", "PS_MODEL_EXP") 350 self.log (" Adding sersic fit")352 self.logger.info(" Adding sersic fit") 351 353 self.updateModelFit("ser", "PS_MODEL_SERSIC") 352 354 … … 361 363 ''' 362 364 def populateStackToImage(self): 363 self.log ("Procesing StackToImage table")365 self.logger.info("Procesing StackToImage table") 364 366 365 367 sql = "INSERT INTO StackToImage (stackMetaID) VALUES (" + self.header['STK_ID'] + ")" … … 371 373 def indexPspsTables(self): 372 374 373 self.log ("Creating indexes on PSPS tables")375 self.logger.info("Creating indexes on PSPS tables") 374 376 self.createIndex("StackDetection", "ippDetectID") 375 377 self.createIndex("StackApFlx", "ippDetectID") … … 381 383 def indexIppTables(self): 382 384 383 self.log ("Creating indexes on IPP tables")385 self.logger.info("Creating indexes on IPP tables") 384 386 self.createIndex("SkyChip_psf", "IPP_IDET") 385 387 self.createIndex("SkyChip_xfit", "IPP_IDET") … … 391 393 def fudgeIDs(self): 392 394 393 self.log ("Creating bogus IDs on all detections")395 self.logger.info("Creating bogus IDs on all detections") 394 396 395 397 sql = "INSERT INTO dvo (ippDetectID) SELECT IPP_IDET FROM SkyChip_psf"; … … 430 432 431 433 432 sky_id = 299 433 gpc1Db = Gpc1Db() 434 logging.config.fileConfig("logging.conf") 435 logger = logging.getLogger("stackbatch") 436 sky_id = 299 # TODO 437 gpc1Db = Gpc1Db(logger) 434 438 cmfFiles = gpc1Db.getStackStageCmfs(sky_id) 435 439 … … 437 441 for file in cmfFiles: 438 442 439 stackBatch = StackBatch( sky_id, file)443 stackBatch = StackBatch(logger, sky_id, file) 440 444 441 445 stackBatch.createEmptyPspsTables() 442 #stackBatch.importIppTables("") 443 stackBatch.populatePspsTables() 444 stackBatch.fudgeIDs() 445 #stackBatch.reportNullsInAllPspsTables(False) 446 #stackBatch.replaceAllPspsNulls("-999") 447 stackBatch.exportPspsTablesToFits() 448 stackBatch.writeBatchManifest() 446 stackBatch.importIppTables("") 447 # stackBatch.populatePspsTables() 448 # stackBatch.fudgeIDs() 449 # stackBatch.reportNullsInAllPspsTables(False) 450 # stackBatch.replaceAllPspsNulls("-999") 451 # stackBatch.exportPspsTablesToFits() 452 # stackBatch.writeBatchManifest() 453 # stackBatch.createTarball() 454 # stackBatch.publishToDatastore() 449 455 450 456 i = i + 1 -
branches/czw_branch/20110406/ippTools/share/Makefile.am
r30373 r31253 164 164 disttool_definebyquery_fake.sql \ 165 165 disttool_definebyquery_raw.sql \ 166 disttool_definebyquery_raw_no_magic.sql \ 166 167 disttool_definebyquery_sky.sql \ 167 168 disttool_definebyquery_stack.sql \ -
branches/czw_branch/20110406/ippTools/share/difftool_listrun.sql
r29172 r31253 20 20 camProcessedInput.zpt_lq, 21 21 camProcessedInput.zpt_uq, 22 camProcessedInput.fwhm_major, 22 23 rawInput.comment, 23 24 rawInput.exp_time, … … 25 26 rawInput.exp_name AS exp_name_1, 26 27 rawInput.exp_id AS exp_id_1, 28 rawInput.filter AS filter_1, 27 29 rawInput.comment AS comment_1, 28 30 rawInput.dateobs AS dateobs_1, … … 34 36 rawTemplate.exp_name AS exp_name_2, 35 37 rawTemplate.exp_id AS exp_id_2, 38 rawInput.filter AS filter_2, 36 39 rawTemplate.comment AS comment_2, 37 40 rawTemplate.dateobs AS dateobs_2, -
branches/czw_branch/20110406/ippTools/share/difftool_skyfile.sql
r27743 r31253 24 24 rawInput.exp_name AS exp_name_1, 25 25 rawInput.exp_id AS exp_id_1, 26 rawInput.filter AS filter_1, 26 27 chipInput.chip_id AS chip_id_1, 27 28 camInput.cam_id AS cam_id_1, … … 31 32 rawTemplate.exp_name AS exp_name_2, 32 33 rawTemplate.exp_id AS exp_id_2, 34 rawTemplate.filter AS filter_2, 33 35 chipTemplate.chip_id AS chip_id_2, 34 36 camTemplate.cam_id AS cam_id_2, -
branches/czw_branch/20110406/ippTools/share/disttool_pending_SSdiff.sql
r30387 r31253 6 6 stage_id, 7 7 diffSkyfile.skycell_id AS component, 8 exp_type, 8 9 clean, 9 10 rawExp.camera, -
branches/czw_branch/20110406/ippTools/share/disttool_pending_camera.sql
r30387 r31253 6 6 stage_id, 7 7 'exposure' AS component, 8 exp_type, 8 9 clean, 9 10 rawExp.camera, -
branches/czw_branch/20110406/ippTools/share/disttool_pending_chip.sql
r30387 r31253 6 6 stage_id, 7 7 chipProcessedImfile.class_id AS component, 8 exp_type, 8 9 distRun.clean, 9 10 rawExp.camera, -
branches/czw_branch/20110406/ippTools/share/disttool_pending_chip_bg.sql
r30387 r31253 6 6 stage_id, 7 7 chipBackgroundImfile.class_id AS component, 8 exp_type, 8 9 distRun.clean, 9 10 rawExp.camera, -
branches/czw_branch/20110406/ippTools/share/disttool_pending_diff.sql
r30387 r31253 6 6 stage_id, 7 7 diffSkyfile.skycell_id AS component, 8 exp_type, 8 9 clean, 9 10 rawExp.camera, -
branches/czw_branch/20110406/ippTools/share/disttool_pending_fake.sql
r30387 r31253 6 6 stage_id, 7 7 fakeProcessedImfile.class_id AS component, 8 exp_type, 8 9 clean, 9 10 rawExp.camera, -
branches/czw_branch/20110406/ippTools/share/disttool_pending_raw.sql
r30653 r31253 1 SELECT * FROM ( 2 -- rawExp magicked with re_place 1 3 SELECT 2 4 distRun.dist_id, … … 6 8 rawExp.exp_id AS stage_id, 7 9 rawImfile.class_id AS component, 10 rawExp.exp_type, 8 11 clean, 9 12 rawExp.camera, … … 38 41 AND distRun.stage = 'raw' 39 42 AND distComponent.dist_id IS NULL 40 AND (rawExp.magicked OR distRun.no_magic) 43 -- AND (rawExp.magicked OR distRun.no_magic) 44 AND rawExp.magicked 41 45 -- need to have magicked the chip image which makes the camera mask 42 46 AND chipProcessedImfile.magicked != 0 43 47 AND camRun.magicked > 0 48 AND (Label.active OR Label.active IS NULL) 49 UNION 50 SELECT 51 -- raw images no_magic required 52 distRun.dist_id, 53 distRun.label, 54 distTarget.dist_group, 55 'raw' AS stage, 56 rawExp.exp_id AS stage_id, 57 rawImfile.class_id AS component, 58 rawExp.exp_type, 59 clean, 60 rawExp.camera, 61 CONCAT_WS('.', distRun.outroot, CONVERT(distRun.dist_id, CHAR)) as outdir, 62 -- XXX: replace this with rawImfile.path_base once it exists 63 TRIM(TRAILING '.fits' FROM rawImfile.uri) AS path_base, 64 CAST(NULL AS CHAR(255)) AS alt_path_base, 65 -- pass camera stage path base since we want the camera mask file. The script knows what to do 66 CAST(NULL AS CHAR(255)) AS chip_path_base, 67 CAST(NULL AS CHAR(255)) AS state, 68 CAST(NULL AS CHAR(255)) AS data_state, 69 0 as quality, 70 distRun.no_magic, 71 rawImfile.magicked, 72 IFNULL(Label.priority, 10000) AS priority 73 FROM distRun 74 JOIN distTarget USING(target_id, stage, clean) 75 JOIN rawExp ON rawExp.exp_id = stage_id 76 AND distTarget.stage = 'raw' AND distRun.alternate = 0 77 JOIN rawImfile USING(exp_id) 78 LEFT JOIN distComponent 79 ON distRun.dist_id = distComponent.dist_id 80 AND rawImfile.class_id = distComponent.component 81 LEFT JOIN Label ON distRun.label = Label.label 82 WHERE 83 distRun.state = 'new' 84 AND distRun.clean = 0 85 AND distRun.stage = 'raw' 86 AND distComponent.dist_id IS NULL 87 AND (distRun.no_magic) 44 88 AND (Label.active OR Label.active IS NULL) 45 89 UNION … … 52 96 rawExp.exp_id AS stage_id, 53 97 rawImfile.class_id AS component, 98 rawExp.exp_type, 54 99 clean, 55 100 rawExp.camera, … … 96 141 rawExp.exp_id AS stage_id, 97 142 'exposure' AS component, 143 rawExp.exp_type, 98 144 clean, 99 145 rawExp.camera, … … 120 166 AND distComponent.dist_id IS NULL 121 167 AND (Label.active OR Label.active IS NULL) 168 ) AS distRun 169 WHERE 1 -
branches/czw_branch/20110406/ippTools/share/disttool_pending_sky.sql
r30387 r31253 6 6 stage_id, 7 7 stackRun.skycell_id AS component, 8 exp_type, 8 9 clean, 9 10 rawExp.camera, -
branches/czw_branch/20110406/ippTools/share/disttool_pending_stack.sql
r30387 r31253 6 6 stage_id, 7 7 stackRun.skycell_id AS component, 8 exp_type, 8 9 clean, 9 10 rawExp.camera, -
branches/czw_branch/20110406/ippTools/share/disttool_pending_warp.sql
r30387 r31253 6 6 stage_id, 7 7 warpSkyfile.skycell_id AS component, 8 exp_type, 8 9 clean, 9 10 rawExp.camera, -
branches/czw_branch/20110406/ippTools/share/disttool_pending_warp_bg.sql
r30387 r31253 6 6 stage_id, 7 7 warpBackgroundSkyfile.skycell_id AS component, 8 exp_type, 8 9 clean, 9 10 rawExp.camera, -
branches/czw_branch/20110406/ippTools/src/difftool.c
r30907 r31253 2967 2967 pxAddLabelSearchArgs (config, where, "-data_group", "diffRun.data_group", "LIKE"); 2968 2968 pxAddLabelSearchArgs (config, where, "-dist_group", "diffRun.dist_group", "LIKE"); 2969 2970 PXOPT_COPY_S64(config->args, where, "-template_exp_id", "rawTemplate.exp_id", "=="); 2969 2971 2970 2972 PXOPT_LOOKUP_BOOL(template, config->args, "-template", false); -
branches/czw_branch/20110406/ippTools/src/difftoolConfig.c
r30907 r31253 182 182 psMetadataAddTime(listrunArgs, PS_LIST_TAIL, "-dateobs_end", 0, "search for exposures by time (<=)", NULL); 183 183 psMetadataAddStr(listrunArgs, PS_LIST_TAIL, "-filter", 0, "search for filter", NULL); 184 psMetadataAddS64(listrunArgs, PS_LIST_TAIL, "-template_exp_id", 0, "search by exposure ID of template", 0); 184 185 psMetadataAddStr(listrunArgs, PS_LIST_TAIL, "-label", PS_META_DUPLICATE_OK, "search by diffRun label (LIKE comparison)", NULL); 185 186 psMetadataAddStr(listrunArgs, PS_LIST_TAIL, "-data_group", PS_META_DUPLICATE_OK, "search by diffRun data_group (LIKE comparison)", NULL); -
branches/czw_branch/20110406/ippTools/src/stacktool.c
r30945 r31253 243 243 PXOPT_COPY_STR(config->args, where, "-select_exp_type", "rawExp.exp_type", "=="); 244 244 PXOPT_COPY_F32(config->args, where, "-select_good_frac_min", "warpSkyfile.good_frac", ">="); 245 PXOPT_COPY_STR(config->args, where, "-select_skycell_id", "warpSkyfile.skycell_id", " ==");245 PXOPT_COPY_STR(config->args, where, "-select_skycell_id", "warpSkyfile.skycell_id", "LIKE"); 246 246 PXOPT_COPY_STR(config->args, where, "-select_data_group", "warpRun.data_group", "=="); 247 247 pxAddLabelSearchArgs (config, where, "-select_label", "warpRun.label", "LIKE"); // define using warp label -
branches/czw_branch/20110406/ippTools/src/staticskytool.c
r30907 r31253 123 123 psAssert (filters->data.list->n, "-select_filter should at least have a place-holder"); 124 124 int num_filter = filters->data.list->n; 125 if (num_filter < 2) {126 psError(PXTOOLS_ERR_CONFIG, false, "invalid request: only 1 filter selected");127 psFree(whereMD);128 return false;129 }130 125 131 126 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); -
branches/czw_branch/20110406/ippTools/src/staticskytoolConfig.c
r28154 r31253 52 52 psMetadataAddF32(definebyqueryArgs, PS_LIST_TAIL, "-select_good_frac_min", 0, "define min good_frac", 0.0); 53 53 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-select_label", PS_META_DUPLICATE_OK, "search by stackRun label (LIKE comparison, multiple OK)", NULL); 54 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-select_filter", PS_META_DUPLICATE_OK, "search by filter (LIKE comparison, multiple required)", NULL);54 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-select_filter", PS_META_DUPLICATE_OK, "search by filter (LIKE comparison, multiplei OK)", NULL); 55 55 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_workdir", 0, "define workdir (required)", NULL); 56 56 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-set_label", 0, "define label", NULL); -
branches/czw_branch/20110406/ippconfig/recipes/nightly_science.config
r31110 r31253 203 203 NAME STR STS 204 204 DISTRIBUTION STR STS 205 TESS STR STS 205 TESS STR STS.V3 206 206 OBSMODE STR STS% 207 207 OBJECT STR STS% -
branches/czw_branch/20110406/ippconfig/recipes/ppStack.config
r31163 r31253 123 123 END 124 124 125 QUICKSTACK METADATA 126 CONVOLVE BOOL FALSE 127 COMBINE.REJ F32 3.0 128 COMBINE.DISCARD F32 0.3 129 MASK.VAL STR MASK.VALUE,CONV.BAD,GHOST,BURNTOOL # Mask value of input bad pixels 130 END 125 131 126 132 # -
branches/czw_branch/20110406/ippconfig/recipes/psphot.config
r31163 r31253 203 203 204 204 # define the annuli (in pixels) for surface brightness measurements 205 # @RADIAL.ANNULAR.BINS.LOWER F32 0.0 5.0 10.0 20.0 40.0 80.0 206 # @RADIAL.ANNULAR.BINS.UPPER F32 5.0 10.0 20.0 40.0 80.0 160.0 205 # @RADIAL.ANNULAR.BINS.LOWER F32 0.0 5.0 10.0 20.0 40.0 80.0 # comment due to ticket #1476 206 # @RADIAL.ANNULAR.BINS.UPPER F32 5.0 10.0 20.0 40.0 80.0 160.0 # 207 207 208 208 # SDSS values (in SDSS pixels) 209 #@RADIAL.ANNULAR.BINS.LOWER F32 0.00 0.56 1.69 2.59 4.41 7.51 11.58 18.58 28.55 45.50 70.51 110.53 172.49 269.52 420.51 210 #@RADIAL.ANNULAR.BINS.UPPER F32 0.56 1.69 2.59 4.41 7.51 11.58 18.58 28.55 45.50 70.51 110.53 172.49 269.52 420.51 652.50 209 #@RADIAL.ANNULAR.BINS.LOWER F32 0.00 0.56 1.69 2.59 4.41 7.51 11.58 18.58 28.55 45.50 70.51 110.53 172.49 269.52 420.51 # 210 #@RADIAL.ANNULAR.BINS.UPPER F32 0.56 1.69 2.59 4.41 7.51 11.58 18.58 28.55 45.50 70.51 110.53 172.49 269.52 420.51 652.50 # 211 211 212 212 # PS1 values? (all SDSS @ PS1 0.2 arcsec pixel scales) 213 # @RADIAL.ANNULAR.BINS.LOWER F32 0.0 1.2 3.4 5.2 8.8 15.0 23.2 37.2 57.1 91.0 141.0 221.1 345.0 539.1 841.0 214 # @RADIAL.ANNULAR.BINS.UPPER F32 1.2 3.4 5.2 8.8 15.0 23.2 37.2 57.1 91.0 141.0 221.1 345.0 539.1 841.0 1305.0 213 # @RADIAL.ANNULAR.BINS.LOWER F32 0.0 1.2 3.4 5.2 8.8 15.0 23.2 37.2 57.1 91.0 141.0 221.1 345.0 539.1 841.0 # 214 # @RADIAL.ANNULAR.BINS.UPPER F32 1.2 3.4 5.2 8.8 15.0 23.2 37.2 57.1 91.0 141.0 221.1 345.0 539.1 841.0 1305.0 # 215 215 216 216 # PS1 values? 217 @RADIAL.ANNULAR.BINS.LOWER F32 0.0 1.2 3.4 5.2 8.8 15.0 23.2 37.2 57.1 91.0 141.0 218 @RADIAL.ANNULAR.BINS.UPPER F32 1.2 3.4 5.2 8.8 15.0 23.2 37.2 57.1 91.0 141.0 221.1 217 @RADIAL.ANNULAR.BINS.LOWER F32 0.0 1.2 3.4 5.2 8.8 15.0 23.2 37.2 57.1 91.0 141.0 # perl parser fails without a comment ticket #1476 218 @RADIAL.ANNULAR.BINS.UPPER F32 1.2 3.4 5.2 8.8 15.0 23.2 37.2 57.1 91.0 141.0 221.1 # perl parser fails without a comment ticket #1476 219 219 220 220 # Extended source fit parameters -
branches/czw_branch/20110406/ippconfig/recipes/reductionClasses.mdc
- Property svn:mergeinfo set to
r31175 r31253 239 239 END 240 240 241 # quick stacks 242 QUICKSTACK METADATA 243 STACK_PPSTACK STR QUICKSTACK 244 STACK_PPSUB STR STACK 245 STACK_PSPHOT STR STACK 246 END 247 241 248 # basic science analysis 242 249 PHOTFEST.SINGLE1 METADATA … … 632 639 END 633 640 641 STS_DATASET METADATA 642 CHIP_PPIMAGE STR CHIP 643 CHIP_PSPHOT STR CHIP 644 WARP_PSWARP STR WARP 645 STACK_PPSTACK STR STACK 646 STACK_PPSUB STR STACK 647 STACK_PSPHOT STR STACK 648 DIFF_PPSUB STR DIFF 649 DIFF_PSPHOT STR DIFF 650 JPEG_BIN1 STR PPIMAGE_J1 651 JPEG_BIN2 STR PPIMAGE_J2 652 FAKEPHOT STR FAKEPHOT 653 ADDSTAR STR ADDSTAR 654 PSASTRO STR STS_DATASET 655 STACKPHOT STR STACKPHOT 656 END 657 -
branches/czw_branch/20110406/ppSub/src/ppSub.c
r30874 r31253 94 94 95 95 if (data) { 96 psString dump_file = psMetadataLookupStr(NULL, data->config->arguments, " -dumpconfig");96 psString dump_file = psMetadataLookupStr(NULL, data->config->arguments, "DUMP_CONFIG"); 97 97 if (dump_file) { 98 98 if (!pmConfigDump(data->config, dump_file)) { -
branches/czw_branch/20110406/psModules/src/camera/pmFPAWrite.c
r27992 r31253 690 690 pmHDU *hdu = pmHDUFromCell(cell); // HDU for cell 691 691 psMetadata *header = psMetadataCopy(NULL, hdu->header); // Header to write 692 692 693 psMetadataAddS32(header, PS_LIST_TAIL, "COVARIANCE.CENTRE.X", PS_META_REPLACE, 693 694 "Centre of covariance matrix in x", -xMinCovar); … … 697 698 // Turn off compression 698 699 int bitpix = fits->options ? fits->options->bitpix : 0; // Desired bits per pixel 700 psFitsScaling scaling = fits->options ? fits->options->scaling : 0; // Current scaling method. 699 701 psFitsCompression *compress = psFitsCompressionGet(fits); // Current compression options 702 703 /* fprintf(stderr,"Attempting to write chip %s cell %s extension %s with scaling %d\n", */ 704 /* chipName,cellName,extname,fits->options->scaling); */ 700 705 if (!psFitsSetCompression(fits, PS_FITS_COMPRESS_NONE, NULL, 0, 0, 0)) { 701 706 psError(PS_ERR_UNKNOWN, false, "Unable to set FITS compression to NONE"); … … 708 713 if (fits->options) { 709 714 fits->options->bitpix = 0; 715 } 716 if (fits->options) { 717 fits->options->scaling = psFitsScalingFromString("STDEV_POSITIVE"); // This is a bit of a hack. We don't really have a default value. 710 718 } 711 719 … … 732 740 fits->options->bitpix = bitpix; 733 741 } 742 if (fits->options) { 743 fits->options->scaling = scaling; 744 } 734 745 if (!psFitsCompressionApply(fits, compress)) { 735 746 psError(PS_ERR_UNKNOWN, false, "Unable to restore FITS compression"); -
branches/czw_branch/20110406/tools/mysql-dump
- Property svn:ignore
-
old new 1 1 password.sh 2 *.log 3 .curr_gpc1_name
-
- Property svn:ignore
-
branches/czw_branch/20110406/tools/mysql-dump/gpc1_dump.sh
r31210 r31253 15 15 . /home/panstarrs/ipp/mysql-dump/functions.sh 16 16 . /home/panstarrs/ipp/mysql-dump/password.sh 17 18 EMAILTO=schastel@ifa.hawaii.edu 17 19 18 20 HOST=ippc02 … … 43 45 if [ "$dump_status" -ne "0" ]; then 44 46 log ERROR "Sending warning e-mail" 45 email "Gpc1 dump failed" schastel@ifa.hawaii.edu"Check log file: /export/$HOST.0/mysql-dumps/gpc1_dump.log"47 email "Gpc1 dump failed" $EMAILTO "Check log file: /export/$HOST.0/mysql-dumps/gpc1_dump.log" 46 48 log INFO "End of gpc1 dump (Error)" 47 49 exit 1 -
branches/czw_branch/20110406/tools/mysql-dump/gpc1_install.sh
r31211 r31253 9 9 # iterates up to $MAX_ITERATIONS times. 10 10 # 2) Check the gpc1 dump file against its checksum. 11 # 3) Import gpc1 into gpc1_0 or gpc1_1 (ensured by gpc1Import.py utility) 12 # 4) Distribute the validated files, that is: 11 # 3) Distribute the validated files, that is: 13 12 # - Hard-links the gzipped MySQL dump in the distribution directory 14 13 # - Moves the MD5 checksum to the distribution directory 14 # 4) Import gpc1 into gpc1_0 or gpc1_1 (ensured by gpc1Import.py utility) 15 15 . /home/panstarrs/ipp/mysql-dump/functions.sh 16 16 … … 30 30 31 31 ITERATION=1 32 if [ ! -s $TARGET/$MD5FILE ]; then 33 log WARNING "MD5 file not found [$TARGET/$MD5FILE]. Waiting $SLEEPING_TIME seconds (Attempt: $ITERATION out of $MAX_ITERATIONS)" 34 sleep $SLEEPING_TIME 35 let ITERATION=ITERATION+1 36 if [ "$ITERATION" -ge "$MAX_ITERATIONS" ]; then 37 log ERROR "Copy of $TARGET/$MD5FILE failed after $ITERATION iterations. Giving up" 38 email "Too many failures when attempting to copy $TARGET/$MD5FILE" $EMAILTO "Check log" 39 exit 1 32 MD5_STATUS=1 33 while [ "$MD5_STATUS" -ne "0" ]; do 34 if [ ! -s $TARGET/$MD5FILE ]; then 35 log WARNING "MD5 file not found [$TARGET/$MD5FILE]. Waiting $SLEEPING_TIME seconds (Attempt: $ITERATION out of $MAX_ITERATIONS)" 36 sleep $SLEEPING_TIME 37 let ITERATION=ITERATION+1 38 if [ "$ITERATION" -ge "$MAX_ITERATIONS" ]; then 39 log ERROR "Copy of $TARGET/$MD5FILE failed after $ITERATION iterations. Giving up" 40 email "Too many failures when attempting to copy $TARGET/$MD5FILE" $EMAILTO "Check log" 41 log INFO "End of gpc1_install.sh (Failure)" 42 exit 1 43 fi 44 else 45 MD5_STATUS=0 40 46 fi 41 fi 47 done 42 48 43 49 log INFO "Checking gpc1 backup file checksum" … … 45 51 BACKUP_FILE=`cat $TARGET/$MD5FILE | sed 's/^.* \//\//'` 46 52 BACKUP_FILE=`basename $BACKUP_FILE` 47 53 log INFO "Backup file is [$TARGET/$BACKUP_FILE]" 48 54 ACTUAL_MD5SUM=`/usr/bin/md5sum $TARGET/$BACKUP_FILE | sed 's/ .*$//'` 49 55 if [ "$ACTUAL_MD5SUM" != "$EXPECTED_MD5SUM" ]; then 50 56 log ERROR "Checksums are different: actual=[$ACTUAL_MD5SUM], expected=[$EXPECTED_MD5SUM]" 51 57 email "Invalid checksum for gpc1 backup" $EMAILTO "Checksums are different: actual=[$ACTUAL_MD5SUM], expected=[$EXPECTED_MD5SUM]" 58 log INFO "End of gpc1_install.sh (Failure)" 52 59 exit 2 53 60 fi 54 55 log INFO "Importing gpc1 backup file to gpc1_0 or gpc1_1"56 /usr/bin/python /home/panstarrs/ipp/mysql-dump/gpc1Import.py57 61 58 62 log INFO "Symlinking backup file [$TARGET/$BACKUP_FILE] to distribution [$DISTRIBUTION_TARGET]" … … 60 64 /usr/bin/mv -f $TARGET/$MD5FILE $DISTRIBUTION_MD5 61 65 66 # if it is between 0 and 4, ingest into gpc1_0 or gpc1_1 67 HOUR=`date +"%H"` 68 if [ "$HOUR" -lt "4" ]; then 69 log INFO "Importing gpc1 backup file to gpc1_0 or gpc1_1" 70 /usr/bin/python /home/panstarrs/ipp/mysql-dump/gpc1Import.py 71 else 72 log DEBUG "No gpc1 backup importation" 73 fi 74 75 log INFO "End of gpc1_install.sh (Success)" 76 -
branches/czw_branch/20110406/tools/mysql-dump/neb_dump.sh
r31213 r31253 12 12 . /home/panstarrs/ipp/mysql-dump/password.sh 13 13 14 EMAILTO=schastel@ifa.hawaii.edu 14 15 HOST=ippdb02 15 16 … … 36 37 if [ "$dump_status" -ne "0" ]; then 37 38 log ERROR "Sending warning e-mail" 38 email "Nebulous dump failed" schastel@ifa.hawaii.edu"Check log file: /export/ippdb02.0/mysql-dumps/neb-dump.log"39 email "Nebulous dump failed" $EMAILTO "Check log file: /export/ippdb02.0/mysql-dumps/neb-dump.log" 39 40 log INFO "End of nebulous dump (Error)" 40 41 exit 1 -
branches/czw_branch/20110406/tools/mysql-dump/ops_dump.csh
r31209 r31253 2 2 3 3 echo "## `/bin/date +%FT%T`" 4 5 set EMAILTO = schastel@ifa.hawaii.edu 4 6 5 7 # dump ippRequestServer from ippc19 … … 7 9 mysqldump --compress -hippc19 -uipp -pipp --flush-logs --single-transaction --log-error=RS-err ippRequestServer | gzip -9 > $DUMP_PATH/mysql-RS-ippc19-`date +%FT%T`.dump.gz 8 10 if ($status != 0) then 9 /bin/mail -s "Warning RS dump failed" schastel@ifa.hawaii.edu< msg11 /bin/mail -s "Warning ippRequestServer/RS dump failed" $EMAILTO < msg 10 12 endif 11 13 … … 16 18 mysqldump --compress -hippdb01 -uipp -pipp --flush-logs --single-transaction ippadmin | gzip -9 > $FILENAME 17 19 if ($status != 0) then 18 /bin/mail -s "Warning ippadmin dump failed" schastel@ifa.hawaii.edu< msg20 /bin/mail -s "Warning ippadmin dump failed" $EMAILTO < msg 19 21 endif 20 22 … … 31 33 mysqldump --compress -hippdb01 -uipp -pipp --flush-logs --single-transaction isp | gzip -9 > $FILENAME 32 34 if ($status != 0) then 33 /bin/mail -s "Warning isp dump failed" schastel@ifa.hawaii.edu< msg35 /bin/mail -s "Warning isp dump failed" $EMAILTO < msg 34 36 endif 35 37 … … 39 41 ln -f ../mysql-isp-ippdb01-$DATEVAR.dump.gz ippdb01-isp.dump.gz 40 42 41 # dump gpc1 from ippdb0142 #set DUMP_PATH = /data/ipp001.0/ipp/mysql-dumps #path(SAB)43 #set DATEVAR=`date +%FT%T` #date44 #set FILENAME = $DUMP_PATH/mysql-gpc1-ippc02-$DATEVAR.dump.gz #dump file name45 #mysqldump --compress -hippc -P3302 -uipp -pipp --flush-logs --single-transaction gpc1 | gzip -9 > $FILENAME46 #if ($status != 0) then47 # /bin/mail -s "Warning gpc1 dump failed" schastel@ifa.hawaii.edu < msg48 #endif49 50 # simlink to gpc1 ippdb01 dump51 #set DUMP_PATH = /data/ipp001.0/ipp/mysql-dumps #path(SAB)52 #cd $DUMP_PATH/distribution/ #link dir53 #ln -f ../mysql-gpc1-ippc02-$DATEVAR.dump.gz ippdb01-gpc1.dump.gz #hard link54 55 56 # dump the ippdb02 database57 #set DUMP_PATH = /data/ipp001.0/ipp/mysql-dumps #path58 #set DATEVAR = `date +%FT%T` #date59 #set FILENAME = $DUMP_PATH/mysql-neb-ippdb02-$DATEVAR.dump.gz #dump file name60 #mysqldump --compress -hippdb02 -ujhipp -pjhipp --flush-logs --single-transaction nebulous | gzip -9 > $FILENAME61 #if ($status != 0) then62 # /bin/mail -s "Warning nebulous dump failed" schastel@ifa.hawaii.edu < msg63 #endif64 65 # simlink to latest ippdb02 dump66 #set DUMP_PATH = /data/ipp001.0/ipp/mysql-dumps #path (SAB)67 #cd $DUMP_PATH/distribution/ #link dir68 #ln -f ../mysql-neb-ippdb02-$DATEVAR.dump.gz ippdb02.dump.gz #hard link69 70 # dump the ippdb00 database71 #set DUMP_PATH = /data/ipp001.0/ipp/mysql-dumps #path72 #set DATEVAR = `date +%FT%T` #date73 #set FILENAME = $DUMP_PATH/mysql-neb-ippdb00-$DATEVAR.dump.gz #dump file name74 #mysqldump --compress -hippdb00 -ujhipp -pjhipp --flush-logs --single-transaction nebulous | gzip -9 > $FILENAME75 #if ($status != 0) then76 # /bin/mail -s "Warning nebulous dump failed" schastel@ifa.hawaii.edu < msg77 #endif78 -
branches/czw_branch/20110406/tools/runcameraexp.pl
r29419 r31253 16 16 my $dbname = "gpc1"; 17 17 my ($cam_id, $update, $redirect, $save_temps, $pretend, $no_verbose); 18 my ($outdir); 18 19 19 20 GetOptions( … … 22 23 'redirect-output' => \$redirect, 23 24 'save-temps' => \$save_temps, 25 'outdir=s' => \$outdir, 24 26 'update' => \$update, 25 27 'dbname=s' => \$dbname, … … 55 57 56 58 die "Cannot update when run is not faulted\n" if $update and ! $fault; 59 60 if ($outdir) { 61 my $base = basename($path_base); 62 $path_base = "$outdir/$base"; 63 print STDERR "changing path_base to $path_base"; 64 $update = 0; 65 } 57 66 58 67 my $run_state;
Note:
See TracChangeset
for help on using the changeset viewer.
