-
Dear Acoular team, I am attempting to use a custom grid provided as an array of x, y, z. I would like to understand how the XML file for the ImportGrid method should be structured to work as expected. I believe it may be similar to the MicArray files, but since the subgrid attribute is unique to the ImportGrid method, it would be greatly appreciated if you could provide an example XML file for this case. Kind regards |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Here is an example for the XML import. You do not necessarily have to write an .xml file. A grid object can also be instantiated from a Numpy array. <?xml version="1.0" encoding="utf-8"?>
<Grid name="rect">
<pos Name="Point 1" x=" -0.021000000" y=" -0.063000000" z="0" />
<pos Name="Point 2" x=" -0.063000000" y=" -0.063000000" z="0" />
<pos Name="Point 3" x=" -0.021000000" y=" -0.021000000" z="0" />
<pos Name="Point 4" x=" -0.063000000" y=" -0.021000000" z="0" />
<pos Name="Point 5" x=" -0.021000000" y=" 0.021000000" z="0" />
<pos Name="Point 6" x=" -0.063000000" y=" 0.021000000" z="0" />
<pos Name="Point 7" x=" -0.021000000" y=" 0.063000000" z="0" />
<pos Name="Point 8" x=" -0.063000000" y=" 0.063000000" z="0" />
<pos Name="Point 9" x=" 0.063000000" y=" 0.063000000" z="0" />
<pos Name="Point 10" x=" 0.021000000" y=" 0.063000000" z="0" />
<pos Name="Point 11" x=" 0.063000000" y=" 0.021000000" z="0" />
<pos Name="Point 12" x=" 0.021000000" y=" 0.021000000" z="0" />
<pos Name="Point 13" x=" 0.063000000" y=" -0.021000000" z="0" />
<pos Name="Point 14" x=" 0.021000000" y=" -0.021000000" z="0" />
<pos Name="Point 15" x=" 0.063000000" y=" -0.063000000" z="0" />
<pos Name="Point 16" x=" 0.021000000" y=" -0.063000000" z="0" />
</Grid> from pathlib import Path
import acoular as ac
grid_file = Path(__file__).parent / 'grid.xml'
grid = ac.ImportGrid(from_file=grid_file)
print(grid.shape)
#%% an import from file is not necessary, the grid can also be set up manually:
import numpy as np
grid_pos = np.random.normal(size=(3,16))
grid2 = ac.ImportGrid(gpos_file=grid_pos)
print(grid2.shape) |
Beta Was this translation helpful? Give feedback.
Here is an example for the XML import. You do not necessarily have to write an .xml file. A grid object can also be instantiated from a Numpy array.
This is the
grid.xml
file: