Changeset 30120 for trunk/ippScripts/scripts/nightly_science.pl
- Timestamp:
- Dec 20, 2010, 5:52:38 PM (15 years ago)
- File:
-
- 1 edited
-
trunk/ippScripts/scripts/nightly_science.pl (modified) (11 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/ippScripts/scripts/nightly_science.pl
r30067 r30120 396 396 exit(0); 397 397 } 398 exit(10); 398 399 399 if (defined($check_confirm_stacks) || defined($test_mode)) { 400 400 $metadata_out{nsStackState} = 'CONFIRM_STACKING'; … … 409 409 exit(0); 410 410 } 411 411 exit(10); 412 412 if (defined($check_sweetspot) || defined($test_mode) || defined($check_mode)) { 413 413 $metadata_out{nsSSState} = 'CHECKSWEETSPOT'; … … 1097 1097 my $pretend = shift; 1098 1098 1099 my $Npotential = 0; 1100 my $Nqueued = 0; 1099 1101 foreach my $target (sort (keys %science_config)) { 1100 1102 if ($science_config{$target}{STACKABLE} == 1) { … … 1120 1122 next; 1121 1123 } 1124 $Npotential++; 1122 1125 if ($Nalready != 0) { 1126 $Nqueued++; 1123 1127 if ($debug == 1) { 1124 1128 print STDERR "execute_stacks: Not queueing $target in filter $filter on $date due to already existing stacks.\n"; … … 1137 1141 } 1138 1142 stack_queue($date,$target,$filter); 1143 $Nqueued ++; 1139 1144 } 1140 1145 if (defined($pretend)) { … … 1152 1157 } 1153 1158 } 1159 $metadata_out{nsStackPotential} = $Npotential; 1160 $metadata_out{nsStackQueued} = $Nqueued; 1161 if (($Npotential == $Nqueued)&&($metadata_out{nsObservingState} eq 'END_OF_NIGHT')) { 1162 $metadata_out{nsStackState} = 'FINISHED_STACKS'; 1163 } 1154 1164 } 1155 1165 … … 1231 1241 my ($label,$workdir,$obs_mode,$object,$comment,$tess_id,$dist_group,$data_group,$reduction) = get_tool_parameters($date,$target); 1232 1242 1233 my $sth = "SELECT diff_id from diffRun JOIN diffInputSkyfile USING(diff_id) where data_group = '$data_group' AND warp1 = $warp_id_1 AND warp2 = $warp_id_2"; 1243 my $count = 0; 1244 1245 my $sth = "SELECT DISTINCT diff_id from diffRun JOIN diffInputSkyfile USING(diff_id) where data_group = '$data_group' AND warp1 = $warp_id_1 AND warp2 = $warp_id_2"; 1234 1246 my $data_ref = $db->selectall_arrayref( $sth ); 1235 1236 return($#{ $data_ref } + 1); 1247 $count += $#{ $data_ref } + 1; 1248 1249 $sth = "SELECT DISTINCT diff_id from diffRun JOIN diffInputSkyfile USING(diff_id) where data_group = '$data_group' AND warp1 = $warp_id_2 AND warp2 = $warp_id_1"; 1250 $data_ref = $db->selectall_arrayref( $sth ); 1251 $count += $#{ $data_ref } + 1; 1252 1253 return($count); 1237 1254 } 1238 1255 … … 1276 1293 foreach my $filter (@filter_list) { 1277 1294 my ($NprocChips,$NprocWarps) = pre_diff_queue($date,$observing_state,$target,$filter); 1278 if ((!defined($force_diff_count))&&($NprocChips != $NprocWarps)) {1279 if ($debug == 1) {1280 print STDERR "execute_diffs: Target $target in filter $filter on $date is not fully processed. ($NprocChips $NprocWarps)\n";1281 }1282 $metadata_out{nsDiffState} = 'FORCETOWARP';1283 next;1284 }1295 # if ((!defined($force_diff_count))&&($NprocChips != $NprocWarps)) { 1296 # if ($debug == 1) { 1297 # print STDERR "execute_diffs: Target $target in filter $filter on $date is not fully processed. ($NprocChips $NprocWarps)\n"; 1298 # } 1299 # $metadata_out{nsDiffState} = 'FORCETOWARP'; 1300 # next; 1301 # } 1285 1302 if ($NprocChips == 0) { 1286 1303 if ($debug == 1) { … … 1326 1343 1327 1344 my $object_ref = $db->selectall_arrayref( $obj_sth ); 1345 1346 my $Npotential = 0; 1347 my $Nqueued = 0; 1328 1348 1329 1349 foreach my $object_row (@{ $object_ref }) { 1330 1350 my $this_object = shift @{ $object_row }; 1331 my $input_sth = "select exp_id,warp_id,dateobs from warpRun JOIN fakeRun USING(fake_id) JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) ";1351 my $input_sth = "select exp_id,warp_id,dateobs,rawExp.comment from warpRun JOIN fakeRun USING(fake_id) JOIN camRun USING(cam_id) JOIN chipRun USING(chip_id) JOIN rawExp USING(exp_id) "; 1332 1352 $input_sth .= " WHERE warpRun.state = 'full' AND warpRun.label = '$label' AND warpRun.data_group = '$data_group' AND rawExp.filter = '$filter' AND rawExp.object = '$this_object' "; 1333 1353 $input_sth .= " ORDER BY dateobs "; 1334 1354 1335 1355 my $warps = $db->selectall_arrayref( $input_sth ); 1356 1357 # Each comment should only appear once. Therefore, if we see it more than once, we assume the first is extra. 1358 my %comment_hash = (); 1359 foreach my $this_warp (@{ $warps }) { 1360 my $this_comment = ${ $this_warp }[3]; 1361 my $this_exp_id = ${ $this_warp }[0]; 1362 $comment_hash{$this_comment} = $this_exp_id; 1363 } 1336 1364 1337 1365 if (($#{ $warps } + 1) % 2 != 0) { 1338 print STDERR "diff_queue: Number of input warps to make diffs is not even for target $target and object $this_object! $#{ $warps }\n"; 1339 next; 1366 print STDERR "diff_queue: Number of input warps to make diffs is not even for target $target and object $this_object! $#{ $warps } "; 1367 if ($#{ $warps} + 1 == 1) { 1368 print STDERR ": I can do no diffs with only one exposure.\n"; 1369 next; 1370 } 1371 else { 1372 print STDERR ": I should declare an exposure to be faulty.\n"; 1373 my @keep_warps = (); 1374 # print "@{ $warps }\n"; 1375 foreach my $this_warp (@{ $warps }) { 1376 my $this_comment = ${ $this_warp }[3]; 1377 my $this_exp_id = ${ $this_warp }[0]; 1378 if ($comment_hash{$this_comment} == $this_exp_id) { 1379 push @keep_warps, $this_warp; 1380 } 1381 else { 1382 print STDERR "diff_queue: excluding $this_exp_id for $this_object\n"; 1383 } 1384 } 1385 @{ $warps } = @keep_warps; 1386 # print "@{ $warps }\n"; 1387 } 1340 1388 } 1341 1389 1342 1390 while ($#{ $warps } > -1) { 1343 1391 my $input_warp = shift @{ $warps }; 1392 my $input_exp_id = ${ $input_warp }[0]; 1393 my $input_comment = ${ $input_warp }[3]; 1394 1395 1344 1396 my $template_warp = shift @{ $warps }; 1345 my $input_exp_id = ${ $input_warp }[0]; 1397 1346 1398 my $template_exp_id = ${ $template_warp }[0]; 1347 1399 1348 1400 my $input_warp_id = ${ $input_warp }[1]; 1349 1401 my $template_warp_id = ${ $template_warp }[1]; 1350 1402 1403 $Npotential++; 1351 1404 if (verify_uniqueness_diff($input_warp_id,$template_warp_id,$date,$target) != 0) { 1405 $Nqueued++; 1352 1406 print STDERR "Diffs already queued for this $date $target $input_exp_id $template_exp_id\n"; 1353 1407 next; … … 1366 1420 $cmd .= ' -pretend '; 1367 1421 print STDERR "diff_queue: $cmd\n"; 1422 print STDERR " $input_warp_id $template_warp_id\n"; 1368 1423 } 1369 1424 … … 1378 1433 } 1379 1434 } 1435 $metadata_out{nsDiffPotential} += $Npotential; 1436 $metadata_out{nsDiffQueued} += $Nqueued; 1437 if (($metadata_out{nsDiffPotential} == $metadata_out{nsDiffQueued})&&($metadata_out{nsObservingState} eq 'END_OF_NIGHT')) { 1438 $metadata_out{nsDiffState} = 'FINISHED_DIFFS'; 1439 } 1440 1380 1441 } 1381 1442
Note:
See TracChangeset
for help on using the changeset viewer.
