Skip to content

Commit

Permalink
chore(lib): adding ML features
Browse files Browse the repository at this point in the history
  • Loading branch information
jeertmans committed May 14, 2024
1 parent 9a8b3d2 commit 2096804
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions differt2d/scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,45 @@ class Scene(Plottable, eqx.Module):
objects: list[Object]
"""The list of objects in the scene."""

@jaxtyped(typechecker=typechecker)
def with_transmitters(self, **transmitters: Point) -> "Scene":
"""
Returns a copy of this scene, with the given transmitters.
:param transmitters: A mapping a transmitter names and points.
:return: The new scene.
"""
return Scene(

Check warning on line 68 in differt2d/scene.py

View check run for this annotation

Codecov / codecov/patch

differt2d/scene.py#L68

Added line #L68 was not covered by tests
transmitters=transmitters, receivers=self.receivers, objects=self.objects
)

@jaxtyped(typechecker=typechecker)
def with_receivers(self, **receivers: Point) -> "Scene":
"""
Returns a copy of this scene, with the given receivers.
:param receivers: A mapping a receiver names and points.
:return: The new scene.
"""
return Scene(

Check warning on line 80 in differt2d/scene.py

View check run for this annotation

Codecov / codecov/patch

differt2d/scene.py#L80

Added line #L80 was not covered by tests
transmitters=self.transmitters, receivers=receivers, objects=self.objects
)

@classmethod
@jaxtyped(typechecker=typechecker)
def from_walls_array(cls, walls: Float[Array, "num_walls 2 2"]) -> "Scene":
"""
Creates an empty scene from an array of walls.
:param walls: An array of wall coordinates.
:return: The new scene.
"""
return cls(

Check warning on line 93 in differt2d/scene.py

View check run for this annotation

Codecov / codecov/patch

differt2d/scene.py#L93

Added line #L93 was not covered by tests
transmitters={},
receivers={},
objects=[Wall(points=points) for points in walls],
)

@singledispatchmethod
@classmethod
def from_geojson(
Expand Down

0 comments on commit 2096804

Please sign in to comment.