#!/usr/local/bin/perl
#
# Convert galaxy boxes into fields.
#

$boxside = 256.0;

  while ($fname = <CLF_*.gal>) {
    if ( $fname =~ m/CLF_83825_(\d\.\d\d\d\d).gal/) {
      $aa = $1;
      $cmd= sprintf "./makecat %s %.2f %.4f > Catalog_%.3f.txt",
              $fname,$boxside,1.0/$aa-1.0,1.0/$aa-1.0;
      printf "$cmd\n";
      $output = `$cmd`;
      if ($output) {print "$output";}
    }
    else {
      printf "Dont know how to parse $fname\n";
    }
  }
