Questions tagged [scipy-spatial]
103 questions
1
vote
1 answer
numpy.vectorise() signature potentially causes scipy.spatial.distance.jaccard() dimension issue
I'm a numpy baby and am looking at using numpy.vectorise() to compute a distance matrix. I think that a key part of this is the signature param, but when I run the code below I get an error:
import numpy as np
from scipy.spatial.distance import…

Tim Kirkwood
- 598
- 2
- 7
- 18
1
vote
1 answer
I cant import scipy.spacial.distance properly
from scipy.spacial.distance import squareform, pdist, cdist
it says 'could not be resolved'. I am using python for a boids program.

Jeremi
- 153
- 1
- 1
- 7
1
vote
1 answer
How to calculate which Voronoi cells are in specific area in Python?
I have some points which illustrates heads of pedestrians during an experiment in each frame. I need to calculate which Voronoi Cells are in specific area - measurement square:
x_range = (-0.4, 0.4)
y_range = (0.5, 1.3)
So I've adapted a sample of…

baziorek
- 2,502
- 2
- 29
- 43
1
vote
1 answer
Why is Scipy.spatial.distance.cdist fast if it uses a double for loop?
I've been told that double for loops are slow in Python. However, while digging into the implementation of Scipy.spatial.distance.cdist(), I found that it's just a double for loop and not some clever numpy trick. And yet, many answers (e.g.…

Alantin14
- 17
- 3
1
vote
0 answers
SciPy Rotation only gives correct answer when I use inv()
What am I doing wrong here?
I have a function that rotates Euler angle inputs using rotation matrices and NumPy. This is proven to be correct because it is currently running on drones that are using it in real-time in their flight control loop.
I'm…

PHinchey
- 31
- 1
1
vote
1 answer
SciPy Delaunay triangulation changes multiple points of simplex for tiny change in parameters
I'm using a Delaunay triangulation to interpolate in some function values evaluated at a set of parameters on a regular 4-dimensional grid. Sometimes, when a parameter value changes by a small amount that takes it to a new simplex, more than one…

Warrick
- 697
- 10
- 19
1
vote
1 answer
How to link initial points coordinates to corresponding Voronoi vertices coordinates in scipy?
I use Voronoi from scipy.spatial to draw points and polygons.
Now I need export table/dataframe which link coordinates of initial points to polygon vertices coordinates but I cannot find corresponding formula from attributes (points, vertices,…

Andrey
- 23
- 3
1
vote
1 answer
Minimum Euclidean Distance
I have two dataframes (attached image). For each of the given row in Table-1 -
Part1 - I need to find the row in Table-2 which gives the minimum Euclidian distance. Output-1 is the expected answer.
Part2 - I need to find the row in Table-2 which…

RPyML
- 13
- 4
1
vote
1 answer
Evaluate the weights of a convex combination
I'm using the scipy.spatial.ConvexHull API for evaluating the convex hull of a set of points and it works well. Given the code below:
p1 = points[11]
hull = ConvexHull(points)
vertices = [points[i] for i in hull.vertices]
how can I evaluate the…

Moshe
- 555
- 3
- 14
1
vote
1 answer
image distance transform different xyz voxel sizes
I would like to find minimum distance of each voxel to a boundary element in a binary image in which the z voxel size is different from the xy voxel size. This is to say that a single voxel represents a 225x110x110 (zyx) nm volume.
Normally, I would…

tdaugird
- 51
- 4
1
vote
2 answers
Scipy Coordinate system
i cannot find the definition of scipy's coordinate system.
i have tried several values (assuming a right hand system) but got a strange result.
for example:
from scipy.spatial.transform import Rotation as R
R.from_euler('zyx',…

Yakov Miron
- 11
- 1
1
vote
1 answer
Creating networkx graph using Delaunay Triangulation
I have a Delaunay Triangulation (DT) (scipy) as follows:
# Take first 50 rows with 3 attributes to create a DT-
d = data.loc[:50, ['aid', 'x', 'y']].values
dt = Delaunay(points = d)
# List of triangles in the DT-
dt.simplices …

Arun
- 2,222
- 7
- 43
- 78
1
vote
1 answer
Is there a more clear description of SciPy's implementation of the Jaccard-Needham (Dis)similiarity formula?
I have reviewed SciPy's documentation explaining their implementation formula of the Jaccard-Needham dissimilarity function https://docs.scipy.org/doc/scipy/reference/generated/scipy.spatial.distance.jaccard.html#scipy.spatial.distance.jaccard.…

Lee
- 49
- 5
1
vote
1 answer
hausdorff distance in python of 2xN matrices with different number of columns
I have two 2xN matrices of values and I want to find the hausdorff distance of them using "directed_hausdorff(u,v)" function. However, since the number of columns are not equal in both matrices I want to find the hausdorff distance of using the…

Angie
- 183
- 3
- 13
1
vote
0 answers
How to avoid Delaunay.find_simplex function from returning -1
I have a set of 500 7D array of points.
When I run the below code:
from scipy.spatial import Delaunay
delau = Delaunay(ip)
Delaunay.find_simplex(delau,ip)
Delaunay.find_simplex returns -1 for only one data point out of 500. I understand that this…

Pragati
- 35
- 4