IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 24, 2010, 5:39:14 PM (16 years ago)
Author:
Paul Price
Message:

It's working now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/microtest.pl

    r27442 r27443  
    99use IPC::Cmd 0.36 qw( can_run run );
    1010use File::Temp qw( tempfile );
     11use PS::IPP::Config;
    1112
    1213my $ppCoord = can_run('ppCoord') or die "Can't find ppCoord";
     
    3536    and defined $label;
    3637
     38my $ipprc = PS::IPP::Config->new() or die "Unable to set up IPP configuration";
     39
    3740# Database connection
    3841my $db = DBI->connect( "DBI:mysql:database=$db_name;host=$db_host;mysql_socket=" . DB_SOCKET(),
     
    4447# Exposures of interest
    4548my $exps = $db->selectall_arrayref(
    46         "SELECT exp_id, exp_name, magic_id, magicRun.outroot AS magic_path, camProcessedExp.path_base AS cam_path FROM magicRun JOIN rawExp USING(exp_id) WHERE label = '$label' AND magicRun.state = 'full'",
    47         Slice => {}
    48         ) or die "Unable to execute SQL: $DBI::errstr";
     49    "SELECT DISTINCT exp_id, exp_name, magic_id, magicRun.workdir AS magic_path, camProcessedExp.path_base AS cam_path FROM magicRun JOIN rawExp USING(exp_id) JOIN diffRun USING(diff_id) JOIN diffInputSkyfile USING(diff_id) JOIN warpRun ON warpRun.warp_id = diffInputSkyfile.warp1 JOIN fakeRun USING(fake_id) JOIN camProcessedExp USING(cam_id) WHERE magicRun.label = '$label' AND magicRun.state = 'full'",
     50    { Slice => {} }
     51    ) or die "Unable to execute SQL: $DBI::errstr";
    4952
    5053foreach my $exp (@$exps) {
     
    5659
    5760    my $clusters = "${magic_path}/$id/$id.mgc.$magic.verify/${id}_clusterPos.txt"; # File with cluster RA,Dec
    58     die "Cannot find clusters file $clusters" unless -e $clusters;
     61    die "Cannot find clusters file $clusters" unless $ipprc->file_exists($clusters);
    5962
    6063    my $astrom = "${cam_path}.smf"; # Astrometry file
    61     die "Cannot find astrometry file $astrom" unless -e $astrom;
     64    die "Cannot find astrometry file $astrom" unless $ipprc->file_exists($astrom);
    6265
    6366    # Format the clusters file
     
    6972        $line =~ s/^\s*//;
    7073        my ($ra, $dec) = split /\s+/, $line;
    71         print $radecFile "$ra $dec\n" if defined $ra and defined $dec and $ra !~ /\w/ and $dec !~ /\w/;
     74        print $radecFile "$ra $dec\n" if
     75            defined $ra and defined $dec and $ra !~ /[[:alpha:]]/ and $dec !~ /[[:alpha:]]/;
    7276    }
    7377    close $clustersFile;
     
    7781        die "Unable to execute SQL: $DBI::errstr";
    7882
    79     open my $outFile, "${name}_clusters.xy" or die "Cannot open output file: $!";
     83    open my $outFile, "> $label.${name}.clusters.xy" or die "Cannot open output file: $!";
    8084    foreach my $raw (@$raws) {
    8185#        my $resolved = `neb-locate --path $raw`; # Resolved filename
     
    8589        die "Unable to run ppCoord" unless $success;
    8690
    87         foreach my $line (@$stdout_buf) {
     91        my @lines = split(/\n/, join("", @$stdout_buf));
     92        foreach my $line (@lines) {
    8893            my @line = split /\s+/, $line;
    8994
Note: See TracChangeset for help on using the changeset viewer.