def gmean(a, axis=0, dtype=None):
 if (not isinstance(a, np.ndarray)):
  log_a = np.log(np.array(a, dtype=dtype))
 elif dtype:
  if isinstance(a, np.ma.MaskedArray):
   log_a = np.log(np.ma.asarray(a, dtype=dtype))
  else:
   log_a = np.log(np.asarray(a, dtype=dtype))
 else:
  log_a = np.log(a)
 return np.exp(log_a.mean(axis=axis))

def gmean ( a , axis = 0 , dtype = None ) : if ( not isinstance ( a , np . ndarray ) ) : log_a = np . log ( np . array ( a , dtype = dtype ) ) elif dtype : if isinstance ( a , np . ma . MaskedArray ) : log_a = np . log ( np . ma . asarray ( a , dtype = dtype ) ) else : log_a = np . log ( np . asarray ( a , dtype = dtype ) ) else : log_a = np . log ( a ) return np . exp ( log_a . mean ( axis = axis ) )
compute the geometric mean along the specified axis .