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

Fix CI errors due to basinhopping algorithm and coverage #520

Merged
merged 7 commits into from
May 7, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics

- name: Setup pip dependencies
run: pip install pytest-cov coveralls coveragepy-lcov
run: pip install pytest-cov coveralls coveragepy-lcov 'coverage<7'

- name: Print conda environment (for debugging)
run: |
Expand Down
6 changes: 3 additions & 3 deletions tests/test_coreg/test_biascorr.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ def test_biascorr__bin_and_fit_1d(self, fit_args, fit_func, fit_optimizer, bin_s
elev_fit_args.update({"niter": 1})

# Run with input parameter, and using only 100 subsamples for speed
bcorr.fit(**elev_fit_args, subsample=100, random_state=42)
bcorr.fit(**elev_fit_args, subsample=1000, random_state=42)

# Check that variable names are defined during fit
assert bcorr._meta["bias_var_names"] == ["elevation"]
Expand Down Expand Up @@ -560,10 +560,10 @@ def test_deramp__synthetic(self, fit_args, order: int) -> None:
deramp = biascorr.Deramp(poly_order=order)
elev_fit_args = fit_args.copy()
if isinstance(elev_fit_args["to_be_aligned_elev"], gpd.GeoDataFrame):
bias_elev = bias_dem.to_pointcloud(data_column_name="z", subsample=30000).ds
bias_elev = bias_dem.to_pointcloud(data_column_name="z", subsample=50000).ds
else:
bias_elev = bias_dem
deramp.fit(elev_fit_args["reference_elev"], to_be_aligned_elev=bias_elev, subsample=20000, random_state=42)
deramp.fit(elev_fit_args["reference_elev"], to_be_aligned_elev=bias_elev, subsample=40000, random_state=42)

# Check high-order fit parameters are the same within 10%
fit_params = deramp._meta["fit_params"]
Expand Down
2 changes: 1 addition & 1 deletion xdem/fit.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ def wrapper_cost_sumofsin(p: NDArrayf, x: NDArrayf, y: NDArrayf) -> float:
# Insert in a scipy bounds object
scipy_bounds = scipy.optimize.Bounds(lb, ub)
# First guess for the mean parameters
p0 = np.divide(lb + ub, 2).squeeze()
p0 = ((lb + ub) / 2).squeeze()

if verbose:
print("Bounds")
Expand Down
Loading