IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 35081 for trunk/ippScripts


Ignore:
Timestamp:
Feb 1, 2013, 5:01:08 PM (13 years ago)
Author:
watersc1
Message:

Merging changes that implement FPA level background continuity.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/scripts/camera_exp.pl

    r33576 r35081  
    4141
    4242my ( $exp_tag, $cam_id, $camera, $outroot, $dbname, $reduction, $dvodb, $verbose, $no_update,
    43      $no_op, $redirect, $save_temps, $run_state, $skip_binned, $skip_masks);
     43     $no_op, $redirect, $save_temps, $run_state, $skip_binned, $skip_masks, $bkg_only);
    4444GetOptions(
    4545    'exp_tag=s'         => \$exp_tag, # Exposure identifier
     
    5353    'skip-binned'       => \$skip_binned, # override recipe - don't create binned images
    5454    'skip-refmask'      => \$skip_masks, # override recipe - don't create refmask
     55    'bkg-only'          => \$bkg_only,  # override recipe - only do background continuity
    5556    'verbose'           => \$verbose,   # Print to stdout
    5657    'no-update'         => \$no_update, # Update the database?
     
    111112&my_die("Unrecognised PSASTRO recipe", $cam_id, $PS_EXIT_CONFIG_ERROR) unless defined $recipe_psastro;
    112113
     114my $bkg_recipe     = 'PPIMAGE_BKGCONT'; # Add to reduction?
    113115my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
    114116
     
    215217my ($list4File, $list4Name) = tempfile( "/tmp/$exp_tag.cm.$cam_id.b4.list.XXXX", UNLINK => !$save_temps ); # For astrometry
    216218
     219### Create temp file for background models
     220my ($list5File, $list5Name) = tempfile( "/tmp/$exp_tag.cm.$cam_id.b5.list.XXXX", UNLINK => !$save_temps ); # For background models
     221
    217222# XXX we perform astrometry iff photometry output exists
    218223my @outMasks;                   # Names of output masks
     224my @bkg_models;                 # Names of output background models
    219225foreach my $file (@$files) {
    220226    next if $file->{quality} != 0;
     
    226232    my $chipObjects = $ipprc->filename("PSPHOT.OUTPUT", $file->{path_base}, $class_id);
    227233    my $chipMask   = $ipprc->filename("PPIMAGE.CHIP.MASK", $file->{path_base}, $class_id);
    228 
     234   
    229235    print $list1File ($ipprc->filename("PPIMAGE.BIN1", $file->{path_base}, $class_id) . "\n");
    230236    print $list2File ($ipprc->filename("PPIMAGE.BIN2", $file->{path_base}, $class_id) . "\n");
    231237    print $list3File ($chipObjects . "\n");
    232238    print $list4File ($chipMask . "\n");
     239    print $list5File ($ipprc->filename("PSPHOT.BACKMDL", $file->{path_base}, $class_id) . "\n");
    233240
    234241    push @outMasks, prepare_output("PSASTRO.OUTPUT.MASK", $outroot, $class_id, 1) if $produceMasks;
     242    push @bkg_models, prepare_output("PPIMAGE.BACKMDL", $outroot, $class_id, 1);
    235243}
    236244close $list1File;
     
    238246close $list3File;
    239247close $list4File;
    240 
     248close $list5File;
    241249# Output products
    242250$ipprc->outroot_prepare($outroot);
     
    291299    }
    292300
    293     {
     301    if (!$bkg_only) {
    294302        # run psastro on the chipObjects, producing fpaObjects
    295303        my $command;
     
    353361            }
    354362        }
     363    }
     364    # Construct FPA continuity corrected background images
     365    {
     366        my $command;
     367        $command = "$ppImage";
     368        $command .= " -list $list5Name $outroot";
     369        $command .= " -recipe PPIMAGE $bkg_recipe";
     370        $command .= " -dbname $dbname" if defined $dbname;
     371
     372        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     373            run(command => $command, verbose => $verbose);
     374        unless ($success) {
     375            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     376            &my_die("Unable to perform ppImage to fix background: $error_code", $cam_id, $error_code);
     377        }
     378        foreach my $bkgModel (@bkg_models) {
     379            check_output($bkgModel, $replicateOutputs);
     380        }
    355381    }
    356382}
Note: See TracChangeset for help on using the changeset viewer.