#NEWLINE# def __init__( self , knots , order = 4 , M = None , coef = None , x = None ) : #NEWLINE# #INDENT# knots = np . squeeze ( np . unique ( np . asarray ( knots ) ) ) #NEWLINE# if ( knots . ndim != 1 ) : #NEWLINE# #INDENT# raise ValueError ( 'expecting 1d array for knots' ) #NEWLINE# #UNINDENT# self . m = order #NEWLINE# if ( M is None ) : #NEWLINE# #INDENT# M = self . m #NEWLINE# #UNINDENT# self . M = M #NEWLINE# self . tau = np . hstack ( [ ( [ knots [ 0 ] ] * ( self . M - 1 ) ) , knots , ( [ knots [ ( - 1 ) ] ] * ( self . M - 1 ) ) ] ) #NEWLINE# self . K = ( knots . shape [ 0 ] - 2 ) #NEWLINE# if ( coef is None ) : #NEWLINE# #INDENT# self . coef = np . zeros ( ( ( self . K + ( 2 * self . M ) ) - self . m ) , np . float64 ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# self . coef = np . squeeze ( coef ) #NEWLINE# if ( self . coef . shape != ( ( M . K + ( 2 * self . M ) ) - self . m ) ) : #NEWLINE# #INDENT# raise ValueError ( 'coefficients of Bspline have incorrect shape' ) #NEWLINE# #UNINDENT# #UNINDENT# if ( x is not None ) : #NEWLINE# #INDENT# self . x = x