The numpy tag has no wiki summary.
-1
votes
0answers
25 views
Maximum Recursion Occurs in Nested Matrix, Keller Box example [closed]
This is the full program and my proposed algorithm, i have fixed the syntax but i cant seem to let the program run, i seem some help to understand, what and where does this algorithm went wrong. it is ...
2
votes
1answer
27 views
Eliminate for loops in numpy implementation
I have the following dataset in numpy
indices | real data (X) |targets (y)
| |
0 0 | 43.25 665.32 ... |2.4 } 1st block
0 0 | 11.234 |-4.5 }
0 ...
5
votes
2answers
112 views
Critiques on a trivially easy to use Python CSV class
I have been working on a project where I needed to analyze multiple, large datasets contained inside many CSV files at the same time. I am not a programmer but an engineer so I did a lot of searching ...
1
vote
1answer
48 views
Using numpy polynomial module - is there a better way?
I'm working on a project where I need to solve for one of the roots of a quartic polymonial many, many times. Is there a better, i.e., faster way to do this? Should I write my own C-library? The ...
2
votes
1answer
36 views
How can I speed up this correlation function Python
I am writing a specialized version of the cross correlation function as used in neuroscience. The function below is supposed to take a time series data and ask how many of its values fall in specified ...
3
votes
1answer
111 views
Are these list-comprehensions written the fastest possible way?
This is a simple repeatable question regarding the usage of Python3's comprehensions:
Could the Python3 syntax be used in another way to speed up the process, further so the gap between Python3 and ...
2
votes
1answer
59 views
Performance problems with 1D cellular automata experiment in Python with Numpy
I'm an experienced programmer but relatively new to Python (a month or so) so it's quite likely that I've made some gauche errors. I very much appreciate your time spent taking a look at my code.
My ...
0
votes
1answer
34 views
Figuring out the structure of a shape tuple
I have some code that uses a multidimensional look-up table (LUT) to do interpolation. The typical application is a color space conversion, where 3D inputs (RGB) are converted to 4D (CMYK), but the ...
2
votes
3answers
141 views
A pythonic way of de-interleaving a list (i.e. data from a generator), into multiple lists
I've recently discovered the wonders of the Python world, and am quickly learning. Coming from Windows/C#/.NET, I find it refreshing working in Python on Linux. A day you've learned something new is ...
2
votes
0answers
142 views
Is there better way to read from a file and connect all data in one big data than to use generators?
Is there better way to read from a file and connect all data in one big data than to use generators?
At the moment, I do the following:
use generators to read data from files.
use numpy to pack all ...
3
votes
1answer
56 views
How can I make this code faster using Numpy?
I have been reading some Numpy guides but can't seem to figure it out. my TA told me I should be able to speed up my code by using a numpy array instead of a for loop in the following segment of code.
...
4
votes
1answer
135 views
Optimizing Python / Numpy Code
So I'm implementing a version of the mean shift image processing algorithm for color segmentation in python/numpy.
I've written a pure numpy version of the actual mean shifting per pixel (which I ...
1
vote
1answer
205 views
Python / Numpy running 15x slower than MATLAB - am I using Numpy effeciently?
Here is some code I wrote in Python / Numpy that I pretty much directly translated from MATLAB code. When I run the code in MATLAB on my machine, it takes roughly 17 seconds. When I run the code in ...
2
votes
2answers
114 views
Simple arithmetic in Python
As a beginner, I wrote the following python script that solves warrant 1 of this document - pp 436-438.
My solution, although works, seems to me as poorly designed and highly unmaintanable. I was ...
0
votes
1answer
72 views
Python comparison numpy matrix
I need a numpy matrix with comparisons among all elements in a sequence:
from numpy import matrix
seq = [0, 1, 2, 3]
matrix([[cmp(a, b) for a in seq] for b in seq])
I'd like to know if there is a ...
1
vote
1answer
234 views
Data cleaning - am I using classes correctly here?
I have a data processing application that does some data cleaning as the first step. This is the module I import for that purpose.
The only 'public' part of the api is the 'clean' function which ...
1
vote
1answer
90 views
Simple utility/convenience module - am I doing it right?
I have a large library (four packages) of data processing code that I have written over the last 12 months. I am quite new to python and would like to see if I am doing things correctly.
This ...
1
vote
1answer
271 views
Linear Regression and data manipulation
How could I improve the following code that runs a simple linear regression using matrix algebra? I import a .csv file (link here) called 'cdd.ny.csv', and perform the matrix calculations that solve ...
6
votes
1answer
192 views
Code Review of small scientific project, particuarly array vs. list perform
I'm new to python but not to programming in general. This is my first project beyond the basics.
I was wondering if I could get some feedback on the code in general, in particular on any bad Java/C++ ...
1
vote
2answers
302 views
Python: optimize this rolling loop
I have a numpy array of about 2500 data points. This function is called on a rolling basis where 363 data points is passed at a time.
def fcn(data):
a = [data[i]/np.mean(data[i-2:i+1])-1 for i in ...
4
votes
5answers
441 views
Python function speedup - how to?
I wrote a simple function that calculates and returns the maximum drawdown of a set of returns. I am trying to squeeze as much efficiency out of the code as possible for speed. I've got it down to ...