A general purpose high-level programming language that emphasizes ease of code syntax and readability.

learn more… | top users | synonyms

1
vote
1answer
20 views

Speedier alternative to “skimage.morphology._pnpoly import points_inside_poly”?

I am using scikit-image's points_inside_poly function, and in my code I am calling it enough times that it takes up about 50% of ...
0
votes
1answer
53 views

Python: Computation time Issue with mpi4py

I am using in Python mpi4py to process in parallel 20 minimization functions. Each of the 20 worker processes the same algorithm but with different random initial ...
2
votes
1answer
64 views

Unwrap cylinder to plane in Paraview

I want to extract the data from the boundary surface of a cylinder (in a .vtu file) and plot it onto a plane, where the coordinates are theta (rotation angle) and ...
1
vote
1answer
42 views

Maximum function evaluation with NLOPT in Python

I am having an issue with the implementation of NLOPT in Python. My objective is to minimize a somewhat complicated Maximum Likelihood function. My function is called mle and there are 6 parameters ...
4
votes
4answers
75 views

Measurement error library

Is there a python library that would keep track of uncertainty in measured data? i.e. if I put in a figure of a±b is there an easy way to track the propagation of error through calculations.
4
votes
0answers
46 views

Line Integral Convolution (LIC) Requirements

I'm trying to plot some vector fields using LIC technique. More specifically, I'm using the Python solution for this kind of plot. Before applying that approach, I was plotting my vectors as quiver. ...
2
votes
2answers
55 views

Parametric spectrum estimation using aryule: difference between Python and Matlab

I have some code illustrating my problem below. As you can see from the results- Matlab is significantly faster than python. It seems that the function which performs the levinson durbin recursion in ...
0
votes
0answers
43 views

Principal Components Analysis Not Behaving as I Expect it to

