- Timestamp:
- Apr 13, 2023, 2:17:26 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/eam/rawfix.20230221/src/check_chip_locations.pl
r42446 r42450 46 46 my $Ncul2 = 0; 47 47 my $Ncul3 = 0; 48 my $Nfail = 0; 49 50 my ($goodchips_r, $failchips_r) = &get_good_or_fail_chiplists ($topdir, $dateword, $stage); 48 51 49 52 foreach my $chip_id (@chip_ids) { … … 52 55 open ($outfh, ">$topdir/$dateword/$chip_id.uris.$stage.txt"); 53 56 57 print "open $topdir/$dateword/$chip_id.uris.$stage.txt\n"; 58 54 59 # get the list of chip neb paths for one chip 55 60 my ($neb_paths_r, $ds_array_r, $md_array_r) = &get_chip_paths ($fulldate, $chip_id); 56 57 # I think this makes a copy of the arrays, which is inefficient58 # my @neb_paths = @$neb_paths_r;59 # my @ds_array = @$ds_array_r;60 # my @md_array = @$md_array_r;61 61 62 62 # reset the hostcount for this chip … … 115 115 print "Ncul2: $Ncul2\n"; 116 116 print "Ncul3: $Ncul3\n"; 117 118 my $Ntotal = $Ngood + $Ngone + $Ndead + $Nsing + $Ndups + $Nsbck + $Nxbck + $Ncul1 + $Ncul2 + $Ncul3; 117 print "Nfail: $Nfail\n"; 118 119 my $Ntotal = $Ngood + $Ngone + $Ndead + $Nsing + $Ndups + $Nsbck + $Nxbck + $Ncul1 + $Ncul2 + $Ncul3 + $Nfail; 119 120 if ($Ntotal != $Nchip) { die "ERROR: inconsistent count of chips\n"; } 120 121 … … 132 133 $sql_update_stats .= ", Ncul2 = $Ncul2"; 133 134 $sql_update_stats .= ", Ncul3 = $Ncul3"; 135 $sql_update_stats .= ", Nfail = $Nfail"; 134 136 $sql_update_stats .= " WHERE dateobs = $dateword"; 135 137 … … 293 295 $Nchip ++; 294 296 297 my $haveMD5 = 0; 298 my $goodMD5 = 0; 299 if ($goodchips_r->{$extID}) { $haveMD5 = 1; $goodMD5 = 1; } 300 if ($failchips_r->{$extID}) { $haveMD5 = 1; $goodMD5 = 0; } 301 302 if ($extID eq "gpc1/20100503/o5319g0003d/o5319g0003d.ota46.fits") { 303 print STDERR "$outinfo $Nmain $Nback $haveMD5 $goodMD5\n"; 304 } 305 295 306 # GOOD : already fixed 296 307 if (($Nmain == 1) && ($Nback == 1)) { 297 308 print $outfh "GOOD: $outinfo\n"; 298 $Ngood ++;309 &update_counts (\$Ngood, \$Nfail, $haveMD5, $goodMD5); 299 310 return; 300 311 } … … 304 315 if (($Nmain == 1) && ($Nback == 0)) { 305 316 print $outfh "SING: $outinfo\n"; 306 $Nsing ++;317 &update_counts (\$Nsing, \$Nfail, $haveMD5, $goodMD5); 307 318 return; 308 319 } … … 312 323 if (($Nmain == 0) && ($Nback == 1)) { 313 324 print $outfh "SBCK: $outinfo\n"; 314 $Nsbck ++;325 &update_counts (\$Nsbck, \$Nfail, $haveMD5, $goodMD5); 315 326 return; 316 327 } … … 320 331 if (($Nmain > 1) && ($Nback == 0)) { 321 332 print $outfh "DUPS: $outinfo\n"; 322 $Ndups ++;333 &update_counts (\$Ndups, \$Nfail, $haveMD5, $goodMD5); 323 334 return; 324 335 } … … 328 339 if (($Nmain == 0) && ($Nback > 1)) { 329 340 print $outfh "XBCK: $outinfo\n"; 330 $Nxbck ++;341 &update_counts (\$Nxbck, \$Nfail, $haveMD5, $goodMD5); 331 342 return; 332 343 } … … 335 346 if (($Nmain == 0) && ($Nback == 0) && $Nlost) { 336 347 print $outfh "DEAD: $outinfo\n"; 337 $Ndead ++;348 &update_counts (\$Ndead, \$Nfail, $haveMD5, $goodMD5); 338 349 return; 339 350 } … … 341 352 if (($Nmain == 0) && ($Nback == 0) && ($Nlost == 0)) { 342 353 print $outfh "GONE: $outinfo\n"; 343 $Ngone ++;354 &update_counts (\$Ngone, \$Nfail, $haveMD5, $goodMD5); 344 355 return; 345 356 } … … 349 360 if (($Nmain > 1) && ($Nback == 1)) { 350 361 print $outfh "CUL1: $outinfo\n"; 351 $Ncul1 ++;362 &update_counts (\$Ncul1, \$Nfail, $haveMD5, $goodMD5); 352 363 return; 353 364 } … … 357 368 if (($Nback > 1) && ($Nmain == 1)) { 358 369 print $outfh "CUL2: $outinfo\n"; 359 $Ncul2 ++;370 &update_counts (\$Ncul2, \$Nfail, $haveMD5, $goodMD5); 360 371 return; 361 372 } … … 365 376 if (($Nback > 1) && ($Nmain > 1)) { 366 377 print $outfh "CUL3: $outinfo\n"; 367 $Ncul3 ++;378 &update_counts (\$Ncul3, \$Nfail, $haveMD5, $goodMD5); 368 379 return; 369 380 } … … 372 383 print $outfh "OOPS: $outinfo\n"; 373 384 return; 385 } 386 387 sub update_counts { 388 389 my $Nstat_r = $_[0]; 390 my $Nfail_r = $_[1]; 391 my $haveMD5 = $_[2]; 392 my $goodMD5 = $_[3]; 393 394 ## if we know the MD5 is bad, add to Nfail, otherwise add to Ndups 395 if ($haveMD5 && !$goodMD5) { 396 $$Nfail_r ++; 397 } else { 398 $$Nstat_r ++; 399 } 400 } 401 402 sub get_good_or_fail_chiplists { 403 404 my $topdir = $_[0]; 405 my $dateword = $_[1]; 406 my $stage = $_[2]; 407 408 # load the lists of good and fail chips 409 my $prev = $stage - 1; 410 my $goodfile = "$topdir/$dateword/goodchips.$prev.txt"; 411 my %goodchips; 412 if (-e $goodfile) { 413 open (GOODFILE, $goodfile); 414 my @lines = <GOODFILE>; 415 close (GOODFILE); 416 417 foreach my $line (@lines) { 418 chomp $line; 419 $goodchips{$line} = 1; 420 } 421 } 422 my $failfile = "$topdir/$dateword/failchips.$prev.txt"; 423 my %failchips; 424 if (-e $failfile) { 425 open (FAILFILE, $failfile); 426 my @lines = <FAILFILE>; 427 close (FAILFILE); 428 429 foreach my $line (@lines) { 430 chomp $line; 431 $failchips{$line} = 1; 432 } 433 } 434 return (\%goodchips, \%failchips); 374 435 } 375 436
Note:
See TracChangeset
for help on using the changeset viewer.
