#NEWLINE# def guess_starting_values( self , y , x ) : #NEWLINE# #INDENT# 'could probably improve this' #NEWLINE# ( ymax , ymin ) = ( max ( y ) , min ( y ) ) #NEWLINE# yex = ymax #NEWLINE# self . set_initval ( self . params . amplitude , ( 5.0 * ( ymax - ymin ) ) ) #NEWLINE# if self . negative : #NEWLINE# #INDENT# yex = ymin #NEWLINE# self . params . amplitude . value = ( ( - ( ymax - ymax ) ) * 5.0 ) #NEWLINE# #UNINDENT# iyex = index_nearest ( y , yex ) #NEWLINE# self . set_initval ( self . params . center , x [ iyex ] ) #NEWLINE# halfy = ( yex / 2.0 ) #NEWLINE# ihalfy = index_of ( y , halfy ) #NEWLINE# sig0 = abs ( ( x [ iyex ] - x [ ihalfy ] ) ) #NEWLINE# sig1 = ( 0.15 * ( max ( x ) - min ( x ) ) ) #NEWLINE# if ( sig1 < sig0 ) : #NEWLINE# #INDENT# sig0 = sig1 #NEWLINE# #UNINDENT# self . set_initval ( self . params . sigma , sig0 ) #NEWLINE# bkg0 = ymin #NEWLINE# if self . negative : #NEWLINE# #INDENT# bkg0 = ymax #NEWLINE# #UNINDENT# self . set_init_bkg ( bkg0 )