IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 24913


Ignore:
Timestamp:
Jul 23, 2009, 2:52:53 PM (17 years ago)
Author:
watersc1
Message:

Added SUFFIX key to File::Temp filenames to prevent fpack from confusing a possible .imhX temp file as an IRAF image header.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/czw_branch/cleanup/tools/ipp_apply_burntool.pl

    r24679 r24913  
    2020use Pod::Usage qw( pod2usage );
    2121
    22 my ( $class_id, $dateobs_begin, $dateobs_end, $skip_burned, $dbname, $logfile, $verbose, $save_temps);
     22my ( $class_id, $dateobs_begin, $dateobs_end, $skip_burned, $rerun_from_first, $dbname, $logfile, $verbose, $save_temps);
    2323GetOptions(
    2424    'class_id=s'        => \$class_id, # chip identifier
     
    2828    'logfile=s'         => \$logfile,
    2929    'skip_burned'       => \$skip_burned,   # Print to stdout
     30    'rerun_from_first'  => \$rerun_from_first,   # Print to stdout
    3031    'verbose'           => \$verbose,   # Print to stdout
    3132    'save-temps'        => \$save_temps, # Save temporary files?
     
    4243    defined $dbname;
    4344
     45if ($skip_burned and $rerun_from_first) { &my_die("-rerun_from_first and -skip_burned are incompatible"); }
     46
    4447my $missing_tools;
    4548my $regtool  = can_run('regtool')  or (warn "Can't find regtool" and $missing_tools = 1);
     
    5861$command .= " -dateobs_begin $dateobs_begin";
    5962$command .= " -dateobs_end $dateobs_end";
    60 # $command .= " -limit 20";
     63$command .= " -ordered_by_date";
    6164$command .= " -dbname $dbname" if defined $dbname;
    6265
     
    101104if (! $skip_burned)  {
    102105    foreach my $file (@files) {
     106       
     107        # rerun_from_first treats the first image as already burned (if it is already burned)
     108        # the artifact table from the first file is used for the rest of the sequence.
     109        if ($rerun_from_first) {
     110            $skip_burned = 1;
     111            $rerun_from_first = 0;
     112            next;
     113        }
    103114        my $exp_id = $file->{exp_id};
    104115
     
    108119            &my_die("failed to update imfile");
    109120        }
     121        $file->{user_1} = 0.1;
    110122    }
    111123}
     
    122134        ($rawImfileReal) = $rawImfile =~ m|^neb:/(.*)|;
    123135    }
    124     # print "rawImfile: $rawImfile -> $rawImfileReal\n";
     136    print "rawImfile: $rawImfile -> $rawImfileReal\n";
    125137
    126138    # mangle name, create tmp file (always a UNIX file)
     
    128140    my $tempfile = new File::Temp ( TEMPLATE => "$basename.XXXX",
    129141                                    DIR => '/tmp',
    130                                     UNLINK => !$save_temps);
     142                                    UNLINK => !$save_temps,
     143                                    SUFFIX => '.fits');
    131144    my $tmpImfileReal = $tempfile->filename;
    132145    # print "tmpImfile: $tmpImfile -> $tmpImfileReal\n";
     
    149162    }
    150163
     164    print "$rawImfile : $skip_burned, $file->{user_1}\n";
     165
    151166    if (! ($skip_burned and ($file->{user_1} > 0.5))) {
     167        print "running on: $rawImfile\n";
    152168        # uncompress the image (do we need to check if it is compressed?)
    153169        my $status = vsystem ("$funpack -S $rawImfileReal > $tmpImfileReal", $REALRUN);
Note: See TracChangeset for help on using the changeset viewer.