I have a bunch of points in $\mathbb{R}^3$ that I would like to translate and rotate so that their center is at the origin and the variance along the $x$ and $y$ axes are maximal (greedy, and in that ...
0
votes
0answers
36 views

Python problem — .fit image resize

I'm using the below python code to resize the image that's of '.fit' file type: ...
2
votes
2answers
70 views

Python: What is a good way to generate a 1D particle field with a gaussian distribution?

If I have N particles how do I assign their x values so that the end result is Gaussian distribution. i.e. particles near the ends are more spread out than particles near the center.
0
votes
1answer
72 views

Tanh-sinh quadrature numerical integration method converging to wrong value

I'm trying to write a Python program to use Tanh-sinh quadrature to compute the value of \begin{equation} \int_{-1}^1 \frac{dx}{\sqrt{1-x^2}} \end{equation} but although the program converges to a ...
0
votes
1answer
56 views

Calculating periodicity of a pseudo random number generator (Middle-square method) [closed]

Below is a Python code that calculates the periodicity of the middle-square method for a given 4 digit-numbers: ...
1
vote
1answer
111 views

Python - calculation time derivative and laplacien by finite differences

I would like to determine a temporal derivitive and a Laplacian by the finite differences method to solve the heat equation in a 1-dimensional case. My aim is to get the sources term that is why I ...
1
vote
1answer
74 views

How can a quadratic positive definite minimization be unbounded [closed]

I am minimising a diagonal quadratic matrix using CPLEX. All off diagonal elements are zero. It has 500 variables and 20 linear constraints plus each variable is constrained to be within 0 and 1 All ...
0
votes
0answers
24 views

F2Py with allocatable and assumed shape arrays as callback arguments

I would like to use f2py to overload some fortran subroutines in my main fortran program by python methods. Some of these subroutines receive an assumed shape array. I have found here how to make ...
0
votes
1answer
23 views

Border Mapping of Scatter plot

I have scatter plot and I want to trace the border of that. for example: Plot: and I wanted it traced: Or at least wanted to know the border points? Also, is it possible to detect if any ...
2
votes
1answer
93 views

Organizing a CFD program written in python

I've spent some time writing a spectral element solver aimed at solving fluid flow problems concerning the motion of self-propelled bodies. I've gotten to the point where the code has grown long ...
4
votes
0answers
84 views

Sparse matrix ordering in Python

I would like to implement custom, domain-specific algorithms for sparse matrix orderings. I am looking for Python packages for ordering sparse matrices. It would be nice to have: The underlying ...
4
votes
1answer
114 views

Python: Multistart optimization using parallel programming

[I previously asked my question on StackOverflow but this site may be more appropriate] In Matlab, I am currently using the MultiStart as an optimization algo in a parallel setup for a computer ...
2
votes
2answers
64 views

Python package for (adaptive) function plotting

Are there any mature Python packages that can plot functions, and possibly use adaptive sampling? I am looking to pass only a function (can be a numerical black box) and a range, and expect a plot as ...
3
votes
3answers
151 views

scipy.sparse: Set row/column in sparse matrix to the identity without changing sparsity

I'm using the SciPy sparse.csr_matrix format for a finite element code. In applying the essential boundary conditions, I'm setting the desired value in the right ...
3
votes
1answer
76 views

Using numpy arrays in Paraview programmable filter

How can I access a field in Paraview's programmable filter as a numpy array? I want to: Import an existing field as a numpy array Create a similar array for output Register it as a new field for ...
3
votes
2answers
91 views

scipy odeint: sum of conservative ode equations does not remain zero as it is being solved — is this normal?

Let us say we have the following equations: dy1/dt = f(y1, t) [1] dy2/dt = g(y2, t) [2] The equations are such that they are "conservative", i.e. the ...
0
votes
1answer
86 views

PyOpenGL/OpenGL Generating Cosmic NBodys

I am working on a Universe Simulator. I'm stuck on creating the dark matters webs of the universe that look like this: http://www.mpa-garching.mpg.de/galform/data_vis/sim3dnew-highres.png I am ...
1
vote
0answers
176 views

Poisson equation with Neumann boundary conditions

I'm trying to solve the Poisson equation with pure Neumann boundary conditions, $$ \nabla^2\phi = \rho \quad in \quad \Omega\\ \mathbf{\nabla}\phi \cdot \mathbf{n} = 0 \quad on \quad \partial \Omega ...
2
votes
0answers
97 views

Polynomial Fitting with Least Squares using Numpy and Scipy

I am trying to fit data to a polynomial using Python - Numpy. The points, with lines sketched above them are as in the picture. I am trying to fit those points to a polynomial of 4. or 5. degree. ...
1
vote
0answers
44 views

learning Gurobi for MIP calculation [closed]

I am a new learner of Unix, python and Gurobi for MIP calculation. I basically finish reading the quick start guide in Gurobi website but still feel that I need more training to use this combination ...
1
vote
1answer
220 views

How do I integrate this function in python?

Essentially this is the problem: $\hat{F}(\omega) = \int_0^{\infty} f(s)e^{-i\omega s}ds$ The function $f$ is in general complex valued. I know this looks like the fourier transform but I don't want ...
1
vote
2answers
107 views

How to get ODE solution at specified time points?

The code below basically illustrates my problem. It is a test code for a pendulum. I solve it using a method suggested on ...
1
vote
3answers
176 views

Scripting for High Performance Computing

I would like links to resources which provide codes for scripting (preferably in python) for high performance computing. I'm looking for sample codes and examples which can, (1) automatically create ...
2
votes
3answers
86 views

importing PARI libraries ( in C++) with Python

I noticed that Python does not have a good datatype for rational numbers, certainly not for algebraic numbers like $\tfrac{1 + \sqrt{2}}{3}$ or the real root of $x^3 - 5x + 7$. They have the ...
1
vote
0answers
64 views

PageRank computation as the left principal eigenvector

I'm following the book here to compute PageRank: http://nlp.stanford.edu/IR-book/html/htmledition/markov-chains-1.html I built the transition matrix P as indicated in the book. Then I computed the ...
1
vote
1answer
101 views

WRL and VRML to Matplotlib/Numpy

I would like to import (or parse ??) a WRL/VRML file format in python in order to work the data with Matplotlib. Is there any way of converting this file format into plottable numpy arrays ? I ...
3
votes
6answers
1k views

Python vs FORTRAN

Which one is better: FORTRAN or Python? And I guess that in both cases you need Gnuplot, am I right? I'm working on a Windows machine at the moment. I'd like to use it to get numerical solutions for ...
5
votes
3answers
141 views

plotting discontinuous functions

I need help plotting the Heaviside function: Real analysis often involves constructing bizarre functions which are intuitively correct, but ultimately wrong. See the great book Counterexamples in ...
1
vote
1answer
115 views

Time array from frequency array in FFT using Python

I have done a Fourier transformation of two signals (in time) $S_1(t),S_2(t)$ using numpy's fft which will give me $S_1(f),S_2(f)$. The corresponding frequency grid ...
0
votes
0answers
123 views

Free HFSS alternative to create geometry using python

I am using a python script to create wirebond interfaces in Ansys HFSS. Variables define the board, wirebond, and package geometry. To simulate a new wirebond, I just edit the geometry variables and ...
3
votes
1answer
129 views

High frequency noise at solving diffusion equation

I'm trying to simulate a simple diffusion based on Fick's 2nd law. ...
3
votes
2answers
98 views

Finding the minimum hamming distance between a bit vector and any pairwise intersection of multiple bit vectors

I'm looking for a way to optimize this procedure. This is the problem: I have a list of bit vectors $\mathbf{A} = [ a_1, a_2, a_3, ..., a_n ]$ I have a list of bit vectors $\mathbf{B} = [ b_1, b_2, ...
2
votes
1answer
113 views

Adaptive ODE algorithm in Python

I want to integrate a particle path in 2D using the integrate.ode module. Things that are a bit different in my case are that, I only want to integrate up to a ...
2
votes
1answer
71 views

Installing GPAW (Python DFT package) on a computing cluster

I'm in the middle of installing GPAW on a cluster but I'm running into problems building the "gpaw-python" interpreter, its job is to allow users to execute parallelised GPAW calculations. Following ...
3
votes
2answers
194 views

Finding eigenvalues of a complex symmetric tridiagonal matrix

I am trying to find specific eigenvalues and -vectors of a large complex symmetric tridiagonal matrix (at least 10000x10000, and ideally larger). I know roughly which eigenvalues I am looking for, so ...
3
votes
1answer
116 views

spectral decomposition in Numpy, sign difference

I am trying to follow along with an example from a book, but I get seemingly different answers depending on which spectral decomposition function I use in Numpy. I am trying to transform the Matrix G, ...
0
votes
0answers
56 views

Solving a non linear equation and iterating for various values in python

problem:Unable to solve a unknown for multiple known values in a non-linear equation ...
7
votes
3answers
1k views

Computational Physics: Python VS C/C++

Going to teach students of undergraduate level a course titled Introduction to Computer Programming. I am confused a bit. In Computational Physics scientists use C/C++ or Python or Fortran,CUDA ...
1
vote
0answers
98 views

BFGS Fails to Converge

The model I'm working on is a multinomial logit choice model. It's a very specific dataset so other existing MNLogit libraries don't fit with my data. So basically, it's a very complex function ...
5
votes
2answers
269 views

Pandas limitations and its alternatives in Python

I read somewhere that Pandas was first developed for the financial world, at least not especially for natural sciences (physics, biology and so on), so is there any similar data analysis Python ...
2
votes
2answers
354 views

Implement the Huffman code in Python or Numpy?

The Huffman code is a way of compressing data streams by encoding the more frequent items with shorter words. Here is a distribution on the letters A thru J and the code I obtained: ...
2
votes
1answer
140 views

Tikhonov regularization in the non-negative least square [duplicate]

I am working on a project that I need to add a regularization into the NNLS algorithm. Is there a way to add the Tikhonov regularization into the NNLS implementation of scipy [1]? [2] talks about it, ...
2
votes
1answer
214 views

Python: Grid with step control ODE solver

I have a problem in physics formulated via an ODE. Now I like to solve it numerically using Pythons scipy.integrate and the therein complex_ode. I figured out how and it works but now I like to ...