<s> """<STR_LIT>""" <EOL> from __future__ import division , print_function , absolute_import <EOL> __all__ = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , <EOL> '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT>' ] <EOL> import warnings <EOL> import numpy as np <EOL> from . import _fitpack <EOL> from numpy import ( atleast_1d , array , ones , zeros , sqrt , ravel , transpose , <EOL> empty , iinfo , intc , asarray ) <EOL> from . import dfitpack <EOL> def _intc_overflow ( x , msg = None ) : <EOL> """<STR_LIT>""" <EOL> if x > iinfo ( intc ) . max : <EOL> if msg is None : <EOL> msg = '<STR_LIT>' % x <EOL> raise OverflowError ( msg ) <EOL> return intc ( x ) <EOL> _iermess = { <EOL> <NUM_LIT:0> : [ "<STR_LIT>" <EOL> "<STR_LIT>" , None ] , <EOL> - <NUM_LIT:1> : [ "<STR_LIT>" , None ] , <EOL> - <NUM_LIT:2> : [ "<STR_LIT>" <EOL> "<STR_LIT>" , None ] , <EOL> <NUM_LIT:1> : [ "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , ValueError ] , <EOL> <NUM_LIT:2> : [ "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> ValueError ] , <EOL> <NUM_LIT:3> : [ "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , ValueError ] , <EOL> <NUM_LIT:10> : [ "<STR_LIT>" , ValueError ] , <EOL> '<STR_LIT>' : [ "<STR_LIT>" , TypeError ] <EOL> } <EOL> _iermess2 = { <EOL> <NUM_LIT:0> : [ "<STR_LIT>" <EOL> "<STR_LIT>" , None ] , <EOL> - <NUM_LIT:1> : [ "<STR_LIT>" , None ] , <EOL> - <NUM_LIT:2> : [ "<STR_LIT>" <EOL> "<STR_LIT>" , None ] , <EOL> - <NUM_LIT:3> : [ "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> None ] , <EOL> <NUM_LIT:1> : [ "<STR_LIT>" <EOL> "<STR_LIT>" , <EOL> ValueError ] , <EOL> <NUM_LIT:2> : [ "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , ValueError ] , <EOL> <NUM_LIT:3> : [ "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , ValueError ] , <EOL> <NUM_LIT:4> : [ "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , ValueError ] , <EOL> <NUM_LIT:5> : [ "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , ValueError ] , <EOL> <NUM_LIT:10> : [ "<STR_LIT>" , ValueError ] , <EOL> <NUM_LIT:11> : [ "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" , ValueError ] , <EOL> '<STR_LIT>' : [ "<STR_LIT>" , TypeError ] <EOL> } <EOL> _parcur_cache = { '<STR_LIT:t>' : array ( [ ] , float ) , '<STR_LIT>' : array ( [ ] , float ) , <EOL> '<STR_LIT>' : array ( [ ] , intc ) , '<STR_LIT:u>' : array ( [ ] , float ) , <EOL> '<STR_LIT>' : <NUM_LIT:0> , '<STR_LIT>' : <NUM_LIT:1> } <EOL> def splprep ( x , w = None , u = None , ub = None , ue = None , k = <NUM_LIT:3> , task = <NUM_LIT:0> , s = None , t = None , <EOL> full_output = <NUM_LIT:0> , nest = None , per = <NUM_LIT:0> , quiet = <NUM_LIT:1> ) : <EOL> """<STR_LIT>""" <EOL> if task <= <NUM_LIT:0> : <EOL> _parcur_cache = { '<STR_LIT:t>' : array ( [ ] , float ) , '<STR_LIT>' : array ( [ ] , float ) , <EOL> '<STR_LIT>' : array ( [ ] , intc ) , '<STR_LIT:u>' : array ( [ ] , float ) , <EOL> '<STR_LIT>' : <NUM_LIT:0> , '<STR_LIT>' : <NUM_LIT:1> } <EOL> x = atleast_1d ( x ) <EOL> idim , m = x . shape <EOL> if per : <EOL> for i in range ( idim ) : <EOL> if x [ i ] [ <NUM_LIT:0> ] != x [ i ] [ - <NUM_LIT:1> ] : <EOL> if quiet < <NUM_LIT:2> : <EOL> warnings . warn ( RuntimeWarning ( '<STR_LIT>' % <EOL> ( i , m , i ) ) ) <EOL> x [ i ] [ - <NUM_LIT:1> ] = x [ i ] [ <NUM_LIT:0> ] <EOL> if not <NUM_LIT:0> < idim < <NUM_LIT:11> : <EOL> raise TypeError ( '<STR_LIT>' ) <EOL> if w is None : <EOL> w = ones ( m , float ) <EOL> else : <EOL> w = atleast_1d ( w ) <EOL> ipar = ( u is not None ) <EOL> if ipar : <EOL> _parcur_cache [ '<STR_LIT:u>' ] = u <EOL> if ub is None : <EOL> _parcur_cache [ '<STR_LIT>' ] = u [ <NUM_LIT:0> ] <EOL> else : <EOL> _parcur_cache [ '<STR_LIT>' ] = ub <EOL> if ue is None : <EOL> _parcur_cache [ '<STR_LIT>' ] = u [ - <NUM_LIT:1> ] <EOL> else : <EOL> _parcur_cache [ '<STR_LIT>' ] = ue <EOL> else : <EOL> _parcur_cache [ '<STR_LIT:u>' ] = zeros ( m , float ) <EOL> if not ( <NUM_LIT:1> <= k <= <NUM_LIT:5> ) : <EOL> raise TypeError ( '<STR_LIT>' % k ) <EOL> if not ( - <NUM_LIT:1> <= task <= <NUM_LIT:1> ) : <EOL> raise TypeError ( '<STR_LIT>' ) <EOL> if ( not len ( w ) == m ) or ( ipar == <NUM_LIT:1> and ( not len ( u ) == m ) ) : <EOL> raise TypeError ( '<STR_LIT>' ) <EOL> if s is None : <EOL> s = m - sqrt ( <NUM_LIT:2> * m ) <EOL> if t is None and task == - <NUM_LIT:1> : <EOL> raise TypeError ( '<STR_LIT>' ) <EOL> if t is not None : <EOL> _parcur_cache [ '<STR_LIT:t>' ] = atleast_1d ( t ) <EOL> n = len ( _parcur_cache [ '<STR_LIT:t>' ] ) <EOL> if task == - <NUM_LIT:1> and n < <NUM_LIT:2> * k + <NUM_LIT:2> : <EOL> raise TypeError ( '<STR_LIT>' ) <EOL> if m <= k : <EOL> raise TypeError ( '<STR_LIT>' ) <EOL> if nest is None : <EOL> nest = m + <NUM_LIT:2> * k <EOL> if ( task >= <NUM_LIT:0> and s == <NUM_LIT:0> ) or ( nest < <NUM_LIT:0> ) : <EOL> if per : <EOL> nest = m + <NUM_LIT:2> * k <EOL> else : <EOL> nest = m + k + <NUM_LIT:1> <EOL> nest = max ( nest , <NUM_LIT:2> * k + <NUM_LIT:3> ) <EOL> u = _parcur_cache [ '<STR_LIT:u>' ] <EOL> ub = _parcur_cache [ '<STR_LIT>' ] <EOL> ue = _parcur_cache [ '<STR_LIT>' ] <EOL> t = _parcur_cache [ '<STR_LIT:t>' ] <EOL> wrk = _parcur_cache [ '<STR_LIT>' ] <EOL> iwrk = _parcur_cache [ '<STR_LIT>' ] <EOL> t , c , o = _fitpack . _parcur ( ravel ( transpose ( x ) ) , w , u , ub , ue , k , <EOL> task , ipar , s , t , nest , wrk , iwrk , per ) <EOL> _parcur_cache [ '<STR_LIT:u>' ] = o [ '<STR_LIT:u>' ] <EOL> _parcur_cache [ '<STR_LIT>' ] = o [ '<STR_LIT>' ] <EOL> _parcur_cache [ '<STR_LIT>' ] = o [ '<STR_LIT>' ] <EOL> _parcur_cache [ '<STR_LIT:t>' ] = t <EOL> _parcur_cache [ '<STR_LIT>' ] = o [ '<STR_LIT>' ] <EOL> _parcur_cache [ '<STR_LIT>' ] = o [ '<STR_LIT>' ] <EOL> ier = o [ '<STR_LIT>' ] <EOL> fp = o [ '<STR_LIT>' ] <EOL> n = len ( t ) <EOL> u = o [ '<STR_LIT:u>' ] <EOL> c . shape = idim , n - k - <NUM_LIT:1> <EOL> tcku = [ t , list ( c ) , k ] , u <EOL> if ier <= <NUM_LIT:0> and not quiet : <EOL> warnings . warn ( RuntimeWarning ( _iermess [ ier ] [ <NUM_LIT:0> ] + <EOL> "<STR_LIT>" % <EOL> ( k , len ( t ) , m , fp , s ) ) ) <EOL> if ier > <NUM_LIT:0> and not full_output : <EOL> if ier in [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] : <EOL> warnings . warn ( RuntimeWarning ( _iermess [ ier ] [ <NUM_LIT:0> ] ) ) <EOL> else : <EOL> try : <EOL> raise _iermess [ ier ] [ <NUM_LIT:1> ] ( _iermess [ ier ] [ <NUM_LIT:0> ] ) <EOL> except KeyError : <EOL> raise _iermess [ '<STR_LIT>' ] [ <NUM_LIT:1> ] ( _iermess [ '<STR_LIT>' ] [ <NUM_LIT:0> ] ) <EOL> if full_output : <EOL> try : <EOL> return tcku , fp , ier , _iermess [ ier ] [ <NUM_LIT:0> ] <EOL> except KeyError : <EOL> return tcku , fp , ier , _iermess [ '<STR_LIT>' ] [ <NUM_LIT:0> ] <EOL> else : <EOL> return tcku <EOL> _curfit_cache = { '<STR_LIT:t>' : array ( [ ] , float ) , '<STR_LIT>' : array ( [ ] , float ) , <EOL> '<STR_LIT>' : array ( [ ] , intc ) } <EOL> def splrep ( x , y , w = None , xb = None , xe = None , k = <NUM_LIT:3> , task = <NUM_LIT:0> , s = None , t = None , <EOL> full_output = <NUM_LIT:0> , per = <NUM_LIT:0> , quiet = <NUM_LIT:1> ) : <EOL> """<STR_LIT>""" <EOL> if task <= <NUM_LIT:0> : <EOL> _curfit_cache = { } <EOL> x , y = map ( atleast_1d , [ x , y ] ) <EOL> m = len ( x ) <EOL> if w is None : <EOL> w = ones ( m , float ) <EOL> if s is None : <EOL> s = <NUM_LIT:0.0> <EOL> else : <EOL> w = atleast_1d ( w ) <EOL> if s is None : <EOL> s = m - sqrt ( <NUM_LIT:2> * m ) <EOL> if not len ( w ) == m : <EOL> raise TypeError ( '<STR_LIT>' % ( len ( w ) , m ) ) <EOL> if ( m != len ( y ) ) or ( m != len ( w ) ) : <EOL> raise TypeError ( '<STR_LIT>' <EOL> '<STR_LIT>' ) <EOL> if not ( <NUM_LIT:1> <= k <= <NUM_LIT:5> ) : <EOL> raise TypeError ( '<STR_LIT>' <EOL> '<STR_LIT>' % k ) <EOL> if m <= k : <EOL> raise TypeError ( '<STR_LIT>' ) <EOL> if xb is None : <EOL> xb = x [ <NUM_LIT:0> ] <EOL> if xe is None : <EOL> xe = x [ - <NUM_LIT:1> ] <EOL> if not ( - <NUM_LIT:1> <= task <= <NUM_LIT:1> ) : <EOL> raise TypeError ( '<STR_LIT>' ) <EOL> if t is not None : <EOL> task = - <NUM_LIT:1> <EOL> if task == - <NUM_LIT:1> : <EOL> if t is None : <EOL> raise TypeError ( '<STR_LIT>' ) <EOL> numknots = len ( t ) <EOL> _curfit_cache [ '<STR_LIT:t>' ] = empty ( ( numknots + <NUM_LIT:2> * k + <NUM_LIT:2> , ) , float ) <EOL> _curfit_cache [ '<STR_LIT:t>' ] [ k + <NUM_LIT:1> : - k - <NUM_LIT:1> ] = t <EOL> nest = len ( _curfit_cache [ '<STR_LIT:t>' ] ) <EOL> elif task == <NUM_LIT:0> : <EOL> if per : <EOL> nest = max ( m + <NUM_LIT:2> * k , <NUM_LIT:2> * k + <NUM_LIT:3> ) <EOL> else : <EOL> nest = max ( m + k + <NUM_LIT:1> , <NUM_LIT:2> * k + <NUM_LIT:3> ) <EOL> t = empty ( ( nest , ) , float ) <EOL> _curfit_cache [ '<STR_LIT:t>' ] = t <EOL> if task <= <NUM_LIT:0> : <EOL> if per : <EOL> _curfit_cache [ '<STR_LIT>' ] = empty ( ( m * ( k + <NUM_LIT:1> ) + nest * ( <NUM_LIT:8> + <NUM_LIT:5> * k ) , ) , float ) <EOL> else : <EOL> _curfit_cache [ '<STR_LIT>' ] = empty ( ( m * ( k + <NUM_LIT:1> ) + nest * ( <NUM_LIT:7> + <NUM_LIT:3> * k ) , ) , float ) <EOL> _curfit_cache [ '<STR_LIT>' ] = empty ( ( nest , ) , intc ) <EOL> try : <EOL> t = _curfit_cache [ '<STR_LIT:t>' ] <EOL> wrk = _curfit_cache [ '<STR_LIT>' ] <EOL> iwrk = _curfit_cache [ '<STR_LIT>' ] <EOL> except KeyError : <EOL> raise TypeError ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if not per : <EOL> n , c , fp , ier = dfitpack . curfit ( task , x , y , w , t , wrk , iwrk , <EOL> xb , xe , k , s ) <EOL> else : <EOL> n , c , fp , ier = dfitpack . percur ( task , x , y , w , t , wrk , iwrk , k , s ) <EOL> tck = ( t [ : n ] , c [ : n ] , k ) <EOL> if ier <= <NUM_LIT:0> and not quiet : <EOL> _mess = ( _iermess [ ier ] [ <NUM_LIT:0> ] + "<STR_LIT>" % <EOL> ( k , len ( t ) , m , fp , s ) ) <EOL> warnings . warn ( RuntimeWarning ( _mess ) ) <EOL> if ier > <NUM_LIT:0> and not full_output : <EOL> if ier in [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] : <EOL> warnings . warn ( RuntimeWarning ( _iermess [ ier ] [ <NUM_LIT:0> ] ) ) <EOL> else : <EOL> try : <EOL> raise _iermess [ ier ] [ <NUM_LIT:1> ] ( _iermess [ ier ] [ <NUM_LIT:0> ] ) <EOL> except KeyError : <EOL> raise _iermess [ '<STR_LIT>' ] [ <NUM_LIT:1> ] ( _iermess [ '<STR_LIT>' ] [ <NUM_LIT:0> ] ) <EOL> if full_output : <EOL> try : <EOL> return tck , fp , ier , _iermess [ ier ] [ <NUM_LIT:0> ] <EOL> except KeyError : <EOL> return tck , fp , ier , _iermess [ '<STR_LIT>' ] [ <NUM_LIT:0> ] <EOL> else : <EOL> return tck <EOL> def splev ( x , tck , der = <NUM_LIT:0> , ext = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> t , c , k = tck <EOL> try : <EOL> c [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] <EOL> parametric = True <EOL> except : <EOL> parametric = False <EOL> if parametric : <EOL> return list ( map ( lambda c , x = x , t = t , k = k , der = der : <EOL> splev ( x , [ t , c , k ] , der , ext ) , c ) ) <EOL> else : <EOL> if not ( <NUM_LIT:0> <= der <= k ) : <EOL> raise ValueError ( "<STR_LIT>" % ( der , k ) ) <EOL> if ext not in ( <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ) : <EOL> raise ValueError ( "<STR_LIT>" % ext ) <EOL> x = asarray ( x ) <EOL> shape = x . shape <EOL> x = atleast_1d ( x ) . ravel ( ) <EOL> y , ier = _fitpack . _spl_ ( x , der , t , c , k , ext ) <EOL> if ier == <NUM_LIT:10> : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> if ier == <NUM_LIT:1> : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> if ier : <EOL> raise TypeError ( "<STR_LIT>" ) <EOL> return y . reshape ( shape ) <EOL> def splint ( a , b , tck , full_output = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> t , c , k = tck <EOL> try : <EOL> c [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] <EOL> parametric = True <EOL> except : <EOL> parametric = False <EOL> if parametric : <EOL> return list ( map ( lambda c , a = a , b = b , t = t , k = k : <EOL> splint ( a , b , [ t , c , k ] ) , c ) ) <EOL> else : <EOL> aint , wrk = _fitpack . _splint ( t , c , k , a , b ) <EOL> if full_output : <EOL> return aint , wrk <EOL> else : <EOL> return aint <EOL> def sproot ( tck , mest = <NUM_LIT:10> ) : <EOL> """<STR_LIT>""" <EOL> t , c , k = tck <EOL> if k != <NUM_LIT:3> : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> try : <EOL> c [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] <EOL> parametric = True <EOL> except : <EOL> parametric = False <EOL> if parametric : <EOL> return list ( map ( lambda c , t = t , k = k , mest = mest : <EOL> sproot ( [ t , c , k ] , mest ) , c ) ) <EOL> else : <EOL> if len ( t ) < <NUM_LIT:8> : <EOL> raise TypeError ( "<STR_LIT>" % len ( t ) ) <EOL> z , ier = _fitpack . _sproot ( t , c , k , mest ) <EOL> if ier == <NUM_LIT:10> : <EOL> raise TypeError ( "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> if ier == <NUM_LIT:0> : <EOL> return z <EOL> if ier == <NUM_LIT:1> : <EOL> warnings . warn ( RuntimeWarning ( "<STR_LIT>" ) ) <EOL> return z <EOL> raise TypeError ( "<STR_LIT>" ) <EOL> def spalde ( x , tck ) : <EOL> """<STR_LIT>""" <EOL> t , c , k = tck <EOL> try : <EOL> c [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] <EOL> parametric = True <EOL> except : <EOL> parametric = False <EOL> if parametric : <EOL> return list ( map ( lambda c , x = x , t = t , k = k : <EOL> spalde ( x , [ t , c , k ] ) , c ) ) <EOL> else : <EOL> x = atleast_1d ( x ) <EOL> if len ( x ) > <NUM_LIT:1> : <EOL> return list ( map ( lambda x , tck = tck : spalde ( x , tck ) , x ) ) <EOL> d , ier = _fitpack . _spalde ( t , c , k , x [ <NUM_LIT:0> ] ) <EOL> if ier == <NUM_LIT:0> : <EOL> return d <EOL> if ier == <NUM_LIT:10> : <EOL> raise TypeError ( "<STR_LIT>" ) <EOL> raise TypeError ( "<STR_LIT>" ) <EOL> _surfit_cache = { '<STR_LIT>' : array ( [ ] , float ) , '<STR_LIT>' : array ( [ ] , float ) , <EOL> '<STR_LIT>' : array ( [ ] , float ) , '<STR_LIT>' : array ( [ ] , intc ) } <EOL> def bisplrep ( x , y , z , w = None , xb = None , xe = None , yb = None , ye = None , <EOL> kx = <NUM_LIT:3> , ky = <NUM_LIT:3> , task = <NUM_LIT:0> , s = None , eps = <NUM_LIT> , tx = None , ty = None , <EOL> full_output = <NUM_LIT:0> , nxest = None , nyest = None , quiet = <NUM_LIT:1> ) : <EOL> """<STR_LIT>""" <EOL> x , y , z = map ( ravel , [ x , y , z ] ) <EOL> m = len ( x ) <EOL> if not ( m == len ( y ) == len ( z ) ) : <EOL> raise TypeError ( '<STR_LIT>' ) <EOL> if w is None : <EOL> w = ones ( m , float ) <EOL> else : <EOL> w = atleast_1d ( w ) <EOL> if not len ( w ) == m : <EOL> raise TypeError ( '<STR_LIT>' % ( len ( w ) , m ) ) <EOL> if xb is None : <EOL> xb = x . min ( ) <EOL> if xe is None : <EOL> xe = x . max ( ) <EOL> if yb is None : <EOL> yb = y . min ( ) <EOL> if ye is None : <EOL> ye = y . max ( ) <EOL> if not ( - <NUM_LIT:1> <= task <= <NUM_LIT:1> ) : <EOL> raise TypeError ( '<STR_LIT>' ) <EOL> if s is None : <EOL> s = m - sqrt ( <NUM_LIT:2> * m ) <EOL> if tx is None and task == - <NUM_LIT:1> : <EOL> raise TypeError ( '<STR_LIT>' ) <EOL> if tx is not None : <EOL> _surfit_cache [ '<STR_LIT>' ] = atleast_1d ( tx ) <EOL> nx = len ( _surfit_cache [ '<STR_LIT>' ] ) <EOL> if ty is None and task == - <NUM_LIT:1> : <EOL> raise TypeError ( '<STR_LIT>' ) <EOL> if ty is not None : <EOL> _surfit_cache [ '<STR_LIT>' ] = atleast_1d ( ty ) <EOL> ny = len ( _surfit_cache [ '<STR_LIT>' ] ) <EOL> if task == - <NUM_LIT:1> and nx < <NUM_LIT:2> * kx + <NUM_LIT:2> : <EOL> raise TypeError ( '<STR_LIT>' ) <EOL> if task == - <NUM_LIT:1> and ny < <NUM_LIT:2> * ky + <NUM_LIT:2> : <EOL> raise TypeError ( '<STR_LIT>' ) <EOL> if not ( ( <NUM_LIT:1> <= kx <= <NUM_LIT:5> ) and ( <NUM_LIT:1> <= ky <= <NUM_LIT:5> ) ) : <EOL> raise TypeError ( '<STR_LIT>' <EOL> '<STR_LIT>' % ( kx , ky ) ) <EOL> if m < ( kx + <NUM_LIT:1> ) * ( ky + <NUM_LIT:1> ) : <EOL> raise TypeError ( '<STR_LIT>' ) <EOL> if nxest is None : <EOL> nxest = int ( kx + sqrt ( m / <NUM_LIT:2> ) ) <EOL> if nyest is None : <EOL> nyest = int ( ky + sqrt ( m / <NUM_LIT:2> ) ) <EOL> nxest , nyest = max ( nxest , <NUM_LIT:2> * kx + <NUM_LIT:3> ) , max ( nyest , <NUM_LIT:2> * ky + <NUM_LIT:3> ) <EOL> if task >= <NUM_LIT:0> and s == <NUM_LIT:0> : <EOL> nxest = int ( kx + sqrt ( <NUM_LIT:3> * m ) ) <EOL> nyest = int ( ky + sqrt ( <NUM_LIT:3> * m ) ) <EOL> if task == - <NUM_LIT:1> : <EOL> _surfit_cache [ '<STR_LIT>' ] = atleast_1d ( tx ) <EOL> _surfit_cache [ '<STR_LIT>' ] = atleast_1d ( ty ) <EOL> tx , ty = _surfit_cache [ '<STR_LIT>' ] , _surfit_cache [ '<STR_LIT>' ] <EOL> wrk = _surfit_cache [ '<STR_LIT>' ] <EOL> u = nxest - kx - <NUM_LIT:1> <EOL> v = nyest - ky - <NUM_LIT:1> <EOL> km = max ( kx , ky ) + <NUM_LIT:1> <EOL> ne = max ( nxest , nyest ) <EOL> bx , by = kx * v + ky + <NUM_LIT:1> , ky * u + kx + <NUM_LIT:1> <EOL> b1 , b2 = bx , bx + v - ky <EOL> if bx > by : <EOL> b1 , b2 = by , by + u - kx <EOL> msg = "<STR_LIT>" <EOL> lwrk1 = _intc_overflow ( u * v * ( <NUM_LIT:2> + b1 + b2 ) + <EOL> <NUM_LIT:2> * ( u + v + km * ( m + ne ) + ne - kx - ky ) + b2 + <NUM_LIT:1> , <EOL> msg = msg ) <EOL> lwrk2 = _intc_overflow ( u * v * ( b2 + <NUM_LIT:1> ) + b2 , msg = msg ) <EOL> tx , ty , c , o = _fitpack . _surfit ( x , y , z , w , xb , xe , yb , ye , kx , ky , <EOL> task , s , eps , tx , ty , nxest , nyest , <EOL> wrk , lwrk1 , lwrk2 ) <EOL> _curfit_cache [ '<STR_LIT>' ] = tx <EOL> _curfit_cache [ '<STR_LIT>' ] = ty <EOL> _curfit_cache [ '<STR_LIT>' ] = o [ '<STR_LIT>' ] <EOL> ier , fp = o [ '<STR_LIT>' ] , o [ '<STR_LIT>' ] <EOL> tck = [ tx , ty , c , kx , ky ] <EOL> ierm = min ( <NUM_LIT:11> , max ( - <NUM_LIT:3> , ier ) ) <EOL> if ierm <= <NUM_LIT:0> and not quiet : <EOL> _mess = ( _iermess2 [ ierm ] [ <NUM_LIT:0> ] + <EOL> "<STR_LIT>" % <EOL> ( kx , ky , len ( tx ) , len ( ty ) , m , fp , s ) ) <EOL> warnings . warn ( RuntimeWarning ( _mess ) ) <EOL> if ierm > <NUM_LIT:0> and not full_output : <EOL> if ier in [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> , <NUM_LIT:5> ] : <EOL> _mess = ( "<STR_LIT>" % <EOL> ( kx , ky , len ( tx ) , len ( ty ) , m , fp , s ) ) <EOL> warnings . warn ( RuntimeWarning ( _iermess2 [ ierm ] [ <NUM_LIT:0> ] + _mess ) ) <EOL> else : <EOL> try : <EOL> raise _iermess2 [ ierm ] [ <NUM_LIT:1> ] ( _iermess2 [ ierm ] [ <NUM_LIT:0> ] ) <EOL> except KeyError : <EOL> raise _iermess2 [ '<STR_LIT>' ] [ <NUM_LIT:1> ] ( _iermess2 [ '<STR_LIT>' ] [ <NUM_LIT:0> ] ) <EOL> if full_output : <EOL> try : <EOL> return tck , fp , ier , _iermess2 [ ierm ] [ <NUM_LIT:0> ] <EOL> except KeyError : <EOL> return tck , fp , ier , _iermess2 [ '<STR_LIT>' ] [ <NUM_LIT:0> ] <EOL> else : <EOL> return tck <EOL> def bisplev ( x , y , tck , dx = <NUM_LIT:0> , dy = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> tx , ty , c , kx , ky = tck <EOL> if not ( <NUM_LIT:0> <= dx < kx ) : <EOL> raise ValueError ( "<STR_LIT>" % ( dx , kx ) ) <EOL> if not ( <NUM_LIT:0> <= dy < ky ) : <EOL> raise ValueError ( "<STR_LIT>" % ( dy , ky ) ) <EOL> x , y = map ( atleast_1d , [ x , y ] ) <EOL> if ( len ( x . shape ) != <NUM_LIT:1> ) or ( len ( y . shape ) != <NUM_LIT:1> ) : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> z , ier = _fitpack . _bispev ( tx , ty , c , kx , ky , x , y , dx , dy ) <EOL> if ier == <NUM_LIT:10> : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> if ier : <EOL> raise TypeError ( "<STR_LIT>" ) <EOL> z . shape = len ( x ) , len ( y ) <EOL> if len ( z ) > <NUM_LIT:1> : <EOL> return z <EOL> if len ( z [ <NUM_LIT:0> ] ) > <NUM_LIT:1> : <EOL> return z [ <NUM_LIT:0> ] <EOL> return z [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] <EOL> def dblint ( xa , xb , ya , yb , tck ) : <EOL> """<STR_LIT>""" <EOL> tx , ty , c , kx , ky = tck <EOL> return dfitpack . dblint ( tx , ty , c , kx , ky , xa , xb , ya , yb ) <EOL> def insert ( x , tck , m = <NUM_LIT:1> , per = <NUM_LIT:0> ) : <EOL> """<STR_LIT>""" <EOL> t , c , k = tck <EOL> try : <EOL> c [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] <EOL> parametric = True <EOL> except : <EOL> parametric = False <EOL> if parametric : <EOL> cc = [ ] <EOL> for c_vals in c : <EOL> tt , cc_val , kk = insert ( x , [ t , c_vals , k ] , m ) <EOL> cc . append ( cc_val ) <EOL> return ( tt , cc , kk ) <EOL> else : <EOL> tt , cc , ier = _fitpack . _insert ( per , t , c , k , x , m ) <EOL> if ier == <NUM_LIT:10> : <EOL> raise ValueError ( "<STR_LIT>" ) <EOL> if ier : <EOL> raise TypeError ( "<STR_LIT>" ) <EOL> return ( tt , cc , k ) <EOL> def splder ( tck , n = <NUM_LIT:1> ) : <EOL> """<STR_LIT>""" <EOL> if n < <NUM_LIT:0> : <EOL> return splantider ( tck , - n ) <EOL> t , c , k = tck <EOL> if n > k : <EOL> raise ValueError ( ( "<STR_LIT>" <EOL> "<STR_LIT>" ) % ( n , tck [ <NUM_LIT:2> ] ) ) <EOL> with np . errstate ( invalid = '<STR_LIT>' , divide = '<STR_LIT>' ) : <EOL> try : <EOL> for j in range ( n ) : <EOL> dt = t [ k + <NUM_LIT:1> : - <NUM_LIT:1> ] - t [ <NUM_LIT:1> : - k - <NUM_LIT:1> ] <EOL> c = ( c [ <NUM_LIT:1> : - <NUM_LIT:1> - k ] - c [ : - <NUM_LIT:2> - k ] ) * k / dt <EOL> c = np . r_ [ c , [ <NUM_LIT:0> ] * k ] <EOL> t = t [ <NUM_LIT:1> : - <NUM_LIT:1> ] <EOL> k -= <NUM_LIT:1> <EOL> except FloatingPointError : <EOL> raise ValueError ( ( "<STR_LIT>" <EOL> "<STR_LIT>" ) % n ) <EOL> return t , c , k <EOL> def splantider ( tck , n = <NUM_LIT:1> ) : <EOL> """<STR_LIT>""" <EOL> if n < <NUM_LIT:0> : <EOL> return splder ( tck , - n ) <EOL> t , c , k = tck <EOL> for j in range ( n ) : <EOL> dt = t [ k + <NUM_LIT:1> : ] - t [ : - k - <NUM_LIT:1> ] <EOL> c = np . cumsum ( c [ : - k - <NUM_LIT:1> ] * dt ) / ( k + <NUM_LIT:1> ) <EOL> c = np . r_ [ <NUM_LIT:0> , c , [ c [ - <NUM_LIT:1> ] ] * ( k + <NUM_LIT:2> ) ] <EOL> t = np . r_ [ t [ <NUM_LIT:0> ] , t , t [ - <NUM_LIT:1> ] ] <EOL> k += <NUM_LIT:1> <EOL> return t , c , k </s>
