Index: trunk/ippScripts/scripts/ds9_cmf_regions.pl
===================================================================
--- trunk/ippScripts/scripts/ds9_cmf_regions.pl	(revision 24343)
+++ trunk/ippScripts/scripts/ds9_cmf_regions.pl	(revision 26901)
@@ -81,5 +81,5 @@
 if ($mag_radius) {
     foreach my $m (@$mag) {
-        next unless defined $m and $m < "inf" and $m > "-inf";
+        next unless defined $m and $m != "nan" and $m < "inf" and $m > "-inf";
         unless (defined $mag_min and defined $mag_max) {
             $mag_min = $m;
@@ -99,5 +99,5 @@
 for (my $i = 0; $i < $numRows; $i++) {
     my $col;                    # Colour to use
-    if ($$flags[$i] & $flag) {
+    if ($$flags[$i] & $flag or not defined $$mag[$i] or $$mag[$i] eq "nan" or $$mag[$i] == "inf" or $$mag[$i] == "-inf") {
         $numBad++;
         $col = $flag_colour;
@@ -107,5 +107,5 @@
     }
     my $r = $radius;            # Radius of circle
-    next if defined $mag_radius and (not defined $$mag[$i] or $$mag[$i] == "inf" or $$mag[$i] == "-inf");
+    next if $mag_radius and (not defined $$mag[$i] or $$mag[$i] eq "nan" 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";
