IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Changeset 26901


Ignore:
Timestamp:
Feb 10, 2010, 7:44:33 PM (16 years ago)
Author:
eugene
Message:

updates from eam_branches/20091201

Location:
trunk/ippScripts
Files:
6 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/ippScripts/Build.PL

    r26670 r26901  
    101101        scripts/whichimage
    102102        scripts/automate_stacks.pl
     103        scripts/ipp_apply_burntool.pl
     104        scripts/make_burntool_pcontrol.pl
    103105    )],
    104106    dist_abstract => 'Scripts for running the Pan-STARRS IPP',
  • trunk/ippScripts/MANIFEST

    r26670 r26901  
    3737scripts/ds9_cmf_regions.pl
    3838scripts/automate_stacks.pl
     39scripts/ipp_apply_burntool.pl
     40scripts/make_burntool_pcontrol.pl
    3941t/00_distribution.t
  • trunk/ippScripts/scripts/chip_imfile.pl

    r26567 r26901  
    134134    $command = "$ppConfigDump -camera $camera -dump-recipe PPIMAGE -recipe PPIMAGE $recipe_ppImage -";
    135135    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    136         run(command => $command, verbose => $verbose);
     136        run(command => $command, verbose => 0);
    137137    unless ($success) {
    138138        $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     
    146146
    147147    if ($useDeburnedImage) {
    148         my $useBestBurntool  = metadataLookupBool($recipeData, 'USE.BEST.BURNTOOL');
    149 
    150         ## Check that we have required programs:
    151 #       print STDERR "Inside burntool loop!\n";
    152         my $regtool  = can_run('regtool') or &my_die ("Can't find regtool", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
    153         my $funpack  = can_run('funpack') or &my_die ("Can't find funpack", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
    154         my $burntool = can_run('burntool') or &my_die ("Can't find burntool", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
    155        
     148        my $useBestBurntool  = metadataLookupBool($recipeData, 'USE.BEST.BURNTOOL');
     149
     150        ## Check that we have required programs:
     151#       print STDERR "Inside burntool loop!\n";
     152        my $regtool  = can_run('regtool') or &my_die ("Can't find regtool", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
     153        my $funpack  = can_run('funpack') or &my_die ("Can't find funpack", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
     154        my $burntool = can_run('burntool') or &my_die ("Can't find burntool", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
     155
    156156        ## Check the current burntool processing version:
    157157        my $regtool_state_cmd = "$regtool -processedimfile -exp_id $exp_id -class_id $class_id -limit 1";
     
    173173        my $burntoolState = 999;
    174174        foreach my $regEntry (@$regData2) {
    175 #           print "$regEntry->{exp_id} $regEntry->{burntool_state}\n";
     175           print "$regEntry->{exp_id} $regEntry->{burntool_state}\n";
    176176
    177177            if ($regEntry->{exp_id} == $exp_id) {
     
    182182            &my_die("Unable to find burntool_state in metadata", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
    183183        }
    184         if ($burntoolState == 32767) {
    185             $burntoolState = 0;
    186         }
     184        if ($burntoolState == 32767) {
     185            $burntoolState = 0;
     186        }
    187187
    188188        ## Read camera config to get the current good burntool state :
     
    190190        my $camera_config_cmd = "$ppConfigDump -camera $camera -dump-camera -";
    191191        ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    192             run(command => $camera_config_cmd, verbose => $verbose);
     192            run(command => $camera_config_cmd, verbose => 0);
    193193        unless ($success) {
    194194            $error_code = (($error_code >> 8) or $PS_EXIT_PROG_ERROR);
     
    206206        }
    207207
    208         if (abs($burntoolState) != $burntoolStateGood) {
    209             if ($useBestBurntool) {
    210                 &my_die("Image burntool version does not match current accepted version.", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
    211             }
    212             else {
    213                 warn ("Image burntool version does not match current accepted version. Continuing as requested.");
    214                 # Internally pretend that we're at a good version.
    215                 if ($burntoolState < -10) {
    216                     $burntoolState = -1 * $burntoolStateGood;
    217                 }
    218                 elsif ($burntoolState > 10) {
    219                     $burntoolState = $burntoolStateGood;
    220                 }
    221                 elsif ($burntoolState == 0) {
    222                     # You've told me to use a deburned image, and that you don't care if it's the most recent. The database has told me
    223                     # that burntool has never been run on this image. We'll hope the database is wrong, but I don't really trust that.
    224                     warn ("burntool_state suggests no table will be found. This will likely crash.");
    225                     $burntoolState = -1 * $burntoolStateGood;
    226                 }
    227                 else {
    228                     &my_die("No valid burntool table will be found.", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
    229                 }
    230             }
    231         }
     208        print "burntool state vs burntoolStateGood : $burntoolState vs $burntoolStateGood\n";
     209        if (abs($burntoolState) != $burntoolStateGood) {
     210            if ($useBestBurntool) {
     211                &my_die("Image burntool version does not match current accepted version.", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
     212            }
     213            else {
     214                warn ("Image burntool version does not match current accepted version. Continuing as requested.");
     215                # Internally pretend that we're at a good version.
     216                if ($burntoolState < -10) {
     217                    $burntoolState = -1 * $burntoolStateGood;
     218                }
     219                elsif ($burntoolState > 10) {
     220                    $burntoolState = $burntoolStateGood;
     221                }
     222                elsif ($burntoolState == 0) {
     223                    # You've told me to use a deburned image, and that you don't care if it's the most recent. The database has told me
     224                    # that burntool has never been run on this image. We'll hope the database is wrong, but I don't really trust that.
     225                    warn ("burntool_state suggests no table will be found. This will likely crash.");
     226                    $burntoolState = -1 * $burntoolStateGood;
     227                }
     228                else {
     229                    &my_die("No valid burntool table will be found.", $exp_id, $chip_id, $class_id, $PS_EXIT_SYS_ERROR);
     230                }
     231            }
     232        }
    232233
    233234        ## We now know that we have an image that has been burntooled.
     
    258259            }
    259260
    260             $burntool_cmd .= "$tempName in=${burntoolTable_uriReal} apply=t";
     261            $burntool_cmd .= "$tempName in=${burntoolTable_uriReal} persist=t apply=t";
    261262        }
    262263        elsif ($burntoolState == $burntoolStateGood) { # Burntool information stored in a header table.
    263             $burntool_cmd .= "$tempName apply=t";
     264            $burntool_cmd .= "$tempName persist=t apply=t";
    264265        }
    265266        else {
  • trunk/ippScripts/scripts/diff_skycell.pl

    r26639 r26901  
    5555pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    5656pod2usage(
    57     -msg => "Required options: --diff_id --skycell_id --outroot --run-state",
     57    -msg => "Required options: --diff_id --skycell_id --outroot --run-state --diff_skyfile_id",
    5858    -exitval => 3,
    5959          ) unless defined $diff_id
     
    168168}
    169169
     170print "reduction: $reduction\n";
     171print "recipe_ppSub: $recipe_ppSub\n";
     172
    170173# print "templateMask: $templateMask\n";
    171174# print "templatePath: $templatePath\n";
  • trunk/ippScripts/scripts/ds9_cmf_regions.pl

    r24343 r26901  
    8181if ($mag_radius) {
    8282    foreach my $m (@$mag) {
    83         next unless defined $m and $m < "inf" and $m > "-inf";
     83        next unless defined $m and $m != "nan" and $m < "inf" and $m > "-inf";
    8484        unless (defined $mag_min and defined $mag_max) {
    8585            $mag_min = $m;
     
    9999for (my $i = 0; $i < $numRows; $i++) {
    100100    my $col;                    # Colour to use
    101     if ($$flags[$i] & $flag) {
     101    if ($$flags[$i] & $flag or not defined $$mag[$i] or $$mag[$i] eq "nan" or $$mag[$i] == "inf" or $$mag[$i] == "-inf") {
    102102        $numBad++;
    103103        $col = $flag_colour;
     
    107107    }
    108108    my $r = $radius;            # Radius of circle
    109     next if defined $mag_radius and (not defined $$mag[$i] or $$mag[$i] == "inf" or $$mag[$i] == "-inf");
     109    next if $mag_radius and (not defined $$mag[$i] or $$mag[$i] eq "nan" or $$mag[$i] == "inf" or $$mag[$i] == "-inf");
    110110    $r -= ($$mag[$i] - $mag_min) * $radius_scale if defined $mag_radius;
    111111    print $coordFile "image; circle(" . ($$x[$i] + 1) . ',' . ($$y[$i] + 1) . ",$r) \# color = $col\n";
  • trunk/ippScripts/scripts/magic_process.pl

    r25934 r26901  
    3131my $magictool      = can_run('magictool') or (warn "Can't find magictool" and $missing_tools = 1);
    3232my $detectstreaks = can_run('DetectStreaks') or (warn "Can't find DetectStreaks" and $missing_tools = 1);
     33my $VerifyStreaks = can_run('VerifyStreaks') or (warn "Can't find VerifyStreaks, will not produce png images");
    3334if ($missing_tools) {
    3435    warn("Can't find required tools.");
     
    3738
    3839# Parse the command-line arguments
    39 my ($magic_id, $node, $camera, $dbname, $outroot, $save_temps, $verbose, $no_update, $no_op, $logfile);
     40my ($magic_id, $node, $camera, $dbname, $baseroot, $save_temps, $verbose, $no_update, $no_op, $logfile);
    4041
    4142GetOptions(
     
    4445           'camera=s'        => \$camera,     # Camera name
    4546           'dbname=s'        => \$dbname,     # Database name
    46            'outroot=s'       => \$outroot,    # Output root name
     47           'baseroot=s'      => \$baseroot,   # Output root name
    4748           'save-temps'      => \$save_temps, # Save temporary files?
    4849           'verbose'         => \$verbose,    # Print stuff?
     
    5354
    5455pod2usage( -msg => "Unknown option: @ARGV", -exitval => 2 ) if @ARGV;
    55 pod2usage( -msg => "Required options: --magic_id --camera --node --outroot",
     56pod2usage( -msg => "Required options: --magic_id --camera --node --baseroot",
    5657           -exitval => 3) unless
    5758    defined $magic_id and
    5859    defined $node and
    5960    defined $camera and
    60     defined $outroot;
     61    defined $baseroot;
    6162
    6263my $ipprc = PS::IPP::Config->new( $camera ) or my_die( "Unable to set up", $magic_id, $node, $PS_EXIT_CONFIG_ERROR ); # IPP configuration
    6364$ipprc->redirect_output($logfile) or my_die( "Unable to redirect output", $magic_id, $node, $PS_EXIT_SYS_ERROR ) if $logfile;
    6465
    65 # DetectStreaks doesn't know about nebulous. It expects to be able to append strings to outroot
    66 # to form valid file names.
    67 # So forbid nebulous path in outroot. We could relax this by change DetectStreaks to take all
    68 # of the file names as arguments or by teaching it about Nebulous
    69 if ($outroot =~ 'neb:/') {
     66# DetectStreaks doesn't know about nebulous. It expects to be able to
     67# append strings to baseroot to form valid file names.  So forbid
     68# nebulous path in baseroot. We could relax this by change
     69# DetectStreaks to take all of the file names as arguments or by
     70# teaching it about Nebulous
     71if ($baseroot =~ 'neb:/') {
    7072    &my_die("DetectStreaks does not support nebulous paths in outroot", $magic_id, $node, $PS_EXIT_CONFIG_ERROR);
    7173}
    7274
     75# most filenames are of the form $baseroot.$node.*, but VerifyStreaks
     76# needs access to $baseroot.*, so we construct $outroot =
     77# $baseroot.$node in here
     78
    7379# resolve any path:// or file:// in outroot
    74 $outroot = $ipprc->file_resolve($outroot);
     80$baseroot = $ipprc->file_resolve($baseroot);
     81my $outroot = "$baseroot.$node";
    7582
    7683my $mdcParser = PS::IPP::Metadata::Config->new; # Parser for metadata config files
     
    255262    }
    256263
     264    &run_verifystreaks($baseroot);
     265
    257266    my $command = "$magictool -addmask";
    258267    $command   .= " -magic_id $magic_id";
     
    275284}
    276285
    277 
    278 
    279286### Pau.
     287
     288sub run_verifystreaks {
     289
     290    my $baseroot = shift;
     291
     292    unless ($VerifyStreaks) {
     293        print STDERR "skipping VerifyStreaks\n";
     294        return 1;
     295    }
     296
     297    # VerifyStreaks --out $outdir --clusters $outdir/clusters.list $rootname.root.streakMap
     298
     299    my $outdir = "$baseroot.verify";
     300
     301    my($status) = system ("mkdir -p $outdir");
     302    if ($status) {
     303        print STDERR "failed to create output directory $outdir\n";
     304        return 1;
     305    }
     306
     307    my $FILE;
     308
     309    my @files = <$baseroot.*.clusters>;
     310
     311    unless (open ($FILE, ">$outdir/clusters.list")) {
     312        print "failed to create cluster file $outdir/clusters.list\n";
     313        return 1;
     314    }
     315    foreach my $file (@files) {
     316        $file =~ s|.clusters$||;
     317        print $FILE "$file\n";
     318    }
     319    close ($FILE);
     320    if ($status) {
     321        print "failed to create cluster file $outdir/clusters.list\n";
     322        return 1;
     323    }
     324
     325    my $command = "$VerifyStreaks --out $outdir --clusters $outdir/clusters.list $baseroot.root.streakMap";
     326
     327    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
     328        run(command => $command, verbose => $verbose);
     329    unless ($success) {
     330        print "failed to run VerifyStreaks:\n";
     331        return 1;
     332    }
     333
     334    return 0;
     335}
    280336
    281337sub open_list_file {
Note: See TracChangeset for help on using the changeset viewer.