Index: trunk/ippScripts/scripts/camera_exp.pl
===================================================================
--- trunk/ippScripts/scripts/camera_exp.pl	(revision 35715)
+++ trunk/ippScripts/scripts/camera_exp.pl	(revision 35723)
@@ -117,4 +117,18 @@
 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
 
+my $recipeData;
+{
+    # Get the PSASTRO recipe
+    my $command = "$ppConfigDump -camera $camera -recipe PSASTRO $recipe_psastro -dump-recipe PSASTRO -";
+    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
+        run(command => $command, verbose => $verbose);
+    unless ($success) {
+        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
+        &my_die("Unable to perform ppConfigDump: $error_code", $cam_id, $PS_EXIT_CONFIG_ERROR);
+    }
+    $recipeData = $mdcParser->parse(join "", @$stdout_buf) or
+        &my_die("Unable to parse metadata config doc", $cam_id, $PS_EXIT_CONFIG_ERROR);
+}
+
 my $cmdflags;
 
@@ -160,35 +174,15 @@
     chomp $cmdflags;
 
-    { # Determine if FWHM is too large to bother continuing.
-	my $maxFWHM = 0;
-      # XXX: temporary hack if this is a CNP exposure set maxFWHM to a large
-      # value.
-      # Before the next tag we will put this into a recipe
-      if ($outroot =~ /CNP/) {
-            $maxFWHM = 25;
-      } else {
-	my $command = "$ppConfigDump -camera $camera -get-key MAX_ALLOWED_FWHM";
-	my ($success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-	    run(command => $command, verbose => $verbose);
-	unless ($success) {
-	    $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-	    &my_die("Unable to perform ppConfigDump: $error_code", $cam_id, $PS_EXIT_CONFIG_ERROR);
-	}
-	if (@$stdout_buf) {
-	    my $cameraConfig = $mdcParser->parse(join "", @$stdout_buf) or
-		&my_die("Unable to parse metadata config doc", $cam_id, $PS_EXIT_CONFIG_ERROR);
-	    $maxFWHM = metadataLookupStr($cameraConfig, 'MAX_ALLOWED_FWHM');
-	}
-      }
-	if ($maxFWHM) {
-	    my $expFWHM;
-	    ($expFWHM) = $cmdflags =~ /-fwhm_major (\d+)/;	
-	    
-	    if ($expFWHM > $maxFWHM) {
-		print "Setting quality to 4007 due to large FWHM: exposure: $expFWHM  maximum: $maxFWHM\n";
-		$cmdflags .= " -quality 4007 "; # This corresponds to PSASTRO_ERR_DATA
-		$no_op = 1;
-	    }
-	}
+    # Determine if FWHM is too large to bother continuing.
+    my $maxFWHM = metadataLookupF32($recipeData, 'PSASTRO.MAX.ALLOWED.FWHM');
+    if ($maxFWHM) {
+        my $expFWHM;
+        ($expFWHM) = $cmdflags =~ /-fwhm_major (\d+)/;	
+        
+        if ($expFWHM > $maxFWHM) {
+            print "Setting quality to 4007 due to large FWHM: exposure: $expFWHM  maximum: $maxFWHM\n";
+            $cmdflags .= " -quality 4007 "; # This corresponds to PSASTRO_ERR_DATA
+            $no_op = 1;
+        }
     }
 }
@@ -197,15 +191,4 @@
 my $do_masks;               # Produce masks?
 if (!$skip_masks) {
-    # Get the PSASTRO recipe
-    my $command = "$ppConfigDump -camera $camera -recipe PSASTRO $recipe_psastro -dump-recipe PSASTRO -";
-    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
-        run(command => $command, verbose => $verbose);
-    unless ($success) {
-        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
-        &my_die("Unable to perform ppConfigDump: $error_code", $cam_id, $PS_EXIT_CONFIG_ERROR);
-    }
-    my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or
-        &my_die("Unable to parse metadata config doc", $cam_id, $PS_EXIT_CONFIG_ERROR);
-
     $do_masks = metadataLookupBool($recipeData, 'REFSTAR_MASK');
 }
@@ -235,5 +218,5 @@
     $psastroInputArg = " -list $list3Name";
 } else {
-    # for $run_state eq 'update' we onlly rebuild the masks using psastro
+    # for $run_state eq 'update' we only rebuild the masks using psastro
     $do_stats = 0;
     $do_jpegs = 0;
@@ -317,5 +300,5 @@
     $configuration = prepare_output("PSASTRO.CONFIG",  $outroot, undef, 1);
 } else {
-    # Do not use the original recipes because they might contain the 
+    # Do not use the original recipes for updates because they might contain the 
     # recipe values that caused the masks to get fouled up in the first place
     # $configuration = $ipprc->filename("PSASTRO.CONFIG",  $outroot, undef);
