##^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^Lance Simms, Stanford University 2009
#! /usr/bin/env python

##Examples of Creating and Searching Arrays

import sys,os
import pyfits
from numpy import *
from pylab import *

#ONE-D array
x=arange(100);
print 'Last 50 Elements   :' + str(x[50:])
print 'Middle 50 Elements :' + str(x[25:75])

#TWO-D array
xdim = 25
ydim = 25
z=arange(xdim*ydim)
z.shape=(xdim,ydim)
ymid = ydim/2
xmid = xdim/2
zmid = z[xmid-1:xmid+2,ymid-1:ymid+2]
print 'Middle 3x3 elements: ' + str(zmid)

#SETTING UP REFERENCE GRID FOR SHACKHARTMAN
subx=2*arange(25)-25
xrow=12.5*subx+542
suby=arange(25)-12
ycol=25.0*suby+465

y=repeat(ycol,25,axis=0)
y.shape=(25,25)
x=zeros((25,25))
x[:,:]=xrow

Ylength=len(y)		#returns the size of the array
Yrange=range(Ylength)		#returns the range of the array

for i in Yrange:
  ThisY=y[i]

y.shape=(625,1)
x.shape=(625,1)

a=4
if a==1:
	b=1
else:
	b=2
print b

