Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default for window size in EquivalentSourcesGB #487

Merged
merged 15 commits into from
May 31, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Add to test_window_size_less_than_5000
Check only 1 data and source window is created.
Check if all sources and data points are inside the window.
  • Loading branch information
indiauppal committed May 31, 2024
commit 3eec5ac6b74f3630e70030598d507875ce99ceeb
10 changes: 9 additions & 1 deletion harmonica/tests/test_gradient_boosted_eqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,13 +378,21 @@ def test_error_ignored_args(coordinates_small, data_small, region):
def test_window_size_less_than_5000():
region = (0, 10e3, -5e3, 5e3)
grid_coords = vd.grid_coordinates(region=region, shape=(64, 64), extra_coords=0)
grid_coords = [c.ravel() for c in grid_coords]
eqs = EquivalentSourcesGB()
eqs.points_ = eqs._build_points(
grid_coords
) # need to build sources first before creating windows.
with pytest.warns(UserWarning, match=f"Found {64**2} number of coordinates"):
eqs._create_windows(grid_coords)
source_windows, data_windows = eqs._create_windows(grid_coords)
assert eqs.window_size_ is None
assert len(source_windows) == 1
assert len(data_windows) == 1
# Check if all sources and data points are inside the window
for coord in eqs.points_:
npt.assert_allclose(coord, coord[source_windows[0]])
for coord in grid_coords:
npt.assert_allclose(coord, coord[data_windows[0]])


def test_window_size():
Expand Down
Loading