Skip to content

Commit

Permalink
more about FAST range issues in py3
Browse files Browse the repository at this point in the history
  • Loading branch information
jdherman committed Jan 29, 2015
1 parent c475a57 commit 19b96b1
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions SALib/analyze/fast.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ def analyze(pfile, output_file, column=0, M=4, delim=' ', print_to_console=False

def compute_first_order(outputs, N, M, omega):
f = np.fft.fft(outputs)
Sp = np.power(np.absolute(f[range(1, int(N / 2))]) / N, 2)
Sp = np.power(np.absolute(f[np.arange(1, int(N / 2))]) / N, 2)
V = 2 * np.sum(Sp)
D1 = 2 * np.sum(Sp[list(np.arange(1, M + 1) * int(omega) - 1)])
D1 = 2 * np.sum(Sp[np.arange(1, M + 1) * int(omega) - 1])
return D1 / V


def compute_total_order(outputs, N, omega):
f = np.fft.fft(outputs)
Sp = np.power(np.absolute(f[range(1, int(N / 2))]) / N, 2)
Sp = np.power(np.absolute(f[np.arange(1, int(N / 2))]) / N, 2)
V = 2 * np.sum(Sp)
Dt = 2 * sum(Sp[range(int(omega / 2))])
Dt = 2 * sum(Sp[np.arange(int(omega / 2))])
return (1 - Dt / V)

if __name__ == "__main__":
Expand Down

0 comments on commit 19b96b1

Please sign in to comment.