IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 16176


Ignore:
Timestamp:
Jan 21, 2008, 4:56:26 PM (18 years ago)
Author:
eugene
Message:

making chip/host and nebulous upgrades

Location:
branches/eam_branch_20080121
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • branches/eam_branch_20080121/ippScripts/scripts/camera_exp.pl

    r16018 r16176  
    3737use Pod::Usage qw( pod2usage );
    3838
    39 my ($exp_tag, $cam_id, $recipe, $camera, $dbname, $workdir, $reduction, $dvodb, $no_update, $no_op);
     39my ($exp_tag, $cam_id, $camera, $outroot, $recipe, $dbname, $reduction, $dvodb, $no_update, $no_op);
    4040GetOptions(
    4141           'exp_tag=s'          => \$exp_tag, # Exposure identifier
     
    4444           'camera|c=s'        => \$camera, # Camera
    4545           'dbname|d=s'        => \$dbname, # Database name
    46            'workdir|w=s'       => \$workdir, # Working directory
     46           'outroot|w=s'       => \$outroot, # output file base name
    4747           'reduction=s'       => \$reduction, # Reduction class                       
    4848           'dvodb|w=s'         => \$dvodb,  # output DVO database
     
    5555          -msg => "Required options: --exp_tag --cam_id --camera",
    5656          -exitval => 3,
    57           ) unless defined $exp_tag
    58     and defined $cam_id
    59     and defined $camera;
     57          ) unless
     58    defined $exp_tag and
     59    defined $cam_id and
     60    defined $outroot and
     61    defined $camera;
    6062
    6163$ipprc->define_camera($camera);
     
    136138}
    137139
     140### not needed to have such an extensive temp file name.
    138141my ($list1File, $list1Name) = tempfile( "$exp_tag.cm.$cam_id.b1.list.XXXX", UNLINK => 1 ); # For binning 1
    139142my ($list2File, $list2Name) = tempfile( "$exp_tag.cm.$cam_id.b2.list.XXXX", UNLINK => 1 ); # For binning 2
     
    162165
    163166# Output products
    164 $workdir = caturi( $workdir, $exp_tag ) if defined $workdir;
    165 my $outputRoot = $ipprc->file_prepare( "$exp_tag.cm.$cam_id", $workdir, ${$files}[0]->{path_base} );
    166 
    167 my $jpeg1      = $ipprc->filename("PPIMAGE.JPEG1", $outputRoot); # Binned JPEG #1
    168 my $jpeg2      = $ipprc->filename("PPIMAGE.JPEG2", $outputRoot); # Binned JPEG #2
    169 my $fpaObjects = $ipprc->filename("PSASTRO.OUTPUT.MEF", $outputRoot); # MEF psastro output
    170 
    171 my $traceDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".trace"; # Trace messages
    172 my $logDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".log"; # Log messages
     167$ipprc->outroot_prepare($outroot);
     168
     169my $jpeg1      = $ipprc->filename("PPIMAGE.JPEG1",      $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
     170my $jpeg2      = $ipprc->filename("PPIMAGE.JPEG2",      $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
     171my $fpaObjects = $ipprc->filename("PSASTRO.OUTPUT.MEF", $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
     172my $traceDest  = $ipprc->filename("TRACE.EXP",          $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
     173my $logDest    = $ipprc->filename("LOG.EXP",            $outroot) or &my_die("Missing entry from camera config", $cam_id, $PS_EXIT_CONFIG_ERROR);
    173174
    174175# convert supplied DVO database name to UNIX filename
     
    184185    # Make the jpeg for binning 1
    185186    {
    186         my $command = "$ppImage -list $list1Name $outputRoot -recipe PPIMAGE $recipe1"; # Command to run
     187        my $command = "$ppImage -list $list1Name $outroot -recipe PPIMAGE $recipe1"; # Command to run
    187188        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    188189            run(command => $command, verbose => 1);
     
    196197    # Make the jpeg for binning 2
    197198    {
    198         my $command = "$ppImage -list $list2Name $outputRoot -recipe PPIMAGE $recipe2"; # Command to run
     199        my $command = "$ppImage -list $list2Name $outroot -recipe PPIMAGE $recipe2"; # Command to run
    199200        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    200201            run(command => $command, verbose => 1);
     
    229230            # XXX add a ppStats call which will collect the astrometry stats
    230231            my $command;
    231             $command  = "$psastro -list $list3Name $outputRoot";
     232            $command  = "$psastro -list $list3Name $outroot";
    232233            $command .= " +mosastro -chipastro";
    233234            $command .= " -F PSASTRO.OUTPUT PSASTRO.OUTPUT.MEF";
     
    276277$fpaCommand .= " -cam_id $cam_id";
    277278$fpaCommand .= " -uri UNKNOWN";
    278 $fpaCommand .= " -path_base $outputRoot";
     279$fpaCommand .= " -path_base $outroot";
    279280$fpaCommand .= " -dbname $dbname" if defined $dbname;
    280281$fpaCommand .= $chipStats->cmdflags();
  • branches/eam_branch_20080121/ippScripts/scripts/chip_imfile.pl

    r15466 r16176  
    3333
    3434# Parse the command-line arguments
    35 my ($exp_id, $chip_id, $class_id, $uri, $exp_tag, $camera, $dbname, $workdir, $reduction, $no_update, $no_op);
     35my ($exp_id, $exp_tag, $chip_id, $class_id, $uri, $camera, $outroot, $dbname, $reduction, $no_update, $no_op);
    3636GetOptions(
    3737           'exp_id=s'      => \$exp_id,    # Exposure identifier                       
     38           'exp_tag=s'     => \$exp_tag,   # Exposure identifier                       
    3839           'chip_id=s'     => \$chip_id,   # Chiptool identifier                       
    3940           'class_id=s'    => \$class_id,  # Class identifier                 
    4041           'uri|u=s'       => \$uri,       # Input FITS file                   
    4142           'camera|c=s'    => \$camera,    # Camera                           
     43           'outroot|w=s'   => \$outroot,   # output file base name
    4244           'dbname|d=s'    => \$dbname,    # Database name
    43            'exp_tag=s'     => \$exp_tag,    # Exposure identifier                     
    44            'workdir|w=s'   => \$workdir,   # Working directory, for output files 
    4545           'reduction=s'   => \$reduction, # Reduction class                   
    4646           'no-update'     => \$no_update, # Don't update the database?       
     
    4949
    5050pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    51 pod2usage( -msg => "Required options: --exp_id --exp_tag --chip_id --class_id --uri --camera",
     51pod2usage( -msg => "Required options: --exp_id --exp_tag --chip_id --class_id --uri --camera --outroot",
    5252           -exitval => 3) unless
    5353    defined $exp_id and
     54    defined $exp_tag and
    5455    defined $chip_id and
    5556    defined $class_id and
    5657    defined $uri and
    57     defined $exp_tag and
    58     defined $camera;
     58    defined $camera and
     59    defined $outroot;
    5960
    6061$ipprc->define_camera($camera);
     
    100101&my_die("Couldn't find input file: $uri\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($uri);
    101102
    102 $workdir = caturi( $workdir, $exp_tag ) if defined $workdir;
    103 
    104 my $outputRoot  = $ipprc->file_prepare( "$exp_tag.ch.$chip_id", $workdir, $uri );
    105 
    106 my $outputImage = $ipprc->filename("PPIMAGE.CHIP",      $outputRoot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
    107 my $outputMask  = $ipprc->filename("PPIMAGE.CHIP.MASK", $outputRoot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
    108 my $outputWeight  = $ipprc->filename("PPIMAGE.CHIP.WEIGHT", $outputRoot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
    109 my $outputBin1  = $ipprc->filename("PPIMAGE.BIN1",      $outputRoot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
    110 my $outputBin2  = $ipprc->filename("PPIMAGE.BIN2",      $outputRoot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
    111 my $outputStats = $ipprc->filename("PPIMAGE.STATS",     $outputRoot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
    112 
    113 my $traceDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".$class_id.trace"; # Trace messages
    114 my $logDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".$class_id.log"; # Log messages
     103# outroot examples (HOST components must be set)
     104# file://data/ipp004.0/gpc1/20080130
     105# neb:///ipp004-v1/gpc1/20080130
     106# neb:///*/gpc1/20080130 (volume not specified)
     107
     108# check for existing directory, generate if needed
     109$ipprc->outroot_prepare($outroot);
     110
     111## these names are used in ppImage, and thus may be URIs
     112my $outputImage   = $ipprc->filename("PPIMAGE.CHIP",        $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
     113my $outputMask    = $ipprc->filename("PPIMAGE.CHIP.MASK",   $outroot, $class_id) or &my_die("Missing entry from camera config", $exp_id, $chip_id, $class_id, $PS_EXIT_CONFIG_ERROR);
     114my $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);
     115my $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);
     116my $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);
     117my $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);
     118my $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);
     119my $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);
    115120
    116121# Run ppImage
    117122unless ($no_op) {
    118     my $command = "$ppImage -file $uri $outputRoot";
     123    ## XXX can we convert ppImage log and trace to use the filerules to generate consistent names
     124    ## XXX also stats: output should be implied by $outroot
     125    my $command = "$ppImage -file $uri $outroot";
    119126    $command .= " -recipe PPIMAGE $recipe";
    120127    $command .= " -recipe PPSTATS CHIPSTATS";
     
    130137    }
    131138
    132     &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);
    133     &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);
    134     &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);
    135     &my_die("Couldn't find expected output file: $outputBin1\n",  $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputBin1);
    136     &my_die("Couldn't find expected output file: $outputBin2\n",  $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputBin2);
    137     &my_die("Couldn't find expected output file: $outputStats\n", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStats);
     139    &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);
     140    &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);
     141    &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);
     142    &my_die("Couldn't find expected output file: $outputBin1\n",   $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputBin1);
     143    &my_die("Couldn't find expected output file: $outputBin2\n",   $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputBin2);
     144    &my_die("Couldn't find expected output file: $outputStats\n",  $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($outputStats);
    138145
    139146    # Get the statistics on the processed image
     
    162169$command .= " -class_id $class_id";
    163170$command .= " -uri $outputImage";
    164 $command .= " -path_base $outputRoot";
     171$command .= " -path_base $outroot";
    165172$command .= " -dbname $dbname" if defined $dbname;
    166173$command .= $stats->cmdflags();
  • branches/eam_branch_20080121/ippScripts/scripts/detrend_norm_apply.pl

    r15918 r16176  
    3333
    3434# Parse the command-line
    35 my ($det_id, $iter, $class_id, $value, $input_uri, $camera, $det_type, $dbname, $workdir, $no_update, $no_op);
     35my ($det_id, $iter, $class_id, $value, $input_uri, $camera, $det_type, $outroot, $dbname, $no_update, $no_op);
    3636GetOptions(
    3737    'det_id|d=s'        => \$det_id,     # Detrend ID                           
     
    4242    'camera|c=s'        => \$camera,     # Camera                               
    4343    'det_type|t=s'      => \$det_type,   # Detrend type                         
     44    'outroot|w=s'       => \$outroot,    # output file base name
    4445    'dbname|d=s'        => \$dbname,     # Database name                               
    45     'workdir|w=s'       => \$workdir,    # Working directory, for output files 
    4646    'no-update'         => \$no_update,  # Don't update the database           
    4747    'no-op'             => \$no_op,      # Don't do any operations               
     
    4949   
    5050pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    51 pod2usage( -msg => "Required options: --det_id --iteration --class_id --value --input_uri --camera --det_type",
    52            -exitval => 3)
    53     unless defined $det_id
    54     and defined $iter
    55     and defined $class_id
    56     and defined $value
    57     and defined $input_uri
    58     and defined $camera
    59     and defined $det_type;
     51pod2usage( -msg => "Required options: --det_id --iteration --class_id --value --input_uri --camera --det_type --outroot",
     52           -exitval => 3) unless
     53    defined $det_id    and
     54    defined $iter      and
     55    defined $class_id  and
     56    defined $value     and
     57    defined $input_uri and
     58    defined $camera    and
     59    defined $det_type  and
     60    defined $outroot;
    6061
    6162$ipprc->define_camera($camera);
     
    9091&my_die("Couldn't find input file: $input_uri\n", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($input_uri);
    9192
    92 $workdir = caturi( $workdir, "$camera.$det_type.$det_id" ) if defined $workdir;
    93 
    94 my $outputRoot = $ipprc->file_prepare( "$camera.$det_type.norm.$det_id.$iter", $workdir, $input_uri );
    95 
    96 my $output    = $ipprc->filename("PPIMAGE.OUTPUT", $outputRoot, $class_id);
    97 my $b1name    = $ipprc->filename("PPIMAGE.BIN1",   $outputRoot, $class_id);
    98 my $b2name    = $ipprc->filename("PPIMAGE.BIN2",   $outputRoot, $class_id);
    99 my $statsName = $ipprc->filename("PPIMAGE.STATS",  $outputRoot, $class_id);
    100 
    101 my $traceDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".$class_id.trace"; # Trace messages
    102 my $logDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".$class_id.log"; # Log messages
     93# outroot examples (HOST components must be set)
     94# file://data/ipp004.0/gpc1/20080130
     95# neb:///ipp004-v1/gpc1/20080130
     96# neb:///*/gpc1/20080130 (volume not specified)
     97
     98# check for existing directory, generate if needed
     99$ipprc->outroot_prepare($outroot);
     100
     101my $output    = $ipprc->filename("PPIMAGE.OUTPUT", $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
     102my $b1name    = $ipprc->filename("PPIMAGE.BIN1",   $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
     103my $b2name    = $ipprc->filename("PPIMAGE.BIN2",   $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
     104my $statsName = $ipprc->filename("PPIMAGE.STATS",  $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
     105my $traceDest = $ipprc->filename("TRACE.IMFILE",   $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
     106my $logDest   = $ipprc->filename("LOG.IMFILE",     $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $iter, $class_id, $PS_EXIT_CONFIG_ERROR);
    103107
    104108# Run normalisation
    105109unless ($no_op) {
    106     my $command = "$ppImage -file $input_uri $outputRoot";
     110    my $command = "$ppImage -file $input_uri $outroot";
    107111    $command .= " -norm $value -stats $statsName";
    108112    $command .= " -recipe PPIMAGE $RECIPE_PPIMAGE";
     
    118122        &my_die("Unable to perform ppImage: $error_code", $det_id, $iter, $class_id, $error_code);
    119123    }
    120     &my_die("Can't find expected output file: $output", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($output);
    121     &my_die("Can't find expected output file: $b1name", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($b1name);
    122     &my_die("Can't find expected output file: $b2name", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($b2name);
     124    &my_die("Can't find expected output file: $output",    $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($output);
     125    &my_die("Can't find expected output file: $b1name",    $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($b1name);
     126    &my_die("Can't find expected output file: $b2name",    $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($b2name);
    123127    &my_die("Can't find expected output file: $statsName", $det_id, $iter, $class_id, $PS_EXIT_SYS_ERROR) unless -f $ipprc->file_resolve($statsName);
    124128   
     
    149153$command .= " -class_id $class_id";
    150154$command .= " -uri $output";
    151 $command .= " -path_base $outputRoot";
     155$command .= " -path_base $outroot";
    152156$command .= " -dbname $dbname" if defined $dbname;
    153157$command .= $stats->cmdflags();
  • branches/eam_branch_20080121/ippScripts/scripts/detrend_norm_calc.pl

    r15616 r16176  
    3232
    3333# Parse command-line arguments
    34 my ($det_id, $iter, $detType, $workdir, $dbname, $no_update, $no_op);
     34my ($det_id, $iter, $detType, $outroot, $dbname, $no_update, $no_op);
    3535GetOptions(
    3636        'det_id|d=s'    => \$det_id,    # Detrend id                         
    3737        'iteration|i=s' => \$iter,      # Iteration                         
    3838        'det_type|t=s'  => \$detType,   # Detrend type                       
    39         'workdir|w=s'   => \$workdir,   # Working directory for output files
     39        'outroot|w=s'   => \$outroot,   # output file base name
    4040        'dbname|d=s'    => \$dbname,    # Database name                     
    4141        'no-update'     => \$no_update, # Don't update the database?         
     
    4444
    4545pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    46 pod2usage( -msg => "Required options --det_id --iteration --det_type",
     46pod2usage( -msg => "Required options --det_id --iteration --det_type --outroot",
    4747           -exitval => 3,
    48            )
    49     unless defined $det_id
    50     and defined $iter
    51     and defined $detType;
     48           ) unless
     49    defined $det_id  and
     50    defined $iter    and
     51    defined $detType and
     52    defined $outroot;
    5253
    5354use constant STATISTIC => 'bg'; # Background statistic to use from the database
  • branches/eam_branch_20080121/ippScripts/scripts/detrend_norm_exp.pl

    r15853 r16176  
    3535use Pod::Usage qw( pod2usage );
    3636
    37 my ($det_id, $iter, $det_type, $camera, $dbname, $workdir, $reduction, $no_update, $no_op);
     37my ($det_id, $iter, $det_type, $camera, $outroot, $dbname, $reduction, $no_update, $no_op);
    3838GetOptions(
    3939           'det_id|d=s'        => \$det_id,
     
    4141           'camera|c=s'        => \$camera,
    4242           'det_type|t=s'      => \$det_type,
     43           'outroot|w=s'       => \$outroot,   # output file base name
    4344           'dbname|d=s'        => \$dbname, # Database name
    44            'workdir|w=s'       => \$workdir,    # Working directory, for output files
    4545           'reduction|=s'      => \$reduction,
    4646           'no-update'         => \$no_update,
     
    4949
    5050pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    51 pod2usage( -msg => "Required options: --det_id --iteration --camera --det_type",
    52            -exitval => 3)
    53     unless defined $det_id
    54     and defined $iter
    55     and defined $camera
    56     and defined $det_type;
     51pod2usage( -msg => "Required options: --det_id --iteration --camera --det_type --outroot",
     52           -exitval => 3) unless
     53    defined $det_id   and
     54    defined $iter     and
     55    defined $camera   and
     56    defined $det_type and
     57    defined $outroot;
    5758
    5859$ipprc->define_camera($camera);
     
    126127close $list2File;
    127128
    128 # Output products
    129 $workdir = caturi( $workdir, "$camera.$det_type.$det_id" ) if defined $workdir;
    130 my $outputRoot = $ipprc->file_prepare( "$camera.$det_type.norm.$det_id.$iter", $workdir );
    131 my $jpeg1Name = $ipprc->filename("PPIMAGE.JPEG1", $outputRoot); # Binned JPEG #1
    132 my $jpeg2Name = $ipprc->filename("PPIMAGE.JPEG2", $outputRoot); # Binned JPEG #2
     129# outroot examples (HOST components must be set)
     130# file://data/ipp004.0/gpc1/20080130
     131# neb:///ipp004-v1/gpc1/20080130
     132# neb:///*/gpc1/20080130 (volume not specified)
     133
     134# check for existing directory, generate if needed
     135$ipprc->outroot_prepare($outroot);
     136
     137my $jpeg1Name = $ipprc->filename("PPIMAGE.JPEG1", $outroot); # Binned JPEG #1
     138my $jpeg2Name = $ipprc->filename("PPIMAGE.JPEG2", $outroot); # Binned JPEG #2
    133139
    134140unless ($no_op) {
    135141    # Make the jpeg for binning 1
    136     $command = "$ppImage -list $list1Name $outputRoot -recipe PPIMAGE $recipe1"; # Command to run
     142    $command = "$ppImage -list $list1Name $outroot -recipe PPIMAGE $recipe1"; # Command to run
    137143    ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    138144        run(command => $command, verbose => 1);
     
    140146   
    141147    # Make the jpeg for binning 2
    142     $command = "$ppImage -list $list2Name $outputRoot -recipe PPIMAGE $recipe2"; # Command to run
     148    $command = "$ppImage -list $list2Name $outroot -recipe PPIMAGE $recipe2"; # Command to run
    143149    ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    144150        run(command => $command, verbose => 1);
     
    152158$command .= " -iteration $iter";
    153159$command .= " -recip $recipe1,$recipe2";
    154 $command .= " -path_base $outputRoot ";
     160$command .= " -path_base $outroot ";
    155161$command .= " -dbname $dbname" if defined $dbname;
    156162$command .= $stats->cmdflags();
  • branches/eam_branch_20080121/ippScripts/scripts/detrend_process_exp.pl

    r15643 r16176  
    3535use Pod::Usage qw( pod2usage );
    3636
    37 my ($det_id, $exp_id, $det_type, $exp_tag, $camera, $dbname, $workdir, $reduction, $no_update, $no_op);
     37my ($det_id, $exp_id, $det_type, $exp_tag, $camera, $outroot, $dbname, $reduction, $no_update, $no_op);
    3838GetOptions(
    3939    'det_id|d=s'        => \$det_id,
     
    4242    'exp_tag|=s'        => \$exp_tag,
    4343    'camera|c=s'        => \$camera,
     44    'outroot|w=s'       => \$outroot,   # output file base name
    4445    'dbname|d=s'        => \$dbname, # Database name
    45     'workdir|w=s'       => \$workdir,   # Working directory, for output files
    4646    'reduction|=s'      => \$reduction,
    4747    'no-update'         => \$no_update,
     
    5050
    5151pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    52 pod2usage( -msg => "Required options: --det_id --det_type --exp_id --exp_tag --camera",
    53            -exitval => 3)
    54     unless defined $det_id
    55     and defined $det_type
    56     and defined $exp_id
    57     and defined $exp_tag
    58     and defined $camera;
     52pod2usage( -msg => "Required options: --det_id --det_type --exp_id --exp_tag --camera --outroot",
     53           -exitval => 3) unless
     54    defined $det_id   and
     55    defined $det_type and
     56    defined $exp_id   and
     57    defined $exp_tag  and
     58    defined $camera   and
     59    defined $outroot;
    5960
    6061$ipprc->define_camera($camera);
     
    129130close $list2File;
    130131
    131 # Output files
    132 $workdir = caturi( $workdir, "$camera.$det_type.$det_id" ) if defined $workdir;
    133 my $outputRoot = $ipprc->file_prepare( "$exp_tag/$exp_tag.detproc.$det_id", $workdir, ${$files}[0]->{path_base} );
    134 my $jpeg1 = $ipprc->filename("PPIMAGE.JPEG1", $outputRoot); # Binned JPEG #1
    135 my $jpeg2 = $ipprc->filename("PPIMAGE.JPEG2", $outputRoot); # Binned JPEG #2
     132# outroot examples (HOST components must be set)
     133# file://data/ipp004.0/gpc1/20080130
     134# neb:///ipp004-v1/gpc1/20080130
     135# neb:///*/gpc1/20080130 (volume not specified)
     136
     137# check for existing directory, generate if needed
     138$ipprc->outroot_prepare($outroot);
     139
     140my $jpeg1 = $ipprc->filename("PPIMAGE.JPEG1", $outroot); # Binned JPEG #1
     141my $jpeg2 = $ipprc->filename("PPIMAGE.JPEG2", $outroot); # Binned JPEG #2
    136142
    137143unless ($no_op) {
    138144    # Make the jpeg for binning 1
    139     $command = "$ppImage -list $list1Name $outputRoot -recipe PPIMAGE $recipe1"; # Command to run
     145    $command = "$ppImage -list $list1Name $outroot -recipe PPIMAGE $recipe1"; # Command to run
    140146    ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    141147        run(command => $command, verbose => 1);
     
    147153   
    148154    # Make the jpeg for binning 2
    149     $command = "$ppImage -list $list2Name $outputRoot -recipe PPIMAGE $recipe2"; # Command to run
     155    $command = "$ppImage -list $list2Name $outroot -recipe PPIMAGE $recipe2"; # Command to run
    150156    ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    151157        run(command => $command, verbose => 1);
     
    161167$command .= " -det_id $det_id";
    162168$command .= " -exp_id $exp_id";
    163 $command .= " -recip $recipe1,$recipe2 -path_base $outputRoot";
     169$command .= " -recip $recipe1,$recipe2 -path_base $outroot";
    164170$command .= " -dbname $dbname" if defined $dbname;
    165171$command .= $stats->cmdflags();
  • branches/eam_branch_20080121/ippScripts/scripts/detrend_process_imfile.pl

    r15466 r16176  
    3232use Pod::Usage qw( pod2usage );
    3333
    34 my ($det_id, $exp_id, $class_id, $det_type, $exp_tag, $input_uri, $camera, $dbname, $workdir, $reduction, $no_update, $no_op);
     34my ($det_id, $exp_id, $class_id, $det_type, $exp_tag, $input_uri, $camera, $outroot, $dbname, $reduction, $no_update, $no_op);
    3535GetOptions(
    3636    'det_id|d=s'        => \$det_id,
     
    4141    'input_uri|u=s'     => \$input_uri,
    4242    'camera|c=s'        => \$camera,
     43    'outroot|w=s'       => \$outroot, # output file base name
    4344    'dbname|d=s'        => \$dbname, # Database name
    44     'workdir|w=s'       => \$workdir, # Working directory, for output files
    4545    'reduction=s'       => \$reduction, # Reduction class
    4646    'no-update'         => \$no_update,
     
    4949
    5050pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    51 pod2usage( -msg => "Required options: --det_id --exp_id --class_id --det_type --exp_tag --input_uri --camera",
    52            -exitval => 3)
    53     unless defined $det_id
    54     and defined $exp_id
    55     and defined $class_id
    56     and defined $det_type
    57     and defined $exp_tag
    58     and defined $input_uri
    59     and defined $camera;
     51pod2usage( -msg => "Required options: --det_id --exp_id --class_id --det_type --exp_tag --input_uri --camera --outroot",
     52           -exitval => 3) unless
     53    defined $det_id    and
     54    defined $exp_id    and
     55    defined $class_id  and
     56    defined $det_type  and
     57    defined $exp_tag   and
     58    defined $input_uri and
     59    defined $camera    and
     60    defined $outroot;
    6061
    6162# XXX this exits with status = 0 on failure
     
    8889&my_die("Couldn't find input file: $input_uri\n", $det_id, $exp_id, $class_id, $PS_EXIT_SYS_ERROR) unless $ipprc->file_exists($input_uri);
    8990
    90 $workdir = caturi( $workdir, "$camera.$det_type.$det_id" ) if defined $workdir;
     91# outroot examples (HOST components must be set)
     92# file://data/ipp004.0/gpc1/20080130
     93# neb:///ipp004-v1/gpc1/20080130
     94# neb:///*/gpc1/20080130 (volume not specified)
    9195
    92 my $outputRoot  = $ipprc->file_prepare( "$exp_tag/$exp_tag.detproc.$det_id", $workdir, $input_uri );
     96# check for existing directory, generate if needed
     97$ipprc->outroot_prepare($outroot);
    9398
    94 my $outputImage = $ipprc->filename("PPIMAGE.OUTPUT", $outputRoot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
    95 my $outputBin1  = $ipprc->filename("PPIMAGE.BIN1",   $outputRoot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
    96 my $outputBin2  = $ipprc->filename("PPIMAGE.BIN2",   $outputRoot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
    97 my $outputStats = $ipprc->filename("PPIMAGE.STATS",  $outputRoot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
    98 
    99 my $traceDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".$class_id.trace"; # Trace messages
    100 my $logDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".$class_id.log"; # Log messages
     99my $outputImage = $ipprc->filename("PPIMAGE.OUTPUT", $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
     100my $outputBin1  = $ipprc->filename("PPIMAGE.BIN1",   $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
     101my $outputBin2  = $ipprc->filename("PPIMAGE.BIN2",   $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
     102my $outputStats = $ipprc->filename("PPIMAGE.STATS",  $outroot, $class_id) or &my_die("Missing entry from camera config", $det_id, $exp_id, $class_id, $PS_EXIT_PROG_ERROR);
     103my $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);
     104my $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);
    101105
    102106# Run ppImage
    103107unless ($no_op) {
    104     my $command = "$ppImage -file $input_uri $outputRoot";
     108    my $command = "$ppImage -file $input_uri $outroot";
    105109    $command .= " -recipe PPIMAGE $recipe";
    106110    $command .= " -recipe PPSTATS CHIPSTATS";
     
    141145$command .= " -class_id $class_id";
    142146$command .= " -recip $reduction";
    143 $command .= " -uri $outputImage -path_base $outputRoot";
     147$command .= " -uri $outputImage -path_base $outroot";
    144148$command .= " -dbname $dbname" if defined $dbname;
    145149$command .= $stats->cmdflags();
  • branches/eam_branch_20080121/ippScripts/scripts/detrend_reject_exp.pl

    r15489 r16176  
    3737use Pod::Usage qw( pod2usage );
    3838
    39 my ($det_id, $iter, $det_type, $camera, $filter, $workdir, $dbname, $no_update, $no_op);
     39my ($det_id, $iter, $det_type, $camera, $outroot, $filter, $dbname, $no_update, $no_op);
    4040GetOptions(
    4141           'det_id|d=s'        => \$det_id,
     
    4343           'det_type|t=s'      => \$det_type,
    4444           'camera=s'          => \$camera,
     45           'outroot|w=s'   => \$outroot,   # output file base name
    4546           'filter=s'          => \$filter,
    46            'workdir|w=s'       => \$workdir, # Working directory for output files
    4747           'dbname|d=s'        => \$dbname, # Database name
    4848           'no-update'         => \$no_update,
     
    5151
    5252pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    53 pod2usage( -msg => "Required options: --det_id --iteration --det_type --camera",
    54            -exitval => 3)
    55     unless defined $det_id
    56     and defined $iter
    57     and defined $det_type
    58     and defined $camera;
     53pod2usage( -msg => "Required options: --det_id --iteration --det_type --camera --outroot",
     54           -exitval => 3) unless
     55    defined $det_id   and
     56    defined $iter     and
     57    defined $det_type and
     58    defined $camera   and
     59    defined $outroot;
    5960
    6061# values to extract from output metadata and the stats to calculate
     
    141142my $reject_meanstdev = rejection_limit( 'ENSEMBLE.MEANSTDEV', $det_type, $filter );
    142143
    143 $workdir = caturi( $workdir, "$camera.$det_type.$det_id" ) if defined $workdir;
    144 
    145 my $logName = $ipprc->file_prepare( "$camera.$det_type.$det_id.$iter.detreject.log", $workdir ); # Name for log
     144# outroot examples (HOST components must be set)
     145# file://data/ipp004.0/gpc1/20080130
     146# neb:///ipp004-v1/gpc1/20080130
     147# neb:///*/gpc1/20080130 (volume not specified)
     148
     149# check for existing directory, generate if needed
     150$ipprc->outroot_prepare($outroot);
     151
     152my $logName = $outroot . "log"; # Name for log
    146153
    147154my $logFile;
  • branches/eam_branch_20080121/ippScripts/scripts/detrend_reject_imfile.pl

    r14823 r16176  
    4343
    4444# parse the command-line options
    45 my ($det_id, $iter, $exp_id, $exp_tag, $det_type, $camera, $filter, $reject, $dbname, $workdir, $reduction, $no_update, $no_op);
     45my ($det_id, $iter, $exp_id, $exp_tag, $det_type, $camera, $filter, $reject, $outroot, $dbname, $reduction, $no_update, $no_op);
    4646GetOptions(
    4747           'det_id|d=s'        => \$det_id,
     
    5151           'det_type|t=s'      => \$det_type,
    5252           'camera=s'          => \$camera,
     53           'outroot|w=s'       => \$outroot,   # output file base name
    5354           'filter=s'          => \$filter,
    5455           'reject'            => \$reject,
    5556           'dbname|d=s'        => \$dbname, # Database name
    56            'workdir|w=s'       => \$workdir, # Working directory, for output files
    5757           'reduction|=s'      => \$reduction,
    5858           'no-update'         => \$no_update,
     
    6161
    6262pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    63 pod2usage( -msg => "Required options: --det_id --iteration --exp_id --exp_tag --det_type --camera",
    64            -exitval => 3)
    65     unless defined $det_id
    66     and defined $iter
    67     and defined $exp_id
    68     and defined $exp_tag
    69     and defined $det_type
    70     and defined $camera;
     63pod2usage( -msg => "Required options: --det_id --iteration --exp_id --exp_tag --det_type --camera --outroot",
     64           -exitval => 3) unless
     65    defined $det_id   and
     66    defined $iter     and
     67    defined $exp_id   and
     68    defined $exp_tag  and
     69    defined $det_type and
     70    defined $camera   and
     71    defined $outroot;
    7172
    7273# load IPP config information for the specified camera
     
    144145}
    145146
    146 # Output products
    147 $workdir = caturi( $workdir, "$camera.$det_type.$det_id" ) if defined $workdir;
    148 my $outputRoot = $ipprc->file_prepare( "$exp_tag/$exp_tag.detresid.$det_id.$iter", $workdir, ${$files}[0]->{path_base} );
    149 my $jpeg1Name  = $ipprc->filename("PPIMAGE.JPEG1", $outputRoot); # Binned JPEG #1
    150 my $jpeg2Name  = $ipprc->filename("PPIMAGE.JPEG2", $outputRoot); # Binned JPEG #2
    151 my $logName    = $ipprc->filename("LOG.EXP", $outputRoot); # Name for log
     147# outroot examples (HOST components must be set)
     148# file://data/ipp004.0/gpc1/20080130
     149# neb:///ipp004-v1/gpc1/20080130
     150# neb:///*/gpc1/20080130 (volume not specified)
     151
     152# check for existing directory, generate if needed
     153$ipprc->outroot_prepare($outroot);
     154
     155my $jpeg1Name  = $ipprc->filename("PPIMAGE.JPEG1", $outroot); # Binned JPEG #1
     156my $jpeg2Name  = $ipprc->filename("PPIMAGE.JPEG2", $outroot); # Binned JPEG #2
     157my $logName    = $ipprc->filename("LOG.EXP",       $outroot); # Name for log
    152158
    153159my $logFile;
     
    170176unless ($no_op) {
    171177    # Make the jpeg for binning 1
    172     $command = "$ppImage -list $list1Name $outputRoot -recipe PPIMAGE $recipe1"; # Command to run
     178    $command = "$ppImage -list $list1Name $outroot -recipe PPIMAGE $recipe1"; # Command to run
    173179    ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    174180        run(command => $command, verbose => 1);
     
    180186   
    181187    # Make the jpeg for binning 2
    182     $command = "$ppImage -list $list2Name $outputRoot -recipe PPIMAGE $recipe2"; # Command to run
     188    $command = "$ppImage -list $list2Name $outroot -recipe PPIMAGE $recipe2"; # Command to run
    183189    ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    184190        run(command => $command, verbose => 1);
     
    502508
    503509$command  = "$dettool -addresidexp -det_id $det_id -iteration $iter -exp_id $exp_id";
    504 $command .= " -recip $recipe1,$recipe2 -path_base $outputRoot ";
     510$command .= " -recip $recipe1,$recipe2 -path_base $outroot ";
    505511$command .= ' -reject' if $reject;
    506512$command .= " -dbname $dbname" if defined $dbname;
  • branches/eam_branch_20080121/ippScripts/scripts/detrend_resid.pl

    r15616 r16176  
    3232use Pod::Usage qw( pod2usage );
    3333
    34 my ($det_id, $iter, $exp_id, $exp_tag, $class_id, $det_type, $detrend, $input_uri, $camera, $mode, $dbname, $workdir, $reduction, $no_update, $no_op);
     34my ($det_id, $iter, $exp_id, $exp_tag, $class_id, $det_type, $detrend, $input_uri, $camera, $mode, $outroot, $dbname, $reduction, $no_update, $no_op);
    3535GetOptions(
    3636    'det_id|d=s'        => \$det_id,
     
    4444    'camera|c=s'        => \$camera,
    4545    'mode|m=s'          => \$mode,
     46    'outroot|w=s'       => \$outroot,   # output file base name
    4647    'dbname|d=s'        => \$dbname, # Database name
    47     'workdir|w=s'       => \$workdir,   # Working directory, for output files
    4848    'reduction=s'       => \$reduction, # Reduction class
    4949    'no-update'         => \$no_update,
     
    5252
    5353pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    54 pod2usage( -msg => "Required options: --det_id --iteration --exp_id --exp_tag --class_id --det_type --camera --input_uri --mode --detrend (not for 'verify' mode)",
    55            -exitval => 3)
    56     unless defined $det_id
    57     and defined $iter
    58     and defined $exp_id
    59     and defined $exp_tag
    60     and defined $class_id
    61     and defined $det_type
    62     and defined $input_uri
    63     and defined $camera
    64     and defined $mode
    65     and (defined $detrend or lc($mode) eq 'verify');
     54pod2usage( -msg => "Required options: --det_id --iteration --exp_id --exp_tag --class_id --det_type --camera --input_uri --mode --detrend --outroot (not for 'verify' mode)",
     55           -exitval => 3) unless
     56    defined $det_id    and
     57    defined $iter      and
     58    defined $exp_id    and
     59    defined $exp_tag   and
     60    defined $class_id  and
     61    defined $det_type  and
     62    defined $input_uri and
     63    defined $camera    and
     64    defined $mode      and
     65    defined $outroot   and
     66    (defined $detrend or lc($mode) eq 'verify');
    6667
    6768$ipprc->define_camera($camera);
     
    130131$ppImage .= " -dbname $dbname" if defined $dbname;
    131132
    132 $workdir = caturi( $workdir, "$camera.$det_type.$det_id" ) if defined $workdir;
    133 
    134 my $outputRoot = $ipprc->file_prepare( "$exp_tag/$exp_tag.detresid.$det_id.$iter", $workdir, $input_uri );
    135 
    136 my $outputName  = $ipprc->filename("PPIMAGE.OUTPUT", $outputRoot, $class_id);
    137 my $bin1Name    = $ipprc->filename("PPIMAGE.BIN1", $outputRoot, $class_id);
    138 my $bin2Name    = $ipprc->filename("PPIMAGE.BIN2", $outputRoot, $class_id);
    139 my $outputStats = $ipprc->filename("PPIMAGE.STATS", $outputRoot, $class_id);
    140 
    141 my $traceDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".$class_id.trace"; # Trace messages
    142 my $logDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".$class_id.log"; # Log messages
     133# outroot examples (HOST components must be set)
     134# file://data/ipp004.0/gpc1/20080130
     135# neb:///ipp004-v1/gpc1/20080130
     136# neb:///*/gpc1/20080130 (volume not specified)
     137
     138# check for existing directory, generate if needed
     139$ipprc->outroot_prepare($outroot);
     140
     141my $outputName  = $ipprc->filename("PPIMAGE.OUTPUT", $outroot, $class_id);
     142my $bin1Name    = $ipprc->filename("PPIMAGE.BIN1",   $outroot, $class_id);
     143my $bin2Name    = $ipprc->filename("PPIMAGE.BIN2",   $outroot, $class_id);
     144my $outputStats = $ipprc->filename("PPIMAGE.STATS",  $outroot, $class_id);
     145my $traceDest   = $ipprc->filename("TRACE.IMFILE",   $outroot, $class_id);
     146my $logDest     = $ipprc->filename("LOG.IMFILE",     $outroot, $class_id);
    143147
    144148# Run ppImage & ppStats
    145149unless ($no_op) {
    146     my $command = "$ppImage -file $input_uri $outputRoot";
     150    my $command = "$ppImage -file $input_uri $outroot";
    147151    $command .= " -recipe PPIMAGE $recipe";
    148152    $command .= " -recipe PPSTATS RESIDUAL";
     
    205209$command .= " -recip $recipe";
    206210$command .= " -uri $outputName";
    207 $command .= " -path_base $outputRoot";
     211$command .= " -path_base $outroot";
    208212$command .= " -dbname $dbname" if defined $dbname;
    209213$command .= $stats->cmdflags();
  • branches/eam_branch_20080121/ippScripts/scripts/detrend_stack.pl

    r15467 r16176  
    3333use Pod::Usage qw( pod2usage );
    3434
    35 my ($det_id, $iter, $class_id, $det_type, $camera, $dbname, $workdir, $reduction, $no_update, $no_op, $quiet);
     35my ($det_id, $iter, $class_id, $det_type, $camera, $outroot, $dbname, $reduction, $no_update, $no_op, $quiet);
    3636GetOptions(
    3737    'det_id|d=s'        => \$det_id,
     
    4040    'det_type|t=s'      => \$det_type,
    4141    'camera|c=s'        => \$camera,
     42    'outroot|w=s'       => \$outroot,   # output file base name
    4243    'dbname|d=s'        => \$dbname, # Database name
    43     'workdir|w=s'       => \$workdir, # Working directory, for output files
    4444    'reduction=s'       => \$reduction, # Reduction class for processing
    4545    'no-update'         => \$no_update,
     
    4949
    5050pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    51 pod2usage( -msg => "Required options: --det_id --iteration --class_id --det_type --camera",
    52            -exitval => 3)
    53     unless defined $det_id
    54     and defined $iter
    55     and defined $class_id
    56     and defined $det_type
    57     and defined $camera;
     51pod2usage( -msg => "Required options: --det_id --iteration --class_id --det_type --camera --outroot",
     52           -exitval => 3) unless
     53    defined $det_id   and
     54    defined $iter     and
     55    defined $class_id and
     56    defined $det_type and
     57    defined $camera   and
     58    defined $outroot;
    5859
    5960my $verbose = 1;
     
    111112}
    112113
    113 $workdir = caturi( $workdir, "$camera.$det_type.$det_id" ) if defined $workdir;
    114 
    115 my $outputRoot  = $ipprc->file_prepare( "$camera.$det_type.$det_id.$iter.$class_id", $workdir, ${$files}[0]->{uri} );
    116 my $outputStack = $outputRoot . '.fits'; # Output name
    117 my $outputStats = $outputRoot . '.stats'; # Statistics name
    118 
    119 my $traceDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".trace"; # Trace messages
    120 my $logDest = 'file:' . $ipprc->file_resolve($outputRoot) . ".log"; # Log messages
     114# outroot examples (HOST components must be set)
     115# file://data/ipp004.0/gpc1/20080130
     116# neb:///ipp004-v1/gpc1/20080130
     117# neb:///*/gpc1/20080130 (volume not specified)
     118
     119# check for existing directory, generate if needed
     120$ipprc->outroot_prepare($outroot);
     121
     122## XXX should we be using the filerules here?
     123my $outputStack = $outroot . '.fits'; # Output name
     124my $outputStats = $outroot . '.stats'; # Statistics name
     125my $traceDest   = $outroot . '.trace'; # Trace messages
     126my $logDest     = $outroot . '.log'; # Log messages
    121127
    122128$command = "$ppMerge $outputStack"; # Command to run
  • branches/eam_branch_20080121/ippTasks/camera.pro

    r16173 r16176  
    122122    book getword camPendingExp $pageName exp_tag -var EXP_TAG
    123123    book getword camPendingExp $pageName cam_id -var CAM_ID
    124     book getword camPendingExp $pageName workdir -var WORKDIR
     124    book getword camPendingExp $pageName workdir -var WORKDIR_TEMPLATE
    125125    book getword camPendingExp $pageName dvodb  -var DVODB
    126126    book getword camPendingExp $pageName dbname -var DBNAME
     
    130130    set.host.for.camera $camera FPA
    131131
    132     # output log from filerule
    133     if ("$WORKDIR" == "NULL")
    134       $outpath = `pwd`
    135     else
    136       $outpath = `ipp_datapath.pl $WORKDIR`
    137     end
    138     sprintf outpath "%s/%s" $outpath $EXP_TAG
    139     sprintf outroot "%s/%s.cm.%s" $outpath $EXP_TAG $CAM_ID
     132    # raw workdir examples:
     133    # file://data/@HOST@.0/gpc1/20080130
     134    # neb:///@HOST@-vol0/gpc1/20080130 (need to supply volname?, or are we re-defining this each time?)
     135    set.workdir.by.camera $CAMERA FPA $WORKDIR_TEMPLATE $default_host WORKDIR
     136    # out workdir examples:
     137    # file://data/ipp004.0/gpc1/20080130
     138    # neb:///ipp004-vol0/gpc1/20080130
     139
     140    ## generate outroot specific to this exposure (& chip)
     141    sprintf outroot "%s/%s/%s.cm.%s" $WORKDIR $EXP_TAG $EXP_TAG $CAM_ID
     142
     143    ## generate output log based on filerule (convert the URI to a PATH)
    140144    $logfile = `ipp_filename.pl --filerule LOG.EXP --camera $CAMERA --class_id NONE --basename $outroot`
    141145    if ("$logfile" == "")
    142       $logfile = $outroot.log
     146      echo "WARNING: logfile not defined in camera.pro:146"
     147      break
    143148    end
    144149
    145150    stdout $logfile
    146151    stderr $logfile
    147     exec mkdir -p $outpath
    148152
    149     $run = camera_exp.pl --exp_tag $EXP_TAG --cam_id $CAM_ID --camera $CAMERA
    150     if ("$WORKDIR" != "NULL")
    151       $run = $run --workdir $WORKDIR
    152     end
     153    $run = camera_exp.pl --exp_tag $EXP_TAG --cam_id $CAM_ID --camera $CAMERA --outroot $outroot
    153154    if ("$REDUCTION" != "NULL")
    154155      $run = $run --reduction $REDUCTION
  • branches/eam_branch_20080121/ippTasks/chip.pro

    r16173 r16176  
    121121    book getword chipPendingImfile $pageName exp_tag -var EXP_TAG
    122122    book getword chipPendingImfile $pageName chip_id -var CHIP_ID
    123     book getword chipPendingImfile $pageName workdir -var WORKDIR
     123    book getword chipPendingImfile $pageName workdir -var WORKDIR_TEMPLATE
    124124    book getword chipPendingImfile $pageName class_id -var CLASS_ID
    125125    book getword chipPendingImfile $pageName uri -var URI
     
    130130    set.host.for.camera $camera $class_id
    131131
    132     ## generate output log based on filerule
    133     if ("$WORKDIR" == "NULL")
    134       $outpath = `pwd`
    135     else
    136       $outpath = `ipp_datapath.pl $WORKDIR`
    137     end
    138     sprintf outpath "%s/%s" $outpath $EXP_TAG
    139     sprintf outroot "%s/%s.ch.%s" $outpath $EXP_TAG $CHIP_ID
     132    # raw workdir examples:
     133    # file://data/@HOST@.0/gpc1/20080130
     134    # neb:///@HOST@-vol0/gpc1/20080130 (need to supply volname?, or are we re-defining this each time?)
     135    set.workdir.by.camera $CAMERA $CLASS_ID $WORKDIR_TEMPLATE $default_host WORKDIR
     136    # out workdir examples:
     137    # file://data/ipp004.0/gpc1/20080130
     138    # neb:///ipp004-vol0/gpc1/20080130
     139
     140    ## generate outroot specific to this exposure (& chip)
     141    sprintf outroot "%s/%s/%s.ch.%s" $WORKDIR $EXP_TAG $EXP_TAG $CHIP_ID
     142
     143    ## generate output log based on filerule (convert the URI to a PATH)
    140144    $logfile = `ipp_filename.pl --filerule LOG.IMFILE --camera $CAMERA --class_id $CLASS_ID --basename $outroot`
    141145    if ("$logfile" == "")
    142       sprintf logfile "%s.%s.log" $outroot $CLASS_ID
     146      echo "WARNING: logfile not defined in chip.pro:152"
     147      break
    143148    end
    144149
    145150    stdout $logfile
    146151    stderr $logfile
    147     exec mkdir -p $outpath
    148152
    149     $run = chip_imfile.pl --exp_id $EXP_ID --chip_id $CHIP_ID --class_id $CLASS_ID --exp_tag $EXP_TAG --uri $URI --camera $CAMERA
    150     if ("$WORKDIR" != "NULL")
    151       $run = $run --workdir $WORKDIR
    152     end
     153    $run = chip_imfile.pl --exp_id $EXP_ID --chip_id $CHIP_ID --class_id $CLASS_ID --exp_tag $EXP_TAG --uri $URI --camera $CAMERA --outroot $outroot
    153154    if ("$REDUCTION" != "NULL")
    154155      $run = $run --reduction $REDUCTION
  • branches/eam_branch_20080121/ippTasks/detrend.norm.pro

    r16173 r16176  
    153153    book getword detPendingNormStatImfile $pageName iteration -var ITERATION
    154154    book getword detPendingNormStatImfile $pageName camera    -var CAMERA 
    155     book getword detPendingNormStatImfile $pageName workdir   -var WORKDIR
     155    book getword detPendingNormStatImfile $pageName workdir   -var WORKDIR_TEMPLATE
    156156    book getword detPendingNormStatImfile $pageName dbname    -var DBNAME
    157157
     
    159159    set.host.for.camera $camera FPA
    160160
    161     if ("$WORKDIR" == "NULL")
    162       $outpath = `pwd`
    163     else
    164       $outpath = `ipp_datapath.pl $WORKDIR`
    165     end
    166     $outpath = $outpath/$CAMERA.$DET_TYPE.$DET_ID
    167     $logfile = $outpath/$CAMERA.$DET_TYPE.norm.$DET_ID.$ITERATION.log
     161    # set workdir (interpolate host; see camera.pro for examples)
     162    set.workdir.by.camera $CAMERA FPA $WORKDIR_TEMPLATE $default_host WORKDIR
     163
     164    ## generate outroot specific to this exposure (& chip)
     165    sprintf outroot "%s/%s.%s.%s/%s.%s.norm.%s.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $CAMERA $DET_TYPE $DET_ID $ITERATION
     166
     167    ## generate output log (NOT based on filerule?)
     168    $logfile = "$outroot.log"
     169    $logfile = `ipp_datapath.pl $logfile`
     170
    168171    stdout $logfile
    169172    stderr $logfile
    170     exec mkdir -p $outpath
    171 
    172     $run = detrend_norm_calc.pl --det_id $DET_ID --iteration $ITERATION --det_type $DET_TYPE
    173     if ("$WORKDIR" != "NULL")
    174       $run = $run --workdir $WORKDIR
    175     end
     173
     174    $run = detrend_norm_calc.pl --det_id $DET_ID --iteration $ITERATION --det_type $DET_TYPE --outroot $outroot
    176175    add_standard_args run
    177176
     
    271270    book getword detPendingNormImfile $pageName class_id  -var CLASS_ID
    272271    book getword detPendingNormImfile $pageName norm      -var NORM     
    273     book getword detPendingNormImfile $pageName workdir   -var WORKDIR
     272    book getword detPendingNormImfile $pageName workdir   -var WORKDIR_TEMPLATE
    274273    book getword detPendingNormImfile $pageName dbname    -var DBNAME
    275274
     
    277276    set.host.for.camera $camera $class_id
    278277
    279     # XXX use ipp_filename.pl to lookup output file names
    280     if ("$WORKDIR" == "NULL")
    281       $outpath = `pwd`
    282     else
    283       $outpath = `ipp_datapath.pl $WORKDIR`
    284     end
    285     $outpath = $outpath/$CAMERA.$DET_TYPE.$DET_ID
    286     $logfile = $outpath/$CAMERA.$DET_TYPE.norm.$DET_ID.$ITERATION.$CLASS_ID.log
     278    # set workdir (interpolate host; see camera.pro for examples)
     279    set.workdir.by.camera $CAMERA $CLASS_ID $WORKDIR_TEMPLATE $default_host WORKDIR
     280
     281    ## generate outroot specific to this stack (& chip)
     282    sprintf outroot "%s/%s.%s.%s/%s.%s.norm.%s.%s.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $CAMERA $DET_TYPE $DET_ID $ITERATION $CLASS_ID
     283
     284    ## generate output log (NOT based on filerule?)
     285    $logfile = "$outroot.log"
     286    $logfile = `ipp_datapath.pl $logfile`
     287
    287288    stdout $logfile
    288289    stderr $logfile
    289     exec mkdir -p $outpath
    290 
    291     $run = detrend_norm_apply.pl --det_id $DET_ID --iteration $ITERATION --class_id $CLASS_ID --value $NORM --input_uri $URI --camera $CAMERA --det_type $DET_TYPE
    292     if ("$WORKDIR" != "NULL")
    293       $run = $run --workdir $WORKDIR
    294     end
     290
     291    $run = detrend_norm_apply.pl --det_id $DET_ID --iteration $ITERATION --class_id $CLASS_ID --value $NORM --input_uri $URI --camera $CAMERA --det_type $DET_TYPE --outroot $outroot
    295292    add_standard_args run
    296293   
     
    387384    book getword detPendingNormExp $pageName det_type  -var DET_TYPE
    388385    book getword detPendingNormExp $pageName camera    -var CAMERA 
    389     book getword detPendingNormExp $pageName workdir   -var WORKDIR
     386    book getword detPendingNormExp $pageName workdir   -var WORKDIR_TEMPLATE
    390387    book getword detPendingNormExp $pageName dbname    -var DBNAME
    391388
     
    393390    set.host.for.camera $camera FPA
    394391
    395     # XXX add $WORKDIR/$LOG_DIR
    396     if ("$WORKDIR" == "NULL")
    397       $outpath = `pwd`
    398     else
    399       $outpath = `ipp_datapath.pl $WORKDIR`
    400     end
    401     $outpath = $outpath/$CAMERA.$DET_TYPE.$DET_ID
    402     $logfile = $outpath/$CAMERA.$DET_TYPE.norm.$DET_ID.$ITERATION.log
     392    # set workdir (interpolate host; see camera.pro for examples)
     393    set.workdir.by.camera $CAMERA FPA $WORKDIR_TEMPLATE $default_host WORKDIR
     394
     395    ## generate outroot specific to this exposure (& chip)
     396    sprintf outroot "%s/%s.%s.%s/%s.%s.norm.%s.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $CAMERA $DET_TYPE $DET_ID $ITERATION
     397
     398    ## generate output log (NOT based on filerule?)
     399    $logfile = "$outroot.log"
     400    $logfile = `ipp_datapath.pl $logfile`
     401
    403402    stdout $logfile
    404403    stderr $logfile
    405     exec mkdir -p $outpath
    406 
    407     $run = detrend_norm_exp.pl --det_id $DET_ID --iteration $ITERATION --camera $CAMERA --det_type $DET_TYPE
    408     if ("$WORKDIR" != "NULL")
    409       $run = $run --workdir $WORKDIR
    410     end
     404
     405    $run = detrend_norm_exp.pl --det_id $DET_ID --iteration $ITERATION --camera $CAMERA --det_type $DET_TYPE  --outroot $outroot
    411406    add_standard_args run
    412407
  • branches/eam_branch_20080121/ippTasks/detrend.process.pro

    r16173 r16176  
    143143    book getword detPendingProcessedImfile $pageName uri      -var URI     
    144144    book getword detPendingProcessedImfile $pageName camera   -var CAMERA   
    145     book getword detPendingProcessedImfile $pageName workdir  -var WORKDIR
     145    book getword detPendingProcessedImfile $pageName workdir  -var WORKDIR_TEMPLATE
    146146    book getword detPendingProcessedImfile $pageName dbname   -var DBNAME
    147147    book getword detPendingProcessedImfile $pageName reduction -var REDUCTION
     
    150150    set.host.for.camera $camera $class_id
    151151
    152     ## output log filename
    153     if ("$WORKDIR" == "NULL")
    154       $outpath = `pwd`
    155     else
    156       $outpath = `ipp_datapath.pl $WORKDIR`
    157     end
    158     sprintf outpath "%s/%s.%s.%s/%s" $outpath $CAMERA $DET_TYPE $DET_ID $EXP_TAG
    159     sprintf outroot "%s/%s.detproc.%s" $outpath $EXP_TAG $DET_ID
     152    # see chip.pro for examples
     153    set.workdir.by.camera $CAMERA $CLASS_ID $WORKDIR_TEMPLATE $default_host WORKDIR
     154
     155    ## generate outroot specific to this exposure (& chip)
     156    sprintf outroot "%s/%s.%s.%s/%s/%s.detproc.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $EXP_TAG $EXP_TAG $DET_ID
     157
     158    ## generate output log based on filerule (convert the URI to a PATH)
    160159    $logfile = `ipp_filename.pl --filerule LOG.IMFILE --camera $CAMERA --class_id $CLASS_ID --basename $outroot`
    161160    if ("$logfile" == "")
    162       sprintf logfile "%s.%s.log" $outroot $CLASS_ID
     161      echo "WARNING: logfile not defined in detrend.process.pro:161"
     162      break
    163163    end
    164164
    165165    stdout $logfile
    166166    stderr $logfile
    167     exec mkdir -p $outpath
    168 
    169     $run = detrend_process_imfile.pl --det_id $DET_ID --exp_id $EXP_ID --det_type $DET_TYPE --class_id $CLASS_ID --exp_tag $EXP_TAG --input_uri $URI --camera $CAMERA
    170     if ("$WORKDIR" != "NULL")
    171       $run = $run --workdir $WORKDIR
    172     end
     167
     168    $run = detrend_process_imfile.pl --det_id $DET_ID --exp_id $EXP_ID --det_type $DET_TYPE --class_id $CLASS_ID --exp_tag $EXP_TAG --input_uri $URI --camera $CAMERA --outroot $outroot
    173169    if ("$REDUCTION" != "NULL")
    174170      $run = $run --reduction $REDUCTION
     
    269265    book getword detPendingProcessedExp $pageName camera    -var CAMERA 
    270266    book getword detPendingProcessedExp $pageName exp_tag   -var EXP_TAG
    271     book getword detPendingProcessedExp $pageName workdir   -var WORKDIR
     267    book getword detPendingProcessedExp $pageName workdir   -var WORKDIR_TEMPLATE
    272268    book getword detPendingProcessedExp $pageName dbname    -var DBNAME
     269    book getword detPendingProcessedExp $pageName reduction -var REDUCTION
    273270
    274271    # specify choice of local or remote host based on camera and chip (class_id)
    275272    set.host.for.camera $camera FPA
    276273
    277     # XXX push this into the filerules?
    278     if ("$WORKDIR" == "NULL")
    279       $outpath = `pwd`
    280     else
    281       $outpath = `ipp_datapath.pl $WORKDIR`
    282     end
    283     sprintf outpath "%s/%s.%s.%s/%s" $outpath $CAMERA $DET_TYPE $DET_ID $EXP_TAG
    284     sprintf outroot "%s/%s.detproc.%s" $outpath $EXP_TAG $DET_ID
     274    # set workdir (interpolate host; see camera.pro for examples)
     275    set.workdir.by.camera $CAMERA FPA $WORKDIR_TEMPLATE $default_host WORKDIR
     276
     277    ## generate outroot specific to this exposure (& chip)
     278    sprintf outroot "%s/%s.%s.%s/%s/%s.detproc.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $EXP_TAG $EXP_TAG $DET_ID
     279
     280    ## generate output log based on filerule (convert the URI to a PATH)
    285281    $logfile = `ipp_filename.pl --filerule LOG.EXP --camera $CAMERA --class_id NONE --basename $outroot`
    286282    if ("$logfile" == "")
    287       $logfile = $outroot.log
     283      echo "WARNING: logfile not defined in detrend.process.pro:282"
     284      break
    288285    end
    289286
    290287    stdout $logfile
    291288    stderr $logfile
    292     exec mkdir -p $outpath
    293 
    294     $run = detrend_process_exp.pl --det_id $DET_ID --exp_id $EXP_ID --exp_tag $EXP_TAG --det_type $DET_TYPE --camera $CAMERA
    295     if ("$WORKDIR" != "NULL")
    296       $run = $run --workdir $WORKDIR
     289
     290    $run = detrend_process_exp.pl --det_id $DET_ID --exp_id $EXP_ID --exp_tag $EXP_TAG --det_type $DET_TYPE --camera $CAMERA --outroot $outroot
     291    if ("$REDUCTION" != "NULL")
     292      $run = $run --reduction $REDUCTION
    297293    end
    298294    add_standard_args run
  • branches/eam_branch_20080121/ippTasks/detrend.reject.pro

    r16173 r16176  
    122122    book getword detRejectExp $pageName mode      -var MODE     
    123123    book getword detRejectExp $pageName camera    -var CAMERA   
    124     book getword detRejectExp $pageName workdir   -var WORKDIR
     124    book getword detRejectExp $pageName workdir   -var WORKDIR_TEMPLATE
    125125    book getword detRejectExp $pageName dbname    -var DBNAME
    126126
     
    128128    set.host.for.camera $camera FPA
    129129
    130     if ("$WORKDIR" == "NULL")
    131       $outroot = `pwd`
    132     else
    133       $outroot = `ipp_datapath.pl $WORKDIR`
    134     end
    135     sprintf outroot "%s/%s.%s.%s" $outroot $CAMERA $DET_TYPE $DET_ID
    136     sprintf logfile "%s/%s.%s.%s.%s.detreject.log" $outroot $CAMERA $DET_TYPE $DET_ID $ITERATION
     130    # set workdir (interpolate host; see camera.pro for examples)
     131    set.workdir.by.camera $CAMERA FPA $WORKDIR_TEMPLATE $default_host WORKDIR
     132
     133    ## generate outroot specific to this exposure (& chip)
     134    sprintf outroot "%s/%s.%s.%s/%s/%s.detreject.%s.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $EXP_TAG $EXP_TAG $DET_ID $ITERATION
     135
     136    ## generate output log based on filerule (convert the URI to a PATH)
     137    $logfile = $outroot.log
     138    $logfile = `ipp_datapath.pl $logfile`
     139
    137140    stdout $logfile
    138141    stderr $logfile
    139     exec mkdir -p $outroot
    140142
    141     $run = detrend_reject_exp.pl --det_id $DET_ID --iteration $ITERATION --det_type $DET_TYPE --camera $CAMERA
    142     if ("$WORKDIR" != "NULL")
    143       $run = $run --workdir $WORKDIR
    144     end
     143    $run = detrend_reject_exp.pl --det_id $DET_ID --iteration $ITERATION --det_type $DET_TYPE --camera $CAMERA --outroot $outroot
    145144    add_standard_args run
    146145
  • branches/eam_branch_20080121/ippTasks/detrend.resid.pro

    r16173 r16176  
    143143    book getword detPendingResidImfile $pageName det_uri   -var DET_URI 
    144144    book getword detPendingResidImfile $pageName camera    -var CAMERA   
    145     book getword detPendingResidImfile $pageName workdir   -var WORKDIR
     145    book getword detPendingResidImfile $pageName workdir   -var WORKDIR_TEMPLATE
    146146    book getword detPendingResidImfile $pageName dbname    -var DBNAME
    147147    book getword detPendingResidImfile $pageName reduction -var REDUCTION
     
    150150    set.host.for.camera $camera $class_id
    151151
    152     # XXX use ipp_filename.pl to lookup output file names
    153     if ("$WORKDIR" == "NULL")
    154       $outpath = `pwd`
    155     else
    156       $outpath = `ipp_datapath.pl $WORKDIR`
    157     end
    158     sprintf outpath "%s/%s.%s.%s/%s" $outpath $CAMERA $DET_TYPE $DET_ID $EXP_TAG
    159     sprintf outroot "%s/%s.detresid.%s.%s" $outpath $EXP_TAG $DET_ID $ITERATION
     152    # set workdir (interpolate host; see camera.pro for examples)
     153    set.workdir.by.camera $CAMERA $CLASS_ID $WORKDIR_TEMPLATE $default_host WORKDIR
     154
     155    ## generate outroot specific to this exposure (& chip)
     156    sprintf outroot "%s/%s.%s.%s/%s/%s.detresid.%s.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $EXP_TAG $EXP_TAG $DET_ID $ITERATION
     157
     158    ## generate output log based on filerule (convert the URI to a PATH)
    160159    $logfile = `ipp_filename.pl --filerule LOG.IMFILE --camera $CAMERA --class_id $CLASS_ID --basename $outroot`
    161160    if ("$logfile" == "")
    162       sprintf logfile "%s.%s.log" $outroot $CLASS_ID
     161      echo "WARNING: logfile not defined in detrend.resid.pro:161"
     162      break
    163163    end
    164164
    165165    stdout $logfile
    166166    stderr $logfile
    167     exec mkdir -p $outpath
    168 
    169     $run = detrend_resid.pl --det_id $DET_ID --iteration $ITERATION --exp_id $EXP_ID --exp_tag $EXP_TAG --class_id $CLASS_ID --det_type $DET_TYPE --detrend $DET_URI --input_uri $URI --camera $CAMERA --mode $MODE
    170     if ("$WORKDIR" != "NULL")
    171       $run = $run --workdir $WORKDIR
    172     end
     167
     168    $run = detrend_resid.pl --det_id $DET_ID --iteration $ITERATION --exp_id $EXP_ID --exp_tag $EXP_TAG --class_id $CLASS_ID --det_type $DET_TYPE --detrend $DET_URI --input_uri $URI --camera $CAMERA --mode $MODE --outroot $outroot
    173169    if ("$REDUCTION" != "NULL")
    174170      $run = $run --reduction $REDUCTION
     
    272268    book getword detPendingResidExp $pageName include   -var INCLUDE
    273269    book getword detPendingResidExp $pageName camera    -var CAMERA 
    274     book getword detPendingResidExp $pageName workdir   -var WORKDIR
     270    book getword detPendingResidExp $pageName workdir   -var WORKDIR_TEMPLATE
    275271    book getword detPendingResidExp $pageName dbname    -var DBNAME
    276272
     
    278274    set.host.for.camera $camera FPA
    279275
    280     # XXX use ipp_filename.pl to lookup output file names
    281     if ("$WORKDIR" == "NULL")
    282       $outpath = `pwd`
    283     else
    284       $outpath = `ipp_datapath.pl $WORKDIR`
    285     end
    286     sprintf outpath "%s/%s.%s.%s/%s" $outpath $CAMERA $DET_TYPE $DET_ID $EXP_TAG
    287     sprintf outroot "%s/%s.detresid.%s.%s" $outpath $EXP_TAG $DET_ID $ITERATION
     276    # set workdir (interpolate host; see camera.pro for examples)
     277    set.workdir.by.camera $CAMERA FPA $WORKDIR_TEMPLATE $default_host WORKDIR
     278
     279    ## generate outroot specific to this exposure (& chip)
     280    sprintf outroot "%s/%s.%s.%s/%s/%s.detresid.%s.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $EXP_TAG $EXP_TAG $DET_ID $ITERATION
     281
     282    ## generate output log based on filerule (convert the URI to a PATH)
    288283    $logfile = `ipp_filename.pl --filerule LOG.IMFILE --camera $CAMERA --class_id NONE --basename $outroot`
     284    if ("$logfile" == "")
     285      echo "WARNING: logfile not defined in detrend.process.pro:285"
     286      break
     287    end
    289288
    290289    stdout $logfile
    291290    stderr $logfile
    292     exec mkdir -p $outpath
    293 
    294     $run = detrend_reject_imfile.pl --det_id $DET_ID --iteration $ITERATION --exp_id $EXP_ID --exp_tag $EXP_TAG --det_type $DET_TYPE --camera $CAMERA
    295     if ("$WORKDIR" != "NULL")
    296       $run = $run --workdir $WORKDIR
    297     end
     291
     292    $run = detrend_reject_imfile.pl --det_id $DET_ID --iteration $ITERATION --exp_id $EXP_ID --exp_tag $EXP_TAG --det_type $DET_TYPE --camera $CAMERA --outroot $outroot
    298293    add_standard_args run
    299294
  • branches/eam_branch_20080121/ippTasks/detrend.stack.pro

    r16173 r16176  
    123123    book getword detPendingStackedImfile $pageName class_id  -var CLASS_ID
    124124    book getword detPendingStackedImfile $pageName camera    -var CAMERA 
    125     book getword detPendingStackedImfile $pageName workdir   -var WORKDIR
     125    book getword detPendingStackedImfile $pageName workdir   -var WORKDIR_TEMPLATE
    126126    book getword detPendingStackedImfile $pageName dbname    -var DBNAME
    127127    book getword detPendingStackedImfile $pageName reduction -var REDUCTION
     
    130130    set.host.for.camera $camera $class_id
    131131
    132     if ("$WORKDIR" == "NULL")
    133       $outpath = `pwd`
    134     else
    135       $outpath = `ipp_datapath.pl $WORKDIR`
    136     end
    137     sprintf outpath "%s/%s.%s.%s" $outpath $CAMERA $DET_TYPE $DET_ID
    138     sprintf outroot "%s/%s.%s.%s.%s" $outpath $CAMERA $DET_TYPE $DET_ID $ITERATION
     132    # set workdir (interpolate host; see camera.pro for examples)
     133    set.workdir.by.camera $CAMERA FPA $WORKDIR_TEMPLATE $default_host WORKDIR
     134
     135    ## generate outroot specific to this exposure (& chip)
     136    sprintf outroot "%s/%s.%s.%s/%s.%s.%s.%s" $WORKDIR $CAMERA $DET_TYPE $DET_ID $CAMERA $DET_TYPE $DET_ID $ITERATION
     137
     138    ## generate output log based on filerule (convert the URI to a PATH)
    139139    $logfile = `ipp_filename.pl --filerule LOG.IMFILE --camera $CAMERA --class_id $CLASS_ID --basename $outroot`
    140140    if ("$logfile" == "")
    141       sprintf logfile "%s.%s.log" $outroot $CLASS_ID
     141      echo "WARNING: logfile not defined in detrend.stack.pro:141"
     142      break
    142143    end
    143144
    144145    stdout $logfile
    145146    stderr $logfile
    146     exec mkdir -p $outpath
    147147
    148     # save the pageName for future reference below
    149     options $pageName
    150 
    151     $run = detrend_stack.pl --det_id $DET_ID --iteration $ITERATION --class_id $CLASS_ID --det_type $DET_TYPE --camera $CAMERA
    152     if ("$WORKDIR" != "NULL")
    153       $run = $run --workdir $WORKDIR
    154     end
     148    $run = detrend_stack.pl --det_id $DET_ID --iteration $ITERATION --class_id $CLASS_ID --det_type $DET_TYPE --camera $CAMERA --outroot $outroot
    155149    if ("$REDUCTION" != "NULL")
    156150      $run = $run --reduction $REDUCTION
    157151    end
    158152    add_standard_args run
     153
     154    # save the pageName for future reference below
     155    options $pageName
    159156
    160157    # create the command line
  • branches/eam_branch_20080121/ippTasks/notes.txt

    r16173 r16176  
    11
    2 2008.01.18
     2  proposal to clean scripts/tasks up somewhat wrt names:
     3
     4  * scripts do NOT use workdir to change the workdir in the db
     5  * thus, what is supplied is actually the outputRoot
     6  * require the output root for the scripts
     7  * have the calling tasks construct the outputRoot
     8  ** replace -workdir with -outroot
     9
     10  some filename rules :
     11
     12  * the db entry WORKDIR is the most abstract version:
     13    path://GPC-@HOST@/20080130
     14    file://data/@HOST@.0/gpc1/20080130
     15    neb:///@HOST@/gpc1/20080130
     16    neb://gpc1/20080130
     17    XXX have nebulous distinguish between neb:///host/path and
     18    neb://path?
     19
     20  * the db WORKDIR entry is carried from step to step unless
     21    over-ridden with a -queue command
     22
     23  * psLib-based binaries (ppImage, etc) may be passed URIs, but not
     24    files with the @HOST@ abstraction
     25
     26  * IPP perl scripts may be passed URIs, but not files with the @HOST@
     27    abstraction
     28
     29  * nebulous : convert neb:///@HOST@/path/name
     30
     31  *** examples:
     32
     33  * this tells ppImage to use the ipp004 version for both input and output:
     34  ppImage -file neb:///ipp004-v0/gpc1/20080130/o4414g0001o/o4414g0001o.XY01.fits neb:///ipp004-v0/gpc1/20080130/o4414g0001o/o4414g0001o.XY01
     35 
     36  * we already know the hostname at this point; include it in the call
     37  chip_imfile.pl --uri neb:///ipp004-v0/gpc1/20080130/o4414g0001o/o4414g0001o.XY01.fits --workdir neb:///ipp004-v0/gpc1/20080130/
     38
     39
     40
     41
     42
     432008.01.21
    344
    445  I'm working on the summit.copy.pro interaction with nebulous (and
     
    2566    host. 
    2667
     68  * specific output filenames
     69
     70    In both ippTasks and ippScripts, there are references to files
     71    which must correctly located on the host.
     72
     73  * workdir choice of output directory.   
     74
     75    the
     76
    2777  * dsget output target:
    2878
    2979    dsget is called by pantasks in the task 'dsget'.  currently, dsget
    3080    accepts a --filename argument which specifies the output filename
    31     to use.  we have to tell t
     81    to use.  in the nebulous context, this is of the form
     82    neb://top/next/stuff, without any host-specific information.  To
     83    target the file instance to a specific host, we pass dsget the
     84    --volume (name) argument.  The volumes refer to the specific
     85    devices (potentially more than one per host), and the names can
     86    then be chosen to include the host. 
    3287 
    33 
    34   * choice of output directory.   
    35 
    36     the
    37 
    38 
    39882007.10.11
    4089
  • branches/eam_branch_20080121/ippTasks/pantasks.pro

    r16173 r16176  
    342342
    343343macro set.workdir.by.camera
     344  if ($0 != 6)
     345    echo "USAGE: set.workdir.by.camera (camera) (class_id) (template) (default) (varname)"
     346    echo " uses global variable NEBULOUS to determine if nebulous is active"
     347    break
     348  end
     349
     350  local host default template camera classID varname
     351  $camera = $1
     352  $classID = $2
     353  $template = $3
     354  $default = $4
     355  $varname = $5
     356
     357  # missing camera and/or chiphosts table results in host = NULL
     358  book getword chiphosts $camera $classID -var host
     359
     360  if ("$host" == "NULL")
     361    strsub $template @HOST@ $default -var $$varname
     362  else
     363    strsub $template @HOST@ $host -var $$varname
     364  end
     365end
     366
     367macro set.volume.by.camera
    344368  if ($0 != 3)
    345     echo "USAGE: set.workdir.by.camera (camera) (class_id)"
    346     break
    347   end
     369    echo "USAGE: set.volume.by.camera (camera) (class_id) (template) (default) (varname)"
     370    echo " uses global variable NEBULOUS to determine if nebulous is active"
     371    break
     372  end
     373
     374  local host default template camera classID varname
     375  $camera = $1
     376  $classID = $2
     377  $template = $3
     378  $default = $4
     379  $varname = $5
    348380
    349381  # missing camera and/or chiphosts table results in host = NULL
    350   book getword chiphosts $1 $2 -var $host
    351 
    352   if ($NEBULOUS)
    353     if ("$host" == "NULL")
    354       $workdir = $workdir_default
    355       $volume  = "NULL"
    356       return
    357     end
    358     strsub $workdir_template @HOST@ $host -var workdir
    359     strsub $volume_template @HOST@ $host -var volume
    360     return
    361   end
    362 
    363   if ("$host" == "NULL")
    364     $workdir = $workdir_default
    365     return
    366   end
    367   strsub $workdir_template @HOST@ $host -var workdir
     382  book getword chiphosts $camera $classID -var host
     383
     384  if (not($NEBULOUS))
     385    $$varname = "NULL"
     386    return
     387  end
     388
     389  if ("$host" == "NULL")
     390    $$varname = $default
     391    return
     392  end
     393
     394  strsub $template @HOST@ $host -var $$varname
    368395end
    369396
  • branches/eam_branch_20080121/ippTasks/summit.copy.pro

    r16174 r16176  
    1919# XXX not sure how to handle the .N value if we need to use more than one
    2020if ($NEBULOUS)
    21  $workdir_default  = neb://
    22  $workdir_template = neb://
    23  $volume_default  = ipp004-v0
    24  $volume_template = @HOST@-v0
     21 $default_host     = ipp004
     22 $workdir_template = neb:///@HOST@-v0
     23 $default_volume   = ipp004-v0
     24 $volume_template  =
    2525else
    26  $workdir_default  = /data/ipp004.0/
     26 $default_host     = ipp004
    2727 $workdir_template = /data/@HOST@.0/
    2828end
     
    278278        book getword pzPendingImfile $pageName camera -var $CAMERA
    279279
     280        set.host.by.camera $CAMERA $CLASS_ID
     281        host        anyhost
     282
    280283        # 2007-08-30T05:09:59Z
    281284        substr $DATEOBS 0 4 YEAR
     
    284287
    285288        # we need to set the workdir based on 1) nebulous or not? 2) chip/host relationship
    286         # this function uses workdir_template, workdir_default, volume_template, volume_default,
     289        # this function uses workdir_template, default_host, volume_template, volume_default,
    287290        # it sets workdir and volume
    288         set.workdir.by.camera $CAMERA $CLASS_ID
     291        set.workdir.by.camera $CAMERA $CLASS_ID $workdir_template $default_host workdir_base
     292        set.volume.by.camera $CAMERA $CLASS_ID $volume_template $default_volume volume
    289293
    290294        # figure out filename
    291         # XXXX this filename needs to use nebulous names
    292         $FILENAME = $workdir/$CAMERA/$YEAR/$MONTH/$DAY/$EXP_NAME/$EXP_NAME.$CLASS_ID.fits
    293         $FILEROOT = $workdir_template/$CAMERA/$YEAR/$MONTH/$DAY
     295        # XXX may need to use sprintf here
     296        $FILENAME = $workdir_base/$CAMERA/$YEAR$MONTH$DAY/$EXP_NAME/$EXP_NAME.$CLASS_ID.fits
     297        $workdir = $workdir_template/$CAMERA/$YEAR$MONTH$DAY
     298        # workdir examples:
     299        # file://data/@HOST@.0/gpc1/20080130
     300        # neb://gpc1/20080130 (need to supply volname?, or are we re-defining this each time?)
    294301
    295302        book setword pzPendingImfile $pageName filename $FILENAME
    296 
    297         set.host.by.camera $CAMERA $CLASS_ID
    298         host        anyhost
    299303
    300304        # store the pageName with this job
    301305        options $pageName
    302         options $FILEROOT
     306        options $workdir
    303307
    304308        $run = dsget --uri $URI --filename $FILENAME --bytes $BYTES
     
    330334        # these are functions of (at least) EXP_TYPE and SURVEY_ID, both of which should come from the data store
    331335
     336        # we saved the workdir so we can pass it to pztool
     337        $workdir = $options:1
     338
    332339        # update the database with the success
    333         $run = pztool -copydone -exp_name $EXP_NAME -inst $CAMERA -telescope $TELESCOPE -class $CLASS -class_id $CLASS_ID -uri $FILENAME -workdir $options:1
     340        # for the moment, let's not propagate these
     341        $run = pztool -copydone -exp_name $EXP_NAME -inst $CAMERA -telescope $TELESCOPE -class $CLASS -class_id $CLASS_ID -uri $FILENAME -workdir $workdir -end_stage reg
    334342        # tess_id, dvodb, workdir, end_stage
    335343
Note: See TracChangeset for help on using the changeset viewer.