zanolette/Project — pull request #1 by zanolette (2014-10-21 10:13:17+00:00)
Title: Luke's

import numpy as np
import matplotlib.pyplot as plt

# specify circle parameters: centre ij and radius
ci,cj=500,500 #centre point
z = np.zeros((2*ci,2*cj))
cr=200

# Create index arrays to z
I,J=np.meshgrid(np.arange(z.shape[0]),np.arange(z.shape[1]))

# np.sqrt((I-ci)**2+(J-cj)**2) calculates distance of all points to centre
# Assign value of 1 to those points where distance to centre is less that cr:
z[np.where(np.sqrt((I-ci)**2+(J-cj)**2)