From 92838a981f077c818a3b99087c605b2a04bc23d9 Mon Sep 17 00:00:00 2001 From: Sebastian Heimann Date: Tue, 5 Dec 2023 08:36:07 +0100 Subject: [PATCH 1/5] fix installation issues --- pyproject.toml | 2 +- setup.py | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index d64cb22..6514e73 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -36,7 +36,7 @@ dependencies = [ "numpy>=1.17.3", "scipy>=1.6.0", "PyQt5>=5.15.0", - "pyqtgraph==0.11.0", + "pyqtgraph>=0.11.0", "pyrocko>=2022.06.10", "utm>=0.7.0", "geojson>=2.5.0", diff --git a/setup.py b/setup.py index 40713a7..d40dbd4 100644 --- a/setup.py +++ b/setup.py @@ -172,7 +172,9 @@ def _have_openmp(): ], } else: - metadata = {} + metadata = dict( + ext_package="kite", + ) setup( From 35404937a2370b9ea706af9292897ddc27a1118a Mon Sep 17 00:00:00 2001 From: Sebastian Heimann Date: Tue, 5 Dec 2023 09:24:25 +0100 Subject: [PATCH 2/5] compatibility with newer pyrocko version --- kite/scene.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kite/scene.py b/kite/scene.py index 6c3ba71..4b6d0bb 100644 --- a/kite/scene.py +++ b/kite/scene.py @@ -8,7 +8,7 @@ import numpy as np import utm -from pyrocko.dataset.topo import srtmgl3 +from pyrocko.dataset import topo from pyrocko.guts import Dict, Float, Object, String, StringChoice, Timestamp, load from pyrocko.orthodrome import latlon_to_ne, latlon_to_ne_numpy, ne_to_latlon # noqa from scipy import interpolate @@ -643,6 +643,7 @@ def los_rotation_factors(self): return self._los_factors def get_elevation(self, interpolation="nearest_neighbor"): + srtmgl3 = topo.dem("SRTMGL3") assert interpolation in ("nearest_neighbor", "bivariate") if self._elevation.get(interpolation, None) is None: From 376efb9d6f44f08f5e3ab1b15c9280771096c047 Mon Sep 17 00:00:00 2001 From: Sebastian Heimann Date: Tue, 5 Dec 2023 10:58:06 +0100 Subject: [PATCH 3/5] fix compatibility with newer pyqtgraph --- kite/spool/base.py | 16 +++++++++++----- kite/spool/tab_covariance.py | 10 ++++++++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/kite/spool/base.py b/kite/spool/base.py index 702ad14..69ab0a6 100644 --- a/kite/spool/base.py +++ b/kite/spool/base.py @@ -3,7 +3,7 @@ import numpy as np import pyqtgraph as pg import pyqtgraph.parametertree.parameterTypes as pTypes -from PyQt5 import QtCore +from PyQt5 import QtCore, QtGui from pyqtgraph import dockarea from kite.qt_utils import _viridis_data @@ -19,6 +19,12 @@ def get_resource(filename): return path.join(path.dirname(path.realpath(__file__)), "res", filename) +def set_scale(image, width, height): + tr = QtGui.QTransform() + tr.scale(width, height) + image.setTransform(tr) + + class KiteView(dockarea.DockArea): title = "View Prototype" @@ -239,13 +245,13 @@ def enableHillshade(self): None, autoDownsample=False, border=None, useOpenGL=False ) hillshade.resetTransform() - hillshade.scale(frame.dE, frame.dN) + set_scale(hillshade, frame.dE, frame.dN) elev_img = pg.ImageItem( None, autoDownsample=False, border=None, useOpenGL=False ) elev_img.resetTransform() - elev_img.scale(frame.dE, frame.dN) + set_scale(elev_img, frame.dE, frame.dN) elev_img.updateImage(elevation.T, autoLevels=True) hillshade.updateImage(shad.T, autoLevels=True) @@ -269,7 +275,7 @@ def transFromFrame(self): frame = self.model.frame self.image.resetTransform() - self.image.scale(frame.dE, frame.dN) + set_scale(self.image, frame.dE, frame.dN) def scalebar(self): """Not working""" @@ -437,12 +443,12 @@ def __init__(self, model, model_attr=None, **kwargs): self.model = model self.model_attr = model_attr + pTypes.GroupParameter.__init__(self, **kwargs) self.parameters = getattr(self, "parameters", []) if isinstance(self.parameters, list): self.parameters = dict.fromkeys(self.parameters) - pTypes.GroupParameter.__init__(self, **kwargs) self.updateValues() def updateValues(self): diff --git a/kite/spool/tab_covariance.py b/kite/spool/tab_covariance.py index 3263f28..36ffe4f 100644 --- a/kite/spool/tab_covariance.py +++ b/kite/spool/tab_covariance.py @@ -3,7 +3,7 @@ import numpy as np import pyqtgraph as pg import pyqtgraph.parametertree.parameterTypes as pTypes -from PyQt5 import QtCore, QtWidgets +from PyQt5 import QtCore, QtGui, QtWidgets from pyqtgraph import dockarea from kite.covariance import CovarianceConfig @@ -26,6 +26,12 @@ pen_roi_highlight = pg.mkPen((115, 210, 22), width=2, style=QtCore.Qt.DashLine) +def set_rotate(item, angle): + tr = QtGui.QTransform() + tr.rotate(angle) + item.setTransform(tr) + + class KiteCovariance(KiteView): title = "Scene.covariance" @@ -477,7 +483,7 @@ def updateHistogram(): ge.hist_syn.setData(*h) ge.hist_syn = pg.PlotDataItem(pen=hist_pen) - ge.hist_syn.rotate(90.0) + set_rotate(ge.hist_syn, 90.0) ge.vb.addItem(ge.hist_syn) updateHistogram() From 200972bb5880a28e64fc04c845f339f925600fcc Mon Sep 17 00:00:00 2001 From: Sebastian Heimann Date: Wed, 13 Dec 2023 12:10:44 +0100 Subject: [PATCH 4/5] spool: fix setMaximum type error --- kite/spool/spool.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kite/spool/spool.py b/kite/spool/spool.py index 579a760..58aabb5 100644 --- a/kite/spool/spool.py +++ b/kite/spool/spool.py @@ -202,7 +202,7 @@ def progressStarted(self, args): self.progress.setWindowTitle("Processing...") self.progress.setLabelText(text) - self.progress.setMaximum(maximum) + self.progress.setMaximum(int(maximum)) self.progress.setValue(0) @QtCore.pyqtSlot() From c746756640d4ab72d32bd627160b0bc942545ecb Mon Sep 17 00:00:00 2001 From: hvasbath Date: Thu, 18 Jan 2024 14:49:57 +0100 Subject: [PATCH 5/5] covariance_ext: fix adaptive subsampling increment when scene is small --- kite/ext/covariance.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/kite/ext/covariance.c b/kite/ext/covariance.c index cf1b4c0..e7192b5 100644 --- a/kite/ext/covariance.c +++ b/kite/ext/covariance.c @@ -27,6 +27,13 @@ uint32_t finished_combinations = 0; typedef npy_float32 float32_t; typedef npy_float64 float64_t; +#ifndef max + #define max(a,b) \ + ({ __typeof__ (a) _a = (a); \ + __typeof__ (b) _b = (b); \ + _a > _b ? _a : _b; }) +#endif + typedef enum { SUCCESS = 0, SAUBSAMPLING_SPARSE_ERROR @@ -127,7 +134,7 @@ static state_covariance calc_covariance_matrix( for (il1=0; il1