Skip to content

Commit

Permalink
added slots for northings and eastings in sampling functions
Browse files Browse the repository at this point in the history
  • Loading branch information
the-sean-c committed Nov 7, 2023
1 parent 5006720 commit a16cd6e
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions src/geotech/distributions.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,19 @@ def __init__(self):

def sample(
self,
# northings: float | np.array = 0.0,
# eastings: float | np.array = 0.0,
elevations: float | np.array = 0.0,
northings: float | list[float] = 0.0,
eastings: float | list[float] = 0.0,
elevations: float | list[float] = 0.0,
):
"""Return a sample from the distribution.
# TODO: Add support for sampling at different locations.
"""
if isinstance(elevations, (int, float)):
elevations = [elevations]

return np.broadcast_to(self.sample_values)
"""Return a sample from the distribution."""
for param in [northings, eastings, elevations]:
if isinstance(param, (int, float)):
param = [param]

return np.broadcast_to(
self.sample_values,
(len(northings), len(eastings), len(elevations), config.iterations),
).copy()

@abstractmethod
def __repr__(self) -> str:
Expand Down

0 comments on commit a16cd6e

Please sign in to comment.