LyceanEM / LyceanEM-Python

Python codebase for LyceanEM
GNU General Public License v3.0
20 stars 3 forks source link

calculate_scattering data types #14

Closed generein closed 5 months ago

generein commented 5 months ago

The docstring still contains references to open3d classes, despite it using meshio.Mesh formats, which does not help with resolving the issue below.

I have a calculate_scattering call as follows:

Ex, Ey, Ez = lyceanem.models.frequency_domain.calculate_scattering(
  aperture_coords = targets_meshedHorn_output,
  sink_coords = meshio_mesh_from_stl
  antenna_solid = None,
  desired_E_axies = desired_E_axis,
  scatter_points = None,
  wavelength = wavelength,
  scattering = 0,
  elements = True
)

This results in an error in the frequency_domain.py file on line 522 in calculate_scattering:

np.asarray(sink_coords.point_data["Normals"]).astype(np.float32),
KeyError: 'Normals'

Is this an error in the data type fed to sink_coords or does it need to be sink.coords.cell_data["Normals"] as elsewhere in that file?

LyceanEM commented 5 months ago

This is likely because the meshio file used for the sink coordinates does not have the point data field "Normals". This could be addressed by adding this point data field. A compute_normals function has been added to the codebase in geometry_functions which will calculate the cell and point normals for a mesh. This can be used now by installing directly from github, and will be included in the next release.