IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 6, 2012, 6:32:19 PM (14 years ago)
Author:
watersc1
Message:

merge from trunk. Preliminary versions of stacktool/warptool updates and regenerate_background.pl script. The warp code is finished and tested, and I still need to get the stack version resolved.

File:
1 edited

Legend:

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

    r34756 r34772  
    1010use IPC::Cmd 0.36 qw( can_run run );
    1111use File::Spec;
     12use File::Temp qw( tempfile );
    1213use PS::IPP::Config 1.01 qw( :standard );
    1314use Getopt::Long qw (GetOptions :config auto_help auto_version gnu_getopt );
    1415use Pod::Usage qw( pod2usage );
     16use PS::IPP::Metadata::Config;
     17use PS::IPP::Metadata::List qw( parse_md_list );
     18
     19
    1520
    1621my $ppConfigDump = can_run('ppConfigDump');
     
    6772    my $astromSource;               # The astrometry source
    6873    {
    69         my $command = "$ppConfigDump -camera $camera -recipe PSWARP DEFAULT -dump-recipe PSWARP -";
     74        my $command = "$ppConfigDump -camera $camera -recipe PSWARP BACKGROUND -dump-recipe PSWARP -";
    7075        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    7176            run(command => $command, verbose => $verbose);
     
    97102    }
    98103
    99     my $in_md = $mdcParser->parse_list(join "", @$stdout_buf) or
     104    my $in_md = $mdcParser->parse(join "", @$stdout_buf) or
    100105        &my_die("Unable to parse metadata config doc", $stage, $stage_id, $PS_EXIT_PROG_ERROR);
    101106    $imfiles  = parse_md_list($in_md) or
     
    165170                &my_die("Unable to generate template skycell",$skycell_id,$warp_id,$PS_EXIT_SYS_ERROR);
    166171        }
    167 
     172        my $bkgOut_log = prepare_output("LOG.EXP",$path_base . ".BKG_REG",$skycell_id,1);
    168173
    169174        # Construct pswarp command
    170175        my $pswarp_command = "$pswarp ";
    171176        $pswarp_command .= " -list $bkgList_name -astromlist $astromList_name -bkglist $bkgList_name ";
     177        $pswarp_command .= " ${path_base} ";
    172178        $pswarp_command .= " $skyCell_name ";
    173179        $pswarp_command .= " -F PSPHOT.PSF.SAVE PSPHOT.PSF.SKY.SAVE -F PSPHOT.OUTPUT PSPHOT.OUT.CMF.MEF ";
     
    186192        unless ($success) {
    187193            $error_code = (($error_code >> 8)  or $PS_EXIT_PROG_ERROR);
     194            &my_die("Unable to perform pswarp: $error_code", $stage, $stage_id, $error_code);
     195        }
     196       
     197        my $update_command = "$warptool ";
     198        $update_command .= " -updateskyfile -warp_id $warp_id -skycell_id $skycell_id ";
     199        $update_command .= " -set_background_model 1 ";
     200        $update_command .= " -dbname $dbname " if defined $dbname;
     201
     202        ( $success, $error_code, $full_buf, $stdout_buf, $stderrr_buf ) =
     203            run(command => $update_command, verbose => $verbose);
     204        unless ($success) {
     205            $error_code = (($error_code >> 8)  or $PS_EXIT_PROG_ERROR);
    188206            &my_die("Unable to perform warptool: $error_code", $stage, $stage_id, $error_code);
    189207        }
     
    223241   
    224242    my $num = 0;
    225    
     243    my $path_base = '/tmp/x';
     244    my $expTime   = 60;
     245
    226246    my ($inputMDC_file, $inputMDC_name) = tempfile("/tmp/bkgreg.stack.mdc.${stage_id}.XXXX",
    227247                                                   UNLINK => !$save_temps);
     
    242262    }
    243263    close($inputMDC_file);
    244    
     264
     265    my $bkgOut_log = prepare_output("LOG.IMFILE",$path_base . "BKG_REG",$skycell_id,1);   
     266
    245267    my $ppStack_command = "$ppStackMedian -input $inputMDC_name $path_base ";
    246268    $ppStack_command   .= " -recipe PPSTACK STACK -recipe PPSUB STACK -recipe PSPHOT STACK ";
     
    253275    $ppStack_command   .= " -Db PHOTOMETRY F -Db VARIANCE F -Db CONVOLVE F ";
    254276    $ppStack_command   .= " -Df DEFAULT.EXPTIME $expTime ";
    255     $ppStack_command   .= " -threads $threads -log $bkgOut_log ";
     277    $ppStack_command   .= " -threads 1 -log $bkgOut_log ";
    256278    $ppStack_command   .= " -dbname $dbname " if defined $dbname;
    257279
Note: See TracChangeset for help on using the changeset viewer.