IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Oct 4, 2006, 2:56:48 PM (20 years ago)
Author:
Paul Price
Message:

Passing command as an array to avoid problems with whitespace.

File:
1 edited

Legend:

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

    r9251 r9268  
    119119# Output results to the database
    120120unless ($no_update) {
    121     my $command = "$p0tool -updateexp -exp_tag $exptag"; # Command to execute to update exposure parameters
     121    my @command;
     122    push @command, $p0tool, '-updateexp', '-exp_tag', $exptag; # Command to execute to update exposure parameters
    122123   
    123124    # Add the values of interest
    124125    foreach my $constant (@{CONSTANTS()}) {
    125         $command .= " -" . $constant . " " . $values{$constant};
     126        push @command, ( '-' . $constant ), $values{$constant};
    126127    }
    127128    foreach my $variable (@{VARIABLES()}) {
     
    129130        my $stats = Statistics::Descriptive::Sparse->new; # Statistics calculator
    130131        $stats->add_data(@$array);
    131         $command .= " -" . $variable . " " . $stats->mean();
     132        push @command, ( '-' . $variable ), $stats->mean();
    132133    }
    133134
     
    136137        my $stats = Statistics::Descriptive::Sparse->new; # Statistics calculator
    137138        $stats->add_data(@backgrounds);
    138         $command .= " -" . PHASE0_BG() . " " . $stats->mean();
     139        push @command, ( '-' . PHASE0_BG() ), $stats->mean(), ( '-' . PHASE0_BG_STDEV() );
    139140        if (scalar @backgrounds == 1) {
    140             $command .= ' -' . PHASE0_BG_STDEV() . " 0.0";
     141            push @command, 1;
    141142        } else {
    142             $command .= " -" . PHASE0_BG_STDEV() . " " . $stats->standard_deviation();
     143            push @command, $stats->standard_deviation();
    143144        }
    144145    }
     
    146147        my $stats = Statistics::Descriptive::Sparse->new; # Statistics calculator
    147148        $stats->add_data(@stdevs);
    148         $command .= " -" . PHASE0_BG_MEAN_STDEV() . " " . $stats->mean();
     149        push @command, ( '-' . PHASE0_BG_MEAN_STDEV() ), $stats->mean();
    149150    }
    150151   
     
    152153    foreach my $detrendType (@{DETRENDS()}) {
    153154        if (lc($values{TYPE()}) eq lc($detrendType)) {
    154             $command .= " " . DETREND_FLAG;
     155            push @command, DETREND_FLAG;
    155156            last;
    156157        }
     
    158159 
    159160    my ( $success, $error_code, $full_buf, $stdout_buf, $stderr_buf ) =
    160         run(command => $command, verbose => 1);
     161        run(command => \@command, verbose => 1);
    161162    die "Unable to run phase0 update for $exptag: $error_code\n" if not $success;
    162163}
Note: See TracChangeset for help on using the changeset viewer.