#NEWLINE# @ staticmethod #NEWLINE# def _args_to_vectors( args ) : #NEWLINE# #INDENT# '\n        TODO - need to add auto-convert to gray\n        ' #NEWLINE# assert ( len ( args ) in ( 1 , 3 ) ) #NEWLINE# if ( len ( args ) == 3 ) : #NEWLINE# #INDENT# if ( not isinstance ( args [ 0 ] , np . ndarray ) ) : #NEWLINE# #INDENT# mode = 0 #NEWLINE# p0 = np . array ( [ args [ 0 ] ] ) #NEWLINE# p1 = np . array ( [ args [ 1 ] ] ) #NEWLINE# p2 = np . array ( [ args [ 2 ] ] ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# mode = 1 #NEWLINE# ( p0 , p1 , p2 ) = args #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# arg = args [ 0 ] #NEWLINE# if ( isinstance ( arg , Iterable ) and ( not isinstance ( arg , np . ndarray ) ) ) : #NEWLINE# #INDENT# arg = np . array ( arg , dtype = np . float64 ) #NEWLINE# #UNINDENT# assert isinstance ( arg , np . ndarray ) #NEWLINE# if ( len ( arg . shape ) == 2 ) : #NEWLINE# #INDENT# if ( arg . shape [ 1 ] == 3 ) : #NEWLINE# #INDENT# mode = 2 #NEWLINE# ( p0 , p1 , p2 ) = arg . transpose ( ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# mode = 3 #NEWLINE# ( p0 , p1 , p2 ) = arg #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# assert ( arg . shape == ( 3 , ) ) #NEWLINE# mode = 4 #NEWLINE# ( p0 , p1 , p2 ) = arg [ : , np . newaxis ] #NEWLINE# #UNINDENT# #UNINDENT# return ( p0 , p1 , p2 , mode )