IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 17803


Ignore:
Timestamp:
May 23, 2008, 5:10:21 PM (18 years ago)
Author:
Paul Price
Message:

Adding hostname to database values.

Location:
trunk/ippScripts/scripts
Files:
7 edited

Legend:

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

    r17671 r17803  
    2929     $no_op, $save_temps );
    3030GetOptions(
    31            'exp_tag=s'          => \$exp_tag, # Exposure identifier
    32            'cam_id=s'          => \$cam_id, # Camtool identifier
    33            'recipe=s'          => \$recipe, # Recipe to use
    34            'camera|c=s'        => \$camera, # Camera
    35            'dbname|d=s'        => \$dbname, # Database name
    36            'outroot|w=s'       => \$outroot, # output file base name
    37            'reduction=s'       => \$reduction, # Reduction class                       
    38            'dvodb|w=s'         => \$dvodb,  # output DVO database
    39            'verbose'           => \$verbose,   # Print to stdout
    40            'no-update'         => \$no_update, # Update the database?
    41            'no-op'             => \$no_op, # Don't do any operations?
    42            'save-temps'        => \$save_temps, # Save temporary files?
    43            ) or pod2usage( 2 );
     31           'exp_tag=s'          => \$exp_tag, # Exposure identifier
     32           'cam_id=s'          => \$cam_id, # Camtool identifier
     33           'recipe=s'          => \$recipe, # Recipe to use
     34           'camera|c=s'        => \$camera, # Camera
     35           'dbname|d=s'        => \$dbname, # Database name
     36           'outroot|w=s'       => \$outroot, # output file base name
     37           'reduction=s'       => \$reduction, # Reduction class
     38           'dvodb|w=s'         => \$dvodb,  # output DVO database
     39           'verbose'           => \$verbose,   # Print to stdout
     40           'no-update'         => \$no_update, # Update the database?
     41           'no-op'             => \$no_op, # Don't do any operations?
     42           'save-temps'        => \$save_temps, # Save temporary files?
     43           ) or pod2usage( 2 );
    4444
    4545pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    4646pod2usage(
    47           -msg => "Required options: --exp_tag --cam_id --camera --outroot",
    48           -exitval => 3,
    49           ) unless
     47          -msg => "Required options: --exp_tag --cam_id --camera --outroot",
     48          -exitval => 3,
     49          ) unless
    5050    defined $exp_tag and
    5151    defined $cam_id and
     
    6666# values to extract from output metadata and the stats to calculate
    6767# these should be coming from the psastro results
    68 my $CHIPSTATS = 
    69     [   
    70         #          PPSTATS KEYWORD         STATISTIC          CHIPTOOL FLAG
    71         { name => "bg",             type => "mean",  flag => "-bg",             dtype => "float" },
    72         { name => "bg_stdev",       type => "rms",   flag => "-bg_stdev",       dtype => "float" }, 
    73         { name => "bg_mean_stdev",  type => "stdev", flag => "-bg_mean_stdev",  dtype => "float" },
    74         { name => "bias",           type => "mean",  flag => "-bias",           dtype => "float" }, 
    75         { name => "bias_stdev",     type => "rms",   flag => "-bias_stdev",     dtype => "float" }, 
    76         { name => "fringe_0",       type => "mean",  flag => "-fringe_0",       dtype => "float" }, 
    77         { name => "fringe_1",       type => "rms",   flag => "-fringe_1",       dtype => "float" }, 
    78         { name => "fringe_0",       type => "stdev", flag => "-fringe_2",       dtype => "float" }, 
    79         { name => "sigma_ra",       type => "rms",   flag => "-sigma_ra",       dtype => "float" }, 
    80         { name => "sigma_dec",      type => "rms",   flag => "-sigma_dec",      dtype => "float" }, 
    81         { name => "ap_resid",       type => "mean",  flag => "-ap_resid",       dtype => "float" }, 
    82         { name => "ap_resid_stdev", type => "rms",   flag => "-ap_resid_stdev", dtype => "float" }, 
    83         { name => "zp_mean",        type => "mean",  flag => "-zp_mean",        dtype => "float" }, 
    84         { name => "zp_stdev",       type => "rms",   flag => "-zp_stdev",       dtype => "float" }, 
    85         { name => "fwhm_major",     type => "mean",  flag => "-fwhm_major",     dtype => "float" }, 
    86         { name => "fwhm_minor",     type => "mean",  flag => "-fwhm_minor",     dtype => "float" }, 
    87         { name => "dtime_detrend",  type => "sum",   flag => "-dtime_detrend",  dtype => "float" }, 
    88         { name => "dtime_photom",   type => "sum",   flag => "-dtime_photom",   dtype => "float" }, 
    89         { name => "dtime_astrom",   type => "sum",   flag => "-dtime_astrom",   dtype => "float" }, 
    90         { name => "n_stars",        type => "sum",   flag => "-n_stars",        dtype => "int"   }, 
    91         { name => "n_extended",     type => "sum",   flag => "-n_extended",     dtype => "int"   }, 
    92         { name => "n_cr",           type => "sum",   flag => "-n_cr",           dtype => "int"   }, 
    93         { name => "n_astrom",       type => "sum",   flag => "-n_astrom",       dtype => "int"   }, 
     68my $CHIPSTATS =
     69    [
     70        #          PPSTATS KEYWORD         STATISTIC          CHIPTOOL FLAG
     71        { name => "bg",             type => "mean",  flag => "-bg",             dtype => "float" },
     72        { name => "bg_stdev",       type => "rms",   flag => "-bg_stdev",       dtype => "float" },
     73        { name => "bg_mean_stdev",  type => "stdev", flag => "-bg_mean_stdev",  dtype => "float" },
     74        { name => "bias",           type => "mean",  flag => "-bias",           dtype => "float" },
     75        { name => "bias_stdev",     type => "rms",   flag => "-bias_stdev",     dtype => "float" },
     76        { name => "fringe_0",       type => "mean",  flag => "-fringe_0",       dtype => "float" },
     77        { name => "fringe_1",       type => "rms",   flag => "-fringe_1",       dtype => "float" },
     78        { name => "fringe_0",       type => "stdev", flag => "-fringe_2",       dtype => "float" },
     79        { name => "sigma_ra",       type => "rms",   flag => "-sigma_ra",       dtype => "float" },
     80        { name => "sigma_dec",      type => "rms",   flag => "-sigma_dec",      dtype => "float" },
     81        { name => "ap_resid",       type => "mean",  flag => "-ap_resid",       dtype => "float" },
     82        { name => "ap_resid_stdev", type => "rms",   flag => "-ap_resid_stdev", dtype => "float" },
     83        { name => "zp_mean",        type => "mean",  flag => "-zp_mean",        dtype => "float" },
     84        { name => "zp_stdev",       type => "rms",   flag => "-zp_stdev",       dtype => "float" },
     85        { name => "fwhm_major",     type => "mean",  flag => "-fwhm_major",     dtype => "float" },
     86        { name => "fwhm_minor",     type => "mean",  flag => "-fwhm_minor",     dtype => "float" },
     87        { name => "dtime_detrend",  type => "sum",   flag => "-dtime_detrend",  dtype => "float" },
     88        { name => "dtime_photom",   type => "sum",   flag => "-dtime_photom",   dtype => "float" },
     89        { name => "dtime_astrom",   type => "sum",   flag => "-dtime_astrom",   dtype => "float" },
     90        { name => "n_stars",        type => "sum",   flag => "-n_stars",        dtype => "int"   },
     91        { name => "n_extended",     type => "sum",   flag => "-n_extended",     dtype => "int"   },
     92        { name => "n_cr",           type => "sum",   flag => "-n_cr",           dtype => "int"   },
     93        { name => "n_astrom",       type => "sum",   flag => "-n_astrom",       dtype => "int"   },
    9494
    9595
    9696# these are not defined for the database table camProcessedExp
    97         ];
     97        ];
    9898my $chipStats = PS::IPP::Metadata::Stats->new($CHIPSTATS); # Stats parser
    9999
     
    108108my $addstar = can_run('addstar') or (warn "Can't find addstar" and $missing_tools = 1);
    109109
    110 if ($missing_tools) { 
     110if ($missing_tools) {
    111111    warn("Can't find required tools.");
    112     exit($PS_EXIT_CONFIG_ERROR); 
    113 }
    114 
    115 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
     112    exit($PS_EXIT_CONFIG_ERROR);
     113}
     114
     115my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
    116116
    117117# Get list of component files
    118 my $files;                      # Array of component files
     118my $files;                      # Array of component files
    119119{
    120120    my $command = "$camtool -pendingimfile -cam_id $cam_id"; # Command to run
    121121    $command .= " -dbname $dbname" if defined $dbname;
    122122    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    123         run(command => $command, verbose => $verbose);
     123        run(command => $command, verbose => $verbose);
    124124    unless ($success) {
    125         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    126         &my_die("Unable to perform camtool: $error_code", $cam_id, $error_code);
     125        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     126        &my_die("Unable to perform camtool: $error_code", $cam_id, $error_code);
    127127    }
    128128    my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
    129         &my_die("Unable to parse metadata config doc", $cam_id, $PS_EXIT_PROG_ERROR);
     129        &my_die("Unable to parse metadata config doc", $cam_id, $PS_EXIT_PROG_ERROR);
    130130
    131131    # extract the metadata for the files into a hash list
    132132    $files = parse_md_list($metadata) or
    133         &my_die("Unable to parse metadata list", $cam_id, $PS_EXIT_PROG_ERROR);
     133        &my_die("Unable to parse metadata list", $cam_id, $PS_EXIT_PROG_ERROR);
    134134
    135135    # extract the stats from the metadata
    136136    unless ($chipStats->parse($metadata)) {
    137         &my_die("Unable to find all values in statistics output.\n", $cam_id, $PS_EXIT_PROG_ERROR);
     137        &my_die("Unable to find all values in statistics output.\n", $cam_id, $PS_EXIT_PROG_ERROR);
    138138    }
    139139}
     
    145145
    146146# XXX we perform astrometry iff photometry output exists
    147 my $chipObjects; 
     147my $chipObjects;
    148148my $chipObjectsExist = 0;
    149149foreach my $file (@$files) {
     
    160160    # if any of the output chip photometry files exist, we can run psastro / addstar below
    161161    if ($ipprc->file_exists($chipObjects)) {
    162         $chipObjectsExist = 1;
     162        $chipObjectsExist = 1;
    163163    }
    164164}
     
    171171
    172172# the camera configurations should define the psastro output to be a single file (MEF), regardless of the inputs
    173 my $jpeg1      = $ipprc->filename("PPIMAGE.JPEG1",      $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
    174 my $jpeg2      = $ipprc->filename("PPIMAGE.JPEG2",      $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
     173my $jpeg1      = $ipprc->filename("PPIMAGE.JPEG1",      $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
     174my $jpeg2      = $ipprc->filename("PPIMAGE.JPEG2",      $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
    175175my $fpaObjects = $ipprc->filename("PSASTRO.OUTPUT",     $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
    176176my $traceDest  = $ipprc->filename("TRACE.EXP",          $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
    177 my $logDest    = $ipprc->filename("LOG.EXP",            $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
     177my $logDest    = $ipprc->filename("LOG.EXP",            $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
    178178
    179179# convert supplied DVO database name to UNIX filename
     
    190190    # Make the jpeg for binning 1
    191191    {
    192         my $command = "$ppImage -list $list1Name $outroot -recipe PPIMAGE $recipe1"; # Command to run
    193         $command .= " -dbname $dbname" if defined $dbname;
    194 
    195         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    196             run(command => $command, verbose => $verbose);
    197         unless ($success) {
    198             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    199             &my_die("Unable to perform ppImage: $error_code", $cam_id, $error_code);
    200         }
    201         &my_die("Unable to find expected output file: $jpeg1", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($jpeg1);
     192        my $command = "$ppImage -list $list1Name $outroot -recipe PPIMAGE $recipe1"; # Command to run
     193        $command .= " -dbname $dbname" if defined $dbname;
     194
     195        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     196            run(command => $command, verbose => $verbose);
     197        unless ($success) {
     198            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     199            &my_die("Unable to perform ppImage: $error_code", $cam_id, $error_code);
     200        }
     201        &my_die("Unable to find expected output file: $jpeg1", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($jpeg1);
    202202    }
    203203
    204204    # Make the jpeg for binning 2
    205205    {
    206         my $command = "$ppImage -list $list2Name $outroot -recipe PPIMAGE $recipe2"; # Command to run
    207         $command .= " -dbname $dbname" if defined $dbname;
    208 
    209         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    210             run(command => $command, verbose => $verbose);
    211         unless ($success) {
    212             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    213             &my_die("Unable to perform ppImage: $error_code", $cam_id, $error_code);
    214         }
    215         &my_die("Unable to find expected output file: $jpeg2", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($jpeg2);
     206        my $command = "$ppImage -list $list2Name $outroot -recipe PPIMAGE $recipe2"; # Command to run
     207        $command .= " -dbname $dbname" if defined $dbname;
     208
     209        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     210            run(command => $command, verbose => $verbose);
     211        unless ($success) {
     212            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     213            &my_die("Unable to perform ppImage: $error_code", $cam_id, $error_code);
     214        }
     215        &my_die("Unable to find expected output file: $jpeg2", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($jpeg2);
    216216    }
    217217
    218218    # only run psastro / addstar if any of the output chip astrometry files exist (should we test for successful astrometry?)
    219219    if ($chipObjectsExist) {
    220         # run psastro on the chipObjects, producing fpaObjects
    221         # XXX add a ppStats call which will collect the astrometry stats
    222         my $command;
    223         $command  = "$psastro -list $list3Name $outroot";
    224         $command .= " -tracedest $traceDest -log $logDest";
    225         $command .= " -dbname $dbname" if defined $dbname;
    226 
    227         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    228             run(command => $command, verbose => $verbose);
    229         unless ($success) {
    230             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    231             &my_die("Unable to perform psastro: $error_code", $cam_id, $error_code);
    232         }
    233         # XXX do we want to give an error if astrometry fails here?
    234         &my_die("Unable to find expected output file: $fpaObjects", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($fpaObjects);
    235        
    236         # run addstar on the output fpaObjects (if a DVO database is defined)
    237         if (defined $dvodbReal) {
    238             # XXX this construct requires the user to have a valid .ptolemyrc
    239             # XXX which in turn points at ippconfig/dvo.site
    240             # require a defined output dvo database to run addstar (ie, refuse to use the .ptolemyrc default)
    241             # XXX this needs to be converted to addstar_client...
    242 
    243             my $camdir = $ipprc->dvo_cameradir(); # Camera directory for addstar
    244             my $command;
    245             $command  = "$addstar -D CAMERA $camdir -update";
    246             $command .= " -D CATDIR $dvodbReal";
    247 
    248             my $realFile = $ipprc->file_resolve($fpaObjects);
    249             $command .= " $realFile";
    250 
    251             my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    252                 run(command => $command, verbose => $verbose);
    253             unless ($success) {
    254                 $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    255                 &my_die("Unable to perform addstar: $error_code", $cam_id, $error_code);
    256             }
    257         }
     220        # run psastro on the chipObjects, producing fpaObjects
     221        # XXX add a ppStats call which will collect the astrometry stats
     222        my $command;
     223        $command  = "$psastro -list $list3Name $outroot";
     224        $command .= " -tracedest $traceDest -log $logDest";
     225        $command .= " -dbname $dbname" if defined $dbname;
     226
     227        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     228            run(command => $command, verbose => $verbose);
     229        unless ($success) {
     230            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     231            &my_die("Unable to perform psastro: $error_code", $cam_id, $error_code);
     232        }
     233        # XXX do we want to give an error if astrometry fails here?
     234        &my_die("Unable to find expected output file: $fpaObjects", $cam_id, $PS_EXIT_PROG_ERROR) unless -f $ipprc->file_resolve($fpaObjects);
     235
     236        # run addstar on the output fpaObjects (if a DVO database is defined)
     237        if (defined $dvodbReal) {
     238            # XXX this construct requires the user to have a valid .ptolemyrc
     239            # XXX which in turn points at ippconfig/dvo.site
     240            # require a defined output dvo database to run addstar (ie, refuse to use the .ptolemyrc default)
     241            # XXX this needs to be converted to addstar_client...
     242
     243            my $camdir = $ipprc->dvo_cameradir(); # Camera directory for addstar
     244            my $command;
     245            $command  = "$addstar -D CAMERA $camdir -update";
     246            $command .= " -D CATDIR $dvodbReal";
     247
     248            my $realFile = $ipprc->file_resolve($fpaObjects);
     249            $command .= " $realFile";
     250
     251            my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     252                run(command => $command, verbose => $verbose);
     253            unless ($success) {
     254                $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     255                &my_die("Unable to perform addstar: $error_code", $cam_id, $error_code);
     256            }
     257        }
    258258    }
    259259}
     
    263263$fpaCommand .= " -uri UNKNOWN";
    264264$fpaCommand .= " -path_base $outroot";
     265$fpaCommand .= " -hostname $host" if defined $host;
    265266$fpaCommand .= " -dbname $dbname" if defined $dbname;
    266267$fpaCommand .= $chipStats->cmdflags();
     
    269270unless ($no_update) {
    270271    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    271         run(command => $fpaCommand, verbose => $verbose);
     272        run(command => $fpaCommand, verbose => $verbose);
    272273    unless ($success) {
    273         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    274         warn("Unable to add result to database: $error_code\n");
    275         exit($error_code);
     274        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     275        warn("Unable to add result to database: $error_code\n");
     276        exit($error_code);
    276277    }
    277278} else {
     
    288289    carp($msg);
    289290    if (defined $cam_id and not $no_update) {
    290         my $command = "$camtool -addprocessedexp -cam_id $cam_id -uri UNKNOWN -code $exit_code";
    291         $command .= " -dbname $dbname" if defined $dbname;
     291        my $command = "$camtool -addprocessedexp -cam_id $cam_id -uri UNKNOWN -code $exit_code";
     292        $command .= " -hostname $host" if defined $host;
     293        $command .= " -dbname $dbname" if defined $dbname;
    292294        system ($command);
    293295    }
  • trunk/ippScripts/scripts/chip_imfile.pl

    r17671 r17803  
    2828     $no_update, $no_op );
    2929GetOptions(
    30            'exp_id=s'      => \$exp_id,    # Exposure identifier
    31            'exp_tag=s'     => \$exp_tag,   # Exposure identifier
    32            'chip_id=s'     => \$chip_id,   # Chiptool identifier
    33            'class_id=s'    => \$class_id,  # Class identifier
    34            'uri|u=s'       => \$uri,       # Input FITS file
    35            'camera|c=s'    => \$camera,    # Camera
    36            'outroot|w=s'   => \$outroot,   # output file base name
    37            'dbname|d=s'    => \$dbname,    # Database name
    38            'reduction=s'   => \$reduction, # Reduction class
    39            'verbose'       => \$verbose,   # Print to stdout
    40            'no-update'     => \$no_update, # Don't update the database?
    41            'no-op'         => \$no_op,     # Don't do any operations?
    42            ) or pod2usage( 2 );
     30           'exp_id=s'      => \$exp_id,    # Exposure identifier
     31           'exp_tag=s'     => \$exp_tag,   # Exposure identifier
     32           'chip_id=s'     => \$chip_id,   # Chiptool identifier
     33           'class_id=s'    => \$class_id,  # Class identifier
     34           'uri|u=s'       => \$uri,       # Input FITS file
     35           'camera|c=s'    => \$camera,    # Camera
     36           'outroot|w=s'   => \$outroot,   # output file base name
     37           'dbname|d=s'    => \$dbname,    # Database name
     38           'reduction=s'   => \$reduction, # Reduction class
     39           'verbose'       => \$verbose,   # Print to stdout
     40           'no-update'     => \$no_update, # Don't update the database?
     41           'no-op'         => \$no_op,     # Don't do any operations?
     42           ) or pod2usage( 2 );
    4343
    4444pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    4545pod2usage( -msg => "Required options: --exp_id --exp_tag --chip_id --class_id --uri --camera --outroot",
    46            -exitval => 3) unless
     46           -exitval => 3) unless
    4747    defined $exp_id and
    4848    defined $exp_tag and
     
    7474       { name => "ROBUST_MEDIAN",  type => "stdev", flag => "-bg_mean_stdev",  dtype => "float" },
    7575       { name => "ROBUST_STDEV",   type => "rms",   flag => "-bg_stdev",       dtype => "float" },
    76        { name => "OVER_VAL",       type => "mean",  flag => "-bias",           dtype => "float" },
     76       { name => "OVER_VAL",       type => "mean",  flag => "-bias",           dtype => "float" },
    7777       { name => "OVER_VAL",       type => "stdev", flag => "-bias_stdev",     dtype => "float" },
    7878       { name => "FRINGE_0",       type => "rms",   flag => "-fringe_0",       dtype => "float" },
     
    107107}
    108108
    109 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
     109my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
    110110
    111111&my_die("Couldn't find input file: $uri\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($uri);
     
    124124my $outputWeight  = $ipprc->filename("PPIMAGE.CHIP.WEIGHT", $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
    125125my $outputBin1    = $ipprc->filename("PPIMAGE.BIN1",        $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
    126 my $outputBin2    = $ipprc->filename("PPIMAGE.BIN2",        $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
    127 my $outputStats   = $ipprc->filename("PPIMAGE.STATS",       $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
    128 my $traceDest     = $ipprc->filename("TRACE.IMFILE",        $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
    129 my $logDest       = $ipprc->filename("LOG.IMFILE",          $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
     126my $outputBin2    = $ipprc->filename("PPIMAGE.BIN2",        $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
     127my $outputStats   = $ipprc->filename("PPIMAGE.STATS",       $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
     128my $traceDest     = $ipprc->filename("TRACE.IMFILE",        $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
     129my $logDest       = $ipprc->filename("LOG.IMFILE",          $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
    130130
    131131# Run ppImage
     
    141141
    142142    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    143         run(command => $command, verbose => $verbose);
     143        run(command => $command, verbose => $verbose);
    144144    unless ($success) {
    145         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    146         &my_die("Unable to perform ppImage: $error_code", $exp_id, $chip_id, $class_id, $error_code);
     145        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     146        &my_die("Unable to perform ppImage: $error_code", $exp_id, $chip_id, $class_id, $error_code);
    147147    }
    148148
     
    150150    $command = "$ppConfigDump -camera $camera -dump-recipe PPIMAGE -recipe PPIMAGE $recipe -";
    151151    ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    152         run(command => $command, verbose => $verbose);
     152        run(command => $command, verbose => $verbose);
    153153    unless ($success) {
    154         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    155         &my_die("Unable to perform ppConfigDump: $error_code", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
     154        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     155        &my_die("Unable to perform ppConfigDump: $error_code", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
    156156    }
    157157    my $recipeData = $mdcParser->parse(join "", @$stdout_buf) or
    158         &my_die("Unable to parse metadata config doc", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
     158        &my_die("Unable to parse metadata config doc", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
    159159
    160160    ## allow the output images to be optional, depending on the recipe / reduction class
    161161    my $outputImageExpect = metadataLookupBool($recipeData, 'CHIP.FITS');
    162162    if ($outputImageExpect) {
    163         &my_die("Couldn't find expected output file: $outputImage\n",  $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputImage);
     163        &my_die("Couldn't find expected output file: $outputImage\n",  $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputImage);
    164164    }
    165165
    166166    my $outputMaskExpect = metadataLookupBool($recipeData, 'CHIP.MASK.FITS');
    167167    if ($outputMaskExpect) {
    168         &my_die("Couldn't find expected output file: $outputMask\n",   $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);
     168        &my_die("Couldn't find expected output file: $outputMask\n",   $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputMask);
    169169    }
    170170
    171171    my $outputWeightExpect = metadataLookupBool($recipeData, 'CHIP.WEIGHT.FITS');
    172172    if ($outputWeightExpect) {
    173         &my_die("Couldn't find expected output file: $outputWeight\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputWeight);
     173        &my_die("Couldn't find expected output file: $outputWeight\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputWeight);
    174174    }
    175175
     
    179179
    180180    # Get the statistics on the processed image
    181     my $statsFile;              # File handle
     181    my $statsFile;              # File handle
    182182    open $statsFile, $ipprc->file_resolve($outputStats) or &my_die("Can't open statistics file $outputStats: $!", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
    183183    my @contents = <$statsFile>; # Contents of file
     
    185185
    186186    # parse the statistics MDC file
    187     my $mdcParser = PS::IPP::Metadata::Config->new();   # Parser for metadata config files
     187    my $mdcParser = PS::IPP::Metadata::Config->new();   # Parser for metadata config files
    188188    my $metadata = $mdcParser->parse(join "", @contents);
    189189    unless ($metadata) {
    190         &my_die("Unable to parse metadata config doc", $exp_id, $chip_id, $class_id, $PS_EXIT_PROG_ERROR);
     190        &my_die("Unable to parse metadata config doc", $exp_id, $chip_id, $class_id, $PS_EXIT_PROG_ERROR);
    191191    }
    192192
    193193    # extract the stats from the metadata
    194194    unless ($stats->parse($metadata)) {
    195         &my_die("Failure extracting metadata from the statistics output file.\n", $exp_id, $chip_id, $class_id, $PS_EXIT_PROG_ERROR);
     195        &my_die("Failure extracting metadata from the statistics output file.\n", $exp_id, $chip_id, $class_id, $PS_EXIT_PROG_ERROR);
    196196    }
    197197}
     
    204204$command .= " -uri $outputImage";
    205205$command .= " -path_base $outroot";
     206$command .= " -hostname $host" if defined $host;
    206207$command .= " -dbname $dbname" if defined $dbname;
    207208$command .= $stats->cmdflags();
     
    210211unless ($no_update) {
    211212    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    212         run(command => $command, verbose => $verbose);
     213        run(command => $command, verbose => $verbose);
    213214    unless ($success) {
    214         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    215         warn("Unable to perform chiptool -addprocessedimfile: $error_code\n");
    216         exit($error_code);
     215        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     216        warn("Unable to perform chiptool -addprocessedimfile: $error_code\n");
     217        exit($error_code);
    217218    }
    218219} else {
     
    230231    carp($msg);
    231232    if (defined $chip_id and defined $class_id and not $no_update) {
    232         my $command = "$chiptool -addprocessedimfile";
    233         $command .= " -exp_id $exp_id";
    234         $command .= " -chip_id $chip_id";
    235         $command .= " -class_id $class_id";
    236         $command .= " -code $exit_code";
    237         $command .= " -uri $outputImage";
    238         $command .= " -dbname $dbname" if defined $dbname;
     233        my $command = "$chiptool -addprocessedimfile";
     234        $command .= " -exp_id $exp_id";
     235        $command .= " -chip_id $chip_id";
     236        $command .= " -class_id $class_id";
     237        $command .= " -code $exit_code";
     238        $command .= " -uri $outputImage";
     239        $command .= " -hostname $host" if defined $host;
     240        $command .= " -dbname $dbname" if defined $dbname;
    239241        system ($command);
    240242    }
  • trunk/ippScripts/scripts/diff_skycell.pl

    r17797 r17803  
    213213        my $command = "$difftool -adddiffskyfile -diff_id $diff_id -uri $outputName -path_base $outroot";
    214214        $command .= $stats->cmdflags();
     215        $command .= " -hostname $host" if defined $host;
    215216        $command .= " -dbname $dbname" if defined $dbname;
    216217
     
    248249    if (defined $diff_id and not $no_update) {
    249250        my $command = "$difftool -adddiffskyfile -diff_id $diff_id -code $exit_code";
     251        $command .= " -hostname $host" if defined $host;
    250252        $command .= " -dbname $dbname" if defined $dbname;
    251253        run(command => $command, verbose => $verbose);
  • trunk/ippScripts/scripts/register_exp.pl

    r17671 r17803  
    3030    'exp_id|e=s'    => \$exp_id,
    3131    'exp_tag|t=s'   => \$exp_tag,
    32     'dbname|d=s'    => \$dbname, # Database name   
     32    'dbname|d=s'    => \$dbname, # Database name
    3333    'verbose'       => \$verbose,   # Print to stdout
    3434    'no-update'     => \$no_update,
     
    3838pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    3939pod2usage( -msg => "Required options: --exp_id --exp_tag",
    40            -exitval => 3) unless
     40           -exitval => 3) unless
    4141    defined $exp_id and
    4242    defined $exp_tag;
     
    4747
    4848# values to extract from output metadata and the stats to calculate
    49 my $STATS = 
     49my $STATS =
    5050   [   #          register imfile
    5151       #          label             STATISTIC          CHIPTOOL FLAG
     
    8383       { name => "env_wind_dir",    type => "constant",   flag => "-env_wind_dir",    dtype => "float"  }, # external wind direction
    8484
    85        { name => "-teltemp_m1",     type => "constant",   flag => "-teltemp_m1",      dtype => "float"  }, # Primary mirror temps (C)           
    86        { name => "-teltemp_m1cell", type => "constant",   flag => "-teltemp_m1cell",  dtype => "float"  }, # Primary mirror support temps (C)   
    87        { name => "-teltemp_m2",     type => "constant",   flag => "-teltemp_m2",      dtype => "float"  }, # Secondary mirror temps (C         
    88        { name => "-teltemp_spider", type => "constant",   flag => "-teltemp_spider",  dtype => "float"  }, # Spider temperatures (C)           
    89        { name => "-teltemp_truss",  type => "constant",   flag => "-teltemp_truss",   dtype => "float"  }, # Mid truss temperatures (C         
    90        { name => "-teltemp_extra",  type => "constant",   flag => "-teltemp_extra",   dtype => "float"  }, # Miscellaneous temperatures (C)     
     85       { name => "-teltemp_m1",     type => "constant",   flag => "-teltemp_m1",      dtype => "float"  }, # Primary mirror temps (C)
     86       { name => "-teltemp_m1cell", type => "constant",   flag => "-teltemp_m1cell",  dtype => "float"  }, # Primary mirror support temps (C)
     87       { name => "-teltemp_m2",     type => "constant",   flag => "-teltemp_m2",      dtype => "float"  }, # Secondary mirror temps (C
     88       { name => "-teltemp_spider", type => "constant",   flag => "-teltemp_spider",  dtype => "float"  }, # Spider temperatures (C)
     89       { name => "-teltemp_truss",  type => "constant",   flag => "-teltemp_truss",   dtype => "float"  }, # Mid truss temperatures (C
     90       { name => "-teltemp_extra",  type => "constant",   flag => "-teltemp_extra",   dtype => "float"  }, # Miscellaneous temperatures (C)
    9191
    9292       { name => "pon_time",        type => "mean",       flag => "-pon_time",        dtype => "float"  }, # time since last power on
     
    102102    or (warn "can't find regtool" and $missing_tools = 1);
    103103
    104 if ($missing_tools) { 
     104if ($missing_tools) {
    105105    warn ("Can't find required tools");
    106     exit($PS_EXIT_CONFIG_ERROR); 
     106    exit($PS_EXIT_CONFIG_ERROR);
    107107}
    108108
     
    120120        cache_run(command => $command, verbose => $verbose);
    121121    unless ($success) {
    122         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     122        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    123123        warn ("Unable to perform regtool -processedimfile on exposure id $exp_id: $error_code");
    124124        exit ($error_code);
     
    148148$command .= " -exp_id $exp_id";
    149149$command .= " -exp_tag $exp_tag";
     150$command .= " -hostname $host" if defined $host;
    150151$command .= " -dbname $dbname" if defined $dbname;
    151152$command .= $stats->cmdflags();
     
    155156# Add the detrend flag, if needed
    156157{
    157     my $object = 0;             # Is it an object exposure?
     158    my $object = 0;             # Is it an object exposure?
    158159    foreach my $scienceType (@SCIENCE) {
    159         if (lc($exp_type) =~ /$scienceType/) {
    160             $object = 1;
    161             last;
    162         }
     160        if (lc($exp_type) =~ /$scienceType/) {
     161            $object = 1;
     162            last;
     163        }
    163164    }
    164165    $command .= " $DETREND_FLAG" unless $object;
     
    170171        cache_run(command => $command, verbose => $verbose);
    171172    unless ($success) {
    172         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     173        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    173174        warn ("Unable to run regtool -addprocessedexp for $exp_id: $error_code");
    174175        exit($error_code);
     
    202203    carp($msg);
    203204    if (defined $exp_id and not $no_update) {
    204         my $command = "$regtool -addprocessedexp -exp_id $exp_id -code $exit_code";
    205         $command .= " -dbname $dbname" if defined $dbname;
     205        my $command = "$regtool -addprocessedexp -exp_id $exp_id -code $exit_code";
     206        $command .= " -hostname $host" if defined $host;
     207        $command .= " -dbname $dbname" if defined $dbname;
    206208        system($command);
    207209    }
  • trunk/ippScripts/scripts/register_imfile.pl

    r17671 r17803  
    5252
    5353# values to extract from output metadata and the stats to calculate
    54 my $STATS = 
    55    [   
     54my $STATS =
     55   [
    5656       #          PPSTATS KEYWORD         STATISTIC          CHIPTOOL FLAG
    5757       { name => "FILE.LEVEL",     type => "constant", flag => "-filelevel",       dtype => "string" }, # File level
     
    6969       { name => "FPA.TIME",       type => "constant", flag => "-dateobs",         dtype => "string" }, # Date of observation (UTC)
    7070       { name => "FPA.TELESCOPE",  type => "constant", flag => "-telescope",       dtype => "string" }, # Telescope
    71        { name => "FPA.INSTRUMENT", type => "constant", flag => "-inst",            dtype => "string" }, # Instrument 
     71       { name => "FPA.INSTRUMENT", type => "constant", flag => "-inst",            dtype => "string" }, # Instrument
    7272       { name => "FPA.M1X",        type => "constant", flag => "-m1_x",            dtype => "float"  }, # M1X
    7373       { name => "FPA.M1Y",        type => "constant", flag => "-m1_y",            dtype => "float"  }, # M1Y
     
    8585       { name => "FPA.ENV.DIR",    type => "constant", flag => "-env_wind_dir",    dtype => "float"  }, # external wind direction
    8686
    87        { name => "FPA.TELTEMP.M1",     type => "constant", flag => "-teltemp_m1",     dtype => "float"  }, # Primary mirror temps (C)           
    88        { name => "FPA.TELTEMP.M1CELL", type => "constant", flag => "-teltemp_m1cell", dtype => "float"  }, # Primary mirror support temps (C)   
    89        { name => "FPA.TELTEMP.M2",     type => "constant", flag => "-teltemp_m2",     dtype => "float"  }, # Secondary mirror temps (C         
    90        { name => "FPA.TELTEMP.SPIDER", type => "constant", flag => "-teltemp_spider", dtype => "float"  }, # Spider temperatures (C)           
    91        { name => "FPA.TELTEMP.TRUSS",  type => "constant", flag => "-teltemp_truss",  dtype => "float"  }, # Mid truss temperatures (C         
    92        { name => "FPA.TELTEMP.EXTRA",  type => "constant", flag => "-teltemp_extra",  dtype => "float"  }, # Miscellaneous temperatures (C)     
     87       { name => "FPA.TELTEMP.M1",     type => "constant", flag => "-teltemp_m1",     dtype => "float"  }, # Primary mirror temps (C)
     88       { name => "FPA.TELTEMP.M1CELL", type => "constant", flag => "-teltemp_m1cell", dtype => "float"  }, # Primary mirror support temps (C)
     89       { name => "FPA.TELTEMP.M2",     type => "constant", flag => "-teltemp_m2",     dtype => "float"  }, # Secondary mirror temps (C
     90       { name => "FPA.TELTEMP.SPIDER", type => "constant", flag => "-teltemp_spider", dtype => "float"  }, # Spider temperatures (C)
     91       { name => "FPA.TELTEMP.TRUSS",  type => "constant", flag => "-teltemp_truss",  dtype => "float"  }, # Mid truss temperatures (C
     92       { name => "FPA.TELTEMP.EXTRA",  type => "constant", flag => "-teltemp_extra",  dtype => "float"  }, # Miscellaneous temperatures (C)
    9393
    9494       { name => "FPA.PON.TIME",   type => "constant", flag => "-pon_time",        dtype => "float"  }, # time since last power on
     
    109109    or (warn "Can't find ppStats" and $missing_tools = 1);
    110110
    111 if ($missing_tools) { 
     111if ($missing_tools) {
    112112    warn ("Can't find required tools");
    113     exit($PS_EXIT_CONFIG_ERROR); 
     113    exit($PS_EXIT_CONFIG_ERROR);
    114114}
    115115
     
    130130    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    131131        cache_run(command => $command, verbose => $verbose);
    132     unless ($success) { 
     132    unless ($success) {
    133133        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    134134        &my_die ("Unable to perform ppStats on exposure id $exp_id: $error_code", $exp_id, $tmp_exp_name, $tmp_class_id, $uri, $error_code);
    135135    }
    136    
     136
    137137    # Parse the output
    138138    my $mdcParser = PS::IPP::Metadata::Config->new;        # Parser for metadata config files
     
    163163$command .= " -tmp_class_id $tmp_class_id"; # the original class_id supplied by the user, replace by ppStats CLASS.ID
    164164$command .= " -uri $uri ";
     165$command .= " -hostname $host" if defined $host;
    165166$command .= " -dbname $dbname" if defined $dbname;
    166167$command .= $stats->cmdflags();
     
    216217        $command .= " -exp_name $exp_name";
    217218        $command .= " -tmp_class_id $tmp_class_id";
    218         $command .= " -uri $uri ";
     219        $command .= " -uri $uri ";
    219220        $command .= " -telescope UNKNOWN";
    220221        $command .= " -inst UNKNOWN";
    221222        $command .= " -class_id $tmp_class_id";
    222223        $command .= " -code $exit_code";
     224        $command .= " -hostname $host" if defined $host;
    223225        $command .= " -dbname $dbname" if defined $dbname;
    224226        system ($command);
  • trunk/ippScripts/scripts/stack_skycell.pl

    r17671 r17803  
    3232    'outroot=s'         => \$outroot, # Output root name
    3333    'verbose'           => \$verbose,   # Print to stdout
    34     'no-update'         => \$no_update, # Don't update the database?
     34    'no-update'         => \$no_update, # Don't update the database?
    3535    'no-op'             => \$no_op, # Don't do any operations?
    3636    'save-temps'        => \$save_temps, # Save temporary files?
     
    4141    -msg => "Required options: --stack_id --outroot",
    4242    -exitval => 3,
    43           ) unless defined $stack_id
     43          ) unless defined $stack_id
    4444    and defined $outroot;
    4545
    46 my $STATS = 
    47    [   
     46my $STATS =
     47   [
    4848       #          PPSTATS KEYWORD         STATISTIC          STACKTOOL FLAG
    4949       { name => "ROBUST_MEDIAN",   type => "mean", flag => "-bg",          dtype => "float" },
     
    5858my $stacktool = can_run('stacktool') or (warn "Can't find stacktool" and $missing_tools = 1);
    5959my $ppStack = can_run('ppStack') or (warn "Can't find ppStack" and $missing_tools = 1);
    60 if ($missing_tools) { 
     60if ($missing_tools) {
    6161    warn("Can't find required tools.");
    62     exit($PS_EXIT_CONFIG_ERROR); 
     62    exit($PS_EXIT_CONFIG_ERROR);
    6363}
    6464
    6565# Get list of components for stacking
    66 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
     66my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
    6767my $files;
    6868{
     
    7070    $command .= " -dbname $dbname" if defined $dbname;
    7171    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    72         run(command => $command, verbose => $verbose);
     72        run(command => $command, verbose => $verbose);
    7373    unless ($success) {
    74         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    75         &my_die("Unable to perform stacktool -inputskyfile: $error_code", $stack_id, $error_code);
     74        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     75        &my_die("Unable to perform stacktool -inputskyfile: $error_code", $stack_id, $error_code);
    7676    }
    7777
    7878    my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
    79         &my_die("Unable to parse metadata config doc", $stack_id, $PS_EXIT_PROG_ERROR);
    80     $files = parse_md_list($metadata) or 
    81         &my_die("Unable to parse metadata list", $stack_id, $PS_EXIT_PROG_ERROR);
     79        &my_die("Unable to parse metadata config doc", $stack_id, $PS_EXIT_PROG_ERROR);
     80    $files = parse_md_list($metadata) or
     81        &my_die("Unable to parse metadata list", $stack_id, $PS_EXIT_PROG_ERROR);
    8282}
    8383
     
    8686
    8787# Parse the list of input files to get the tesselation, skycell identifiers and camera
    88 my $skycell_id;                 # Skycell identifier
    89 my $tess_id;                    # Tesselation identifier
    90 my $camera;                     # Camera
     88my $skycell_id;                 # Skycell identifier
     89my $tess_id;                    # Tesselation identifier
     90my $camera;                     # Camera
    9191foreach my $file (@$files) {
    9292    # skip warps which are speicified as 'ignored'
    9393    if ($file->{ignored}) { next; }
    9494    if (defined $tess_id) {
    95         &my_die("Tesselation identifiers don't match", $stack_id, $PS_EXIT_SYS_ERROR) unless
    96             $file->{tess_id} eq $tess_id;
     95        &my_die("Tesselation identifiers don't match", $stack_id, $PS_EXIT_SYS_ERROR) unless
     96            $file->{tess_id} eq $tess_id;
    9797    } else {
    98         $tess_id = $file->{tess_id};
     98        $tess_id = $file->{tess_id};
    9999    }
    100100    if (defined $skycell_id) {
    101         &my_die("Skycell identifiers don't match", $stack_id, $PS_EXIT_SYS_ERROR) unless
    102             $file->{skycell_id} eq $skycell_id;
     101        &my_die("Skycell identifiers don't match", $stack_id, $PS_EXIT_SYS_ERROR) unless
     102            $file->{skycell_id} eq $skycell_id;
    103103    } else {
    104         $skycell_id = $file->{skycell_id};
     104        $skycell_id = $file->{skycell_id};
    105105    }
    106106    if (defined $camera) {
    107         &my_die("Cameras don't match", $stack_id, $PS_EXIT_SYS_ERROR) unless $file->{camera} eq $camera;
     107        &my_die("Cameras don't match", $stack_id, $PS_EXIT_SYS_ERROR) unless $file->{camera} eq $camera;
    108108    } else {
    109         $camera = $file->{camera};
     109        $camera = $file->{camera};
    110110    }
    111111}
     
    116116# Generate MDC file with the inputs
    117117my ($listFile, $listName) = tempfile( "$tess_id.$skycell_id.stk$stack_id.list.XXXX",
    118                                       UNLINK => !$save_temps );
     118                                      UNLINK => !$save_temps );
    119119my $num = 0;
    120 my $inputSources;               # Sources to use as stamps
     120my $inputSources;               # Sources to use as stamps
    121121foreach my $file (@$files) {
    122122    if ($file->{ignored}) { next; }
     
    125125    $num++;
    126126
    127     my $image = $file->{uri};   # Image name
     127    my $image = $file->{uri};   # Image name
    128128    my $mask = $ipprc->filename( "PSWARP.OUTPUT.MASK", $file->{path_base} ); # Mask name
    129129    my $weight = $ipprc->filename( "PSWARP.OUTPUT.WEIGHT", $file->{path_base} ); # Weight name
     
    134134    &my_die("Weight $weight does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists( $weight );
    135135    &my_die("PSF $psf does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists( $psf );
    136    
     136
    137137    print $listFile "\tIMAGE\tSTR\t" . $image . "\n";
    138     print $listFile "\tMASK\tSTR\t" . $mask . "\n"; 
    139     print $listFile "\tWEIGHT\tSTR\t" . $weight . "\n"; 
     138    print $listFile "\tMASK\tSTR\t" . $mask . "\n";
     139    print $listFile "\tWEIGHT\tSTR\t" . $weight . "\n";
    140140    print $listFile "\tPSF\tSTR\t" . $psf . "\n";
    141141
     
    147147    # XXX details about supplying sources, etc, need to be specified in the libraries
    148148    unless (defined $inputSources) {
    149         $inputSources = $ipprc->filename("PSWARP.OUTPUT.SOURCES", $file->{path_base});
    150         &my_die("Source file $inputSources does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists( $inputSources );
    151     }
    152        
     149        $inputSources = $ipprc->filename("PSWARP.OUTPUT.SOURCES", $file->{path_base});
     150        &my_die("Source file $inputSources does not exist", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists( $inputSources );
     151    }
     152
    153153}
    154154
     
    175175
    176176    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    177         run(command => $command, verbose => $verbose);
     177        run(command => $command, verbose => $verbose);
    178178    unless ($success) {
    179         $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    180         &my_die("Unable to perform ppStack: $error_code", $stack_id, $error_code);
     179        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     180        &my_die("Unable to perform ppStack: $error_code", $stack_id, $error_code);
    181181    }
    182182    &my_die("Couldn't find expected output file: $outputName", $stack_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputName);
     
    189189
    190190    # Get the statistics on the stacked image
    191     my $statsFile;              # File handle
     191    my $statsFile;              # File handle
    192192    open $statsFile, $ipprc->file_resolve($outputStats) or &my_die("Can't open statistics file $outputStats: $!", $stack_id, $PS_EXIT_SYS_ERROR);
    193193    my @contents = <$statsFile>; # Contents of file
    194194    close $statsFile;
    195195    my $metadata = $mdcParser->parse(join "", @contents) or
    196         &my_die("Unable to parse metadata config doc", $stack_id, $PS_EXIT_PROG_ERROR);
     196        &my_die("Unable to parse metadata config doc", $stack_id, $PS_EXIT_PROG_ERROR);
    197197    $stats->parse($metadata) or &my_die("Unable to find all values in statistics output.", $stack_id, $PS_EXIT_PROG_ERROR);
    198198}
     
    202202    # Add the stack result
    203203    {
    204         my $command = "$stacktool -addsumskyfile -stack_id $stack_id -uri $outputName -path_base $outroot";
    205         $command .= $stats->cmdflags();
    206         $command .= " -dbname $dbname" if defined $dbname;
    207        
    208         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    209             run(command => $command, verbose => $verbose);
    210         unless ($success) {
    211             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    212             &my_die("Unable to perform stacktool -addsumskyfile: $error_code", $stack_id, $error_code);
    213         }
     204        my $command = "$stacktool -addsumskyfile -stack_id $stack_id -uri $outputName -path_base $outroot";
     205        $command .= $stats->cmdflags();
     206        $command .= " -hostname $host" if defined $host;
     207        $command .= " -dbname $dbname" if defined $dbname;
     208
     209        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     210            run(command => $command, verbose => $verbose);
     211        unless ($success) {
     212            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     213            &my_die("Unable to perform stacktool -addsumskyfile: $error_code", $stack_id, $error_code);
     214        }
    214215    }
    215216
    216217    # Register the run as completed
    217218    {
    218         my $command = "$stacktool -updaterun -stack_id $stack_id -state stop"; # Command to run stacktool
    219         $command .= " -dbname $dbname" if defined $dbname;
    220 
    221         my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    222             run(command => $command, verbose => $verbose);
    223         unless ($success) {
    224             $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
    225             warn("Unable to perform stacktool -updaterun: $error_code\n");
    226             exit($error_code);
    227         }
     219        my $command = "$stacktool -updaterun -stack_id $stack_id -state stop"; # Command to run stacktool
     220        $command .= " -dbname $dbname" if defined $dbname;
     221
     222        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     223            run(command => $command, verbose => $verbose);
     224        unless ($success) {
     225            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     226            warn("Unable to perform stacktool -updaterun: $error_code\n");
     227            exit($error_code);
     228        }
    228229    }
    229230}
     
    232233sub my_die
    233234{
    234     my $msg = shift;            # Warning message on die
    235     my $stack_id = shift;       # Stack identifier
    236     my $exit_code = shift;      # Exit code to add
     235    my $msg = shift;            # Warning message on die
     236    my $stack_id = shift;       # Stack identifier
     237    my $exit_code = shift;      # Exit code to add
    237238
    238239    warn($msg);
    239240    if (defined $stack_id and not $no_update) {
    240         my $command = "$stacktool -addsumskyfile -stack_id $stack_id -code $exit_code";
    241         $command .= " -dbname $dbname" if defined $dbname;
     241        my $command = "$stacktool -addsumskyfile -stack_id $stack_id -code $exit_code";
     242        $command .= " -hostname $host" if defined $host;
     243        $command .= " -dbname $dbname" if defined $dbname;
    242244        system ($command);
    243245    }
  • trunk/ippScripts/scripts/warp_skycell.pl

    r17787 r17803  
    219219    $command .= " -uri $outputImage -path_base $outroot" if $accept;
    220220    $command .= $stats->cmdflags() if $accept;
     221    $command .= " -hostname $host" if defined $host;
    221222    $command .= " -dbname $dbname" if defined $dbname;
    222223
     
    241242    if (defined $warp_id and defined $skycell_id and defined $tess_id and not $no_update) {
    242243        my $command = "$warptool -addwarped -warp_id $warp_id -skycell_id $skycell_id -tess_id $tess_id -code $exit_code";
     244        $command .= " -hostname $host" if defined $host;
    243245        $command .= " -dbname $dbname" if defined $dbname;
    244246        run(command => $command, verbose => $verbose);
Note: See TracChangeset for help on using the changeset viewer.