Questions tagged [scipy-spatial]
103 questions
1
vote
1 answer
Problem with distance.euclidean() missing 'u' and 'v'
So, i'm learning machine learning and i wanted to "create" my own classifier
but when i try to run it it says that in distance.euclidean() misses 'u' and 'v'
Can you help me find out the problem?
import random
from scipy.spatial import…

Danilo
- 23
- 5
1
vote
1 answer
How to compute a spatial distance matrix from a given value
I've been looking for a way to (efficiently) compute a distance matrix from a target value and an input matrix.
If you consider an input array as:
[0 0 1 2 5 2 1]
[0 0 2 3 5 2 1]
[0 1 1 2 5 4 1]
[1 1 1 2 5 4 0]
Ho do you compute the spatial…

Bibi
- 53
- 4
1
vote
1 answer
How to add simplices to a scipy Delaunay triangulation object
I already have a rectangle triangulated by a scipy.spatial.Delaunay() object. I manage to stretch and curve it around so that it looks like an annulus cut along a line. Here is some code to make something with the same topology:
from scipy.spatial…

ap21
- 2,372
- 3
- 16
- 32
1
vote
0 answers
Calculating Spatial Distance returns operand error
It is a follow-up question to my previous question:
I have a dataframe like this
Company_id year dummy_1 dummy_2 dummy_3 dummy_4 dummy_5
1 1990 1 0 1 1 1
1 1991 0 0 1 1 0
1 …

Dogukan Yılmaz
- 556
- 2
- 15
1
vote
2 answers
How to create volume from point cloud in spherical coordinates?
I have two sets of discrete points in spherical coordinates, each representing top and bottom surfaces of an object.
I am trying to create volume from these points to separate points which lies inside and outside the object. Any suggestions where…

GTR
- 13
- 5
1
vote
2 answers
Scipy Euclidean distance between two points
The below code for calculating the Euclidean distance between two points returns [[9.]] :
from scipy import spatial
d1 = [[11 , 3]]
d2 = [[2 , 3]]
print(spatial.distance.cdist(d1 , d2 , "euclidean"))
But the Euclidean distance between these two…

blue-sky
- 51,962
- 152
- 427
- 752
0
votes
0 answers
I tried to colorize of a Voronoï diagram using the dedeicated scipy.spatial module but the colors don't match
I have an image made of many dots of 5 different colours.
I'd like to create a Voronoï diagram where every created region around a dot is filled with the same colour.
I'm able to create the diagram without colours, but when I want to add them they…

chloe bke
- 1
- 1
0
votes
0 answers
Using imported packages to calculate 2-point correlation functions between features of an image
I have been doing a lot of reading on 2-point correlation functions, and nothing has struck me as useful yet. I am trying to use Python to calculate 2-point spatial correlation functions for various features in an image (particle-particle;…

d.nikolai
- 1
- 1
0
votes
0 answers
How do I plot boundary lines from a mesh?
I am working on a visualization for voronoi regions in python. Using a mesh of 110x110 points in a 10x10 plane I have obtained the voronoi regions. In the plot you can see all the points plotted with a different color to indicate the different…
0
votes
0 answers
How to express 1D data in linear combination of Spherical harmonics?
I am new to python and wish to calculate a wavefunction by fitting 1D data to a linear combination of spherical harmonics.
I am thinking of expressing wavefcntion as follows
wavefcuntion = aY0+bY1+c*Y2......Yn
and then fit cofficient using curve…
0
votes
1 answer
How do I reduce the number of ConvexHull Vertices from a Pandas Dataframe
I am using scipy.spatial ConvexHull to create an envelope around a dataset, here is an example that creates the dataset and the envelope using ConvexHull,
import pandas as pd
import numpy as np
from scipy.spatial import ConvexHull,…

James
- 29
- 2
- 6
0
votes
0 answers
how to take rms without considering extreme points
I center each point on my graph and take the rms with the points that are within 8's of that centered point. However, the points at the ends skew my results. I would like to know how to disregard these extreme points when removing the rms but…

Jezebel
- 1
- 1
0
votes
1 answer
Define a Voronoi cell max radius (python)
My question is similar to this one (R + ggplot) but for Python.
Question
How to generate a (2D) Voronoi diagram where cells have a maximum extend / growth limit ?
it would result in some cells with curved boundary (circle arc), and some space…

LoneWanderer
- 3,058
- 1
- 23
- 41
0
votes
0 answers
How to create minimum enclosing area from given datapoints, analyse the found areas and quantify respective to each other
I have a 2D datapoint set (Nx2) and they are labelled (Nx1). I need to check if the minimum enclosing areas created by the datapoints with the same label are behaving well.
Well behaviour: having roughly the same shape (or at least same orientation)…

Uğur Dinç
- 303
- 3
- 16
0
votes
0 answers
Merging Delaunay Triangulations in scipy
Starting from a sphere, I check if a new point is inside the sphere, if not I would like to add a sphere centered around the new point to the Delaunay Triangulated space.
Unfortunately, I can only find a way to add points to the Delaunay class.
Is…

Raymond gsh
- 363
- 3
- 15