I have the following code:
r = numpy.zeros(shape = (width, height, 9))
It creates a width x height x 9 matrix filled with zero
Are you familiar with numpy.nan?
You can create your own method such as:
def nans(shape, dtype=float):
a = numpy.empty(shape, dtype)
a.fill(numpy.nan)
return a
Then
nans([3,4])
would output
array([[ NaN, NaN, NaN, NaN],
[ NaN, NaN, NaN, NaN],
[ NaN, NaN, NaN, NaN]])
I found this code in a mailing list thread.