In fact i have a bigger issue. I see that no matter what input file i give to work on, the graph will always look the same.
I made 2 files where i talk from different angles, but the output sources seems identical..
import sys
import numpy as np
import h5py
from os import path
import acoular
from pylab import figure, plot, axis, imshow, colorbar, show
from acoular import __file__ as bpath, td_dir, MicGeom, WNoiseGenerator, PointSource, Mixer, WriteH5
if __name__ == "__main__":
if len(sys.argv) <= 1:
print ("You must supply a filename to generate")
exit(-1)
for fname in sys.argv[1:]:
fo = open(fname, "r")
arr = np.fromfile(fo, dtype=float, count=-1, sep=',')
arr = np.resize(arr, (len(arr)/2,2) )
max_value = np.max(arr)
arr = (arr/max_value) - 0.5
hdf = h5py.File('data2.h5', 'w')
time_data = hdf.create_dataset('time_data', data=arr, dtype='float32')
time_data.attrs['CLASS'] = 'EARRAY'
time_data.attrs['EXTDIM'] = '0'
time_data.attrs['TITLE '] = ''
time_data.attrs['VERSION'] = '1.1'
time_data.attrs.create('sample_freq' , '20000.0',None,float)
hdf.attrs.__setitem__('CLASS', 'GROUP')
hdf.attrs.__setitem__('PYTABLES_FORMAT_VERSION', '2.1')
hdf.attrs.__setitem__('TITLE' , '')
hdf.attrs.__setitem__('VERSION', '1.0')
hdf.close()
hdf = h5py.File('data2.h5', 'r')
micgeofile = path.join(path.split(acoular.__file__)[0],'xml','array_2.xml')
mg = acoular.MicGeom( from_file=micgeofile )
ts = acoular.TimeSamples( name='data2.h5' )
ps = acoular.PowerSpectra( time_data=ts, block_size=128, window='Hanning' )
rg = acoular.RectGrid( x_min=-0.7, x_max=0.7, y_min=-0.7, y_max=0.7, z=0.7, increment=0.01 )
bb = acoular.BeamformerBase( freq_data=ps, grid=rg, mpos=mg )
pm = bb.synthetic( 250, 1 )
Lm = acoular.L_p( pm )
imshow( Lm.T, origin='lower', vmin=Lm.max()-20, extent=rg.extend(), \
interpolation='bicubic')
colorbar()
figure(2)
plot(mg.mpos[0],mg.mpos[1],'o')
axis('equal')
show()
hdf.close()