Am I interpreting your question (in)correctly? Using pyfits.
import numpy
import scipy
import pyfits
# Use Pyfits to read in a file.
im = pyfits.open("example.fits")
# pyfits opens a "list" of all header extensions in the file.
isinstance(im,list)
# my example is a simple 2d image. so I want the first header unit
im0 = im[0]
# you access the data shape this way
print im0.data.shape
# simple check of the image variance
print numpy.var(im0.data)
# now I'm just repeating the same as your example
poisson = str(raw_input("Poisson noise amount: "))
poissonNoise = numpy.random.poisson(poisson, im0.data.shape).astype(float)
test = im0.data + poissonNoise
# check things out and write to new file
print numpy.var(test)
# you could do this.
im0.data = test
# write that new image back out with the old header.
pyfits.writeto("/tmp/test.fits", data=test, header=im0.header)
# prove it worked.
check = pyfits.open("/tmp/test.fits")
numpy.var(check[0].data)