lasp/test/benchmark.py

46 lines
769 B
Python
Raw Normal View History

#!/usr/bin/env python
2018-01-29 15:14:50 +00:00
# -*- coding: utf-8 -*-
"""
Created on Mon Jan 15 19:45:33 2018
@author: anne
"""
from pycallgraph import PyCallGraph
from pycallgraph.output import GraphvizOutput
2018-01-29 15:14:50 +00:00
import numpy as np
from beamforming import Fft
2018-01-29 15:14:50 +00:00
nfft=2**17
print('nfft:',nfft)
nchannels = 50
number_run = 10
t = np.linspace(0,1,nfft+1)
# Using transpose to get the strides right
x = np.random.randn(nchannels,nfft).T
import time
start = time.time()
for i in range(number_run):
X = np.fft.rfft(x,axis=0)
end = time.time()
print("Time numpy fft:",end-start)
# X =np.fft.fft(x)
#X =np.fft.rfft(x)
fft = Fft(nfft,nchannels)
start = time.time()
for i in range(number_run):
# print('--- run %i' %i)
fft.fft(x)
end = time.time()
print("Time ASCEE fft:",end-start)