#!/usr/bin/perl

$all_number=0;	#all reflections
$measured_numb=0; #reflections without "?" in F or F_sigma
$measured_good_number=0; #reflections such that F/F_sigma > 3

open(FILE, '<2pr5-sf.cif');

while ($line=<FILE>) {
next if $.<53;
$line=~m#\s(\S+)\s+(\S+)\n#;
$F=$1;
$F_sigma=$2;
if ($F=~m#^\d+\.\d+$# and $F_sigma=~m#^\d+\.\d+$# and $F/$F_sigma > 3) {$all_number++; $measured_numb++; $measured_good_number++;}
elsif ($F=~m#^\d+\.\d+$# and $F_sigma=~m#^\d+\.\d+$# and $F/$F_sigma <= 3) {$all_number++; $measured_numb++;}
elsif ($F=~m#\?# or $F_sigma=~m#\?#) {$all_number++;}
else {print "strange line: $line";}
}

close FILE;

print $all_number."\n";
print $measured_numb."\n";
print $measured_good_number."\n";
print sprintf("%.0d", ($measured_good_number/$measured_numb)*100)."\n";
