def argstoarray(*args):
 if ((len(args) == 1) and (not isinstance(args[0], ndarray))):
  output = ma.asarray(args[0])
  if (output.ndim != 2):
   raise ValueError('The input should be 2D')
 else:
  n = len(args)
  m = max([len(k) for k in args])
  output = ma.array(np.empty((n, m), dtype=float), mask=True)
  for (k, v) in enumerate(args):
   output[k, :len(v)] = v
 output[np.logical_not(np.isfinite(output._data))] = masked
 return output

def argstoarray ( * args ) : if ( ( len ( args ) == 1 ) and ( not isinstance ( args [ 0 ] , ndarray ) ) ) : output = ma . asarray ( args [ 0 ] ) if ( output . ndim != 2 ) : raise ValueError ( 'The input should be 2D' ) else : n = len ( args ) m = max ( [ len ( k ) for k in args ] ) output = ma . array ( np . empty ( ( n , m ) , dtype = float ) , mask = True ) for ( k , v ) in enumerate ( args ) : output [ k , : len ( v ) ] = v output [ np . logical_not ( np . isfinite ( output . _data ) ) ] = masked return output
constructs a 2d array from a group of sequences .