diff --git a/docs/API-reference.md b/docs/API-reference.md
index 363d9dd..521194f 100644
--- a/docs/API-reference.md
+++ b/docs/API-reference.md
@@ -34,6 +34,8 @@ ________________________________________________________________________________
::: sgptools.utils.metrics
---
::: sgptools.utils.gpflow
+---
+::: sgptools.utils.data
____________________________________________________________________________________________________________________________________________________________
---
::: sgptools.kernels.neural_kernel
diff --git a/sgptools/models/cma_es.py b/sgptools/models/cma_es.py
index 9b10e4f..7ee2439 100644
--- a/sgptools/models/cma_es.py
+++ b/sgptools/models/cma_es.py
@@ -33,6 +33,7 @@ class CMA_ES:
as waypoints of a path
num_robots (int): Number of robots, used when modeling
multi-robot IPP with a distance budget
+ transform (Transform): Transform object
"""
def __init__(self, X_train, noise_variance, kernel,
distance_budget=None,
diff --git a/sgptools/utils/data.py b/sgptools/utils/data.py
index da7520f..8b1e816 100644
--- a/sgptools/utils/data.py
+++ b/sgptools/utils/data.py
@@ -18,47 +18,86 @@
from sklearn.preprocessing import StandardScaler
from hkb_diamondsquare.DiamondSquare import diamond_square
+# Load optional dependency
try:
from osgeo import gdal
except:
pass
+
####################################################
# Utils used to prepare synthetic datasets
-'''
-Remove points inside polygons
-'''
def remove_polygons(X, Y, polygons):
+ '''
+ Remove points inside polygons.
+
+ Args:
+ X (ndarray): (N,); array of x-coordinate
+ Y (ndarray): (N,); array of y-coordinate
+ polygons (list of matplotlib path polygon): Polygons to remove from the X, Y points
+
+ Returns:
+ X (ndarray): (N,); array of x-coordinate
+ Y (ndarray): (N,); array of y-coordinate
+ '''
points = np.array([X.flatten(), Y.flatten()]).T
for polygon in polygons:
p = path.Path(polygon)
points = points[~p.contains_points(points)]
return points[:, 0], points[:, 1]
-'''
-Remove points inside circle patches
-'''
def remove_circle_patches(X, Y, circle_patches):
+ '''
+ Remove points inside polycircle patchesgons.
+
+ Args:
+ X (ndarray): (N,); array of x-coordinate
+ Y (ndarray): (N,); array of y-coordinate
+ polygons (list of matplotlib circle patches): Circle patches to remove from the X, Y points
+
+ Returns:
+ X (ndarray): (N,); array of x-coordinate
+ Y (ndarray): (N,); array of y-coordinate
+ '''
points = np.array([X.flatten(), Y.flatten()]).T
for circle_patch in circle_patches:
points = points[~circle_patch.contains_points(points)]
return points[:, 0], points[:, 1]
-'''
-Generate a point at a distance d from a point at angle theta
-
-Args:
- point: (N, 2) array of points
- d: distance
- theta: angle in radians
-'''
def point_pos(point, d, theta):
+ '''
+ Generate a point at a distance d from a point at angle theta.
+
+ Args:
+ point (ndarray): (N, 2); array of points
+ d (float): distance
+ theta (float): angle in radians
+
+ Returns:
+ X (ndarray): (N,); array of x-coordinate
+ Y (ndarray): (N,); array of y-coordinate
+ '''
return np.c_[point[:, 0] + d*np.cos(theta), point[:, 1] + d*np.sin(theta)]
####################################################
-def prep_tif_dataset(dataset_path=None):
+def prep_tif_dataset(dataset_path):
+ '''Load and preprocess a dataset from a GeoTIFF file (.tif file). The input features
+ are set to the x and y pixel block coordinates and the labels are read from the file.
+ The method also removes all invalid points.
+
+ Large tif files
+ need to be downsampled using the following command:
+ ```gdalwarp -tr 50 50 .tif