All Questions
Tagged with performance numpy
239
questions
52
votes
3
answers
170k
views
Finding the closest point to a list of points
I'm trying to find the closest point (Euclidean distance) from a user-inputted point to a list of 50,000 points that I have. Note that the list of points changes all the time. and the closest distance ...
24
votes
2
answers
58k
views
Crop black border of image using NumPy
Objective: Crop the image so only the number stays in the image
Problem: Slow Performance
I have code that crops an image.
The image pixels are 0 or 255. There are no values between.
The ...
20
votes
4
answers
17k
views
Processing an image to extract green-screen mask
I am using OpenCV to process an image, and in my code, I have to check / edit each pixel separately:
...
18
votes
2
answers
97k
views
Fastest way to iterate over Numpy array
I wrote a function to calculate the gamma coefficient of a clustering. The bottleneck is the comparison of values from dist_withing to ...
16
votes
1
answer
391
views
Solve the phase state between two haplotype blocks using markov transition probabilities
I have spent about more than a year in python, but I come from biology background. I should say I have got some understanding of for-loop and nested-for-loop to workout the solution to the problem I ...
14
votes
2
answers
9k
views
Possible optimizations for calculating squared euclidean distance
I need to do a few hundred million euclidean distance calculations every day in a Python project.
Here is what I started out with:
...
14
votes
1
answer
10k
views
Faster computation of barycentric coordinates for many points
I'm just starting to understand the Python syntax and I created a module that does what I wanted, but really slow.
Here are the stats of cProfile, top 10 ordered by ...
13
votes
1
answer
1k
views
Temperature Interpolation
I want to interpolate temperature in correlation with height. I have temperature data from stations with coordinates and height in this format:
...
13
votes
1
answer
337
views
Population dynamic simulation on biological information maintenance 2
This question is the follow-up to this previous question.
Background
Using this simulation I investigate a system in which enzymes proliferate in cells. During the replications of enzymes, ...
13
votes
1
answer
1k
views
Plotting polynomials roots
NOTE: See follow up to this question here
I created a simple python script to plot quadratic, cubic and quartic polynomials with integer coefficients between -4 and 4. It uses numpy to find the roots ...
12
votes
2
answers
17k
views
Generating a 3D Point Cloud
I'm trying to produce a 3D point cloud from a depth image and some camera intrinsics. The image is 640x480, and is a NumPy array of bytes. The output is a (rows * columns) x 3 array of points.
I've ...
12
votes
1
answer
2k
views
Python program that draws the Mandelbrot set fractal
I wrote a Python program that draws the Mandelbrot set fractal. However, the program is very slow. I would appreciate any feedback on the program, but I would especially appreciate feedback on how to ...
11
votes
2
answers
524
views
Approximate (250 over 100) permutation best fitting certain criteria
Given a list of 250 words of 4 letters each, what is the fastest way, in Python, to find a subsample of 100 words (drawn without replacement) so that the distribution of letters across the whole ...
11
votes
1
answer
344
views
Calculate the closest point to many hyperbolic paraboloids
In this question I asked for a way to compute the closest projected point to a hyperbolic paraboloid using python.
Using the iterative approximation answer, I'm able to use the code below to ...
10
votes
2
answers
2k
views
A 3-D vector class built on top of numpy.array
I wanted a convenient class to easy access the parameters inside. I am using a lot of math in my game; that's why a wanted to access them through x, ...