Skip to content
Open
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
1 change: 0 additions & 1 deletion promis/estimators/filters/extended_gmphd.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@


class ExtendedGaussianMixturePhd(GaussianMixturePhd):

"""The extended gaussian mixture PHD filter for non-linear multi-target tracking.

The extended gaussian mixture PHD is a multi target tracker for non-linear state space models.
Expand Down
1 change: 0 additions & 1 deletion promis/estimators/filters/extended_kalman.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@


class ExtendedKalman:

"""The extended Kalman filter for non-linear state estimation.

This filter behaves similarly to the standard Kalman filter, but utilizes nonlinear
Expand Down
1 change: 0 additions & 1 deletion promis/estimators/filters/gmphd.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@


class GaussianMixturePhd:

"""The gaussian mixture PHD filter for linear multi-target tracking.

The gaussian mixture PHD filter is a multi target tracker for linear state space models.
Expand Down
1 change: 0 additions & 1 deletion promis/estimators/filters/kalman.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@


class Kalman:

"""The Kalman filter for linear state estimation.

The Kalman filter is a single target tracker for linear state space models, i.e. models that
Expand Down
1 change: 0 additions & 1 deletion promis/estimators/filters/unscented_kalman.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@


class UnscentedKalman:

"""The unscented Kalman filter for non-linear state estimation.

This filter behaves similarly to the standard Kalman filter, but utilizes the so-called
Expand Down
1 change: 0 additions & 1 deletion promis/estimators/smoothers/extended_rts.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@


class ExtendedRts(ExtendedKalman):

"""The Extended RTS smoother for non-linear state estimation.

The Extended RTS smoother is a single target state estimator for non-linear
Expand Down
1 change: 0 additions & 1 deletion promis/estimators/smoothers/rts.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@


class Rts(Kalman):

"""The RTS smoother for linear state estimation.

The RTS smoother is a state estimator for linear state space models, i.e. models that
Expand Down
1 change: 0 additions & 1 deletion promis/estimators/smoothers/unscented_rts.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@


class UnscentedRts(UnscentedKalman):

"""The unscented Kalman filter for non-linear state estimation.

This filter behaves similarly to the standard Rts smoother, but utilizes the so-called
Expand Down
3 changes: 1 addition & 2 deletions promis/geo/collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def make_latin_hypercube(
height: float,
number_of_samples: int,
number_of_values: int = 1,
include_corners: bool = False
include_corners: bool = False,
) -> "Collection":
samples = LatinHypercube(d=2).random(n=number_of_samples)
samples = scale(samples, [-width / 2, -height / 2], [width / 2, height / 2])
Expand Down Expand Up @@ -559,7 +559,6 @@ def to_cartesian(self) -> CartesianCollection:


class HybridInterpolator:

def __init__(self, coordinates, values):
self.linear = LinearNDInterpolator(coordinates, values)
self.nearest = NearestNDInterpolator(coordinates, values)
Expand Down
3 changes: 1 addition & 2 deletions promis/geo/geospatial.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@


class Geospatial(ABC):

"""The common abstract base class for both polar and cartesian geospatial objects.

See :meth:`~Geospatial.to_geo_json` on how this class can be used for visualizing geometries.
Expand Down Expand Up @@ -124,7 +123,7 @@ def to_geo_json(
),
)

def send_to_gui(self, url: str ="http://localhost:8000/add_geojson", timeout: int = 1):
def send_to_gui(self, url: str = "http://localhost:8000/add_geojson", timeout: int = 1):
"""Send an HTTP POST-request to the GUI backend.

Args:
Expand Down
1 change: 0 additions & 1 deletion promis/geo/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@


class Direction(float, Enum):

"""A simple collection of named "compass" bearings in degrees for self-documenting code."""

NORTH = 0.0
Expand Down
2 changes: 1 addition & 1 deletion promis/geo/location.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ def to_polar(self, origin: "PolarLocation | None" = None) -> PolarLocation:
def distance(self, other: Any) -> float:
return cast(float, self.geometry.distance(other.geometry))

def send_to_gui(self, url = "http://localhost:8000/add_geojson", timeout = 1):
def send_to_gui(self, url="http://localhost:8000/add_geojson", timeout=1):
raise NotImplementedError("Cartesian Location does not have geospatial feature to send to gui!")

def __repr__(self) -> str:
Expand Down
7 changes: 4 additions & 3 deletions promis/geo/map.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def to_cartesian(self) -> "CartesianMap":

return CartesianMap(self.origin, cartesian_features)

def send_to_gui(self, url: str ="http://localhost:8000/add_geojson_map", timeout: int = 10):
def send_to_gui(self, url: str = "http://localhost:8000/add_geojson_map", timeout: int = 10):
"""Send an HTTP POST-request to the GUI backend to add all feature in the map to gui.

Args:
Expand All @@ -221,12 +221,13 @@ def send_to_gui(self, url: str ="http://localhost:8000/add_geojson_map", timeout
data = "["
for feature in self.features:
data += feature.to_geo_json()
data += ','
data += ","
data = data[:-1]
data += ']'
data += "]"
r = post(url=url, data=data, timeout=timeout)
r.raise_for_status()


class CartesianMap(Map):
"""A map containing geospatial objects based on local coordinates with a global reference point.

Expand Down
2 changes: 1 addition & 1 deletion promis/geo/polygon.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ def plot(self, axis, **kwargs) -> None:
def distance(self, other: Any) -> float:
return self.geometry.distance(other.geometry)

