IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 9004


Ignore:
Timestamp:
Sep 27, 2006, 9:35:47 AM (20 years ago)
Author:
Paul Price
Message:

Changing name conventions to match those in doc/ippTools/filenames.txt

Location:
trunk/ippScripts/scripts
Files:
7 edited

Legend:

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

    r8976 r9004  
    55
    66use IPC::Cmd qw( can_run run );
    7 use PS::IPP::Metadata::Config;
    8 use PS::IPP::Metadata::List qw( parse_md_list );
    97use Data::Dumper;
    108
     
    1816    $value,                     # Value to multiple (for normalisation)
    1917    $input,                     # Input file
    20     $output                     # Output file
     18    $camera,                    # Camera
     19    $detType                    # Detrend type
    2120    );
    2221GetOptions(
     
    2625    'value|v=s'         => \$value,
    2726    'input_uri|u=s'     => \$input,
    28     'output_uri|o=s'    => \$output,
     27    'camera|c=s'        => \$camera,
     28    'det_type|t=s'      => \$detType
    2929    ) or pod2usage( 2 );
    3030   
    3131pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    32 pod2usage(     -msg => "Required options: --det_id --iteration --class_id --value --input_uri --output_uri",
     32pod2usage(     -msg => "Required options: --det_id --iteration --class_id --value --input_uri --camera --det_type",
    3333    -exitval => 3,
    3434    ) unless defined $detId
    35         and defined $iter
    36             and defined $classId
    37                 and defined $value
    38                     and defined $input
    39                         and defined $output;
    40                        
     35    and defined $iter
     36    and defined $classId
     37    and defined $value
     38    and defined $input
     39    and defined $camera
     40    and defined $detType;
     41
    4142
    4243# Look for programs we need
     
    4647die "Can't find required tools.\n" if $missing_tools;
    4748
    48 my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
     49# Output name
     50my $output = $camera . '.' . $detType . '.norm.' . $detId . '.' . $iter . '.' . $classId . '.fits';
    4951
    5052# Run ppArith
  • trunk/ippScripts/scripts/detrend_calc_norm.pl

    r8998 r9004  
    1616# Parse command-line arguments
    1717my ($detId,                     # Detrend id
    18     $iter,                      # Iteration
    19     $camera,                    # Camera name
    20     $detType                    # Detrend type
     18    $iter                       # Iteration
    2119    );
    2220GetOptions(
    2321        'det_id|d=s'    => \$detId,
    2422        'iteration|i=s' => \$iter,
    25         'camera|c=s'    => \$camera,
    26         'det_type|t=s'  => \$detType
    2723        ) or pod2usage( 2 );
    2824
     
    3127           -exitval => 3,
    3228           ) unless defined $detId
    33     and defined $iter
    34     and defined $camera
    35     and defined $detType;
     29    and defined $iter;
    3630
    3731
     
    5650   
    5751    # Parse the output
    58     my $metadata = $mdcParser->parse(join "", @$stdout)
     52    my $metadata = $mdcParser->parse($stdout)
    5953        or die "unable to parse metadata config doc";
    6054    $files = parse_md_list($metadata);
     
    9185
    9286    # Parse the output
    93     $norms = $mdcParser->parse(join "", @$stdout)
     87    $norms = $mdcParser->parse($stdout)
    9488        or die "unable to parse metadata config doc";
    9589}
  • trunk/ippScripts/scripts/detrend_create_resid.pl

    r8983 r9004  
    1616
    1717my ($det_id, $iter, $exp_id, $class_id, $det_type, $detrend,
    18         $input_uri, $output_uri);
     18        $input_uri);
    1919GetOptions(
    2020    'det_id|d=s'        => \$det_id,
     
    2525    'detrend=s'         => \$detrend,
    2626    'input_uri|u=s'     => \$input_uri,
    27     'output_uri|o=s'    => \$output_uri,
    2827) or pod2usage( 2 );
    2928
    3029pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    3130pod2usage(
    32     -msg => "Required options: --det_id --iteration --exp_id --class_id --det_type --detrend --input_uri --output_uri",
     31    -msg => "Required options: --det_id --iteration --exp_id --class_id --det_type --detrend --input_uri",
    3332    -exitval => 3,
    3433) unless defined $det_id
     
    3837    and defined $det_type
    3938    and defined $detrend
    40     and defined $input_uri
    41     and defined $output_uri;
     39    and defined $input_uri;
    4240
    4341# Recipes to use, as a function of the detrend type
     
    5351    'dark' => '-dark',          # Specify the dark frame
    5452    'flat' => '-flat',          # Specify the flat frame
    55 };
    56 
    57 # Prefix to add to filenames
    58 use constant PREFIX => {
    59     'bias' => 'ob',             # Overscan only
    60     'dark' => 'obd',            # Overscan and bias only
    61     'flat' => 'obdf',           # Overscan, bias and dark only
    6253};
    6354
     
    7768my $detFlag = DETRENDS->{$det_type};
    7869die "Unrecognised detrend type: $det_type\n" if not defined $detFlag;
    79 # Prefix to use for filename
    80 my $prefix = PREFIX->{$det_type};
    81 die  "Unrecognised detrend type: $det_type\n" if not defined $prefix;
    8270
    8371### Output file names --- must match camera configuration!
    84 my $outputRoot = $prefix . '_' . $output_uri;
    85 my $outputName = $outputRoot . '.' . $class_id . '.fit';
     72my $outputRoot = $exp_id . '.detresid.' . $det_id . '.' . $iter; # Root name
     73my $outputName = $outputRoot . '.' . $class_id . '.fits'; # Name for
    8674my $outputStats = $outputRoot . '.' . $class_id . '.stats';
    87 my $bin1Name = $outputRoot . '.' . $class_id . '.b1.fit';
    88 my $bin2Name =  $outputRoot . '.' . $class_id . '.b2.fit';
     75my $bin1Name = $outputRoot . '.' . $class_id . '.b1.fits';
     76my $bin2Name =  $outputRoot . '.' . $class_id . '.b2.fits';
    8977
    9078# Run ppImage
     
    9684    die "Unable to perform ppImage on $input_uri: $error_code\n" if not $success;
    9785    die "Couldn't find expected output file: $outputName\n" if not -f $outputName;
     86    die "Couldn't find expected output file: $outputStats\n" if not -f $outputStats;
    9887    die "Couldn't find expected output file: $bin1Name\n" if not -f $bin1Name;
    9988    die "Couldn't find expected output file: $bin2Name\n" if not -f $bin2Name;
     
    10493{
    10594    my $statsFile;              # File handle
    106     open $statsFile, "$outputStats" or die "Can't open statistics file $outputStats: $!\n";
     95    open $statsFile, $outputStats or die "Can't open statistics file $outputStats: $!\n";
    10796    my @contents = <$statsFile>; # Contents of file
    10897    close $statsFile;
     
    134123}
    135124
    136 unlink "$output_uri.stats" if DELETE_STATS;
     125unlink $outputStats if DELETE_STATS;
    137126
    138127__END__
  • trunk/ippScripts/scripts/detrend_process.pl

    r8983 r9004  
    2222    'det_type|t=s'      => \$det_type,
    2323    'input_uri|u=s'     => \$input_uri,
    24     'output_uri|o=s'    => \$output_uri,
    2524) or pod2usage( 2 );
    2625
    2726pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    2827pod2usage(
    29     -msg => "Required options: --det_id --exp_id --class_id --det_type --input_uri --output_uri",
     28    -msg => "Required options: --det_id --exp_id --class_id --det_type --input_uri",
    3029    -exitval => 3,
    3130) unless defined $det_id
     
    3332    and defined $class_id
    3433    and defined $det_type
    35     and defined $input_uri
    36     and defined $output_uri;
     34    and defined $input_uri;
    3735
    3836# Recipes to use, as a function of the detrend type
     
    4139    'dark' => 'PPIMAGE_OB',     # Overscan and bias only
    4240    'flat' => 'PPIMAGE_OBD',    # Overscan, bias and dark only
    43 };
    44 
    45 # Prefix to add to filenames
    46 use constant PREFIX => {
    47     'bias' => 'o',              # Overscan only
    48     'dark' => 'ob',             # Overscan and bias only
    49     'flat' => 'obd',            # Overscan, bias and dark only
    5041};
    5142
     
    6152my $recipe = RECIPES->{$det_type};
    6253die "Unrecognised detrend type: $det_type\n" if not defined $recipe;
    63 die "Unrecognised detrend type: $det_type\n" if not defined PREFIX->{$det_type};
    6454
    6555### Output file name --- must match camera configuration!
    66 my $outputRoot =  PREFIX->{$det_type} . '_' . $output_uri;
     56my $outputRoot =  $exp_id . '.detproc' ;
    6757my $outputName = $outputRoot . '.' . $class_id ;
    68 my $outputImage = $outputName . '.fit';
     58my $outputImage = $outputName . '.fits';
    6959my $outputStats = $outputName . '.stats';
    7060
  • trunk/ippScripts/scripts/detrend_reject_exp.pl

    r8764 r9004  
    2424pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    2525pod2usage(
    26     -msg => "Required options: --det_id --exp_id --class_id --det_type --input_uri --output_uri",
     26    -msg => "Required options: --det_id --iteration --det_type",
    2727    -exitval => 3,
    2828) unless defined $det_id
  • trunk/ippScripts/scripts/detrend_reject_imfile.pl

    r8963 r9004  
    9696
    9797# Generate the file list, and get the statistics
    98 my $outputName = $exp_id . '_' . $det_id . '_' . $iter; # Root output name
    99 my $list1Name = $outputName . '_jpeg1.list'; # Name for the input file list for binning 1
    100 my $list2Name = $outputName . '_jpeg2.list'; # Name for the input file list for binning 2
     98my $outputRoot = $exp_id . '.detresid.' . $det_id . '.' . $iter; # Root output name
     99my $list1Name = $outputRoot . '.b1.list'; # Name for the input file list for binning 1
     100my $list2Name = $outputRoot . '.b2.list'; # Name for the input file list for binning 2
    101101my @means;                      # Array of means
    102102my @stdevs;                     # Array of stdevs
     
    113113
    114114# Output products --- need to synch with the camera configuration!
    115 my $jpeg1Name = $outputName . ".b1.jpg"; # Binned JPEG #1
    116 my $jpeg2Name = $outputName . ".b2.jpg"; # Binned JPEG #2
     115my $jpeg1Name = $outputRoot . ".b1.jpg"; # Binned JPEG #1
     116my $jpeg2Name = $outputRoot . ".b2.jpg"; # Binned JPEG #2
    117117
    118118# Make the jpeg for binning 1
    119119{
    120     my $command = "$ppImage -list $list1Name $outputName -recipe PPIMAGE " . RECIPE1; # Command to run
     120    my $command = "$ppImage -list $list1Name $outputRoot -recipe PPIMAGE " . RECIPE1; # Command to run
    121121    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    122122        run(command => $command, verbose => 1);
     
    126126# Make the jpeg for binning 2
    127127{
    128     my $command = "$ppImage -list $list2Name $outputName -recipe PPIMAGE " . RECIPE2; # Command to run
     128    my $command = "$ppImage -list $list2Name $outputRoot -recipe PPIMAGE " . RECIPE2; # Command to run
    129129    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    130130        run(command => $command, verbose => 1);
  • trunk/ippScripts/scripts/detrend_stack.pl

    r8983 r9004  
    1515use Pod::Usage qw( pod2usage );
    1616
    17 my ($det_id, $iter, $class_id, $det_type);
     17my ($det_id, $iter, $class_id, $det_type, $camera);
    1818GetOptions(
    1919    'det_id|d=s'        => \$det_id,
     
    2121    'class_id|i=s'      => \$class_id,
    2222    'det_type|t=s'      => \$det_type,
     23    'camera|c=s'        => \$camera,
    2324) or pod2usage( 2 );
    2425
    2526pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    2627pod2usage(
    27     -msg => "Required options: --det_id --iteration --class_id --det_type",
     28    -msg => "Required options: --det_id --iteration --class_id --det_type --camera",
    2829    -exitval => 3,
    2930) unless defined $det_id
    3031    and defined $iter
    3132    and defined $class_id
    32     and defined $det_type;
     33    and defined $det_type
     34    and defined $camera;
    3335
    3436# Recipes to use as a function of detrend type
     
    4446    'dark' => 0,
    4547    'flat' => 1
    46     };   
     48    };
    4749
    48 die "Unrecognised detrend type: $det_type\n" if not defined RECIPES()->{$det_type};
     50die "Unrecognised detrend type: $det_type\n" if not defined RECIPES()->{$det_type}
     51                                             or not defined NORMALISE()->{$det_type};
    4952my $recipe = RECIPES()->{$det_type}; # Recipe to use in stacking
    5053
     
    7073
    7174# Stack the files
    72 my $output = $det_type . '_' . $class_id . '_' . $det_id . '_' . $iter . '.fit'; # Output name
    73 my $outputStats = $det_type . '_' . $class_id . '_' . $det_id . '_' . $iter . '.stats'; # Statistics name
     75my $outputRoot = $camera . '.' . $det_type . '.' . $det_id . '.' . $iter . '.' . $class_id; # Root name
     76my $outputStack = $outputRoot . '.fits'; # Output name
     77my $outputStats = $outputRoot . '.stats'; # Statistics name
    7478{
    75     my $command = "$ppMerge $output"; # Command to run
     79    my $command = "$ppMerge $outputStack"; # Command to run
    7680    foreach my $file (@$files) {
    7781        my $uri = $file->{uri}; # URI for input file
     
    8589        run(command => $command, verbose => 1);
    8690    die "Unable to perform ppMerge: $error_code\n" if not $success;
    87     die "Unable to find expected output file: $output\n" if not -f $output;
     91    die "Unable to find expected output file: $outputStack\n" if not -f $outputStack;
    8892    die "Unable to find expected output file: $outputStats\n" if not -f $outputStats;
    8993}
     
    109113{
    110114    my $command = "$dettool -addstacked -det_id $det_id -iteration $iter -class_id $class_id" .
    111         " -uri $output -recip $recipe"; # Command to run
     115        " -uri $outputStack -recip $recipe"; # Command to run
    112116    $command .= ' -bg ' . $stats->bg_mean();
    113117    if (defined($stats->bg_stdev())) {
Note: See TracChangeset for help on using the changeset viewer.