IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
May 30, 2007, 12:41:30 PM (19 years ago)
Author:
eugene
Message:

make jpeg recipe depend on the data type (bias, flat) and the mode (positive image, residual image)

File:
1 edited

Legend:

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

    r13275 r13552  
    6060$ipprc->define_camera($camera);
    6161
    62 use constant RECIPE1 => 'PPIMAGE_J1'; # Recipe to use for ppImage to make JPEGs
    63 use constant RECIPE2 => 'PPIMAGE_J2'; # Recipe to use for ppImage to make JPEGs
     62# Recipes to use, as a function of the detrend type
     63use constant RECIPES => {
     64    'bin1' => {         # We're creating a master --- already processed the input
     65        'bias'     => 'PPIMAGE_J1_RESID_B',     # Bias only
     66        'dark'     => 'PPIMAGE_J1_RESID_B',     # Dark only
     67        'shutter'  => 'PPIMAGE_J1_RESID_B',     # Shutter only
     68        'flat'     => 'PPIMAGE_J1_RESID_F',     # Flat-field only
     69        'domeflat' => 'PPIMAGE_J1_RESID_F',     # Flat-field only
     70        'skyflat'  => 'PPIMAGE_J1_RESID_F',     # Flat-field only
     71        'fringe'   => 'PPIMAGE_J1_RESID_F',     # Fringe only
     72    },
     73    'bin2' => {         # We're checking the master --- input is not already processed
     74        'bias'     => 'PPIMAGE_J2_RESID_B',     # Bias only
     75        'dark'     => 'PPIMAGE_J2_RESID_B',     # Dark only
     76        'shutter'  => 'PPIMAGE_J2_RESID_B',     # Shutter only
     77        'flat'     => 'PPIMAGE_J2_RESID_F',     # Flat-field only
     78        'domeflat' => 'PPIMAGE_J2_RESID_F',     # Flat-field only
     79        'skyflat'  => 'PPIMAGE_J2_RESID_F',     # Flat-field only
     80        'fringe'   => 'PPIMAGE_J2_RESID_F',     # Fringe only
     81    },
     82};
    6483
    6584# Look for programs we need
     
    87106    }
    88107
     108    # XXX report an error message if stdout_buf is empty
     109
    89110    my $metadata = $mdcParser->parse(join "", @$stdout_buf) or
    90111        &my_die("Unable to parse metadata config doc", $det_id, $iter, $exp_tag, $PS_EXIT_PROG_ERROR);
     112
    91113    $files = parse_md_list($metadata) or
    92114        &my_die("Unable to parse metadata list", $det_id, $iter, $exp_tag, $PS_EXIT_PROG_ERROR);
    93115}
    94116
    95 
     117# XXX in debug mode, unlink = 0
    96118my ($list1File, $list1Name) = tempfile( "$exp_tag.detresid.$det_id.$iter.b1.list.XXXX", UNLINK => 1 );
    97119my ($list2File, $list2Name) = tempfile( "$exp_tag.detresid.$det_id.$iter.b2.list.XXXX", UNLINK => 1 );
     
    118140my $jpeg2Name = $ipprc->filename("PPIMAGE.JPEG2", $outputRoot); # Binned JPEG #2
    119141
     142# Recipes to use in processing
     143my $recipe1 = RECIPES->{"bin1"}->{lc($det_type)};
     144&my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $exp_tag, $PS_EXIT_PROG_ERROR) unless defined $recipe1;
     145
     146my $recipe2 = RECIPES->{"bin2"}->{lc($det_type)};
     147&my_die("Unrecognised detrend type: $det_type", $det_id, $iter, $exp_tag, $PS_EXIT_PROG_ERROR) unless defined $recipe2;
     148
    120149unless ($no_op) {
    121150
    122151    # Make the jpeg for binning 1
    123152    {
    124         my $command = "$ppImage -list $list1Name $outputRoot -recipe PPIMAGE " . RECIPE1; # Command to run
     153        my $command = "$ppImage -list $list1Name $outputRoot -recipe PPIMAGE $recipe1"; # Command to run
    125154        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    126155            run(command => $command, verbose => 1);
     
    134163    # Make the jpeg for binning 2
    135164    {
    136         my $command = "$ppImage -list $list2Name $outputRoot -recipe PPIMAGE " . RECIPE2; # Command to run
     165        my $command = "$ppImage -list $list2Name $outputRoot -recipe PPIMAGE $recipe2"; # Command to run
    137166        my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    138167            run(command => $command, verbose => 1);
     
    159188my $logFile;
    160189unless ($no_op) {
     190    # XXX this will fail if the file exists (because of Nebulous rules)
    161191    $logFile = $ipprc->file_create_open( $logName );
    162192}
     
    298328
    299329unless ($no_update) {
    300     my $command = "$dettool -addresidexp -det_id $det_id -iteration $iter -exp_tag $exp_tag " .
    301         "-recip " . RECIPE1() . "," . RECIPE2() . " -path_base $outputRoot "; # Command to run
     330    my $command = "$dettool -addresidexp -det_id $det_id -iteration $iter -exp_tag $exp_tag";
     331    $command .= " -recip $recipe1,$recipe2 -path_base $outputRoot ";
    302332    $command .= " -bg $bg -bg_stdev $bg_stdev -bg_mean_stdev $bg_mean_stdev";
    303333    $command .= ' -reject' if $reject;
Note: See TracChangeset for help on using the changeset viewer.