def send_to_gui(self, url = "http://localhost:8000/add_geojson", timeout = 1):
def send_to_gui(self, url="http://localhost:8000/add_geojson", timeout=1):
raise NotImplementedError("Cartesian Polygon does not have geospatial feature to send to gui!")

def __repr__(self) -> str:
Expand Down
4 changes: 1 addition & 3 deletions promis/geo/polyline.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ def to_numpy(self) -> ndarray:


class PolarPolyLine(PolyLine):

"""A polyline (line string) based on WGS84 coordinates.

Note:
Expand Down Expand Up @@ -211,7 +210,6 @@ def __repr__(self) -> str:


class CartesianPolyLine(PolyLine):

"""A Cartesian polyline (line string) in local coordinates.

Args:
Expand Down Expand Up @@ -316,7 +314,7 @@ def from_numpy(cls, data: ndarray, *args, **kwargs) -> "CartesianPolyLine":
def distance(self, other: Any) -> float:
return self.geometry.distance(other.geometry)

def send_to_gui(self, url = "http://localhost:8000/add_geojson", timeout = 1):
def send_to_gui(self, url="http://localhost:8000/add_geojson", timeout=1):
raise NotImplementedError("Cartesian PolyLine does not have geospatial feature to send to gui!")

def __repr__(self) -> str:
Expand Down
4 changes: 2 additions & 2 deletions promis/geo/raster_band.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ def search_path(
start: tuple[float, float],
goal: tuple[float, float],
cost_model: Callable[[float], float],
value_filter: Callable[[float], float]
value_filter: Callable[[float], float],
) -> NDArray:
"""Search the shortest path through this RasterBand using A*.

Expand All @@ -122,7 +122,7 @@ def heuristic(a, b):
tuple(self.get_nearest_coordinate(start)),
tuple(self.get_nearest_coordinate(goal)),
heuristic=heuristic,
weight='weight'
weight="weight",
)

return array(path)
Expand Down
2 changes: 1 addition & 1 deletion promis/loaders/osm_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def __init__(
origin: PolarLocation,
dimensions: tuple[float, float],
feature_description: dict | None,
timeout: float = 5.0
timeout: float = 5.0,
):
# Initialize Overpass API
self.overpass_api = Overpass()
Expand Down
1 change: 0 additions & 1 deletion promis/logic/solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@


class Solver:

"""A solver for HPLP based ProMis.

Args:
Expand Down
8 changes: 3 additions & 5 deletions promis/logic/spatial/relation.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,8 @@ def index_to_distributional_clause(self, index: int) -> str:
else:
relation = f"{self.problog_name}(x_{index}, {self.location_type})"

mean = self.parameters.data['v0'][index]
std = sqrt(clip(self.parameters.data['v1'][index], self.enforced_min_variance, None))
distribution = (
f"normal({mean}, {std})"
)
mean = self.parameters.data["v0"][index]
std = sqrt(clip(self.parameters.data["v1"][index], self.enforced_min_variance, None))
distribution = f"normal({mean}, {std})"

return f"{relation} ~ {distribution}.\n"
1 change: 0 additions & 1 deletion promis/models/gaussian.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@


class Gaussian:

"""A weighted multivariate gaussian distribution.

Examples:
Expand Down
1 change: 0 additions & 1 deletion promis/models/gaussian_mixture.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@


class GaussianMixture:

"""The Gaussian Mixture Model (GMM) for representing multi-modal probability distribution.

Args:
Expand Down
2 changes: 1 addition & 1 deletion promis/promis.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ def adaptive_solve(
batch_size: int = 10,
scaler: float = 10.0,
interpolation_method: str = "linear",
acquisition_method: str = "entropy"
acquisition_method: str = "entropy",
):
"""Automatically add support points at locations where the uncertainty is high.

Expand Down
8 changes: 4 additions & 4 deletions promis/star_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def adaptive_sample(
what: dict[str, Iterable[str | None]] | None = None,
scaler: float = 10.0,
value_index: int = 0,
acquisition_method: str = "entropy"
acquisition_method: str = "entropy",
):
"""Automatically add support points at locations where the uncertainty is high.

Expand Down Expand Up @@ -224,7 +224,7 @@ def value_function(points):
number_of_improvement_points=number_of_improvement_points,
scaler=scaler,
value_index=value_index,
acquisition_method=acquisition_method
acquisition_method=acquisition_method,
)

def _make_r_trees(self, location_type: str, number_of_random_maps: int):
Expand All @@ -242,7 +242,7 @@ def _compute_parameters(
relation: str,
location_type: str,
r_trees: list,
random_maps: list[CartesianMap]
random_maps: list[CartesianMap],
) -> NDArray:
# Get the class of the spatial relation
relation_class = self.relation_name_to_class(relation)
Expand Down Expand Up @@ -304,5 +304,5 @@ def sample(
# Update collection of sample points
self.relations[relation][location_type].parameters.append(
coordinates,
self._compute_parameters(coordinates, relation, location_type, r_trees, random_maps)
self._compute_parameters(coordinates, relation, location_type, r_trees, random_maps),
)
8 changes: 8 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@ target-version = "py310"
# GitLab CI code quality report
output-format = "grouped"

[tool.ruff.format]

# Quote style for strings: "single" or "double"
quote-style = "double"

# Automatically format docstrings
docstring-code-format = false

[tool.ruff.lint.pep8-naming]
ignore-names = [
"i",
Expand Down