Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions adascape/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,14 +399,14 @@ def _mov_within_bounds(self, x, y, sigma, disp_boundary=None):

if disp_boundary is not None:
hull = spatial.Delaunay(disp_boundary)
inhull = hull.find_simplex(np.column_stack([new_x, new_y])) <= 0
inhull = hull.find_simplex(np.column_stack([new_x, new_y])) < 0

while any(inhull):
delta_bounds_x = self._grid_bounds['x'][:, None] - x[inhull]
delta_bounds_y = self._grid_bounds['y'][:, None] - y[inhull]
new_x[inhull] = self._truncnorm.rvs(*(delta_bounds_x / sigma), loc=x[inhull], scale=sigma)
new_y[inhull] = self._truncnorm.rvs(*(delta_bounds_y / sigma), loc=y[inhull], scale=sigma)
inhull = hull.find_simplex(np.column_stack([new_x, new_y])) <= 0
inhull = hull.find_simplex(np.column_stack([new_x, new_y])) < 0
return new_x, new_y

def _mutate_trait(self, trait, sigma):
Expand Down
2 changes: 1 addition & 1 deletion adascape/tests/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def test_constructor(self, grid, trait_funcs):
assert m._rng is rs

m2 = IR12SpeciationModel(X, Y, init_trait_funcs, opt_trait_funcs, 10, random_seed=0)
np.testing.assert_equal(m2._rng.__getstate__()['state'], rs.__getstate__()['state'])
np.testing.assert_equal(m2._rng.random(10), rs.random(10))

def test_params(self, params_IR12, model_IR12):
assert model_IR12.params == params_IR12
Expand Down
1 change: 1 addition & 0 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dependencies:
- toytree
- toyplot
- pytest
- zarr<3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is safer indeed. We'll probably need some work in xarray-simlab to support Zarr v3.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking a look! I'll merge it on then.

- pip
- pip:
- 'git+https://github.com/EstebanAce/orographic-precipitation.git'
Expand Down
Loading