Skip to content

Commit

Permalink
switch laptops commit
Browse files Browse the repository at this point in the history
  • Loading branch information
tf17270 committed Apr 19, 2024
1 parent d317142 commit 5a27096
Show file tree
Hide file tree
Showing 13 changed files with 376 additions and 804 deletions.
15 changes: 8 additions & 7 deletions conda/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{ % set name = "lyceanem" % }
{ % set version = "0.0.4" % }
{% set name = "lyceanem" %}
{% set version = "0.0.4" %}

package:
name: { { name|lower } }
version: { { version } }
name: {{ name|lower }}
version: {{ version }}

source:
url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/LyceanEM-{{ version }}.tar.gz
sha256: a12631f848174a177e0856e5099e34bfe0969bfe50ecc6439a0318206cdc0b8b

build:
noarch: python
script: { { PYTHON } } -m pip install . -vv
script: {{ PYTHON }} -m pip install . -vv
number: 0

requirements:
Expand All @@ -24,14 +24,15 @@ requirements:
- open3d-admin::open3d

- pip:
-lyceanem==0.0.4
- lyceanem=={{ version }}

about:
home: https://lyceanem-python.readthedocs.io/en/latest/index.html
summary: LyceanEM is a Python library for modelling electromagnetic propagation for sensors and communications. You can find the documentation at https://lyceanem-python.readthedocs.io/en/latest/
summary: LyceanEM is a Python library for modeling electromagnetic propagation for sensors and communications. You can find the documentation at https://lyceanem-python.readthedocs.io/en/latest/
license: GPL-3.0
license_file: LICENSE.txt

extra:
recipe-maintainers:
- LyceanEM

