IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 34780


Ignore:
Timestamp:
Dec 7, 2012, 4:21:32 PM (14 years ago)
Author:
watersc1
Message:

It looks like everything is workign as designed. Next to automate via the task.

Location:
branches/czw_branch/20120906
Files:
3 edited

Legend:

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

    r34772 r34780  
    110110        my $skycell_id = $imfile->{skycell_id};
    111111        my $path_base  = $imfile->{path_base};
    112         my $tess_id    = $imfile->{path_base};
     112        my $tess_id    = $imfile->{tess_id};
    113113
    114114        # Parse the results to determine if there are any problems that prevent this from
     
    220220    my $ppStackMedian = can_run('ppStackMedian') or
    221221        &my_die("Can't find ppStackMedian",$stage,$stage_id,$PS_EXIT_UNKNOWN_ERROR);
    222    
     222
     223    # Get the information about this run
     224    my $st_command = "$stacktool -sumskyfile -stack_id $stack_id";
     225    $st_command   .= " -dbname $dbname " if defined $dbname;
     226    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     227        run(command => $st_command, verbose => $verbose);
     228    unless($success) {
     229        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     230        &my_die("Unable to perform stacktool -sumskyfile",$stage,$stage_id,$error_code);
     231    }
     232    if (@$stdout_buf == 0) {
     233        # Nothing to do;
     234    }
     235    my $in_md = $mdcParser->parse(join "", @$stdout_buf) or
     236        &my_die("Unable to parse metadata config doc", $stage, $stage_id, $PS_EXIT_PROG_ERROR);
     237    my $stacks  = parse_md_list($in_md) or
     238        &my_die("Unable to parse metadata", $stage, $stage_id, $PS_EXIT_PROG_ERROR);
     239    my $stack = shift(@$stacks);
     240    my $path_base = $stack->{path_base};
    223241
    224242    # Get inputs
     
    226244    my $command = "$stacktool -inputskyfile -stack_id $stack_id";
    227245    $command .= " -dbname $dbname " if defined $dbname;
    228     my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     246    ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    229247        run(command => $command, verbose => $verbose);
    230248    unless($success) {
     
    235253        # Nothing to do;
    236254    }
    237     my $in_md = $mdcParser->parse_list(join "", @$stdout_buf) or
     255    $in_md = $mdcParser->parse(join "", @$stdout_buf) or
    238256        &my_die("Unable to parse metadata config doc", $stage, $stage_id, $PS_EXIT_PROG_ERROR);
    239257    $imfiles  = parse_md_list($in_md) or
    240258        &my_die("Unable to parse metadata", $stage, $stage_id, $PS_EXIT_PROG_ERROR);
    241    
     259
    242260    my $num = 0;
    243     my $path_base = '/tmp/x';
    244     my $expTime   = 60;
    245 
     261    my $expTime;
    246262    my ($inputMDC_file, $inputMDC_name) = tempfile("/tmp/bkgreg.stack.mdc.${stage_id}.XXXX",
    247263                                                   UNLINK => !$save_temps);
     
    260276        print $inputMDC_file "END\n\n";
    261277        $num++;
     278
     279        $expTime = $imfile->{exp_time}; # I need something here.
    262280    }
    263281    close($inputMDC_file);
    264282
    265     my $bkgOut_log = prepare_output("LOG.IMFILE",$path_base . "BKG_REG",$skycell_id,1);   
    266 
    267     my $ppStack_command = "$ppStackMedian -input $inputMDC_name $path_base ";
     283    my $bkgOut_log = prepare_output("LOG.EXP",$path_base . ".BKG_REG",1);   
     284
     285    my $ppStack_command = "$ppStackMedian -input $inputMDC_name ${path_base}.mdl ";
    268286    $ppStack_command   .= " -recipe PPSTACK STACK -recipe PPSUB STACK -recipe PSPHOT STACK ";
    269287    $ppStack_command   .= " -recipe PPSTATS STACKSTATS -stack-type DEEP_STACK ";
    270     $ppStack_command   .= " -F PSPHOT.PSF.SAVE PSPHOT.PSF.SKY.SAVE ";
    271     $ppStack_command   .= " -F PSPHOT.OUTPUT PSPHOT.OUT.CMF.MEF -F PSPHOT.BACKMDL PSPHOT.BACKMDL.MEF ";
    272     $ppStack_command   .= " -F SOURCE.PLOT.MOMENTS SOURCE.PLOT.SKY.MOMENTS ";
    273     $ppStack_command   .= " -F SOURCE.PLOT.PSFMODEL SOURCE.PLOT.SKY.PSFMODEL ";
    274     $ppStack_command   .= " -F SOURCE.PLOT.APRESID SOURCE.PLOT.SKY.APRESID ";
     288#    $ppStack_command   .= " -F PSPHOT.PSF.SAVE PSPHOT.PSF.SKY.SAVE ";
     289#    $ppStack_command   .= " -F PSPHOT.OUTPUT PSPHOT.OUT.CMF.MEF -F PSPHOT.BACKMDL PSPHOT.BACKMDL.MEF ";
     290#    $ppStack_command   .= " -F SOURCE.PLOT.MOMENTS SOURCE.PLOT.SKY.MOMENTS ";
     291#    $ppStack_command   .= " -F SOURCE.PLOT.PSFMODEL SOURCE.PLOT.SKY.PSFMODEL ";
     292#    $ppStack_command   .= " -F SOURCE.PLOT.APRESID SOURCE.PLOT.SKY.APRESID ";
    275293    $ppStack_command   .= " -Db PHOTOMETRY F -Db VARIANCE F -Db CONVOLVE F ";
    276294    $ppStack_command   .= " -Df DEFAULT.EXPTIME $expTime ";
    277295    $ppStack_command   .= " -threads 1 -log $bkgOut_log ";
    278296    $ppStack_command   .= " -dbname $dbname " if defined $dbname;
     297
     298    ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     299        run(command => $ppStack_command, verbose => $verbose);
     300    unless($success) {
     301        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     302        &my_die("Unable to perform ppStackMedian",$stage,$stage_id,$error_code);
     303    }
     304
     305    my $update_command = "$stacktool ";
     306    $update_command .= " -updatesumskyfile -stack_id $stack_id ";
     307    $update_command .= " -set_background_model 1 -fault 0 ";
     308    $update_command .= " -dbname $dbname " if defined $dbname;
     309   
     310    ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     311        run(command => $update_command, verbose => $verbose);
     312    unless ($success) {
     313        $error_code = (($error_code >> 8)  or $PS_EXIT_PROG_ERROR);
     314        &my_die("Unable to perform stacktool: $error_code", $stage, $stage_id, $error_code);
     315    }
     316   
     317
    279318
    280319}
  • branches/czw_branch/20120906/ippTools/share/stacktool_inputskyfile.sql

    r32937 r34780  
    44    rawExp.exp_id,
    55    rawExp.exp_name,
     6    rawExp.exp_time,
    67    rawExp.object,
    78    rawExp.dateobs,
  • branches/czw_branch/20120906/ippTools/src/stacktool.c

    r34772 r34780  
    17661766      psMetadata *values = psMetadataAlloc();
    17671767      PXOPT_COPY_S16(config->args, values, "-set_background_model", "background_model", "==");
    1768       long rows = psDBUpdateRows(config->dbh,"warpSkyfile", where, values);
     1768      long rows = psDBUpdateRows(config->dbh,"stackSumSkyfile", where, values);
    17691769      psFree(values);
    17701770      if (!rows) {
Note: See TracChangeset for help on using the changeset viewer.