Index: trunk/ippScripts/scripts/ds9_cmf_regions.pl
===================================================================
--- trunk/ippScripts/scripts/ds9_cmf_regions.pl	(revision 24341)
+++ trunk/ippScripts/scripts/ds9_cmf_regions.pl	(revision 24342)
@@ -47,5 +47,5 @@
            'flag-colour=s' => \$flag_colour,
            'flag=o' => \$flag,
-    'mag-radius' => $mag_radius,
+    'mag-radius' => \$mag_radius,
            'radius=f' => \$radius,
            'save-temps'        => \$save_temps, # Save temporary files?
@@ -75,5 +75,5 @@
 $fits->read_col(TFLOAT, $yCol, 1, 1, $numRows, 0, $y, undef, $status) and check_fitsio($status);
 $fits->read_col(TINT, $flagCol, 1, 1, $numRows, 0, $flags, undef, $status) and check_fitsio($status);
-$fits->read_col(TINT, $magCol, 1, 1, $numRows, 0, $mag, undef, $status) and check_fitsio($status);
+$fits->read_col(TFLOAT, $magCol, 1, 1, $numRows, 0, $mag, undef, $status) and check_fitsio($status);
 $fits->close_file($status);
 
@@ -81,5 +81,5 @@
 if ($mag_radius) {
     foreach my $m (@$mag) {
-        next unless defined $m;
+        next unless defined $m and $m < "inf" and $m > "-inf";
         unless (defined $mag_min and defined $mag_max) {
             $mag_min = $m;
@@ -97,4 +97,5 @@
 my $numBad = 0;                 # Number of bad sources
 my $radius_scale = $radius / ($mag_min - $mag_max + 1.0); # Scaling for radius
+print "Scaling: $mag_min --> $mag_max ==> $radius_scale\n";
 for (my $i = 0; $i < $numRows; $i++) {
     my $col;                    # Colour to use
@@ -107,6 +108,8 @@
     }
     my $r = $radius;            # Radius of circle
+    next if defined $mag_radius and (not defined $$mag[$i] or $$mag[$i] == "inf" or $$mag[$i] == "-inf");
     $r -= ($$mag[$i] - $mag_min) * $radius_scale if defined $mag_radius;
     print $coordFile "image; circle(" . ($$x[$i] + 1) . ',' . ($$y[$i] + 1) . ",$r) \# color = $col\n";
+    print "image; circle(" . ($$x[$i] + 1) . ',' . ($$y[$i] + 1) . ",$r) \# color = $col\n";
 }
 close $coordFile;