112 changes: 43 additions & 69 deletions docs/examples/03_frequency_domain_channel_modelling.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"""

import numpy as np
import open3d as o3d

# %%
# Frequency and Mesh Resolution
Expand All @@ -32,6 +31,7 @@
import lyceanem.geometry.targets as TL
import lyceanem.geometry.geometryfunctions as GF


transmit_horn_structure, transmitting_antenna_surface_coords = TL.meshedHorn(
58e-3, 58e-3, 128e-3, 2e-3, 0.21, mesh_resolution
)
Expand All @@ -48,38 +48,33 @@
#
rotation_vector1 = np.radians(np.asarray([90.0, 0.0, 0.0]))
rotation_vector2 = np.radians(np.asarray([0.0, 0.0, -90.0]))
transmit_horn_structure = GF.open3drotate(
transmit_horn_structure,
o3d.geometry.TriangleMesh.get_rotation_matrix_from_xyz(rotation_vector1),
)
transmit_horn_structure = GF.open3drotate(
transmit_horn_structure = GF.mesh_rotate(
transmit_horn_structure,
o3d.geometry.TriangleMesh.get_rotation_matrix_from_xyz(rotation_vector2),
)
transmit_horn_structure.translate(np.asarray([2.695, 0, 0]), relative=True)
transmitting_antenna_surface_coords = GF.open3drotate(
transmitting_antenna_surface_coords,
o3d.geometry.TriangleMesh.get_rotation_matrix_from_xyz(rotation_vector1),
rotation_vector1
)
transmitting_antenna_surface_coords = GF.open3drotate(
transmitting_antenna_surface_coords,
o3d.geometry.TriangleMesh.get_rotation_matrix_from_xyz(rotation_vector2),
)
transmitting_antenna_surface_coords.translate(np.asarray([2.695, 0, 0]), relative=True)
transmit_horn_structure = GF.mesh_rotate(transmit_horn_structure,rotation_vector2)

transmit_horn_structure = GF.translate_mesh(transmit_horn_structure,np.asarray([2.695, 0, 0]))

transmitting_antenna_surface_coords = GF.mesh_rotate(transmitting_antenna_surface_coords,rotation_vector1)

transmitting_antenna_surface_coords = GF.mesh_rotate(
transmitting_antenna_surface_coords,rotation_vector2)

transmitting_antenna_surface_coords = GF.translate_mesh(transmitting_antenna_surface_coords,np.asarray([2.695, 0, 0]))
# %%
# Position Receiver
# ------------------
# rotate the receiving horn to desired orientation and translate to final position.
receive_horn_structure = GF.open3drotate(
receive_horn_structure,
o3d.geometry.TriangleMesh.get_rotation_matrix_from_xyz(rotation_vector1),
)
receive_horn_structure.translate(np.asarray([0, 1.427, 0]), relative=True)
receiving_antenna_surface_coords = GF.open3drotate(
receiving_antenna_surface_coords,
o3d.geometry.TriangleMesh.get_rotation_matrix_from_xyz(rotation_vector1),
)
receiving_antenna_surface_coords.translate(np.asarray([0, 1.427, 0]), relative=True)

receive_horn_structure = GF.mesh_rotate(receive_horn_structure,rotation_vector1)
receive_horn_structure = GF.translate_mesh(receive_horn_structure,np.asarray([0, 1.427, 0]))
receiving_antenna_surface_coords = GF.mesh_rotate(receiving_antenna_surface_coords,rotation_vector1)
receiving_antenna_surface_coords = GF.translate_mesh(receiving_antenna_surface_coords,np.asarray([0, 1.427, 0]))

receive_horn_structure = GF.mesh_rotate(receive_horn_structure,rotation_vector2)
receiving_antenna_surface_coords = GF.mesh_rotate(receiving_antenna_surface_coords,rotation_vector2)


# %%
# Create Scattering Plate
Expand All @@ -89,18 +84,19 @@
reflectorplate, scatter_points = TL.meshedReflector(
0.3, 0.3, 6e-3, wavelength * 0.5, sides="front"
)

position_vector = np.asarray([29e-3, 0.0, 0])
rotation_vector1 = np.radians(np.asarray([0.0, 90.0, 0.0]))
scatter_points = GF.open3drotate(
scatter_points = GF.mesh_rotate(
scatter_points,
o3d.geometry.TriangleMesh.get_rotation_matrix_from_xyz(rotation_vector1),
rotation_vector1
)
reflectorplate = GF.open3drotate(
reflectorplate = GF.mesh_rotate(
reflectorplate,
o3d.geometry.TriangleMesh.get_rotation_matrix_from_xyz(rotation_vector1),
rotation_vector1
)
reflectorplate.translate(position_vector, relative=True)
scatter_points.translate(position_vector, relative=True)
reflectorplate = GF.translate_mesh(reflectorplate,position_vector)
scatter_points = GF.translate_mesh(scatter_points,position_vector)

# %%
# Specify Reflection Angle
Expand All @@ -110,13 +106,12 @@
plate_orientation_angle = 45.0

rotation_vector = np.radians(np.asarray([0.0, 0.0, plate_orientation_angle]))
scatter_points = GF.open3drotate(
scatter_points = GF.mesh_rotate(
scatter_points,
o3d.geometry.TriangleMesh.get_rotation_matrix_from_xyz(rotation_vector),
)
reflectorplate = GF.open3drotate(
rotation_vector)
reflectorplate = GF.mesh_rotate(
reflectorplate,
o3d.geometry.TriangleMesh.get_rotation_matrix_from_xyz(rotation_vector),
rotation_vector
)

from lyceanem.base_classes import structures
Expand All @@ -129,21 +124,8 @@
# Use open3d function :func:`open3d.visualization.draw_geometries` to visualise the scene and ensure that all the
# relavent sources and scatter points are correct. Point normal vectors can be displayed by pressing 'n' while the
# window is open.
mesh_frame = o3d.geometry.TriangleMesh.create_coordinate_frame(
size=0.5, origin=[0, 0, 0]
)
o3d.visualization.draw_geometries(
[
transmitting_antenna_surface_coords,
receiving_antenna_surface_coords,
scatter_points,
reflectorplate,
mesh_frame,
receive_horn_structure,
transmit_horn_structure,
]
)
# %%


# .. image:: ../_static/03_frequency_domain_channel_model_picture_01.png
#

Expand Down Expand Up @@ -176,6 +158,7 @@
scattering=1,
)


# %%
# Examine Scattering
# ---------------------
Expand All @@ -184,6 +167,8 @@
# through different angles from 0 to 90 degrees in 1 degree steps.




angle_values = np.linspace(0, 90, 91)
angle_increment = np.diff(angle_values)[0]
responsex = np.zeros((len(angle_values)), dtype="complex")
Expand All @@ -195,27 +180,16 @@
rotation_vector = np.radians(
np.asarray([0.0, 0.0, plate_orientation_angle + angle_increment])
)
scatter_points = GF.open3drotate(
scatter_points,
o3d.geometry.TriangleMesh.get_rotation_matrix_from_xyz(rotation_vector),
)
reflectorplate = GF.open3drotate(
reflectorplate,
o3d.geometry.TriangleMesh.get_rotation_matrix_from_xyz(rotation_vector),
)
scatter_points = GF.mesh_rotate(scatter_points,rotation_vector)
reflectorplate = GF.mesh_rotate(reflectorplate,rotation_vector)


from tqdm import tqdm

for angle_inc in tqdm(range(len(angle_values))):
rotation_vector = np.radians(np.asarray([0.0, 0.0, angle_increment]))
scatter_points = GF.open3drotate(
scatter_points,
o3d.geometry.TriangleMesh.get_rotation_matrix_from_xyz(rotation_vector),
)
reflectorplate = GF.open3drotate(
reflectorplate,
o3d.geometry.TriangleMesh.get_rotation_matrix_from_xyz(rotation_vector),
)
scatter_points = GF.mesh_rotate(scatter_points,rotation_vector)
reflectorplate = GF.mesh_rotate(reflectorplate,rotation_vector)
Ex, Ey, Ez = FD.calculate_scattering(
aperture_coords=transmitting_antenna_surface_coords,
sink_coords=receiving_antenna_surface_coords,
Expand Down
Binary file added docs/examples/rayhits.npy
Binary file not shown.
Binary file added docs/examples/rect_reflectorref.ply
Binary file not shown.
Binary file added docs/examples/reference_reflectorplate.ply
Binary file not shown.
Loading

0 comments on commit 5a27096

Please sign in to comment.