Questions tagged [scientific-computing]

Use this tag for questions about using computers in science. Many of these questions also fit on scicomp.stackexchange.com.

Scientific computing encompasses numerical methods, physical simulations, data processing and visualization, and the many other ways in which computers are used to do scientific research.

There is an entire Stack Exchange site devoted to questions about scientific applications of computers. These sorts of questions may get more specialized attention at that site.

756 questions
8
votes
1 answer

Nonlinear e^(-x) regression using scipy, python, numpy

The code below is giving me a flat line for the line of best fit rather than a nice curve along the model of e^(-x) that would fit the data. Can anyone show me how to fix the code below so that it fits my data? import numpy as np import…
MedicalMath
  • 83
  • 1
  • 3
8
votes
4 answers

How can I use Cython well to solve a differential equation faster?

I would like to lower the time Scipy's odeint takes for solving a differential equation. To practice, I used the example covered in Python in scientific computations as template. Because odeint takes a function f as argument, I wrote this…
fabian
  • 1,413
  • 1
  • 13
  • 24
8
votes
2 answers

python solutions for managing scientific data dependency graph by specification values

I have a scientific data management problem which seems general, but I can't find an existing solution or even a description of it, which I have long puzzled over. I am about to embark on a major rewrite (python) but I thought I'd cast about one…
ricopan
  • 662
  • 6
  • 13
8
votes
2 answers

Object-oriented scientific data processing, how to cleverly fit data, analysis and visualization in objects?

As a biology undergrad i'm often writing python software in order to do some data analysis. The general structure is always : There is some data to load, perform analysis on (statistics, clustering...) and then visualize the results. Sometimes for…
Geeklhem
  • 689
  • 7
  • 12
8
votes
1 answer

Performance comparison of FPU with software emulation

While I know (so I have been told) that Floating-point coprocessors work faster than any software implementation of floating-point arithmetic, I totally lack the gut feeling how large this difference is, in order of magnitudes. The answer probably…
shuhalo
  • 5,732
  • 12
  • 43
  • 60
8
votes
1 answer

Most efficient way to filter a long time series Python

I have a large time series, say 1e10, that results from recording neural activity, i.e. voltages. Before doing further analysis I want to band pass filter that data between 300 Hz and 7000 Hz. Below, I post the code for the Butterworth filter I…
mac389
  • 3,004
  • 5
  • 38
  • 62
8
votes
5 answers

fast numpy addnan

I would like to add thousands of 4D arrays element wise and accounting for nans. A simple example using 1D arrays would be: X = array([4,7,89,nan,89,65, nan]) Y = array([0,5,4, 9, 8, 100,nan]) z = X+Y print z = array([4,12,93,9,97,165,nan]) I've…
Shejo284
  • 4,541
  • 6
  • 32
  • 44
7
votes
3 answers

SciPy global minimum curve fit

I'm using scipy.optimize.curve_fit, but I suspect it is converging to a local minimum and not the global minimum. I tried using simulated annealing in the following way: def fit(params): return np.sum((ydata - specf(xdata,*params))**2) p =…
Gus
  • 4,375
  • 5
  • 31
  • 50
7
votes
2 answers

Application of Boundary Conditions in finite difference solution for the heat equation and Crank-Nicholson

The code below solves the 1D heat equation that represents a rod whose ends are kept at zero temparature with initial condition 10*np.sin(np.pi*x). How are the Dirichlet boundary conditions (zero temp at both ends) worked into this calculation? I…
BBSysDyn
  • 4,389
  • 8
  • 48
  • 63
7
votes
3 answers

What's the best way to process an image in clojure?

As part of a python simulation I have I take a 2d array and take the gradient of this array. This is done in scipy/numpy by convolving the 2d array with a filter with the appropriate weights. So my question is if I want to do this in clojure…
2daaa
  • 2,788
  • 7
  • 33
  • 44
7
votes
3 answers

Generate 2d images of molecules from PubChem FTP data

Rather than crawl PubChem's website, I'd prefer to be nice and generate the images locally from the PubChem ftp site: ftp://ftp.ncbi.nih.gov/pubchem/specifications/ The only problem is that I'm limited to OSX and Linux and I can't seem to find a…
zachaysan
  • 1,726
  • 16
  • 32
7
votes
5 answers

Industry-style practices for increasing productivity in a small scientific environment

I work in a small, independent scientific lab in a university in the United States, and it has come to my notice that, compared with a lot of practices that are ostensibly followed in the industry, like daily checkout into a version control system,…
7
votes
3 answers

Best way to have a python script copy itself?

I am using python for scientific applications. I run simulations with various parameters, my script outputs the data to an appropriate directory for that parameter set. Later I use that data. However sometimes I edit my script; in order to be able…
Kai Sikorski
  • 250
  • 2
  • 7
7
votes
1 answer

Library support for very high dynamic range TIFF files?

I work with satellite radar, and have been provided with a (very) large TIFF file containing 32 bpp greyscale data. Unfortunately, libtiff, the standard Linux library for working with TIFF files, doesn't support SampleFormat TIFF files, which means…
Peter T.B. Brett
  • 1,250
  • 11
  • 20
7
votes
4 answers

Harvesting the power of highly-parallel computers with python scientific code

I run into the following problem when writing scientific code with Python: Usually you write the code iteratively, as a script which perform some computation. Finally, it works; now you wish to run it with multiple inputs and parameters and find…