- Timestamp:
- May 13, 2009, 12:37:33 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 5 deleted
- 53 edited
- 8 copied
-
. (modified) (1 prop)
-
Nebulous (modified) (1 prop)
-
Nebulous-Server (modified) (1 prop)
-
Nebulous/bin (modified) (1 prop)
-
Nebulous/examples (modified) (1 prop)
-
Nebulous/lib (modified) (1 prop)
-
Nebulous/nebclient (modified) (1 prop)
-
Nebulous/nebclient/tests/tap (modified) (1 prop)
-
Nebulous/t (modified) (1 prop)
-
Ohana (modified) (1 prop)
-
dbconfig/changes.txt (modified) (1 diff)
-
dbconfig/config.md (modified) (1 diff)
-
dbconfig/diff.md (modified) (2 diffs)
-
dbconfig/magic.md (modified) (3 diffs)
-
ippScripts/Build.PL (modified) (2 diffs)
-
ippScripts/scripts/diff_skycell.pl (modified) (5 diffs)
-
ippScripts/scripts/ipp_serial_magic.pl (copied) (copied from branches/pap_magic/ippScripts/scripts/ipp_serial_magic.pl )
-
ippScripts/scripts/magic_definerun.pl (modified) (2 diffs)
-
ippScripts/scripts/magic_destreak.pl (modified) (5 diffs)
-
ippScripts/scripts/magic_mask.pl (deleted)
-
ippScripts/scripts/magic_process.pl (modified) (9 diffs)
-
ippScripts/scripts/magic_tree.pl (modified) (4 diffs)
-
ippTasks/diff.pro (modified) (2 diffs)
-
ippTasks/magic.pro (modified) (5 diffs)
-
ippTasks/simtest.basic.auto (modified) (2 diffs)
-
ippTools/configure.ac (modified) (1 diff)
-
ippTools/share/Makefile.am (modified) (1 diff)
-
ippTools/share/chiptool_export_imfile.sql (modified) (1 prop)
-
ippTools/share/chiptool_export_processed_imfile.sql (modified) (1 prop)
-
ippTools/share/difftool_definebyquery.sql (deleted)
-
ippTools/share/difftool_definebyquery_part1.sql (deleted)
-
ippTools/share/difftool_definebyquery_part2.sql (deleted)
-
ippTools/share/difftool_definebyquery_temp_create.sql (deleted)
-
ippTools/share/difftool_definewarpstack.sql (copied) (copied from branches/pap_magic/ippTools/share/difftool_definewarpstack.sql )
-
ippTools/share/difftool_definewarpstack_part1.sql (copied) (copied from branches/pap_magic/ippTools/share/difftool_definewarpstack_part1.sql )
-
ippTools/share/difftool_definewarpstack_part2.sql (copied) (copied from branches/pap_magic/ippTools/share/difftool_definewarpstack_part2.sql )
-
ippTools/share/difftool_definewarpstack_temp_create.sql (copied) (copied from branches/pap_magic/ippTools/share/difftool_definewarpstack_temp_create.sql )
-
ippTools/share/difftool_definewarpwarp_select.sql (modified) (2 diffs)
-
ippTools/share/difftool_definewarpwarp_temp_create.sql (copied) (copied from branches/pap_magic/ippTools/share/difftool_definewarpwarp_temp_create.sql )
-
ippTools/share/difftool_definewarpwarp_temp_insert.sql (copied) (copied from branches/pap_magic/ippTools/share/difftool_definewarpwarp_temp_insert.sql )
-
ippTools/share/difftool_definewarpwarp_test.sql (copied) (copied from branches/pap_magic/ippTools/share/difftool_definewarpwarp_test.sql )
-
ippTools/share/difftool_skyfile.sql (modified) (1 diff)
-
ippTools/share/difftool_todiffskyfile.sql (modified) (1 diff)
-
ippTools/share/magicdstool_todestreak.sql (modified) (6 diffs)
-
ippTools/share/magictool_definebyquery_insert.sql (modified) (1 diff)
-
ippTools/share/magictool_definebyquery_select.sql (modified) (1 diff)
-
ippTools/share/magictool_inputs.sql (modified) (1 diff)
-
ippTools/share/magictool_inputskyfile.sql (modified) (1 diff)
-
ippTools/share/magictool_toprocess_inputs.sql (modified) (1 diff)
-
ippTools/share/magictool_toprocess_tree.sql (modified) (1 diff)
-
ippTools/share/magictool_totree.sql (modified) (1 diff)
-
ippTools/share/pxadmin_create_tables.sql (modified) (6 diffs)
-
ippTools/share/pxadmin_drop_tables.sql (modified) (1 diff)
-
ippTools/src/difftool.c (modified) (21 diffs)
-
ippTools/src/difftool.h (modified) (1 diff)
-
ippTools/src/difftoolConfig.c (modified) (5 diffs)
-
ippTools/src/magictool.c (modified) (17 diffs)
-
ippTools/src/magictoolConfig.c (modified) (5 diffs)
-
ppImage (modified) (1 prop)
-
ppStack (modified) (1 prop)
-
ppSub (modified) (1 prop)
-
psModules (modified) (1 prop)
-
psastro (modified) (1 prop)
-
psastro/src/psastroFindChip.c (modified) (1 prop)
-
psconfig (modified) (1 prop)
-
psphot (modified) (1 prop)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:mergeinfo changed
/branches/pap_magic (added) merged: 24120,24132-24136,24145,24147-24154,24156-24164,24168-24173
- Property svn:mergeinfo changed
-
trunk/Nebulous
- Property svn:mergeinfo changed (with no actual effect on merging)
-
trunk/Nebulous-Server
- Property svn:mergeinfo changed
/trunk/Nebulous-Server merged: 2-2784
- Property svn:mergeinfo changed
-
trunk/Nebulous/bin
- Property svn:mergeinfo changed (with no actual effect on merging)
-
trunk/Nebulous/examples
- Property svn:mergeinfo changed (with no actual effect on merging)
-
trunk/Nebulous/lib
- Property svn:mergeinfo changed (with no actual effect on merging)
-
trunk/Nebulous/nebclient
- Property svn:mergeinfo changed (with no actual effect on merging)
-
trunk/Nebulous/nebclient/tests/tap
- Property svn:mergeinfo changed (with no actual effect on merging)
-
trunk/Nebulous/t
- Property svn:mergeinfo changed (with no actual effect on merging)
-
trunk/Ohana
- Property svn:mergeinfo changed (with no actual effect on merging)
-
trunk/dbconfig/changes.txt
r24125 r24174 1105 1105 ALTER TABLE receiveFileset ADD COLUMN dirinfo VARCHAR(255) AFTER state; 1106 1106 1107 -- Playing with the diffs for warp-warp 1108 ALTER TABLE diffRun ADD COLUMN bothways TINYINT DEFAULT 0 AFTER tess_id; 1109 UPDATE diffRun SET bothways = 1 WHERE reduction = 'WARPWARP'; 1110 ALTER TABLE diffRun DROP FOREIGN KEY diffRun_ibfk_1; 1111 ALTER TABLE diffRun DROP COLUMN exp_id; 1112 ALTER TABLE diffRun ADD KEY(label); 1113 ALTER TABLE diffRun ADD COLUMN exposure TINYINT DEFAULT 0 AFTER bothways; 1114 UPDATE diffRun, diffInputSkyfile SET diffRun.exposure = 1 WHERE diffRun.diff_id = diffInputSkyfile.diff_id and diffInputSkyfile.warp1 IS NOT NULL; 1115 ALTER TABLE stackRun ADD KEY(label); 1116 1117 ALTER TABLE magicRun ADD COLUMN inverse TINYINT NOT NULL DEFAULT 0 AFTER diff_id; 1118 ALTER TABLE diffSkyfile DROP COLUMN uri; 1119 1120 DROP TABLE IF EXISTS magicSkyfileMask; 1121 ALTER TABLE magicInputSkyfile DROP FOREIGN KEY magicInputSkyfile_ibfk_2; 1122 ALTER TABLE magicInputSkyfile DROP KEY diff_id; 1123 ALTER TABLE magicInputSkyfile DROP PRIMARY KEY, ADD PRIMARY KEY(magic_id,node); 1124 ALTER TABLE magicInputSkyfile DROP COLUMN diff_id; 1125 ALTER TABLE magicNodeResult CHANGE COLUMN uri path_base VARCHAR(255); 1126 1127 -- Version 1.1.53 -
trunk/dbconfig/config.md
r23688 r24174 2 2 pkg_name STR ippdb 3 3 pkg_namespace STR ippdb 4 pkg_version STR 1.1.5 24 pkg_version STR 1.1.53 5 5 END -
trunk/dbconfig/diff.md
r23940 r24174 10 10 registered TAI NULL 11 11 tess_id STR 64 # Key 12 exp_id S64 0 # fkey(exp_id) ref rawExp(exp_id) 12 bothways BOOL f 13 exposure BOOL f 13 14 magicked BOOL f 14 15 END … … 32 33 diff_id S64 0 # Primary Key fkey(diff_id) ref diffRun(diff_id) 33 34 skycell_id STR 64 # 34 uri STR 25535 35 path_base STR 255 36 36 data_state STR 64 -
trunk/dbconfig/magic.md
r23387 r24174 6 6 exp_id S64 0 # Key 7 7 diff_id S64 0 # Key 8 inverse BOOL FALSE 8 9 state STR 64 # Key 9 10 workdir STR 255 … … 15 16 END 16 17 18 ### This is left over from when diffs were composed of a single skycell 19 ### When we're not too busy, it should be deleted in favour of: 20 ### magicRun JOIN diffSkyfile USING(diff_id) WHERE diffSkyfile.fault = 0 AND diffSkyfile.quality = 0 17 21 magicInputSkyfile METADATA 18 22 magic_id S64 0 # Primary Key fkey(magic_id) ref magicRun(magic_id) 19 diff_id S64 0 # Primary Key fkey(diff_id) ref diffRun(diff_id)20 23 node STR 64 # 21 24 END … … 30 33 magic_id S64 0 # Primary Key fkey(magic_id) ref magicRun(magic_id) 31 34 node STR 64 # Primary Key fkey(magic_id, node) ref magicTree(magic_id, node) 32 uriSTR 25535 path_base STR 255 33 36 fault S16 0 # Key 34 37 END -
trunk/ippScripts/Build.PL
r24038 r24174 56 56 scripts/magic_tree.pl 57 57 scripts/magic_process.pl 58 scripts/magic_mask.pl59 58 scripts/magic_destreak.pl 60 59 scripts/ippdb.pl … … 73 72 scripts/ipp_serial_stack.pl 74 73 scripts/ipp_serial_mops.pl 74 scripts/ipp_serial_magic.pl 75 75 scripts/ipp_mops_translate.pl 76 76 scripts/ipp_simulation_data.pl -
trunk/ippScripts/scripts/diff_skycell.pl
r23740 r24174 35 35 } 36 36 37 my ($diff_id, $dbname, $threads, $outroot, $reduction, $ verbose, $no_update, $no_op, $redirect);37 my ($diff_id, $dbname, $threads, $outroot, $reduction, $inverse, $verbose, $no_update, $no_op, $redirect); 38 38 my ($skycell_id, $diff_skyfile_id); 39 39 GetOptions( … … 44 44 'threads=s' => \$threads, # Number of threads to use 45 45 'outroot=s' => \$outroot, # Output root name 46 'inverse' => \$inverse, # Make inverse subtraction? 46 47 'reduction=s' => \$reduction, # Reduction class 47 48 'verbose' => \$verbose, # Print to stdout … … 96 97 my $camera; # Camera 97 98 my ($inputMagic, $templateMagic); # Are the inputs been magicked? 98 my $inverse = 1; # Generate inverse subtraction if warp-warp99 99 foreach my $file (@$files) { 100 100 if (defined $file->{template} and $file->{template}) { … … 107 107 # template is a stack so it doesn't need to be magicked 108 108 $templateMagic = 1; 109 $inverse = 0;110 109 ## use an explicit stack name for psphot output objects 111 110 } else { … … 123 122 $inputVariance = "PPSTACK.OUTPUT.VARIANCE"; 124 123 $inputSources = "PSPHOT.OUT.CMF.MEF"; ## this must be consistent with the value in stack_skycell.pl:161 125 $inverse = 0;126 124 } else { 127 125 $inputMask = "PSWARP.OUTPUT.MASK"; -
trunk/ippScripts/scripts/magic_definerun.pl
r23186 r24174 164 164 &my_die("failed to retrieve new magic run information", $PS_EXIT_CONFIG_ERROR) if !$magic_id; 165 165 166 ### This is left over from when diffs were composed of a single skycell 167 ### When we're not too busy, it should be deleted in favour of: 168 ### magicRun JOIN diffSkyfile USING(diff_id) WHERE diffSkyfile.fault = 0 AND diffSkyfile.quality = 0 166 169 foreach my $diff_skyfile (@$inputs) { 167 170 my $skycell_id = $diff_skyfile->{skycell_id}; … … 171 174 } 172 175 my $diff_id = $diff_skyfile->{diff_id}; 173 my $command = "$magictool -addinputskyfile -magic_id $magic_id -diff_id $diff_id"; 174 $command .= " -node $skycell_id"; 176 my $command = "$magictool -addinputskyfile"; 177 $command .= " -magic_id $magic_id"; 178 $command .= " -node $skycell_id"; 175 179 $command .= " -dbname $dbname" if $dbname; 176 180 -
trunk/ippScripts/scripts/magic_destreak.pl
r23909 r24174 35 35 36 36 # Parse the command-line arguments 37 my ($magic_ds_id, $camera, $streaks, $stage, $stage_id, $component, $uri, $path_base, $ cam_path_base);37 my ($magic_ds_id, $camera, $streaks, $stage, $stage_id, $component, $uri, $path_base, $inverse, $cam_path_base); 38 38 my ($outroot, $recoveryroot); 39 39 my ($replace, $remove, $release); … … 49 49 'uri=s' => \$uri, # uri of the input image 50 50 'path_base=s' => \$path_base, # path_base of the input 51 'inverse' => \$inverse, # Inverse subtraction? 51 52 'cam_path_base=s'=> \$cam_path_base, # path_base of the associated camera run 52 53 'outroot=s' => \$outroot, # "directory" for temporary images (may be nebulous) … … 183 184 my $image = $uri; 184 185 185 my ($ mask, $ch_mask, $weight, $astrom);186 my ($image, $mask, $ch_mask, $weight, $astrom); 186 187 187 188 if ($stage eq "raw") { 189 $image = $uri; 188 190 $astrom = $ipprc->filename("PSASTRO.OUTPUT", $cam_path_base); 189 191 $mask = $ipprc->filename("PSASTRO.OUTPUT.MASK", $cam_path_base, $class_id) if $release ; … … 191 193 # we use the mask output from the camera stage for input and replace 192 194 # the output of the chip stage with that mask as well. 195 $image = $ipprc->filename("PPIMAGE.CHIP", $path_base, $class_id); 193 196 $mask = $ipprc->filename("PSASTRO.OUTPUT.MASK", $cam_path_base, $class_id); 194 197 $ch_mask= $ipprc->filename("PPIMAGE.CHIP.MASK", $path_base, $class_id); … … 196 199 $astrom = $ipprc->filename("PSASTRO.OUTPUT", $cam_path_base); 197 200 } elsif ($stage eq "warp") { 201 $image = $ipprc->filename("PSWARP.OUTPUT", $path_base); 198 202 $mask = $ipprc->filename("PSWARP.OUTPUT.MASK", $path_base); 199 203 $weight = $ipprc->filename("PSWARP.OUTPUT.VARIANCE", $path_base); 200 204 } elsif ($stage eq "diff") { 201 $mask = $ipprc->filename("PPSUB.OUTPUT.MASK", $path_base); 202 $weight = $ipprc->filename("PPSUB.OUTPUT.VARIANCE", $path_base); 205 my $name = $inverse ? "PPSUB.INVERSE" : "PPSUB.OUTPUT"; # Base name for images 206 $image = $ipprc->filename($name, $path_base); 207 $mask = $ipprc->filename("$name.MASK", $path_base); 208 $weight = $ipprc->filename("$name.VARIANCE", $path_base); 203 209 } 204 210 -
trunk/ippScripts/scripts/magic_process.pl
r24166 r24174 37 37 38 38 # Parse the command-line arguments 39 my ($magic_id, $node, $camera, $dbname, $outroot, $ template_uri, $save_temps, $verbose, $no_update, $no_op, $logfile);39 my ($magic_id, $node, $camera, $dbname, $outroot, $save_temps, $verbose, $no_update, $no_op, $logfile); 40 40 41 41 GetOptions( … … 45 45 'dbname=s' => \$dbname, # Database name 46 46 'outroot=s' => \$outroot, # Output root name 47 'template_uri=s' => \$template_uri,# uri of diff template48 47 'save-temps' => \$save_temps, # Save temporary files? 49 48 'verbose' => \$verbose, # Print stuff? … … 59 58 defined $node and 60 59 defined $camera and 61 defined $outroot and 62 defined $template_uri; 60 defined $outroot; 63 61 64 62 my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $magic_id, $node, $PS_EXIT_CONFIG_ERROR ); # IPP configuration … … 138 136 } 139 137 140 my $template = $ipprc->file_resolve($template_uri);141 &my_die("failed to resolve template _uri: $template_uri", $magic_id, $node, $PS_EXIT_DATA_ERROR)142 if !($template);138 my $template = resolve_template($innode); 139 &my_die("failed to resolve template", $magic_id, $node, $PS_EXIT_DATA_ERROR) 140 unless defined $template; 143 141 144 142 $command .= " --detect --image $image --mask $mask --weight $weight -k $template"; … … 189 187 foreach my $innode (@$inputs) { 190 188 # root for inputs from previous stage 191 my $in_ uri = $innode->{uri};192 print $sfh "$in_ uri\n";193 194 cat_list_to_list($in_fh, $in_ uri, "input.list");189 my $in_path_base = $innode->{magic_path_base}; 190 print $sfh "$in_path_base\n"; 191 192 cat_list_to_list($in_fh, $in_path_base, "input.list"); 195 193 # build input lists by combining the lists from 196 194 # previous stages 197 cat_list_to_list($ifh, $in_ uri, "image.list");198 cat_list_to_list($mfh, $in_ uri, "mask.list");199 cat_list_to_list($wfh, $in_ uri, "weight.list");195 cat_list_to_list($ifh, $in_path_base, "image.list"); 196 cat_list_to_list($mfh, $in_path_base, "mask.list"); 197 cat_list_to_list($wfh, $in_path_base, "weight.list"); 200 198 } 201 199 close $in_fh; … … 243 241 $command .= " -magic_id $magic_id"; 244 242 $command .= " -node $node"; 245 $command .= " - uri$outroot";243 $command .= " -path_base $outroot"; 246 244 $command .= " -dbname $dbname" if defined $dbname; 247 245 … … 262 260 my $resolved = $ipprc->file_resolve($streaks_file); 263 261 264 my $fh; 265 open $fh, "<$resolved" or 266 &my_die("failed to open streaks file $streaks_file", $magic_id, $node, $PS_EXIT_UNKNOWN_ERROR); 267 # the first line in the streaks file contains the number of streaks found 268 my $num_streaks = <$fh>; 269 chomp $num_streaks; 270 close $fh; 271 print "$num_streaks streaks found on magicRun $magic_id\n" if $verbose; 262 my $num_streaks = -1; 263 unless ($no_op) { 264 my $fh; 265 open $fh, "<$resolved" or 266 &my_die("failed to open streaks file $streaks_file", $magic_id, $node, $PS_EXIT_UNKNOWN_ERROR); 267 # the first line in the streaks file contains the number of streaks found 268 $num_streaks = <$fh>; 269 chomp $num_streaks; 270 close $fh; 271 print "$num_streaks streaks found on magicRun $magic_id\n" if $verbose; 272 } 272 273 273 274 my $command = "$magictool -addmask"; … … 309 310 sub cat_list_to_list { 310 311 my $out = shift; # output file handle 311 my $ uri = shift; # urito append ...312 my $path_base = shift; # path_base to append ... 312 313 my $extension = shift; # ... the extension to 313 314 314 my $filename = "$ uri.$extension";315 my $filename = "$path_base.$extension"; 315 316 316 317 my $in; … … 321 322 } 322 323 323 sub resolve_inputs {324 324 sub resolve_inputs 325 { 325 326 my $node = shift; 326 my $input_base = $node->{path_base}; 327 328 my $image = $ipprc->file_resolve($ipprc->filename("PPSUB.OUTPUT", $input_base)); 329 my $mask = $ipprc->file_resolve($ipprc->filename("PPSUB.OUTPUT.MASK", $input_base)); 330 my $weight= $ipprc->file_resolve($ipprc->filename("PPSUB.OUTPUT.VARIANCE", $input_base)); 331 332 return ($image, $mask, $weight); 327 my $input_base = $node->{diff_path_base}; 328 329 my ($image, $mask, $variance); # Names to return 330 if ($node->{inverse}) { 331 $image = "PPSUB.INVERSE"; 332 $mask = "PPSUB.INVERSE.MASK"; 333 $variance = "PPSUB.INVERSE.VARIANCE"; 334 } else { 335 $image = "PPSUB.OUTPUT"; 336 $mask = "PPSUB.OUTPUT.MASK"; 337 $variance = "PPSUB.OUTPUT.VARIANCE"; 338 } 339 340 $image = $ipprc->file_resolve($ipprc->filename($image, $input_base)); 341 $mask = $ipprc->file_resolve($ipprc->filename($mask, $input_base)); 342 $variance= $ipprc->file_resolve($ipprc->filename($variance, $input_base)); 343 344 return ($image, $mask, $variance); 345 } 346 347 sub resolve_template 348 { 349 my $node = shift; 350 351 my $image; # Name of template to return 352 my $path_base; # Base name for name 353 if (defined $node->{warp_path_base} and $node->{warp_path_base} ne "NULL") { 354 $path_base = $node->{warp_path_base}; 355 $image = "PSWARP.OUTPUT"; 356 } elsif (defined $node->{stack_path_base} and $node->{stack_path_base} ne "NULL") { 357 $path_base = $node->{stack_path_base}; 358 $image = "PPSTACK.OUTPUT"; 359 } else { 360 return undef; 361 } 362 363 $image = $ipprc->file_resolve($ipprc->filename($image, $path_base)); 364 365 return $image 333 366 } 334 367 -
trunk/ippScripts/scripts/magic_tree.pl
r23688 r24174 73 73 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files 74 74 75 ### Get a list of warpSkyfiles76 ### This is a workaround to allow processing with older diffSkyfiles that don't have77 ### a wcs. If warp_id is provided, we get the wcs from there78 my %warpSkyfiles; # hash of warps79 if ($warp_id) {80 my $command = "$warptool -warped -warp_id $warp_id"; # Command to run81 $command .= " -dbname $dbname" if defined $dbname;82 my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =83 run(command => $command, verbose => $verbose);84 unless ($success) {85 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);86 &my_die("Unable to perform warptool -warped: $error_code", $magic_id, $error_code);87 }88 89 my $metadata = $mdcParser->parse(join "", @$stdout_buf) or90 &my_die("Unable to parse metadata config doc", $magic_id, $PS_EXIT_PROG_ERROR);91 92 my $warps = parse_md_list($metadata) or93 &my_die("Unable to parse metadata list", $magic_id, $PS_EXIT_PROG_ERROR);94 95 # make a hash indexed by skycell_id96 foreach my $warp ( @$warps ) {97 my $skycell_id = $warp->{skycell_id};98 die "failed to lookup skycell_id from warp" if !$skycell_id;99 $warpSkyfiles{$skycell_id} = $warp;100 }101 }102 75 ### Get a list of skycells 103 76 my @skycells; # List of skycells … … 126 99 my @fields; 127 100 foreach my $input ( @skycells ) { 128 # the filename method doesn't add the $skycell_id 129 130 # my $skyfile = $ipprc->filename("SKYCELL.TEMPLATE", $outroot, $skycell_id ); 131 #my $skyfile = $ipprc->filename("SKYCELL.TEMPLATE", $outroot, $skycell_id ); 132 133 # my $skycellBase = "$outroot/$skycell_id"; 134 # my $skyfile = $ipprc->filename("SKYCELL.TEMPLATE", $skycellBase); 135 # $ipprc->skycell_file($tess_id, $skycell_id, $skyfile, $verbose) or &my_die("Unable to generate skycells $skycell_id", $magic_id, $PS_EXIT_PROG_ERROR); 136 137 my $skyfile; 138 my $skycell_id = $input->{node}; 139 if ($warp_id) { 140 # Applying the workaround 141 my $warp = $warpSkyfiles{$skycell_id}; 142 die "warpSkyfile for $skycell_id not found" if !$warp; 143 my $skyfileBase = $warp->{path_base}; 144 $skyfile = $ipprc->filename("SKYCELL.TEMPLATE", $skyfileBase); 145 } else { 146 # using the diffSkyfile 147 $skyfile = $input->{uri}; 148 } 149 my $skyfileResolved = $ipprc->file_resolve( $skyfile ); 150 151 # my ($header, $status) = Astro::FITS::CFITSIO::fits_read_header( $skyfileResolved ); 152 # &my_die("Unable to read skycell header: $status", $magic_id, $PS_EXIT_SYS_ERROR) if $status; 101 # We use the WCS in the diff image 102 my $name = "PPSUB.OUTPUT"; # Name of file 103 my $skycell_id = $input->{node}; # Name of skycell 104 my $skyfile = $ipprc->filename($name, $input->{path_base}, $skycell_id); # Filename for diff 105 my $skyfileResolved = $ipprc->file_resolve( $skyfile ); # Resolved filename 153 106 154 107 my ($header, $status) = (undef, 0); … … 162 115 163 116 # Get the useful header keywords 164 # my $naxis1 = $$header{'NAXIS1'} or &my_die("Can't find NAXIS1", $magic_id, $PS_EXIT_SYS_ERROR);165 117 my $naxis1 = $$header{'NAXIS1'}; 166 118 my $naxis2; … … 181 133 $naxis2 = $$header{'ZNAXIS2'} or &my_die("Can't find ZNAXIS2", $magic_id, $PS_EXIT_SYS_ERROR); 182 134 } 183 my $ctype1 = $$header{'CTYPE1'} or &my_die("Can't find CTYPE1 ", $magic_id, $PS_EXIT_SYS_ERROR);184 my $ctype2 = $$header{'CTYPE2'} or &my_die("Can't find CTYPE2 ", $magic_id, $PS_EXIT_SYS_ERROR);185 my $cdelt1 = $$header{'CDELT1'} or &my_die("Can't find CDELT1 ", $magic_id, $PS_EXIT_SYS_ERROR);186 my $cdelt2 = $$header{'CDELT2'} or &my_die("Can't find CDELT2 ", $magic_id, $PS_EXIT_SYS_ERROR);187 my $crval1 = $$header{'CRVAL1'} or &my_die("Can't find CRVAL1 ", $magic_id, $PS_EXIT_SYS_ERROR);188 my $crval2 = $$header{'CRVAL2'} or &my_die("Can't find CRVAL2 ", $magic_id, $PS_EXIT_SYS_ERROR);189 my $crpix1 = $$header{'CRPIX1'} or &my_die("Can't find CRPIX1 ", $magic_id, $PS_EXIT_SYS_ERROR);190 my $crpix2 = $$header{'CRPIX2'} or &my_die("Can't find CRPIX2 ", $magic_id, $PS_EXIT_SYS_ERROR);191 my $pc11 = $$header{'PC001001'} or &my_die("Can't find PC001001 ", $magic_id, $PS_EXIT_SYS_ERROR);192 my $pc12 = $$header{'PC001002'} or &my_die("Can't find PC001002 ", $magic_id, $PS_EXIT_SYS_ERROR);193 my $pc21 = $$header{'PC002001'} or &my_die("Can't find PC002001 ", $magic_id, $PS_EXIT_SYS_ERROR);194 my $pc22 = $$header{'PC002002'} or &my_die("Can't find PC002002 ", $magic_id, $PS_EXIT_SYS_ERROR);135 my $ctype1 = $$header{'CTYPE1'} or &my_die("Can't find CTYPE1 in $skyfile", $magic_id, $PS_EXIT_SYS_ERROR); 136 my $ctype2 = $$header{'CTYPE2'} or &my_die("Can't find CTYPE2 in $skyfile", $magic_id, $PS_EXIT_SYS_ERROR); 137 my $cdelt1 = $$header{'CDELT1'} or &my_die("Can't find CDELT1 in $skyfile", $magic_id, $PS_EXIT_SYS_ERROR); 138 my $cdelt2 = $$header{'CDELT2'} or &my_die("Can't find CDELT2 in $skyfile", $magic_id, $PS_EXIT_SYS_ERROR); 139 my $crval1 = $$header{'CRVAL1'} or &my_die("Can't find CRVAL1 in $skyfile", $magic_id, $PS_EXIT_SYS_ERROR); 140 my $crval2 = $$header{'CRVAL2'} or &my_die("Can't find CRVAL2 in $skyfile", $magic_id, $PS_EXIT_SYS_ERROR); 141 my $crpix1 = $$header{'CRPIX1'} or &my_die("Can't find CRPIX1 in $skyfile", $magic_id, $PS_EXIT_SYS_ERROR); 142 my $crpix2 = $$header{'CRPIX2'} or &my_die("Can't find CRPIX2 in $skyfile", $magic_id, $PS_EXIT_SYS_ERROR); 143 my $pc11 = $$header{'PC001001'} or &my_die("Can't find PC001001 in $skyfile", $magic_id, $PS_EXIT_SYS_ERROR); 144 my $pc12 = $$header{'PC001002'} or &my_die("Can't find PC001002 in $skyfile", $magic_id, $PS_EXIT_SYS_ERROR); 145 my $pc21 = $$header{'PC002001'} or &my_die("Can't find PC002001 in $skyfile", $magic_id, $PS_EXIT_SYS_ERROR); 146 my $pc22 = $$header{'PC002002'} or &my_die("Can't find PC002002 in $skyfile", $magic_id, $PS_EXIT_SYS_ERROR); 195 147 my $crota1 = $$header{'CROTA1'}; 196 148 my $crota2 = $$header{'CROTA2'}; -
trunk/ippTasks/diff.pro
r24098 r24174 146 146 book getword diffSkyfile $pageName skycell_id -var SKYCELL_ID 147 147 book getword diffSkyfile $pageName camera -var CAMERA 148 book getword diffSkyfile $pageName bothways -var BOTHWAYS 148 149 book getword diffSkyfile $pageName workdir -var WORKDIR_TEMPLATE 149 150 book getword diffSkyfile $pageName dbname -var DBNAME … … 164 165 165 166 $run = diff_skycell.pl --threads @MAX_THREADS@ --diff_id $DIFF_ID --skycell_id $SKYCELL_ID --diff_skyfile_id $DIFF_SKYFILE_ID --outroot $outroot --redirect-output 167 if ($BOTHWAYS > 1) 168 $run = $run --inverse 169 end 166 170 add_standard_args run 167 171 -
trunk/ippTasks/magic.pro
r24098 r24174 280 280 book getword magicToProcess $pageName camera -var CAMERA 281 281 book getword magicToProcess $pageName workdir -var WORKDIR_TEMPLATE 282 book getword magicToProcess $pageName template_uri -var TEMPLATE_URI283 282 book getword magicToProcess $pageName dbname -var DBNAME 284 283 … … 302 301 mkdir $outpath 303 302 304 $run = magic_process.pl --magic_id $MAGIC_ID --camera $CAMERA --node $NODE --outroot $outroot -- template_uri $TEMPLATE_URI --logfile $logfile303 $run = magic_process.pl --magic_id $MAGIC_ID --camera $CAMERA --node $NODE --outroot $outroot --logfile $logfile 305 304 add_standard_args run 306 305 … … 354 353 if ($magicToDS_DB >= $DB:n) set magicToDS_DB = 0 355 354 end 356 # XXX magicDSRun doesn't have label so can't use add_poll_args 357 # add_poll_args run355 add_poll_args run 356 add_poll_labels run 358 357 command $run 359 358 end … … 410 409 book getword magicToDS $pageName uri -var URI 411 410 book getword magicToDS $pageName path_base -var PATH_BASE 411 book getword magicToDS $pageName inverse -var INVERSE 412 412 book getword magicToDS $pageName cam_path_base -var CAM_PATH_BASE 413 413 book getword magicToDS $pageName outroot -var OUTROOT … … 424 424 425 425 $run = magic_destreak.pl --magic_ds_id $MAGIC_DS_ID --camera $CAMERA --streaks $STREAKS --stage $STAGE --stage_id $STAGE_ID --component $COMPONENT --uri $URI --path_base $PATH_BASE --cam_path_base $CAM_PATH_BASE --outroot $OUTROOT --logfile $logfile --recoveryroot $RECROOT --replace $REPLACE --remove $REMOVE 426 if ($INVERSE > 0) 427 # Inverse subtraction 428 $run = $run --inverse 429 end 426 430 427 431 add_standard_args run -
trunk/ippTasks/simtest.basic.auto
r24098 r24174 58 58 END 59 59 60 ### Stack automation ???60 ### Stack automation 61 61 automate METADATA 62 62 name STR STACK … … 64 64 END 65 65 66 ### Diff automation ???66 ### Diff automation 67 67 automate METADATA 68 68 name STR DIFF 69 regular STR "difftool -define byquery-label proc -workdir file://@CWD@/diff -good_frac 0.2 -dbname @DBNAME@"69 regular STR "difftool -definewarpstack -label proc -workdir file://@CWD@/diff -good_frac 0.2 -dbname @DBNAME@" 70 70 END 71 71 -
trunk/ippTools/configure.ac
r23884 r24174 18 18 PKG_CHECK_MODULES([PSLIB], [pslib >= 1.1.0]) 19 19 PKG_CHECK_MODULES([PSMODULES], [psmodules >= 1.1.0]) 20 PKG_CHECK_MODULES([IPPDB], [ippdb >= 1.1.5 2])20 PKG_CHECK_MODULES([IPPDB], [ippdb >= 1.1.53]) 21 21 22 22 PXTOOLS_CFLAGS="${PSLIB_CFLAGS=} ${PSMODULES_CFLAGS=} ${IPPDB_CFLAGS=}" -
trunk/ippTools/share/Makefile.am
r24111 r24174 81 81 dettool_tostacked.sql \ 82 82 difftool_completed_runs.sql \ 83 difftool_definebyquery_part1.sql \ 84 difftool_definebyquery_part2.sql \ 85 difftool_definebyquery_temp_create.sql \ 83 difftool_definewarpstack_part1.sql \ 84 difftool_definewarpstack_part2.sql \ 85 difftool_definewarpstack_temp_create.sql \ 86 difftool_definewarpwarp_temp_create.sql \ 87 difftool_definewarpwarp_temp_insert.sql \ 86 88 difftool_definewarpwarp_select.sql \ 87 89 difftool_definewarpwarp_insert.sql \ -
trunk/ippTools/share/chiptool_export_imfile.sql
- Property svn:mergeinfo changed
/trunk/ippTools/share/chiptool_export_imfile.sql merged: 23690-23696
- Property svn:mergeinfo changed
-
trunk/ippTools/share/chiptool_export_processed_imfile.sql
- Property svn:mergeinfo changed
/trunk/ippTools/share/chiptool_export_processed_imfile.sql merged: 23690-23696
- Property svn:mergeinfo changed
-
trunk/ippTools/share/difftool_definewarpwarp_select.sql
r23503 r24174 1 1 SELECT 2 2 inputWarpRun.warp_id AS input_warp_id, 3 inputWarpRun.tess_id AS tess_id, 3 4 inputRawExp.exp_id AS input_exp_id, 4 inputWarpRun.tess_id AS tess_id,5 -- The following trick pulls out the warp_id that has the smallest distance 5 6 SUBSTRING_INDEX(GROUP_CONCAT(templateWarpRun.warp_id ORDER BY ABS(ASIN(SQRT(POW(SIN(0.5*(inputRawExp.decl - templateRawExp.decl)),2) + COS(inputRawExp.decl) * COS(templateRawExp.decl) * POW(SIN(0.5*(inputRawExp.ra - templateRawExp.ra)),2))))), ',', 1) AS template_warp_id 6 7 FROM warpRun AS inputWarpRun … … 9 10 JOIN chipRun AS inputChipRun USING(chip_id) 10 11 JOIN rawExp AS inputRawExp USING(exp_id) 11 -- To find exposures that haven't been diffed :%s LEFT JOIN diffRun ON diffRun.exp_id = inputRawExp.exp_id12 -- To find exposures that haven't been diffed, insert newline here:%s LEFT JOIN diffs USING(exp_id) 12 13 JOIN warpRun AS templateWarpRun 13 14 ON templateWarpRun.warp_id != inputWarpRun.warp_id -- Don't use self as template! -
trunk/ippTools/share/difftool_skyfile.sql
r24112 r24174 8 8 stack1, 9 9 warp2, 10 stack2, 11 exp_id 10 stack2 12 11 FROM diffRun 13 JOIN diffSkyfile 14 USING(diff_id) 15 JOIN diffInputSkyfile 16 USING (diff_id, skycell_id) 12 JOIN diffSkyfile USING(diff_id) 13 JOIN diffInputSkyfile USING(diff_id, skycell_id) 17 14 JOIN warpRun 18 15 ON warpRun.warp_id = diffInputSkyfile.warp1 19 JOIN rawExp 20 USING(exp_id) 16 JOIN fakeRun USING(fake_id) 17 JOIN camRun USING(cam_id) 18 JOIN chipRun USING(chip_id) 19 JOIN rawExp USING(exp_id) -
trunk/ippTools/share/difftool_todiffskyfile.sql
r23688 r24174 9 9 diffRun.tess_id, 10 10 diffRun.label, 11 diffRun.state 11 diffRun.state, 12 diffRun.bothways 12 13 FROM diffRun 13 14 JOIN diffInputSkyfile USING(diff_id) -
trunk/ippTools/share/magicdstool_todestreak.sql
r23974 r24174 13 13 rawImfile.uri as uri, 14 14 NULL as path_base, 15 magicRun.inverse, 15 16 camProcessedExp.path_base as cam_path_base, 16 17 outroot, … … 44 45 chipProcessedImfile.uri, 45 46 chipProcessedImfile.path_base, 47 magicRun.inverse, 46 48 camProcessedExp.path_base as cam_path_base, 47 49 outroot, … … 51 53 FROM magicDSRun 52 54 JOIN magicMask USING (magic_id) 55 JOIN magicRun USING(magic_id) 53 56 JOIN camProcessedExp USING(cam_id) 54 57 JOIN chipRun ON chip_id = stage_id … … 79 82 warpSkyfile.uri, 80 83 warpSkyfile.path_base, 84 magicRun.inverse, 81 85 NULL as cam_path_base, 82 86 outroot, … … 113 117 magicRun.diff_id as stage_id, 114 118 diffSkyfile.skycell_id as component, 115 diffSkyfile.uri,119 NULL AS uri, 116 120 diffSkyfile.path_base, 121 magicRun.inverse, 117 122 NULL as cam_path_base, 118 123 outroot, … … 126 131 JOIN magicInputSkyfile USING(magic_id) 127 132 JOIN diffSkyfile 128 ON magic InputSkyfile.diff_id = diffSkyfile.diff_id133 ON magicRun.diff_id = diffSkyfile.diff_id 129 134 AND magicInputSkyfile.node = diffSkyfile.skycell_id 130 135 LEFT JOIN magicDSFile -
trunk/ippTools/share/magictool_definebyquery_insert.sql
r23688 r24174 3 3 SELECT 4 4 @MAGIC_ID@, -- Update this with the appropriate magic_id 5 diff_id,6 5 skycell_id 7 6 FROM diffSkyfile -
trunk/ippTools/share/magictool_definebyquery_select.sql
r20973 r24174 1 1 -- Get a list of exposures on which magic may be performed 2 SELECT 2 SELECT 3 3 exp_id, 4 MAX(diffRun.diff_id) AS diff_id 5 FROM diffRun 6 JOIN rawExp USING(exp_id) 4 MAX(diffWarps.diff_id) AS diff_id, 5 -- The following trick pulls out the 'inverse' value for the maximum diff_id 6 CONVERT(SUBSTRING_INDEX(GROUP_CONCAT(diffWarps.inverse ORDER BY diffWarps.diff_id), ',', 1), UNSIGNED) AS inverse 7 FROM ( 8 -- Forward diffs 9 SELECT 10 diffRun.diff_id, 11 warp1 AS warp_id, 12 0 AS inverse 13 FROM diffRun 14 JOIN diffInputSkyfile USING(diff_id) 15 WHERE diffInputSkyfile.warp1 IS NOT NULL 16 AND diffRun.exposure = 1 17 -- WHERE hook %s 18 UNION 19 -- Backward diffs 20 SELECT 21 diffRun.diff_id, 22 warp2 AS warp_id, 23 1 AS inverse 24 FROM diffRun 25 JOIN diffInputSkyfile USING(diff_id) 26 WHERE diffInputSkyfile.warp2 IS NOT NULL 27 AND diffRun.exposure = 1 28 AND diffRun.bothways = 1 29 -- WHERE hook %s 30 ) AS diffWarps 31 JOIN warpRun USING(warp_id) 32 JOIN fakeRun USING(fake_id) 33 JOIN camRun USING(cam_id) 34 JOIN chipRun USING(chip_id) 7 35 LEFT JOIN magicRun USING(exp_id) 8 36 -- WHERE hook %s -
trunk/ippTools/share/magictool_inputs.sql
r23886 r24174 1 SELECT * 2 FROM ( 3 -- Single skycells 1 -- Get input details for a magic node 4 2 SELECT 5 3 magicRun.magic_id, 6 magicRun.state, 7 magicInputSkyfile.node, 8 diffSkyfile.diff_id, 9 diffSkyfile.uri, 10 diffSkyfile.path_base, 11 diffSkyfile.fault, 12 diffSkyfile.quality 4 magicRun.inverse, -- Using the inverse subtraction? 5 magicRun.diff_id, 6 magicInputs.node, 7 -- Only one of diff_path_base and magic_path_base should be non-NULL 8 -- If diff_path_base is non-NULL, then only one of warp_path_base and stack_path_base should be non-NULL 9 magicInputs.diff_path_base, -- path_base for the diff (if any) 10 magicInputs.warp_path_base, -- path_base for the template warp (if any) 11 magicInputs.stack_path_base, -- path_base for the template stack (if any) 12 magicInputs.magic_path_base -- path_base for child nodes (if any) 13 13 FROM magicRun 14 JOIN magicInputSkyfile 15 USING(magic_id) 16 JOIN diffSkyfile 17 ON magicInputSkyfile.diff_id = diffSkyfile.diff_id 18 AND magicInputSkyfile.node = diffSkyfile.skycell_id 19 UNION 20 -- Merged skycells 21 SELECT 22 magicRun.magic_id, 23 magicRun.state, 24 magicTree.node, 25 0, -- no diff_id 26 magicNodeResult.uri, 27 NULL, -- magicNodeResult doesn't have a path_base 28 magicNodeResult.fault, 29 0 as quality 30 FROM magicTree 31 JOIN magicRun 32 USING(magic_id) 33 JOIN magicNodeResult 34 ON magicTree.magic_id = magicNodeResult.magic_id 35 AND magicTree.dep = magicNodeResult.node 36 ) as Foo 37 WHERE 38 fault = 0 39 AND quality = 0 14 JOIN ( 15 -- Single skycells: have uri=NULL 16 SELECT 17 magic_id, 18 magicRun.diff_id, 19 skycell_id AS node, 20 diffSkyfile.path_base AS diff_path_base, 21 warpSkyfile.path_base AS warp_path_base, 22 stackSumSkyfile.path_base AS stack_path_base, 23 NULL AS magic_path_base 24 FROM magicRun 25 JOIN magicTree USING(magic_id) 26 JOIN magicInputSkyfile USING(magic_id, node) 27 JOIN diffRun USING(diff_id) 28 JOIN diffSkyfile 29 ON diffSkyfile.diff_id = magicRun.diff_id 30 AND diffSkyfile.skycell_id = magicInputSkyfile.node 31 JOIN ( 32 -- Template for non-inverse 33 SELECT 34 magic_id, 35 skycell_id, 36 warp1 AS warp_id, 37 stack1 AS stack_id 38 FROM magicRun 39 JOIN diffInputSkyfile USING(diff_id) 40 WHERE magicRun.inverse = 0 41 -- WHERE hook (magicRun.magic_id, diffInputSkyfile.skycell_id) %s 42 UNION 43 -- Template for inverse 44 SELECT 45 magic_id, 46 skycell_id, 47 warp2 AS warp_id, 48 stack2 AS stack_id 49 FROM magicRun 50 JOIN diffInputSkyfile USING(diff_id) 51 WHERE magicRun.inverse = 1 52 -- WHERE hook (magicRun.magic_id, diffInputSkyfile.skycell_id) %s 53 ) AS diffTemplates USING(magic_id, skycell_id) 54 LEFT JOIN warpSkyfile USING(warp_id, skycell_id) 55 LEFT JOIN stackSumSkyfile USING(stack_id) 56 -- WHERE hook (magicRun.magic_id, magicTree.node) %s 57 UNION 58 -- Merged skycells: have diff_id=0, various_path_base=NULL 59 SELECT 60 magicTree.magic_id, 61 0 AS diff_id, 62 magicTree.dep, 63 NULL AS diff_path_base, 64 NULL AS warp_path_base, 65 NULL AS stack_path_base, 66 magicNodeResult.path_base AS magic_path_base 67 FROM magicTree 68 JOIN magicRun USING(magic_id) 69 JOIN magicNodeResult 70 ON magicTree.magic_id = magicNodeResult.magic_id 71 AND magicTree.dep = magicNodeResult.node 72 -- WHERE hook (magicRun.magic_id, magicTree.node) %s 73 ) AS magicInputs USING(magic_id) -
trunk/ippTools/share/magictool_inputskyfile.sql
r23389 r24174 1 1 SELECT 2 2 magicInputSkyfile.*, 3 diffSkyfile.uri 3 magicRun.inverse, 4 diffSkyfile.path_base 4 5 FROM magicRun 5 JOIN magicInputSkyfile 6 USING(magic_id) 6 JOIN magicInputSkyfile USING(magic_id) 7 7 JOIN diffSkyfile 8 ON magicInputSkyfile.diff_id = diffSkyfile.diff_id9 AND magicInputSkyfile.node = diffSkyfile.skycell_id8 ON diffSkyfile.diff_id = magicRun.diff_id 9 AND diffSkyfile.skycell_id = magicInputSkyfile.node 10 10 WHERE 11 11 magicRun.state = 'new' -
trunk/ippTools/share/magictool_toprocess_inputs.sql
r23971 r24174 1 SELECT * FROM 2 (SELECT 1 SELECT 3 2 magicTree.*, 3 magicRun.workdir, 4 4 rawExp.exp_id, 5 5 rawExp.camera, 6 -- diffSkyfile.path_base,7 magicRun.workdir,8 6 -- convert magic_id into a boolean value (1 or 0) 9 7 -- note that the type stays a 64 bit int 10 magicNodeResult.magic_id IS TRUE as done, 11 magicNodeResult.fault IS TRUE as bad, 12 warpSkyfile.uri as template_uri 13 FROM magicTree 14 JOIN magicRun USING(magic_id) 8 magicNodeResult.magic_id IS TRUE AS done, 9 magicNodeResult.fault IS TRUE AS bad 10 FROM magicRun 11 JOIN magicTree USING(magic_id) 15 12 JOIN magicInputSkyfile USING(magic_id, node) 16 JOIN diffSkyfile17 ON magicInputSkyfile.diff_id = diffSkyfile.diff_id18 AND magicInputSkyfile.node = diffSkyfile.skycell_id19 JOIN diffInputSkyfile20 ON diffSkyfile.diff_id = diffInputSkyfile.diff_id21 AND diffSkyfile.skycell_id = diffInputSkyfile.skycell_id22 JOIN warpSkyfile23 ON diffInputSkyfile.warp2 = warpSkyfile.warp_id24 AND diffInputSkyfile.skycell_id = warpSkyfile.skycell_id25 13 JOIN rawExp USING(exp_id) 26 LEFT JOIN magicNodeResult 27 ON magicTree.magic_id = magicNodeResult.magic_id 28 AND magicTree.node = magicNodeResult.node 14 JOIN diffSkyfile -- only get nodes that match a skycell 15 ON diffSkyfile.diff_id = magicRun.diff_id 16 AND diffSkyfile.skycell_id = magicInputSkyfile.node 17 LEFT JOIN magicNodeResult USING(magic_id, node) 29 18 WHERE 30 19 magicRun.state = 'new' 31 20 AND magicNodeResult.magic_id IS NULL 32 21 AND magicNodeResult.node IS NULL 33 -- where hook 1 %s 34 UNION 35 SELECT 36 magicTree.*, 37 rawExp.exp_id, 38 rawExp.camera, 39 -- diffSkyfile.path_base, 40 magicRun.workdir, 41 -- convert magic_id into a boolean value (1 or 0) 42 -- note that the type stays a 64 bit int 43 magicNodeResult.magic_id IS TRUE as done, 44 magicNodeResult.fault IS TRUE as bad, 45 stackSumSkyfile.uri as template_uri 46 FROM magicTree 47 JOIN magicRun USING(magic_id) 48 JOIN magicInputSkyfile USING(magic_id, node) 49 JOIN diffSkyfile 50 ON magicInputSkyfile.diff_id = diffSkyfile.diff_id 51 AND magicInputSkyfile.node = diffSkyfile.skycell_id 52 JOIN diffInputSkyfile 53 ON diffSkyfile.diff_id = diffInputSkyfile.diff_id 54 AND diffSkyfile.skycell_id = diffInputSkyfile.skycell_id 55 JOIN stackSumSkyfile 56 ON diffInputSkyfile.stack2 = stackSumSkyfile.stack_id 57 JOIN rawExp USING(exp_id) 58 LEFT JOIN magicNodeResult 59 ON magicTree.magic_id = magicNodeResult.magic_id 60 AND magicTree.node = magicNodeResult.node 61 WHERE 62 magicRun.state = 'new' 63 AND magicNodeResult.magic_id IS NULL 64 AND magicNodeResult.node IS NULL 65 -- where hook 2 %s 66 ) as foo 22 -- WHERE hook %s -
trunk/ippTools/share/magictool_toprocess_tree.sql
r23971 r24174 1 1 SELECT 2 2 magicTree.*, 3 exp_id,4 camera,5 3 magicRun.workdir, 4 rawExp.exp_id, 5 rawExp.camera, 6 6 -- convert magic_id into a boolean value (1 or 0) 7 7 -- note that the type stays a 64 bit int 8 magicNodeResult.magic_id IS TRUE as done, 9 magicNodeResult.fault IS TRUE as bad, 10 'notused' as template_uri 8 magicNodeResult.magic_id IS TRUE AS done, 9 magicNodeResult.fault IS TRUE AS bad 11 10 FROM magicTree 12 11 JOIN magicRun USING(magic_id) 13 12 JOIN rawExp USING(exp_id) 14 LEFT JOIN magicNodeResult 15 ON magicTree.magic_id = magicNodeResult.magic_id 16 AND magicTree.node = magicNodeResult.node 13 LEFT JOIN magicNodeResult USING(magic_id, node) 17 14 WHERE 18 15 magicRun.state = 'new' 19 -- wherehook %s16 -- WHERE hook %s 20 17 ORDER BY 21 18 magicRun.magic_id -
trunk/ippTools/share/magictool_totree.sql
r23389 r24174 6 6 ra, 7 7 decl, 8 tess_id8 diffRun.tess_id 9 9 FROM magicRun 10 JOIN diffRun USING(diff_id) 10 11 JOIN rawExp USING(exp_id) 11 12 LEFT JOIN magicTree -
trunk/ippTools/share/pxadmin_create_tables.sql
r24125 r24174 877 877 KEY(state), 878 878 KEY(skycell_id), 879 KEY(tess_id) 879 KEY(tess_id), 880 KEY(label) 880 881 ) ENGINE=innodb DEFAULT CHARSET=latin1; 881 882 … … 933 934 registered DATETIME, 934 935 tess_id VARCHAR(64), 935 exp_id BIGINT, 936 bothways TINYINT DEFAULT 0, 937 exposure TINYINT DEFAULT 0, 936 938 magicked TINYINT, 937 939 PRIMARY KEY(diff_id), … … 939 941 KEY(state), 940 942 KEY(tess_id), 943 KEY(label), 941 944 FOREIGN KEY(exp_id) REFERENCES rawExp(exp_id) 942 945 ) ENGINE=innodb DEFAULT CHARSET=latin1; … … 969 972 diff_id BIGINT, 970 973 skycell_id VARCHAR(64), 971 uri VARCHAR(255),972 974 path_base VARCHAR(255), 973 975 data_state VARCHAR(64), … … 1006 1008 exp_id BIGINT, 1007 1009 diff_id BIGINT, 1010 inverse TINYINT NOT NULL DEFAULT 0, 1008 1011 state VARCHAR(64), 1009 1012 workdir VARCHAR(255), … … 1046 1049 magic_id BIGINT, 1047 1050 node VARCHAR(64), 1048 uriVARCHAR(255),1051 path_base VARCHAR(255), 1049 1052 fault SMALLINT, 1050 1053 PRIMARY KEY(magic_id, node), -
trunk/ippTools/share/pxadmin_drop_tables.sql
r23894 r24174 48 48 DROP TABLE IF EXISTS magicNodeResult; 49 49 DROP TABLE IF EXISTS magicMask; 50 DROP TABLE IF EXISTS magicSkyfileMask;51 50 DROP TABLE IF EXISTS magicDSRun; 52 51 DROP TABLE IF EXISTS magicDSFile; -
trunk/ippTools/src/difftool.c
r24059 r24174 40 40 static bool revertdiffskyfileMode(pxConfig *config); 41 41 static bool definepoprunMode(pxConfig *config); 42 static bool define byqueryMode(pxConfig *config);42 static bool definewarpstackMode(pxConfig *config); 43 43 static bool definewarpwarpMode(pxConfig *config); 44 44 static bool pendingcleanuprunMode(pxConfig *config); … … 79 79 MODECASE(DIFFTOOL_MODE_REVERTDIFFSKYFILE, revertdiffskyfileMode); 80 80 MODECASE(DIFFTOOL_MODE_DEFINEPOPRUN, definepoprunMode); 81 MODECASE(DIFFTOOL_MODE_DEFINE BYQUERY, definebyqueryMode);81 MODECASE(DIFFTOOL_MODE_DEFINEWARPSTACK, definewarpstackMode); 82 82 MODECASE(DIFFTOOL_MODE_DEFINEWARPWARP, definewarpwarpMode); 83 83 MODECASE(DIFFTOOL_MODE_PENDINGCLEANUPRUN, pendingcleanuprunMode); … … 116 116 PXOPT_LOOKUP_STR(workdir, config->args, "-workdir", true, false); 117 117 PXOPT_LOOKUP_STR(tess_id, config->args, "-tess_id", true, false); 118 PXOPT_LOOKUP_BOOL(bothways, config->args, "-bothways", false); 119 PXOPT_LOOKUP_BOOL(exposure, config->args, "-exposure", false); 118 120 PXOPT_LOOKUP_STR(label, config->args, "-label", false, false); 119 121 PXOPT_LOOKUP_STR(reduction, config->args, "-reduction", false, false); 120 PXOPT_LOOKUP_S64(exp_id, config->args, "-exp_id", false, false);121 122 122 123 // default … … 133 134 registered, 134 135 tess_id, 135 exp_id, 136 bothways, 137 exposure, 136 138 false 137 139 ); … … 487 489 PXOPT_LOOKUP_S16(fault, config->args, "-fault", false, false); 488 490 PXOPT_LOOKUP_S16(quality, config->args, "-quality", false, false); 489 PXOPT_LOOKUP_STR(uri, config->args, "-uri", (fault == 0), false);490 491 PXOPT_LOOKUP_STR(path_base, config->args, "-path_base", (fault == 0), false); 491 492 … … 521 522 diff_id, 522 523 skycell_id, 523 uri,524 524 path_base, 525 525 "full", … … 771 771 psS64 template_warp_id, // Warp identifier for template image, PS_MAX_S64 for none 772 772 psS64 template_stack_id, // Stack identifier for template image, PS_MAX_S64 for none 773 psS64 exp_id, // exposure id for input_warp_id (if defined)774 773 pxConfig *config // Configuration 775 774 ) … … 802 801 registered, 803 802 tess_id, 804 exp_id, 803 false, 804 false, 805 805 false // magicked 806 806 ); … … 882 882 PXOPT_LOOKUP_S64(input_warp_id, config->args, "-input_warp_id", false, false); 883 883 PXOPT_LOOKUP_S64(input_stack_id, config->args, "-input_stack_id", false, false); 884 PXOPT_LOOKUP_S64(exp_id, config->args, "-exp_id", false, false);885 884 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 886 885 … … 902 901 psError(PS_ERR_BAD_PARAMETER_VALUE, true, 903 902 "No input has been defined (-input_stack_id or -input_warp_id)"); 904 return false;905 }906 if (input_warp_id && !exp_id) {907 psError(PS_ERR_BAD_PARAMETER_VALUE, true,908 "-exp_id is required with -input_warp_id.");909 903 return false; 910 904 } … … 917 911 template_warp_id ? template_warp_id : PS_MAX_S64, 918 912 template_stack_id ? template_stack_id : PS_MAX_S64, 919 exp_id ? exp_id : PS_MAX_S64,920 913 config)) { 921 914 psError(PS_ERR_UNKNOWN, false, "failed to create populated diffRun"); … … 935 928 936 929 937 static bool define byqueryMode(pxConfig *config)930 static bool definewarpstackMode(pxConfig *config) 938 931 { 939 932 PS_ASSERT_PTR_NON_NULL(config, false); … … 960 953 PXOPT_LOOKUP_BOOL(reRun, config->args, "-rerun", false); 961 954 PXOPT_LOOKUP_BOOL(available, config->args, "-available", false); 955 PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false); 962 956 963 957 // find all things to queue 964 psString query = pxDataGet("difftool_define byquery_part1.sql");958 psString query = pxDataGet("difftool_definewarpstack_part1.sql"); 965 959 if (!query) { 966 960 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); … … 1057 1051 } 1058 1052 1053 if (pretend) { 1054 // negative simple so the default is true 1055 if (!ippdbPrintMetadatas(stdout, output, "diffRun", !simple)) { 1056 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 1057 psFree(output); 1058 return false; 1059 } 1060 psFree(output); 1061 return true; 1062 } 1063 1059 1064 // create temporary table 1060 query = pxDataGet("difftool_define byquery_temp_create.sql");1065 query = pxDataGet("difftool_definewarpstack_temp_create.sql"); 1061 1066 if (!p_psDBRunQuery(config->dbh, query)) { 1062 1067 psError(PS_ERR_UNKNOWN, false, "database error"); … … 1070 1075 query = NULL; 1071 1076 1072 psString skycell_query = pxDataGet("difftool_define byquery_part2.sql");1077 psString skycell_query = pxDataGet("difftool_definewarpstack_part2.sql"); 1073 1078 1074 1079 psArray *list = psArrayAllocEmpty(16); // List of runs, to print … … 1183 1188 registered, 1184 1189 tess_id, 1185 exp_id, 1190 true, 1191 false, 1186 1192 false // magicked 1187 1193 ); … … 1284 1290 // Haversine formula for great circle distance 1285 1291 PXOPT_COPY_F32(config->args, selectWhere, "-distance", 1286 "DEGREES(2*ASIN(SQRT(POW(SIN(inputRawExp.decl - templateRawExp.decl),2) + COS(inputRawExp.decl)*COS(templateRawExp.decl)*POW(SIN(inputRawExp.ra - templateRawExp.ra),2))))", "<="); 1292 "DEGREES(2*ASIN(SQRT(POW(SIN(inputRawExp.decl - templateRawExp.decl),2) + " 1293 "COS(inputRawExp.decl)*COS(templateRawExp.decl)*" 1294 "POW(SIN(inputRawExp.ra - templateRawExp.ra),2))))", "<="); 1287 1295 1288 1296 PXOPT_LOOKUP_BOOL(backwards, config->args, "-backwards", false); … … 1308 1316 PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false); 1309 1317 1318 if (!psDBTransaction(config->dbh)) { 1319 psError(PS_ERR_UNKNOWN, false, "database error"); 1320 psFree(selectWhere); 1321 psFree(insertWhere); 1322 return false; 1323 } 1324 1325 if (!rerun) { 1326 // Need to build table of exposures with diffs 1327 psString tempCreate = pxDataGet("difftool_definewarpwarp_temp_create.sql"); // Create temp table SQL 1328 if (!tempCreate) { 1329 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 1330 psFree(selectWhere); 1331 psFree(insertWhere); 1332 if (!psDBRollback(config->dbh)) { 1333 psError(PS_ERR_UNKNOWN, false, "database error"); 1334 } 1335 return false; 1336 } 1337 1338 if (!p_psDBRunQuery(config->dbh, tempCreate)) { 1339 psError(PS_ERR_UNKNOWN, false, "Unable to create temp table: %s", tempCreate); 1340 psFree(tempCreate); 1341 psFree(selectWhere); 1342 psFree(insertWhere); 1343 if (!psDBRollback(config->dbh)) { 1344 psError(PS_ERR_UNKNOWN, false, "database error"); 1345 } 1346 return false; 1347 } 1348 psFree(tempCreate); 1349 1350 psString tempInsert = pxDataGet("difftool_definewarpwarp_temp_insert.sql"); // Insert to temp table 1351 if (!tempInsert) { 1352 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 1353 psFree(selectWhere); 1354 psFree(insertWhere); 1355 if (!psDBRollback(config->dbh)) { 1356 psError(PS_ERR_UNKNOWN, false, "database error"); 1357 } 1358 return false; 1359 } 1360 1361 psString where = psStringCopy(""); // WHERE for insertion 1362 if (label) { 1363 psStringAppend(&where, "\nAND diffRun.label = '%s'", label); 1364 } 1365 1366 if (!p_psDBRunQueryF(config->dbh, tempInsert, where, where)) { 1367 psError(PS_ERR_UNKNOWN, false, "Unable to insert into temp table: %s", tempInsert); 1368 psFree(tempInsert); 1369 psFree(where); 1370 psFree(selectWhere); 1371 psFree(insertWhere); 1372 if (!psDBRollback(config->dbh)) { 1373 psError(PS_ERR_UNKNOWN, false, "database error"); 1374 } 1375 return false; 1376 } 1377 psFree(where); 1378 psFree(tempInsert); 1379 } 1380 1381 // Get list of warps to diff 1310 1382 psString select = pxDataGet("difftool_definewarpwarp_select.sql"); 1311 1383 if (!select) { 1312 1384 psError(PXTOOLS_ERR_DATA, false, "failed to retreive SQL statement"); 1385 psFree(selectWhere); 1386 psFree(insertWhere); 1387 if (!psDBRollback(config->dbh)) { 1388 psError(PS_ERR_UNKNOWN, false, "database error"); 1389 } 1313 1390 return false; 1314 1391 } … … 1323 1400 psFree(selectWhere); 1324 1401 1325 if (!rerun) {1326 psStringAppend(&whereClause, "\n%s (diffRun.diff_id IS NULL", whereClause ? "AND" : "WHERE");1327 if (label) {1328 psStringAppend(&whereClause, " OR diffRun.label != '%s'", label);1329 }1330 psStringAppend(&whereClause, ")");1331 }1332 1333 1402 if (!available) { 1334 1403 psStringAppend(&whereClause, "\n%s inputWarpRun.state = 'full'", whereClause ? "AND" : "WHERE"); 1335 1404 } 1336 1405 1337 if (!psDBTransaction(config->dbh)) { 1338 psError(PS_ERR_UNKNOWN, false, "database error"); 1339 psFree(select); 1340 psFree(whereClause); 1341 psFree(insertWhere); 1342 return false; 1406 if (!rerun) { 1407 psStringAppend(&whereClause, "\n%s diffs.diff_id IS NULL", whereClause ? "AND" : "WHERE"); 1343 1408 } 1344 1409 1345 1410 if (!p_psDBRunQueryF(config->dbh, select, 1346 !rerun ? "\n" : "", // Activate LEFT JOIN against diff Run?1411 !rerun ? "\n" : "", // Activate LEFT JOIN against diffs? 1347 1412 whereClause)) { 1348 1413 psError(PS_ERR_UNKNOWN, false, "Unable to run query: %s [WITH] %s", select, whereClause); … … 1414 1479 psMetadata *row = results->data[i]; // Result row from query 1415 1480 1416 psS64 exp_id = psMetadataLookupS64(NULL, row, "input_exp_id");1417 1481 psS64 input_id = psMetadataLookupS64(NULL, row, "input_warp_id"); 1418 1482 const char *template = psMetadataLookupStr(NULL, row, "template_warp_id"); 1419 1483 const char *tess_id = psMetadataLookupStr(NULL, row, "tess_id"); 1420 if (! exp_id || !input_id || !template || !tess_id) {1484 if (!input_id || !template || !tess_id) { 1421 1485 psError(PXTOOLS_ERR_PROG, false, "Identifiers not found"); 1422 1486 psFree(list); … … 1430 1494 1431 1495 diffRunRow *run = diffRunRowAlloc(0, "reg", workdir, label, reduction, NULL, registered, 1432 tess_id, exp_id, false); // Run to insert1496 tess_id, true, true, false); // Run to insert 1433 1497 if (!diffRunInsertObject(config->dbh, run)) { 1434 1498 psError(PS_ERR_UNKNOWN, false, "database error"); -
trunk/ippTools/src/difftool.h
r23502 r24174 34 34 DIFFTOOL_MODE_REVERTDIFFSKYFILE, 35 35 DIFFTOOL_MODE_DEFINEPOPRUN, 36 DIFFTOOL_MODE_DEFINE BYQUERY,36 DIFFTOOL_MODE_DEFINEWARPSTACK, 37 37 DIFFTOOL_MODE_DEFINEWARPWARP, 38 38 DIFFTOOL_MODE_PENDINGCLEANUPRUN, -
trunk/ippTools/src/difftoolConfig.c
r23940 r24174 49 49 psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-workdir", 0, "define workdir (required)", NULL); 50 50 psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-tess_id", 0, "define tessellation ID (required)", NULL); 51 psMetadataAddBool(definerunArgs, PS_LIST_TAIL, "-bothways", 0, "do the subtraction both ways?", false); 52 psMetadataAddBool(definerunArgs, PS_LIST_TAIL, "-exposure", 0, "subtraction for entire exposure?", false); 51 53 psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-label", 0, "define label", NULL); 52 54 psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-reduction", 0, "define reduction class", NULL); … … 90 92 psMetadataAddS16(adddiffskyfileArgs, PS_LIST_TAIL, "-fault", 0, "set fault code", 0); 91 93 psMetadataAddS16(adddiffskyfileArgs, PS_LIST_TAIL, "-quality", 0, "set quality", 0); 92 psMetadataAddStr(adddiffskyfileArgs, PS_LIST_TAIL, "-uri", 0, "define URI of file", 0);93 94 psMetadataAddStr(adddiffskyfileArgs, PS_LIST_TAIL, "-path_base", 0, "define base output location", 0); 94 95 psMetadataAddF64(adddiffskyfileArgs, PS_LIST_TAIL, "-bg", 0, "define exposure background", NAN); … … 142 143 psMetadataAddStr(definepoprunArgs, PS_LIST_TAIL, "-reduction", 0, "define reduction class", NULL); 143 144 psMetadataAddBool(definepoprunArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 144 psMetadataAddS64(definepoprunArgs, PS_LIST_TAIL, "-exp_id", 0, "define exposure ID for template", 0);145 145 psMetadataAddS64(definepoprunArgs, PS_LIST_TAIL, "-template_warp_id", 0, "define warp ID for template", 0); 146 146 psMetadataAddS64(definepoprunArgs, PS_LIST_TAIL, "-template_stack_id", 0, "define stack ID for template", 0); … … 148 148 psMetadataAddS64(definepoprunArgs, PS_LIST_TAIL, "-input_stack_id", 0, "define stack ID for input", 0); 149 149 150 // -definebyquery 151 psMetadata *definebyqueryArgs = psMetadataAlloc(); 152 psMetadataAddS64(definebyqueryArgs, PS_LIST_TAIL, "-warp_id", 0, "search by warp ID", 0); 153 psMetadataAddS64(definebyqueryArgs, PS_LIST_TAIL, "-exp_id", 0, "search by exposure ID", 0); 154 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-skycell_id", 0, "search by skycell ID", NULL); 155 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-tess_id", 0, "search by tess ID", NULL); 156 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-filter", 0, "search by filter", NULL); 157 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-stack_label", 0, "search by stack label", NULL); 158 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-warp_label", 0, "search by warp label", NULL); 159 psMetadataAddF32(definebyqueryArgs, PS_LIST_TAIL, "-good_frac", 0, "minimum good fraction of skycell", NAN); 160 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-workdir", 0, "define workdir (required)", NULL); 161 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-label", 0, "define label", NULL); 162 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-reduction", 0, "define reduction class", NULL); 163 psMetadataAddTime(definebyqueryArgs, PS_LIST_TAIL, "-registered", 0, "time detrend run was registered", now); 164 psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-new-templates", 0, "also search for diffs with new template", false); 165 psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-rerun", 0, "define new run even if one exists", false); 166 psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-available", 0, "define new run even if warpRun has some faults", false); 167 psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 150 // -definewarpstack 151 psMetadata *definewarpstackArgs = psMetadataAlloc(); 152 psMetadataAddS64(definewarpstackArgs, PS_LIST_TAIL, "-warp_id", 0, "search by warp ID", 0); 153 psMetadataAddS64(definewarpstackArgs, PS_LIST_TAIL, "-exp_id", 0, "search by exposure ID", 0); 154 psMetadataAddStr(definewarpstackArgs, PS_LIST_TAIL, "-skycell_id", 0, "search by skycell ID", NULL); 155 psMetadataAddStr(definewarpstackArgs, PS_LIST_TAIL, "-tess_id", 0, "search by tess ID", NULL); 156 psMetadataAddStr(definewarpstackArgs, PS_LIST_TAIL, "-filter", 0, "search by filter", NULL); 157 psMetadataAddStr(definewarpstackArgs, PS_LIST_TAIL, "-stack_label", 0, "search by stack label", NULL); 158 psMetadataAddStr(definewarpstackArgs, PS_LIST_TAIL, "-warp_label", 0, "search by warp label", NULL); 159 psMetadataAddF32(definewarpstackArgs, PS_LIST_TAIL, "-good_frac", 0, "minimum good fraction of skycell", NAN); 160 psMetadataAddStr(definewarpstackArgs, PS_LIST_TAIL, "-workdir", 0, "define workdir (required)", NULL); 161 psMetadataAddStr(definewarpstackArgs, PS_LIST_TAIL, "-label", 0, "define label", NULL); 162 psMetadataAddStr(definewarpstackArgs, PS_LIST_TAIL, "-reduction", 0, "define reduction class", NULL); 163 psMetadataAddTime(definewarpstackArgs, PS_LIST_TAIL, "-registered", 0, "time detrend run was registered", now); 164 psMetadataAddBool(definewarpstackArgs, PS_LIST_TAIL, "-new-templates", 0, "also search for diffs with new template", false); 165 psMetadataAddBool(definewarpstackArgs, PS_LIST_TAIL, "-rerun", 0, "define new run even if one exists", false); 166 psMetadataAddBool(definewarpstackArgs, PS_LIST_TAIL, "-available", 0, "define new run even if warpRun has some faults", false); 167 psMetadataAddBool(definewarpstackArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 168 psMetadataAddBool(definewarpstackArgs, PS_LIST_TAIL, "-pretend", 0, "list results but to not queue", false); 168 169 169 170 // -definewarpwarp … … 239 240 PXOPT_ADD_MODE("-revertdiffskyfile","", DIFFTOOL_MODE_REVERTDIFFSKYFILE, revertdiffskyfileArgs); 240 241 PXOPT_ADD_MODE("-definepoprun", "", DIFFTOOL_MODE_DEFINEPOPRUN, definepoprunArgs); 241 PXOPT_ADD_MODE("-define byquery", "", DIFFTOOL_MODE_DEFINEBYQUERY, definebyqueryArgs);242 PXOPT_ADD_MODE("-definewarpstack", "", DIFFTOOL_MODE_DEFINEWARPSTACK, definewarpstackArgs); 242 243 PXOPT_ADD_MODE("-definewarpwarp", "", DIFFTOOL_MODE_DEFINEWARPWARP, definewarpwarpArgs); 243 244 PXOPT_ADD_MODE("-pendingcleanuprun", "show runs that need to be cleaned up", DIFFTOOL_MODE_PENDINGCLEANUPRUN, pendingcleanuprunArgs); -
trunk/ippTools/src/magictool.c
r23970 r24174 127 127 PXOPT_LOOKUP_TIME(registered, config->args, "-registered", false, false); 128 128 PXOPT_LOOKUP_BOOL(simple, config->args, "-simple", false); 129 130 psMetadata *where = psMetadataAlloc(); 131 PXOPT_COPY_S64(config->args, where, "-exp_id", "exp_id", "=="); 132 PXOPT_COPY_STR(config->args, where, "-diff_label", "diffRun.label", "=="); 133 129 PXOPT_LOOKUP_BOOL(pretend, config->args, "-pretend", false); 130 131 psMetadata *diffWhere = psMetadataAlloc(); // WHERE conditions for diffRuns 132 PXOPT_COPY_STR(config->args, diffWhere, "-diff_label", "diffRun.label", "=="); 133 PXOPT_COPY_S64(config->args, diffWhere, "-diff_id", "diff_id", "=="); 134 135 psMetadata *queryWhere = psMetadataAlloc(); // WHERE conditions for everything else 136 PXOPT_COPY_S64(config->args, queryWhere, "-exp_id", "exp_id", "=="); 134 137 135 138 // Get list of exposures ready to magic … … 146 149 PXOPT_LOOKUP_BOOL(rerun, config->args, "-rerun", false); 147 150 148 psString queryWhere = NULL; // WHERE conditions for entire query 151 psString diffWhereStr = NULL; // WHERE conditions for diffRuns 152 psString queryWhereStr = NULL; // WHERE conditions for entire query 149 153 if (!available) { 150 psStringAppend(& queryWhere, " \nWHEREdiffRun.state = 'full'");151 } else {152 // what if no skycells for the diff run completed?153 } 154 psStringAppend(&diffWhereStr, "\nAND diffRun.state = 'full'"); 155 } 156 // what if no skycells for the diff run completed? 157 154 158 if (!rerun) { 155 const char *newWhere = " magic_id IS NULL"; // String to add 156 if (queryWhere) { 157 psStringAppend(&queryWhere, " AND %s", newWhere); 158 } else { 159 psStringAppend(&queryWhere, "\nWHERE %s", newWhere); 160 } 161 } 159 psStringAppend(&queryWhereStr, "\n%s magic_id IS NULL", queryWhereStr ? "AND" : "WHERE"); 160 } 161 162 162 // now add the user specified qualifiers 163 if (psListLength( where->list)) {164 psString whereClause = psDBGenerateWhereConditionSQL( where, NULL);165 psStringAppend(& queryWhere, "\n%s %s", queryWhere == NULL ? "WHERE" : "AND", whereClause);163 if (psListLength(diffWhere->list)) { 164 psString whereClause = psDBGenerateWhereConditionSQL(diffWhere, NULL); 165 psStringAppend(&diffWhereStr, "\nAND %s", whereClause); 166 166 psFree(whereClause); 167 167 } 168 psFree(where); 169 if (!queryWhere) { 170 psStringAppend(&queryWhere, " "); 171 } 172 173 if (!p_psDBRunQueryF(config->dbh, query, queryWhere)) { 168 if (psListLength(queryWhere->list)) { 169 psString whereClause = psDBGenerateWhereConditionSQL(queryWhere, NULL); 170 psStringAppend(&queryWhereStr, "\n%s %s", queryWhereStr ? "AND" : "WHERE", whereClause); 171 psFree(whereClause); 172 } 173 psFree(diffWhere); 174 psFree(queryWhere); 175 176 // Ensure the WHERE strings have something 177 if (!diffWhereStr) { 178 diffWhereStr = psStringCopy(""); 179 } 180 if (!queryWhereStr) { 181 queryWhereStr = psStringCopy(""); 182 } 183 184 if (!p_psDBRunQueryF(config->dbh, query, diffWhereStr, diffWhereStr, queryWhereStr)) { 174 185 psError(PS_ERR_UNKNOWN, false, "database error"); 175 psFree(queryWhere); 186 psFree(diffWhereStr); 187 psFree(queryWhereStr); 176 188 psFree(query); 177 189 return false; 178 190 } 179 psFree(queryWhere); 191 psFree(diffWhereStr); 192 psFree(queryWhereStr); 180 193 psFree(query); 181 194 } … … 201 214 } 202 215 216 217 if (pretend) { 218 // negative simple so the default is true 219 if (!ippdbPrintMetadatas(stdout, output, "diffRun", !simple)) { 220 psError(PS_ERR_UNKNOWN, false, "failed to print array"); 221 psFree(output); 222 return false; 223 } 224 psFree(output); 225 return true; 226 } 227 228 203 229 // Parse the list of exposures ready to magic 204 205 230 if (!psDBTransaction(config->dbh)) { 206 231 psError(PS_ERR_UNKNOWN, false, "database error"); … … 215 240 psS64 exp_id = psMetadataLookupS64(NULL, row, "exp_id"); // Exposure identifier 216 241 psS64 diff_id = psMetadataLookupS64(NULL, row, "diff_id"); // difference identifier 242 bool inverse = psMetadataLookupU64(NULL, row, "inverse"); // Inverse subtraction? Note types! 217 243 218 244 // create a new magicRun for this group 219 magicRunRow *run = magicRunRowAlloc(0, exp_id, diff_id, "new", workdir, "dirty", label, dvodb, registered, 0); 245 magicRunRow *run = magicRunRowAlloc(0, exp_id, diff_id, inverse, "new", workdir, "dirty", label, 246 dvodb, registered, 0); 220 247 if (!run) { 221 248 psAbort("failed to alloc magicRun object"); … … 296 323 297 324 // optional 325 PXOPT_LOOKUP_BOOL(inverse, config->args, "-inverse", false); 298 326 PXOPT_LOOKUP_STR(label, config->args, "-label", false, false); 299 327 PXOPT_LOOKUP_STR(dvodb, config->args, "-dvodb", false, false); … … 305 333 exp_id, 306 334 diff_id ? diff_id : PS_MAX_S64, 335 inverse, 307 336 "reg", // state 308 337 workdir, … … 363 392 // required 364 393 PXOPT_LOOKUP_S64(magic_id, config->args, "-magic_id", true, false); 365 PXOPT_LOOKUP_S64(diff_id, config->args, "-diff_id", true, false);366 394 PXOPT_LOOKUP_STR(node, config->args, "-node", true, false); 367 395 … … 369 397 config->dbh, 370 398 magic_id, 371 diff_id,372 399 node 373 400 ); … … 563 590 PXOPT_COPY_S16(config->args, where, "-fault", "fault", "=="); 564 591 565 psString query = psStringCopy("UPDATE magicRun SET fault = 0, state = ' run' WHERE fault != 0");592 psString query = psStringCopy("UPDATE magicRun SET fault = 0, state = 'new' WHERE fault != 0"); 566 593 567 594 if (psListLength(where->list)) { … … 584 611 PS_ASSERT_PTR_NON_NULL(config, false); 585 612 586 psMetadata *where = psMetadataAlloc(); 587 PXOPT_COPY_S64(config->args, where, "-magic_id", "magic_id", "=="); 588 PXOPT_COPY_STR(config->args, where, "-node", "node", "=="); 613 // Regrettably, there are multiple WHERE hooks which call the same things different names 614 psMetadata *templatesWhere = psMetadataAlloc(); // WHERE for selecting template 615 psMetadata *magicWhere = psMetadataAlloc(); // WHERE for selecting magic runs 616 617 PXOPT_COPY_S64(config->args, templatesWhere, "-magic_id", "magicRun.magic_id", "=="); 618 PXOPT_COPY_STR(config->args, templatesWhere, "-node", "diffInputSkyfile.skycell_id", "=="); 619 620 PXOPT_COPY_S64(config->args, magicWhere, "-magic_id", "magicRun.magic_id", "=="); 621 PXOPT_COPY_STR(config->args, magicWhere, "-node", "magicTree.node", "=="); 589 622 590 623 PXOPT_LOOKUP_U64(limit, config->args, "-limit", false, false); … … 597 630 } 598 631 599 if (psListLength(where->list)) { 600 psString whereClause = psDBGenerateWhereConditionSQL(where, NULL); 601 psStringAppend(&query, " AND %s", whereClause); 632 psString templatesWhereStr = psStringCopy(""); // WHERE for selecting template 633 psString magicWhereStr = psStringCopy(""); // WHERE for selecting magic runs 634 635 if (psListLength(templatesWhere->list)) { 636 psString whereClause = psDBGenerateWhereConditionSQL(templatesWhere, NULL); 637 psStringAppend(&templatesWhereStr, "\nAND %s", whereClause); 602 638 psFree(whereClause); 603 639 } 604 psFree(where); 640 psFree(templatesWhere); 641 642 if (psListLength(magicWhere->list)) { 643 psString whereClause = psDBGenerateWhereConditionSQL(magicWhere, NULL); 644 psStringAppend(&magicWhereStr, "\nWHERE %s", whereClause); 645 psFree(whereClause); 646 } 647 psFree(magicWhere); 605 648 606 649 // treat limit == 0 as "no limit" … … 611 654 } 612 655 613 if (!p_psDBRunQuery(config->dbh, query)) { 614 psError(PS_ERR_UNKNOWN, false, "database error"); 656 if (!p_psDBRunQueryF(config->dbh, query, 657 templatesWhereStr, templatesWhereStr, 658 magicWhereStr, magicWhereStr)) { 659 psError(PS_ERR_UNKNOWN, false, "database error"); 660 psFree(templatesWhereStr); 661 psFree(magicWhereStr); 615 662 psFree(query); 616 663 return false; 617 664 } 665 psFree(templatesWhereStr); 666 psFree(magicWhereStr); 618 667 psFree(query); 619 668 … … 704 753 705 754 bool status = false; 706 psS 32 done = psMetadataLookupS32(&status, data, "done");755 psS64 done = psMetadataLookupS64(&status, data, "done"); 707 756 if (!status) { 708 757 psAbort("failed to lookup value for done column"); 709 758 } 710 psS 16 bad = psMetadataLookupS16(&status, data, "bad");759 psS64 bad = psMetadataLookupS64(&status, data, "bad"); 711 760 if (!status) { 712 761 psAbort("failed to lookup value for bad column"); … … 738 787 739 788 psMetadata *where = psMetadataAlloc(); 740 PXOPT_COPY_S64(config->args, where, "-magic_id", "magic _id", "==");789 PXOPT_COPY_S64(config->args, where, "-magic_id", "magicRun.magic_id", "=="); 741 790 pxAddLabelSearchArgs (config, where, "-label", "magicRun.label", "=="); 742 791 … … 794 843 if (limit) { 795 844 if (psArrayLength(output) >= limit) { 796 // we've found enough (not that limit was applied to the query so '> limit' won't happen)845 // we've found enough (note that limit was applied to the query so '> limit' won't happen) 797 846 // negative simple so the default is true 798 847 if (!ippdbPrintMetadatas(stdout, output, "magicMe", !simple)) { … … 936 985 937 986 // optional 938 PXOPT_LOOKUP_STR( uri, config->args, "-uri", false, false);987 PXOPT_LOOKUP_STR(path_base, config->args, "-path_base", false, false); 939 988 940 989 // default values … … 944 993 magic_id, 945 994 node, 946 uri,995 path_base, 947 996 fault 948 997 )) { -
trunk/ippTools/src/magictoolConfig.c
r23969 r24174 53 53 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-dvodb", 0, "define dvodb", NULL); 54 54 psMetadataAddTime(definebyqueryArgs, PS_LIST_TAIL, "-registered", 0, "time detrend run was registered", now); 55 psMetadataAddS64(definebyqueryArgs, PS_LIST_TAIL, "-diff_id", 0, "search diff_id", 0); 55 56 psMetadataAddS64(definebyqueryArgs, PS_LIST_TAIL, "-exp_id", 0, "search exp_id", 0); 56 57 psMetadataAddStr(definebyqueryArgs, PS_LIST_TAIL, "-diff_label", 0, "select diff label", NULL); … … 58 59 psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-rerun", 0, "generate new run even if existing?", false); 59 60 psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-simple", 0, "use the simple output format", false); 61 psMetadataAddBool(definebyqueryArgs, PS_LIST_TAIL, "-pretend", 0, "list results but do not queue", false); 60 62 61 63 // -definerun … … 65 67 // following argument is for compatability 66 68 psMetadataAddS64(definerunArgs, PS_LIST_TAIL, "-diff_id", 0, "define diff_id", 0); 69 psMetadataAddBool(definerunArgs, PS_LIST_TAIL, "-inverse", 0, "use the inverse subtraction?", false); 67 70 psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-label", 0, "define label", NULL); 68 71 psMetadataAddStr(definerunArgs, PS_LIST_TAIL, "-dvodb", 0, "define dvodb", NULL); … … 78 81 psMetadata *addinputskyfileArgs = psMetadataAlloc(); 79 82 psMetadataAddS64(addinputskyfileArgs, PS_LIST_TAIL, "-magic_id", 0, "define magictool ID (required)", 0); 80 psMetadataAddS64(addinputskyfileArgs, PS_LIST_TAIL, "-diff_id", 0, "define difftool ID (required)", 0);81 83 psMetadataAddStr(addinputskyfileArgs, PS_LIST_TAIL, "-node", 0, "define symbolic node name (required)", NULL); 82 84 … … 125 127 psMetadataAddS64(addresultArgs, PS_LIST_TAIL, "-magic_id", 0, "define magictool ID (required)", 0); 126 128 psMetadataAddStr(addresultArgs, PS_LIST_TAIL, "-node", 0, "define symbolic node name (required)", NULL); 127 psMetadataAddStr(addresultArgs, PS_LIST_TAIL, "- uri", 0, "define URI", NULL);129 psMetadataAddStr(addresultArgs, PS_LIST_TAIL, "-path_base", 0, "define path_base", NULL); 128 130 psMetadataAddS16(addresultArgs, PS_LIST_TAIL, "-fault", 0, "set fault code", 0); 129 131 -
trunk/ppImage
- Property svn:mergeinfo changed (with no actual effect on merging)
-
trunk/ppStack
- Property svn:mergeinfo changed (with no actual effect on merging)
-
trunk/ppSub
- Property svn:mergeinfo changed (with no actual effect on merging)
-
trunk/psModules
- Property svn:mergeinfo changed (with no actual effect on merging)
-
trunk/psastro
- Property svn:mergeinfo changed (with no actual effect on merging)
-
trunk/psastro/src/psastroFindChip.c
- Property svn:mergeinfo changed (with no actual effect on merging)
-
trunk/psconfig
- Property svn:mergeinfo changed (with no actual effect on merging)
-
trunk/psphot
- Property svn:mergeinfo changed (with no actual effect on merging)
Note:
See TracChangeset
for help on using the changeset viewer.
