Tag Archives: Python

Interpreting A/B Test using Python

Suppose we ran an A/B test with two different versions of a web page, and , for which we count the number of visitors and whether they convert or not. We can summarize this in a contingency table showing the … Continue reading

Posted in Uncategorized | Tagged , , | Leave a comment

Brand Positioning by Correspondence Analysis

I was reading an article about visualization techniques using multidimensional scaling (MDS), the correspondence analysis in particular. The example used R, but as usual I want to find ways to do it on Python, so here goes. The correspondence analysis … Continue reading

Posted in Uncategorized | Tagged , , | Leave a comment

PCA and Biplot using Python

There are several ways to run principal component analysis (PCA) using various packages (scikit-learn, statsmodels, etc.) or even just rolling out your own through singular-value decomposition and such. Visualizing the PCA result can be done through biplot. I was looking … Continue reading

Posted in Uncategorized | Tagged , , , , | 2 Comments

Running Tornado on dotCloud

To brush up my web development skills, I decided to try Tornado. I also wanted to find a hosting service of some sort for my projects, which must be cheap and developer friendly. There, dotCloud seemed very nice and I … Continue reading

Posted in Uncategorized | Tagged , , , , | Leave a comment

Searching for Nearest-Neighbors between Two Coordinate Catalogs

Say I have two catalogs of points, each in two-dimensional space. For each object in a catalog, I want to find the nearest object(s) in the other catalog. I can do this by computing the distances between every single unique … Continue reading

Posted in Uncategorized | Tagged , , , , | Leave a comment

Using Linux Shell Command within Python

If you just want to do some simple task, this would do:

Posted in Uncategorized | Tagged , , , | Leave a comment

SciPy Weave Bug in Debian Squeeze

I was trying to remove a bottleneck by converting a portion of Python code into C++ via scipy.weave.inline, and encountered a bug. Here is my code: And this is what I get: Fortunately there is a fix: The fix for … Continue reading

Posted in Uncategorized | Tagged , , , , , , | Leave a comment

Comparing the Efficiencies of Gaussian Convolution Routines

These days I quite often need to convolve (i.e., smooth) 2D images by some Gaussian. There are quite a few routines that can do this with varying efficiencies. So I compared a couple of them. On my laptop, this script … Continue reading

Posted in Uncategorized | Tagged , , , , , | Leave a comment

Suppressing Warnings in PyFITS

PyFITS is obviously a great Python package if you ever need to deal with data in astronomy. One thing that consistently annoyed me however was their use of warning messages. ¬†For example, whenever you overwrite an existing FITS file, the … Continue reading

Posted in Uncategorized | Tagged , , , | 4 Comments

Estimating Standard Deviation from N Data Points

In astronomy people often estimate a standard deviation in, say, background counts from the observed data themselves, since it is very difficult to know what true standard deviations are. Then the question is this: How many measurements (e.g., the number … Continue reading

Posted in Uncategorized | Tagged , , , | Leave a comment