IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Nov 17, 2015, 10:01:24 AM (11 years ago)
Author:
bills
Message:

started to add code to handle csv files but it doesn't work.
Add option to skip adding the delta columns.
For a full stack batch we have more than 999 columns and that doesn't work. So in that case
tell joinstackcmf to skip the joins to xsrc and xfit tables. The comparision code doesn't
use them.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/bills/comparestackdetections

    r39117 r39150  
    2222my $testdata;
    2323
    24 my ($checkdeltas, $verbose, $save_temps);
     24my ($checkdeltas, $just_join, $verbose, $save_temps);
    2525
    2626my $label = 'SAS.20141118.sc8';
     
    3030    "testdata=s"        =>  \$testdata,
    3131    "join=s"            =>  \$joinType,
     32    "just-join"         =>  \$just_join,
    3233    "check"             =>  \$checkdeltas,
    3334    "verbose|v"         =>  \$verbose,
     
    9091    $command .= " --test" if $testdata;
    9192    $command .= " --verbose" if $verbose;
     93    # FITS has a limit of 999 for the number of columns in a table
     94    # If we're adding the delta columns that's too many. So skip the
     95    # joins (we heed to run joinstackcmf to add some columns that we need)
     96    $command .= " --skip-joins" unless $just_join;
    9297
    9398    runcommand($command);
     
    112117    $input = $outfile;
    113118}
     119
     120if ($just_join) {
     121    rename ($outfile, $out) or die "failed to rename $outfile to $out\n";
     122    exit 0;
     123}
     124
    114125
    115126my @deltas;
     
    141152
    142153if ($checkdeltas) {
     154    my ($fmt, $sep);
     155    if ($out =~ /fits$/) {
     156        $fmt = "-fits StackObjectAttributes";
     157        $sep = "";
     158    } elsif ($out =~ /csv$/) {
     159        $fmt = "-csv";
     160        $sep = ",";
     161    } else {
     162        die "don't know how to read $out. Use .fits or .csv\n";
     163    }
    143164    $save_temps = 1;
    144165    my ($manafile, $mananame) = tempfile( "/var/tmp/manacmds.XXXX", UNLINK => !$save_temps);
     
    172193
    173194    print $manafile "datafile $out\n";
    174     print $manafile "read -fits StackObjectAttributes";
     195    print $manafile "read $fmt";
     196    my $first = 1;
    175197    foreach my $col (@deltas) {
     198        if ($sep and !$first) {
     199            print $manafile $sep;
     200        } else {
     201            $first = 0;
     202        }
    176203        print $manafile " $col";
    177204    }
Note: See TracChangeset for help on using the changeset viewer.