def _validate_sos(sos):
 sos = np.atleast_2d(sos)
 if (sos.ndim != 2):
  raise ValueError('sos array must be 2D')
 (n_sections, m) = sos.shape
 if (m != 6):
  raise ValueError('sos array must be shape (n_sections, 6)')
 if (not (sos[:, 3] == 1).all()):
  raise ValueError('sos[:, 3] should be all ones')
 return (sos, n_sections)

def _validate_sos ( sos ) : sos = np . atleast_2d ( sos ) if ( sos . ndim != 2 ) : raise ValueError ( 'sos array must be 2D' ) ( n_sections , m ) = sos . shape if ( m != 6 ) : raise ValueError ( 'sos array must be shape (n_sections, 6)' ) if ( not ( sos [ : , 3 ] == 1 ) . all ( ) ) : raise ValueError ( 'sos[:, 3] should be all ones' ) return ( sos , n_sections )
helper to validate a sos input .