Questions tagged [scipy-spatial]

103 questions
0
votes
0 answers

Efficient calculation of cosine_distance of a csc_sparse_matrix using scipy.spatial.distance

Have a csc_matrix sparse named as eventPropMatrix having datatype=float64 with shape=(13000,7). Upon which I am applying following distance calculating function. Here eventPropMatrix.getrow(i).todense()==[[0. 0. 0. 0. 0. 0.…
afghani
  • 467
  • 5
  • 7
0
votes
1 answer

Shapely Convex Hull area gives radically different results from scipy.ConvexHull area?

I must be missing something incredibly obvious, but there seems to be a huge difference in the area computed by scipy.ConvexHull.area compared to shapely.convex_hull.area. I get Scipy Convex Hull Area: 457761.9061526276, Shapely Convex Hull Area:…
Lieu Zheng Hong
  • 676
  • 1
  • 10
  • 22
0
votes
0 answers

Scipy vs Matlab: 3D Rotations matrix

I compared the outputs of scipy and MATLAB functions for creating 3D rotation matrices and the two programs showed different results. First SciPys scipy.spatial.transform.Rotation: >>> import numpy as np >>> from scipy.spatial.transform import…
JakobJakobson13
  • 135
  • 1
  • 4
  • 13
0
votes
2 answers

Scipy ImportError: No module named transform

I'm using a python script within ROS. Ros uses python 2.7 and the version of scipy that I'm using is 0.19.1. The following error is reported: from scipy.spatial.transform import Rotation as R ImportError: No module named transform
Didon
  • 383
  • 2
  • 4
  • 13
0
votes
1 answer

speed up in finding nearst points and sorting them in python

I have N points in 2D space (N row, 2 column) and I want to find nearest k points for each point (x_n,y_n) in the point set and then sort them. Here is the codes for this purpose. I want to speed up the following codes: def nearst_sort(x,y,k): …
For Bonder
  • 67
  • 5
0
votes
2 answers

smart computation of distances over a (sparse ?) numpy.meshgrid

I want to compute distances between every pairs of nodes on a regular 3D-grid. The grid may be huge, so I want to optimize the computation (privilege to the CPU). After many many tests, I gave up the ‘scitools’ module, that is convenient only for…
Stéphane
  • 1,389
  • 3
  • 13
  • 34
0
votes
1 answer

ModuleNotFoundError: No module named 'spatial'

I've been faced to Module Not Found Error in a script which all it's requirements has been installed. I'm trying to import spatial library: import spatial This library is located…
Zar Ashouri
  • 174
  • 3
  • 17
0
votes
1 answer

Fetch points label within specified distance/Boundary- Python

I would like to fetch the points label which are with in specified distance I have pasted the sample coordinates below. Points A1 to A5 are the zones, points P1 to P30 are the points to be fetched out, which are falling with in 10000 meter from the…
Bhuvan Kumar
  • 554
  • 1
  • 7
  • 23
0
votes
1 answer

Adding results from ckdTree cluster to DataFrame in Pandas

I'm trying to use ckdTree to find all of the data points within a specified distance (1500 m). I have a dataframe of centres, and a dataframe of raw data. My plan was to use the x and y coordinates extracted from the clusters to build a new…
0
votes
2 answers

Find 10 closest points in decreasing order

I am trying to find the distance between a point and other 40,000 points. Each point is a 300 dimension vector. I am able to find the closes point. How do I find the 10 nearest points in decreasing order? Function for closest point: from…
Jerry George
  • 335
  • 1
  • 7
  • 23
0
votes
1 answer

Vectorized spatial distance between values in multidimensional arrays

Given an (2,2,3,3,3) array of 3D-cartesian coordinates along the last dimension, what is the syntax for computing the Euclidean between pairwise values in XA and XB using scipy.spatial.distance.cdist to yield an output array with shape (2, 3, 3)? XA…
Kambiz
  • 685
  • 2
  • 8
  • 18
0
votes
0 answers

Scipy's KDTree query doesn't find anything

So, I have two numpy arrays, a, of shape (p,2) and b, of shape (q,2). I create a KDTree with scipy c=sp.KDTree(a) I have an upper bound, ub=1.0/12.0 When I do print c.query(b,distance_upper_bound=ub) I get…
Federico
  • 1
  • 2
1 2 3 4 5 6
7