fixed graph_belts.py interpolate2d edge case bug on indices in table borders
This commit is contained in:
@@ -192,8 +192,13 @@ def interpolate_2d(target_x, target_y, source_x, source_y, source_data):
|
|||||||
# and ensure we don't exceed array bounds
|
# and ensure we don't exceed array bounds
|
||||||
x_indices = np.searchsorted(source_x, x) - 1
|
x_indices = np.searchsorted(source_x, x) - 1
|
||||||
y_indices = np.searchsorted(source_y, y) - 1
|
y_indices = np.searchsorted(source_y, y) - 1
|
||||||
x_indices = max(0, min(len(source_x) - 2, x_indices))
|
x_indices = max(0, min(len(source_x) - 1, x_indices))
|
||||||
y_indices = max(0, min(len(source_y) - 2, y_indices))
|
y_indices = max(0, min(len(source_y) - 1, y_indices))
|
||||||
|
|
||||||
|
if x_indices == len(source_x) - 2:
|
||||||
|
x_indices -= 1
|
||||||
|
if y_indices == len(source_y) - 2:
|
||||||
|
y_indices -= 1
|
||||||
|
|
||||||
x1, x2 = source_x[x_indices], source_x[x_indices + 1]
|
x1, x2 = source_x[x_indices], source_x[x_indices + 1]
|
||||||
y1, y2 = source_y[y_indices], source_y[y_indices + 1]
|
y1, y2 = source_y[y_indices], source_y[y_indices + 1]
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ If needed, refer to [my IS graphs documentation](./docs/input_shaper.md) for tip
|
|||||||
|
|
||||||
| Belts graphs | X graphs | Y graphs | Vibrations measurement |
|
| Belts graphs | X graphs | Y graphs | Vibrations measurement |
|
||||||
|:----------------:|:------------:|:------------:|:---------------------:|
|
|:----------------:|:------------:|:------------:|:---------------------:|
|
||||||
|  |  |  |  |
|
|  |  |  |  |
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
|
|||||||
BIN
docs/images/X_example.png
Normal file
BIN
docs/images/X_example.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 745 KiB |
BIN
docs/images/Y_example.png
Normal file
BIN
docs/images/Y_example.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 754 KiB |
BIN
docs/images/belts_example.png
Normal file
BIN
docs/images/belts_example.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 169 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 68 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 142 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 158 KiB |
Reference in New Issue
Block a user