def UnZeroMatrix(matrix):
  """
  replaces all instances of 0.0000 in the 
  matrix with the lowest observed non-zero value
  assumes first row and first column of matrix are
  descriptors
  """
  minNonZero = min([float(m) for m in matrix[1][1:]])
  for line in matrix[2:]:
    for el in line[1:]:
      if float(el) != 0.000 and float(el) < minNonZero:
        minNonZero = float(el)

  newMat = [matrix[0]]
  for line in matrix[1:]:
    curVec = [line[0]]
    for el in line[1:]:
      if float(el) == 0.000:
        curVec.append(minNonZero)
      else:
        curVec.append(float(el))
    newMat.append(curVec)
  return newMat