IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34756


Ignore:
Timestamp:
Nov 30, 2012, 6:54:14 PM (14 years ago)
Author:
watersc1
Message:

Fixed most of the errors. I think I'm calling it good enough for a friday.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/20120906/ippScripts/scripts/regenerate_background.pl

    r34746 r34756  
    1111use File::Spec;
    1212use PS::IPP::Config 1.01 qw( :standard );
    13 use Getopt::Long qw (GetOtions :config auto_help auto_version gnu_getopt );
     13use Getopt::Long qw (GetOptions :config auto_help auto_version gnu_getopt );
    1414use Pod::Usage qw( pod2usage );
    1515
     16my $ppConfigDump = can_run('ppConfigDump');
     17my $pswarp       = can_run('pswarp');
    1618
    1719# Parse command line options.
    18 my ($stage, $camera, $stage_id, $dbname, $verbose, $logfile);
     20my ($stage, $camera, $stage_id, $skycell_id, $dbname, $verbose, $logfile, $save_temps);
    1921GetOptions('stage=s'         => \$stage,       # which analysis stage to generate bkg model
    2022           'camera|i=s'      => \$camera,      # user-supplied camera name
     
    2224           'skycell_id=s'    => \$skycell_id,  # skycell_id
    2325           'verbose'         => \$verbose,     # verbose commands
    24            'logfile=s'       => \$logfile      # destination for stdout and stderr 
     26           'logfile=s'       => \$logfile,     # destination for stdout and stderr 
     27           'save_temps'      => \$save_temps   # save temporary files.
    2528    ) or pod2usage ( 2 );
    2629
     
    4952    &my_die("Unable to redirect output to logfile", $stage, $stage_id, $PS_EXIT_UNKNOWN_ERROR) if $logfile;
    5053
    51 my $mdcParser = PS:IPP:Metadata::Config->new; # parser for metadata config files
     54my $mdcParser = PS::IPP::Metadata::Config->new; # parser for metadata config files
    5255
    5356
     
    6467    my $astromSource;               # The astrometry source
    6568    {
    66         my $command = "$ppConfigDump -camera $camera -recipe PSWARP $recipe_pswarp -dump-recipe PSWARP -";
     69        my $command = "$ppConfigDump -camera $camera -recipe PSWARP DEFAULT -dump-recipe PSWARP -";
    6770        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    6871            run(command => $command, verbose => $verbose);
     
    7073            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    7174            &my_die("Unable to perform ppConfigDump: $error_code",
    72                     $warp_id, $skycell_id, $tess_dir, $error_code);
     75                    $stage, $stage_id, $error_code);
    7376        }
    7477        my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
    7578            &my_die("Unable to parse metadata config doc",
    76                     $warp_id, $skycell_id, $tess_dir, $PS_EXIT_PROG_ERROR);
     79                    $stage, $stage_id, $PS_EXIT_PROG_ERROR);
    7780        $astromSource = metadataLookupStr($metadata, 'ASTROM.SOURCE');
    7881    }
    7982
    80 
     83   
    8184    my $imfiles;   # Array of component files
    8285    my $command = "$warptool -warped -warp_id $stage_id -skycell_id $skycell_id";
    83     my $command .= " -dbname $dbname " if defined $dbname;
     86    $command .= " -dbname $dbname " if defined $dbname;
    8487
    8588    my ( $success, $error_code, $full_buf, $stdout_buf, $stderrr_buf ) =
     
    118121        my ($bkgList_file,$bkgList_name) = tempfile("/tmp/bkgreg.warp.bkg.${warp_id}.${skycell_id}.XXXX",
    119122                                                    UNLINK => !$save_temps);
    120         my ($astromList_file,$astroList_name) = tempfile("/tmp/bkgreg.warp.astrom.${warp_id}.${skycell_id}.XXXX",
     123        my ($astromList_file,$astromList_name) = tempfile("/tmp/bkgreg.warp.astrom.${warp_id}.${skycell_id}.XXXX",
    121124                                                         UNLINK => !$save_temps);
    122125        my $chipFiles;
     
    159162        if (!$skyCell_exists) { # Generate it
    160163            my $skyFile = prepare_output("SKYCELL.TEMPLATE", $path_base, $skycell_id, 1);
    161             $ipprc->skycell_file( $tess_dir, $skycell_id, $skyFile, $verbose ) or
     164            $ipprc->skycell_file( $tess_id, $skycell_id, $skyFile, $verbose ) or
    162165                &my_die("Unable to generate template skycell",$skycell_id,$warp_id,$PS_EXIT_SYS_ERROR);
    163166        }
     
    269272    my $error;
    270273    my $output = $ipprc->prepare_output($filerule, $outroot, $skycell_id, $delete, \$error)
    271         or &my_die("failed to prepare output file for: $filerule", $skycell_id, $warp_id, $error);
     274        or &my_die("failed to prepare output file for: $filerule", $skycell_id, $stage_id, $error);
    272275    return $output;
    273276}
Note: See TracChangeset for help on using the changeset viewer.